ACC SHELL
/**
* File: modules/HTTP.ycp
* Package: Transfer Protocols
* Summary: Handle HTTP Requests
* Authors: Anas Nashif <nashif@suse.de>
* Flags: Stable
*
* $Id: HTTP.ycp 31241 2006-06-01 12:32:41Z locilka $
*/
{
module "HTTP";
global string user = "";
global string password = "";
/**
* Send a get request
* @param url url in any standard form
* @param output file to save result to
* @return map Reponse map with HTTP code and transfer size and time
*/
global define map Get(string url, string output) ``{
y2debug("URL: %1", url);
map response = (map) SCR::Execute(.curl.get, url, $["output":output]);
return response;
}
/**
* Send a post request
* @param url url in any standard form
* @param output file to save result to
* @param postdata the rest of the url and whatever comes after the ? in the URL
* @return map Reponse map with HTTP code and transfer size and time
*/
global define map Post(string url, string output, string postData) ``{
y2debug("URL: %1", url);
map response = (map) SCR::Execute(.curl.get, url, $["output":output, "data":postData]);
return response;
}
/**
* Set user and password for HTTP authentication
*/
global define map setUserPassword() ``{
string userpass = sformat("%1:%2", user , password );
return (map) SCR::Execute(.curl.setUserPassword, userpass, $[]);
}
global define void easySSL( boolean easy ) ``{
y2debug("setting easySSL to %1",easy);
SCR::Execute(.curl.easySSL, easy, $[]);
return;
}
/* EOF */
}
ACC SHELL 2018