Core: HttpRequest now supports alternate method name

git-svn-id: svn://ultimatepp.org/upp/trunk@5977 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-04-11 12:36:42 +00:00
parent 1aad3e7bd8
commit 024a16aedc
4 changed files with 18 additions and 7 deletions

View file

@ -52,6 +52,13 @@ HttpRequest::HttpRequest(const char *url)
Url(url);
}
HttpRequest& HttpRequest::Method(int m, const char *custom_name)
{
method = m;
custom_method = custom_name;
return *this;
}
HttpRequest& HttpRequest::Url(const char *u)
{
ssl = memcmp(u, "https", 5) == 0;
@ -458,7 +465,7 @@ void HttpRequest::StartRequest()
"GET", "POST", "HEAD", "PUT", "DELETE", "TRACE", "OPTIONS", "CONNECT", "PATCH",
};
ASSERT(method >= 0 && method <= 8);
data = smethod[method];
data = Nvl(custom_method, smethod[method]);
data << ' ';
String host_port = host;
if(port)