hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <David.K...@wamu.net>
Subject URI with "nn.nn.nn.nn:nn" parses port but not with "xx.net:nn"
Date Thu, 13 Nov 2003 17:33:28 GMT
I'm using HttpClient-2.0rc2.

I'm testing some code that makes an external URL connection.  I'm
testing it with two possible URLs, but they only differ by the host name
and possibly the specified port.  This is probably just a continuation
of some earlier issues I was having because of my need to install an
alternate socket factory.

One URL uses a raw IP address and a specific port, like
"nn.nn.nn.nn:nn".  When I create the PostMethod with this URL, then get
the URI from the method, and then read the port, I find it's found the
correct port.

However, I have two problems with the other URL.  I first tried it
without a specific port, using the default.  This creates a problem
because my connection eventually fails because I end up using a port
value of "-1".  This is probably because I end up using a block of code
like this:

    setHost(uri.getHost(), uri.getPort(), newProtocol);

Apparently, the port value in the URI is -1.  I'm not sure how to solve

So, I then tried changing the second URL to include a specific port
number, like "host.net:443".  Strangely enough, this ends up generating
the same error.  I tried stepping the HttpMethodBase constructor (which
I send my URL to), and I found that after it parsed the URI, it didn't
think there was a specified port number.  When I stepped through the
same code with the first URL (using the IP address), it was able to find
the port number.

To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org

View raw message