Bug 89206. Get HTTP/HTTPS to work with socks proxies. Other protocols are

broken though, and have been for some time. r/sr=dougt, sr=smfr
This commit is contained in:
bbaetz%cs.mcgill.ca 2001-07-06 01:34:31 +00:00
parent bcf02f1d15
commit d8a192342c
2 changed files with 14 additions and 7 deletions

View File

@ -293,10 +293,12 @@ nsHttpChannel::SetupTransaction()
NS_ADDREF(mTransaction);
// use the URI path if not proxying (transparent proxying such as SSL proxy
// does not count here).
// or socks does not count here).
nsXPIDLCString requestURIStr;
const char* requestURI;
if ((mConnectionInfo->ProxyHost() == nsnull) || mConnectionInfo->UsingSSL()) {
if (!mConnectionInfo->ProxyHost() ||
mConnectionInfo->UsingSSL() ||
!PL_strcmp(mConnectionInfo->ProxyType(), "socks")) {
rv = mURI->GetPath(getter_Copies(requestURIStr));
if (NS_FAILED(rv)) return rv;
requestURI = requestURIStr.get();

View File

@ -340,7 +340,10 @@ nsHttpConnection::ActivateConnection()
if (NS_FAILED(rv)) return rv;
// need to handle SSL proxy CONNECT if this is the first time.
if (mConnectionInfo->UsingSSL() && mConnectionInfo->ProxyHost()) {
// unless its SOCKS.
if (mConnectionInfo->UsingSSL() &&
mConnectionInfo->ProxyHost() &&
PL_strcmp(mConnectionInfo->ProxyType(), "socks")) {
rv = SetupSSLProxyConnect();
if (NS_FAILED(rv)) return rv;
}
@ -433,15 +436,17 @@ nsHttpConnection::CreateTransport()
// configure the socket type based on the connection type requested.
const char *types[3] = {0,0,0};
PRUint32 count = 0;
if (mConnectionInfo->UsingSSL()) {
types[0] = "ssl";
count++;
}
if (!PL_strcasecmp(mConnectionInfo->ProxyType(), "socks")) {
types[count] = "socks";
count++;
}
if (mConnectionInfo->UsingSSL()) {
types[count] = "ssl";
count++;
}
nsCOMPtr<nsITransport> transport;
rv = sts->CreateTransportOfTypes(count, types,
mConnectionInfo->Host(),