X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fio%2FHTTPRequest.hxx;h=0def08880162c667d9f714f490dc99dbdd0ecbd4;hb=8d93206dd33ed0079af6670a0ecd41a3b203d9a0;hp=1897a5b0ce92b7f99caedd061fe62c4e252ac07f;hpb=5c9ca9cbe24382e71cf8dc6d9764148ad9fc76be;p=simgear.git diff --git a/simgear/io/HTTPRequest.hxx b/simgear/io/HTTPRequest.hxx index 1897a5b0..0def0888 100644 --- a/simgear/io/HTTPRequest.hxx +++ b/simgear/io/HTTPRequest.hxx @@ -37,6 +37,8 @@ namespace simgear namespace HTTP { +class Client; + /** * Base class for HTTP request (and answer). */ @@ -50,6 +52,7 @@ public: { UNSENT = 0, OPENED, + STATUS_RECEIVED, HEADERS_RECEIVED, LOADING, DONE, @@ -130,6 +133,9 @@ public: 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; @@ -193,18 +199,15 @@ public: 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"); @@ -233,6 +236,10 @@ private: 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; @@ -252,6 +259,7 @@ private: ReadyState _ready_state; bool _willClose; + bool _connectionCloseHeader; }; typedef SGSharedPtr Request_ptr;