namespace HTTP
{
+class Client;
+
/**
* Base class for HTTP request (and answer).
*/
{
UNSENT = 0,
OPENED,
+ STATUS_RECEIVED,
HEADERS_RECEIVED,
LOADING,
DONE,
virtual std::string url() const
{ return _url; }
+ Client* http() const
+ { return _client; }
+
virtual std::string scheme() const;
virtual std::string path() const;
virtual std::string host() const;
ReadyState readyState() const { return _ready_state; }
- /**
- * Request aborting this request.
- */
- void abort();
+ bool closeAfterComplete() const;
+ bool isComplete() const;
/**
- * Request aborting this request and specify the reported reaseon for it.
+ * Check if the server response indicates pipelining should be continued.
+ * Currently tests that HTTP_1_1 is explicitly supported, and that the
+ * server/proxy did not request Connection: close
*/
- void abort(const std::string& reason);
-
- bool closeAfterComplete() const;
- bool isComplete() const;
+ bool serverSupportsPipelining() const;
protected:
Request(const std::string& url, const std::string method = "GET");
void processBodyBytes(const char* s, int n);
void setReadyState(ReadyState state);
+ void setCloseAfterComplete();
+
+ Client* _client; // HTTP client we're active on
+
std::string _method;
std::string _url;
StringMap _request_headers;
ReadyState _ready_state;
bool _willClose;
+ bool _connectionCloseHeader;
};
typedef SGSharedPtr<Request> Request_ptr;