HttpRequest: missing fields initializations

* Some fields weren't initialized, leading to random crashes later on
 * Remove the enum that was used for protocol options
 * Use a single field to track the request state, instead of separate
booleans.
This commit is contained in:
Adrien Destugues
2013-10-09 15:46:10 +02:00
parent a5826aafb0
commit 8ca6eeb77c
2 changed files with 24 additions and 51 deletions
+10 -41
View File
@@ -84,11 +84,17 @@ private:
BHttpAuthentication fAuthentication;
// Request status
BHttpHeaders fOutputHeaders;
bool fStatusReceived;
bool fHeadersReceived;
bool fContentReceived;
bool fTrailingHeadersReceived;
// Request state/events
enum {
kRequestInitialState,
kRequestStatusReceived,
kRequestHeadersReceived,
kRequestContentReceived,
kRequestTrailingHeadersReceived
} fRequestStatus;
// Protocol options
@@ -134,43 +140,6 @@ enum {
};
// HTTP Protocol options
enum {
B_HTTPOPT_METHOD = 0,
// (int) Request method (see B_HTTP_GET, ...)
B_HTTPOPT_FOLLOWLOCATION,
// (bool) Follow Location: headers
B_HTTPOPT_MAXREDIRS,
// (int) Max relocation
B_HTTPOPT_HEADERS,
// (BHttpHeaders*) Headers to be sent
B_HTTPOPT_REFERER,
// (string) Referer
B_HTTPOPT_USERAGENT,
// (string) User-Agent
B_HTTPOPT_SETCOOKIES,
// (bool) Send cookies from context
B_HTTPOPT_DISCARD_DATA,
// (bool) Discard incoming data (still notified)
B_HTTPOPT_DISABLE_LISTENER,
// (bool) Don't send notification to the listener
B_HTTPOPT_AUTOREFERER,
// (bool) Automatically set the Referer header
B_HTTPOPT_POSTFIELDS,
// (BHttpForm*) POST data to be sent
B_HTTPOPT_INPUTDATA,
// (BDataIO*) Input data to be sent (POST, PUT)
B_HTTPOPT_AUTHUSERNAME,
// (string) Authentication username
B_HTTPOPT_AUTHPASSWORD,
// (string) Authentication password
B_HTTPOPT_AUTHMETHOD,
// (int) Allowed authentication methods (see BHttpAuthenticationMethod)
B_HTTPOPT__OPT_NUM
};
// HTTP status classes
enum http_status_code_class {
B_HTTP_STATUS_CLASS_INVALID = 000,