From bfecc033f2441b18aad03eeeef3305d19e2ebc2b Mon Sep 17 00:00:00 2001 From: "rpotts%netscape.com" Date: Tue, 13 Jul 1999 20:42:36 +0000 Subject: [PATCH] Added the query string (if any) to the GET request... NECKO only. git-svn-id: svn://10.0.0.236/trunk@39204 18797224-902f-48f8-a5cc-f745e15eee43 --- .../protocol/http/src/nsHTTPRequest.cpp | 22 ++++++++++++++----- .../netwerk/protocol/http/src/nsHTTPRequest.h | 7 +++--- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPRequest.cpp b/mozilla/netwerk/protocol/http/src/nsHTTPRequest.cpp index c1a583aac06..2f4629df642 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPRequest.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHTTPRequest.cpp @@ -37,7 +37,6 @@ extern PRLogModuleInfo* gHTTPLog; #endif /* PR_LOGGING */ nsHTTPRequest::nsHTTPRequest(nsIURI* i_pURL, HTTPMethod i_Method, nsIChannel* i_pTransport): - m_pURI(i_pURL), m_Method(i_Method), m_pArray(new nsVoidArray()), m_Version(HTTP_ONE_ZERO), @@ -45,6 +44,8 @@ nsHTTPRequest::nsHTTPRequest(nsIURI* i_pURL, HTTPMethod i_Method, nsIChannel* i_ { NS_INIT_REFCNT(); + m_pURL = do_QueryInterface(i_pURL); + PR_LOG(gHTTPLog, PR_LOG_DEBUG, ("Creating nsHTTPRequest [this=%x].\n", this)); @@ -92,7 +93,7 @@ nsHTTPRequest::Build() return NS_ERROR_FAILURE; } - if (!m_pURI) { + if (!m_pURL) { NS_ERROR("No URL to build request for!"); return NS_ERROR_NULL_POINTER; } @@ -117,12 +118,21 @@ nsHTTPRequest::Build() this)); // Write the request method and HTTP version. - char* filename; + char* name; lineBuffer.Append(MethodToString(m_Method)); - rv = m_pURI->GetPath(&filename); - lineBuffer.Append(filename); - nsCRT::free(filename); + rv = m_pURL->GetPath(&name); + lineBuffer.Append(name); + nsCRT::free(name); + + // Append the Query string if any... + name = nsnull; + rv = m_pURL->GetQuery(&name); + if (name && *name) { + lineBuffer.Append("?"); + lineBuffer.Append(name); + } + nsCRT::free(name); lineBuffer.Append(" HTTP/1.0"CRLF); diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPRequest.h b/mozilla/netwerk/protocol/http/src/nsHTTPRequest.h index 0c48313ca3f..a7225ddcff5 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPRequest.h +++ b/mozilla/netwerk/protocol/http/src/nsHTTPRequest.h @@ -19,13 +19,14 @@ #ifndef _nsHTTPRequest_h_ #define _nsHTTPRequest_h_ +#include "nscore.h" +#include "nsCOMPtr.h" #include "nsIHTTPCommonHeaders.h" #include "nsIHTTPRequest.h" #include "nsIStreamObserver.h" -#include "nscore.h" +#include "nsIURL.h" class nsIInputStream; -class nsIURL; class nsVoidArray; class nsIBufferInputStream; class nsIInputStream; @@ -293,7 +294,7 @@ protected: return methods[i_Method]; } - nsIURI* m_pURI; + nsCOMPtr m_pURL; HTTPVersion m_Version; HTTPMethod m_Method; // The actual request stream!