HttpRequest: allow custom http methods

* The W3C XmlHttpRequest testsuite likes to use "CHICKEN" as a method.
 * Also add constants for all specified methods in HTTP 1.1.
This commit is contained in:
Adrien Destugues
2013-10-15 14:43:09 +02:00
parent f6f14c5d1c
commit 7696f7dd54
2 changed files with 15 additions and 43 deletions
+10 -10
View File
@@ -29,7 +29,7 @@ public:
BUrlContext* context = NULL);
virtual ~BHttpRequest();
void SetMethod(int8 method);
void SetMethod(const char* const method);
void SetFollowLocation(bool follow);
void SetMaxRedirections(int8 maxRedirections);
void SetReferrer(const BString& referrer);
@@ -74,7 +74,7 @@ private:
BNetworkAddress fRemoteAddr;
bool fSSL;
int8 fRequestMethod;
BString fRequestMethod;
int8 fHttpVersion;
BString fOutputBuffer;
@@ -123,14 +123,14 @@ enum {
// Request method
enum {
B_HTTP_GET = 1,
B_HTTP_POST,
B_HTTP_PUT,
B_HTTP_HEAD,
B_HTTP_DELETE,
B_HTTP_OPTIONS
};
const char* const B_HTTP_GET = "GET";
const char* const B_HTTP_POST = "POST";
const char* const B_HTTP_PUT = "PUT";
const char* const B_HTTP_HEAD = "HEAD";
const char* const B_HTTP_DELETE = "DELETE";
const char* const B_HTTP_OPTIONS = "OPTIONS";
const char* const B_HTTP_TRACE = "TRACE";
const char* const B_HTTP_CONNECT = "CONNECT";
// HTTP Version