[Common-dev] CR: Client Bug 19 [splay incorrectly reports "invalid host" when server refuses connection]
Anil Jaiswal ajaiswal at real.comModified by: ajaiswal at real.com Reviewed by: Date: 08-11-2005 Synopsis: When running splay with a http URL to a web server which intentionally has not been properly configured to listen on a certain subnet, the error reported by "splay" is a misleading "invalid host", when in fact it should be "connection refused". Fix: Connect call was properly handled in sockimp.cpp however the error code was not properly propagated to the app. These changes fixes the problem and application now display correct error message as "HXR_SOCK_CONNREFUSED". Files Modified: filesystem/http/httpfsys.cpp common/netio/platform/posix/sockimp.cpp common/netio/pub/platform/posix/sockimp.h Image Size and Heap Use impact: none Platforms and Profiles Affected: all platforms, all profiles Platforms and Profiles Build Verified: Linux, Windows helix-client-all-defines.pf Platforms and Profiles Functionality verified: Using splaypr.exe on Linux and Windows platforms helix-client-all-defines.pf Project: HEAD, 150Cay cvs diff : cvs diff: Diffing . Index: httpfsys.cpp =================================================================== RCS file: /cvsroot/filesystem/http/httpfsys.cpp,v retrieving revision 1.72.2.12 diff -u -w -r1.72.2.12 httpfsys.cpp --- httpfsys.cpp 9 Aug 2005 18:56:46 -0000 1.72.2.12 +++ httpfsys.cpp 12 Aug 2005 02:39:15 -0000 @@ -3872,7 +3872,7 @@ else { // Failed connection - m_LastError = HXR_INVALID_HOST; + m_LastError = status; if (m_bOnServer) { ReportConnectionFailure(); ? vc60.idb Index: platform/posix/sockimp.cpp =================================================================== RCS file: /cvsroot/common/netio/platform/posix/sockimp.cpp,v retrieving revision 1.74.2.4 diff -u -w -r1.74.2.4 sockimp.cpp --- platform/posix/sockimp.cpp 10 Jun 2005 23:25:09 -0000 1.74.2.4 +++ platform/posix/sockimp.cpp 12 Aug 2005 02:38:04 -0000 @@ -106,7 +106,7 @@ m_pOldResponse = m_pSock->GetResponse(); m_pSock->SetResponse(this); - AttemptConnect(); + AttemptConnect(HXR_OK); return HXR_OK; } @@ -179,20 +179,20 @@ } else { - AttemptConnect(); + AttemptConnect(status); } return HXR_OK; } void -CHXSocketConnectEnumerator::AttemptConnect(void) +CHXSocketConnectEnumerator::AttemptConnect(HX_RESULT status) { for (;;) { if (m_nIndex >= m_nVecLen) { - FinishEnumeration(HXR_FAIL); + FinishEnumeration(status); break; } Index: pub/platform/posix/sockimp.h =================================================================== RCS file: /cvsroot/common/netio/pub/platform/posix/sockimp.h,v retrieving revision 1.32.2.2 diff -u -w -r1.32.2.2 sockimp.h --- pub/platform/posix/sockimp.h 10 Aug 2005 21:15:05 -0000 1.32.2.2 +++ pub/platform/posix/sockimp.h 12 Aug 2005 02:38:04 -0000 @@ -84,7 +84,7 @@ STDMETHOD(EventPending) (THIS_ UINT32 uEvent, HX_RESULT status); private: - void AttemptConnect(void); + void AttemptConnect(HX_RESULT status); void FinishEnumeration(HX_RESULT status); protected: