Bug 1311044 - show error when connection to domain socket is failed; r=bagder
authorLiang-Heng Chen <xeonchen@mozilla.com>
Wed, 19 Oct 2016 18:28:02 +0800
changeset 427622 df49275ec24cf78028bcba9ecdd85334350c19f8
parent 427621 4adb7daf5033d99baf8c55483ea7d628f4693424
child 427623 c249f55213b6acad8f39579d732a2fc0745e0d47
push id33070
push userbmo:gps@mozilla.com
push dateThu, 20 Oct 2016 17:11:05 +0000
reviewersbagder
bugs1311044
milestone52.0a1
Bug 1311044 - show error when connection to domain socket is failed; r=bagder MozReview-Commit-ID: GtqKiMVwQyX
netwerk/socket/nsSOCKSIOLayer.cpp
--- a/netwerk/socket/nsSOCKSIOLayer.cpp
+++ b/netwerk/socket/nsSOCKSIOLayer.cpp
@@ -508,20 +508,26 @@ nsSOCKSSocketInfo::ConnectToProxy(PRFile
 
         NetAddr proxy = mInternalProxyAddr;
         FixupAddressFamily(fd, &proxy);
         PRNetAddr prProxy;
         NetAddrToPRNetAddr(&proxy, &prProxy);
         status = fd->lower->methods->connect(fd->lower, &prProxy, mTimeout);
         if (status != PR_SUCCESS) {
             PRErrorCode c = PR_GetError();
+
             // If EINPROGRESS, return now and check back later after polling
             if (c == PR_WOULD_BLOCK_ERROR || c == PR_IN_PROGRESS_ERROR) {
                 mState = SOCKS_CONNECTING_TO_PROXY;
                 return status;
+            } else if (IsHostDomainSocket()) {
+                LOGERROR(("socks: connect to domain socket failed (%d)", c));
+                PR_SetError(PR_CONNECT_REFUSED_ERROR, 0);
+                mState = SOCKS_FAILED;
+                return status;
             }
         }
     } while (status != PR_SUCCESS);
 
     // Connected now, start SOCKS
     if (mVersion == 4)
         return WriteV4ConnectRequest();
     return WriteV5AuthRequest();