$OpenBSD$ index e00e0f4..baa14da 100644 --- netwerk/base/src/nsSocketTransport2.cpp.orig Fri Feb 20 15:40:37 2015 +++ netwerk/base/src/nsSocketTransport2.cpp Fri Feb 20 15:40:37 2015 @@ -812,6 +812,7 @@ nsSocketTransport::Init(const char **types, uint32_t typeCount, mHost = host; const char *proxyType = nullptr; + mProxyInfo = proxyInfo; if (proxyInfo) { mProxyPort = proxyInfo->Port(); mProxyHost = proxyInfo->Host(); @@ -1082,6 +1083,7 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us const char *proxyHost = mProxyHost.IsEmpty() ? nullptr : mProxyHost.get(); int32_t proxyPort = (int32_t) mProxyPort; uint32_t proxyFlags = 0; + nsCOMPtr proxyInfo = mProxyInfo; uint32_t i; for (i=0; iNewSocket(mNetAddr.raw.family, - host, port, proxyHost, proxyPort, + host, port, proxyInfo, proxyFlags, &fd, getter_AddRefs(secinfo)); @@ -1121,7 +1123,7 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us // so we just want the service to add itself // to the stack (such as pushing an io layer) rv = provider->AddToSocket(mNetAddr.raw.family, - host, port, proxyHost, proxyPort, + host, port, proxyInfo, proxyFlags, fd, getter_AddRefs(secinfo)); } @@ -1151,6 +1153,7 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us (strcmp(mTypes[i], "socks4") == 0)) { // since socks is transparent, any layers above // it do not have to worry about proxy stuff + proxyInfo = nullptr; proxyHost = nullptr; proxyPort = -1; proxyTransparent = true; @@ -1189,11 +1192,11 @@ nsSocketTransport::InitiateSocket() nsRefPtr netaddr = new nsNetAddr(&mNetAddr); netaddr->GetAddress(ipaddr); fprintf_stderr(stderr, - "Non-local network connections are disabled and a connection " - "attempt to %s (%s) was made. You should only access hostnames " + "FATAL ERROR: Non-local network connections are disabled and a connection " + "attempt to %s (%s) was made.\nYou should only access hostnames " "available via the test networking proxy (if running mochitests) " - "or from a test-specific httpd.js server (if running xpcshell tests)." - " Browser services should be disabled or redirected to a local server.\n", + "or from a test-specific httpd.js server (if running xpcshell tests). " + "Browser services should be disabled or redirected to a local server.\n", mHost.get(), ipaddr.get()); MOZ_CRASH("Attempting to connect to non-local address!"); } @@ -1793,9 +1796,25 @@ nsSocketTransport::OnSocketReady(PRFileDesc *fd, int16_t outFlags) // Update poll timeout in case it was changed mPollTimeout = mTimeouts[TIMEOUT_READ_WRITE]; } - else if (mState == STATE_CONNECTING) { + +//STATE_SENDINGGET: handshake proceeded to state "sent connect" +//one more poll to OnSocketReady will trigger the get request, and state STATE_SENTGET +//STATE_SENTGET: continue and finish handshake + else if (mState == STATE_SENDINGGET) { + if ((mPollFlags & PR_POLL_WRITE) && (outFlags & ~PR_POLL_READ)) { + mOutput.OnSocketReady(NS_OK); + } + mPollTimeout = mTimeouts[TIMEOUT_READ_WRITE]; + mState = STATE_SENTGET; + } + + else if (mState == STATE_CONNECTING || mState == STATE_SENTGET) { PRStatus status = PR_ConnectContinue(fd, outFlags); - if (status == PR_SUCCESS) { + if (status == PR_SUCCESS && mState == STATE_CONNECTING) { + OnSocketConnected(); + mState = STATE_SENDINGGET; + } + else if (status == PR_SUCCESS && mState == STATE_SENTGET) { // // we are connected! //