Pārlūkot izejas kodu

properly pass query in non-proxy case

David Rose 22 gadi atpakaļ
vecāks
revīzija
d14a5523f4

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

@@ -3003,7 +3003,7 @@ make_header() {
   } else {
   } else {
     // If we'll be asking the server directly for the document, we
     // If we'll be asking the server directly for the document, we
     // just want its path relative to the server.
     // just want its path relative to the server.
-    request_path = _request.get_url().get_path();
+    request_path = _request.get_url().get_path_and_query();
   }
   }
 
 
   // HTTP syntax always requires something in the request path.  If it
   // HTTP syntax always requires something in the request path.  If it
@@ -3171,7 +3171,7 @@ make_request_text() {
     string authorization = 
     string authorization = 
     _request_text += "Authorization: ";
     _request_text += "Authorization: ";
     _request_text +=
     _request_text +=
-      _www_auth->generate(_method, _request.get_url().get_path(), _www_username, _body);
+      _www_auth->generate(_method, _request.get_url().get_path_and_query(), _www_username, _body);
     _request_text += "\r\n";
     _request_text += "\r\n";
   }
   }
 
 

+ 17 - 0
panda/src/downloader/urlSpec.cxx

@@ -133,6 +133,23 @@ get_path() const {
   return "/";
   return "/";
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: URLSpec::get_path_and_query
+//       Access: Published
+//  Description: Returns the path (or "/" if no path is specified),
+//               followed by the query if it is specified.
+////////////////////////////////////////////////////////////////////
+string URLSpec::
+get_path_and_query() const {
+  if (has_path()) {
+    return _url.substr(_path_start);
+  }
+  if (has_query()) {
+    return "/?" + get_query();
+  }
+  return "/";
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: URLSpec::set_scheme
 //     Function: URLSpec::set_scheme
 //       Access: Published
 //       Access: Published

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

@@ -60,6 +60,7 @@ PUBLISHED:
   string get_server_and_port() const;
   string get_server_and_port() const;
   string get_path() const;
   string get_path() const;
   INLINE string get_query() const;
   INLINE string get_query() const;
+  string get_path_and_query() const;
   INLINE bool is_ssl() const;
   INLINE bool is_ssl() const;
 
 
   INLINE const string &get_url() const;
   INLINE const string &get_url() const;