Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.5 Final
-
None
-
i5/OS (OS/400 iSeries) and *nix (Linux and others)
Description
In HTTPChannel.hpp and HTTPSSLChannel.hpp, INVALID_SOCKET is defined as 0 (zero). This causes a client using Axis C++ to fail consequently with a HTTPTransportException on the first connection attempt on the i5/OS, because 0 (zero) in fact is a valid socket descriptor on the i5/OS platform (as well as it is on other platforms such as Linux). This also means that real errors are not caught because -1 from the API is compared with to a 0 (zero).
To my knowledge, all platforms defines socket() to return either -1 or ~0 depending on whether socket() is implemented with a signed or unsigned return value.
My suggestion would be to change the following two files:
HTTPChannel.hpp line 56 in Axis C++ 1.5 Final
HTTPSSLChannel.hpp line 58 in Axis C++ 1.5 Final
from: const unsigned int INVALID_SOCKET = 0;
to: const unsigned int INVALID_SOCKET = ~0; // for unsigned socket() implementations
or: const int INVALID_SOCKET = -1; // for signed socket() implementations
As a workaround for this issue, I've tried to allocate a dummy socket in my client program before calling any of the Axis C++ methods, causing Axis C++ to succeed on the first connection attempt.