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
This commit is contained in:
rpotts%netscape.com 1999-07-13 20:42:36 +00:00
parent 8e0193b167
commit bfecc033f2
2 changed files with 20 additions and 9 deletions

View File

@ -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);

View File

@ -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<nsIURL> m_pURL;
HTTPVersion m_Version;
HTTPMethod m_Method;
// The actual request stream!