Sfoglia il codice sorgente

lip service to http/0.9

David Rose 23 anni fa
parent
commit
57c8314258

+ 5 - 0
panda/src/downloader/httpClient.cxx

@@ -163,6 +163,9 @@ get_username(const string &server, const string &realm) const {
 string HTTPClient::
 string HTTPClient::
 get_http_version_string() const {
 get_http_version_string() const {
   switch (_http_version) {
   switch (_http_version) {
+  case HV_09:
+    return "HTTP/0.9";
+
   case HV_10:
   case HV_10:
     return "HTTP/1.0";
     return "HTTP/1.0";
 
 
@@ -191,6 +194,8 @@ parse_http_version_string(const string &version) {
     return HV_10;
     return HV_10;
   } else if (version == "HTTP/1.1") {
   } else if (version == "HTTP/1.1") {
     return HV_11;
     return HV_11;
+  } else if (version.substr(0, 6) == "HTTP/0") {
+    return HV_09;
   } else {
   } else {
     return HV_other;
     return HV_other;
   }
   }

+ 1 - 0
panda/src/downloader/httpClient.h

@@ -64,6 +64,7 @@ PUBLISHED:
   string get_username(const string &server, const string &realm) const;
   string get_username(const string &server, const string &realm) const;
 
 
   enum HTTPVersion {
   enum HTTPVersion {
+    HV_09,  // HTTP 0.9 or older
     HV_10,  // HTTP 1.0
     HV_10,  // HTTP 1.0
     HV_11,  // HTTP 1.1
     HV_11,  // HTTP 1.1
     HV_other,
     HV_other,

+ 2 - 2
panda/src/downloader/httpDocument.cxx

@@ -228,8 +228,8 @@ is_regular_file() const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 bool HTTPDocument::
 bool HTTPDocument::
 will_close_connection() const {
 will_close_connection() const {
-  if (get_http_version() == HTTPClient::HV_10) {
-    // HTTP 1.0 always closes.
+  if (get_http_version() < HTTPClient::HV_11) {
+    // pre-HTTP 1.1 always closes.
     return true;
     return true;
   }
   }