hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Becke <be...@u.washington.edu>
Subject Re: URI with "nn.nn.nn.nn:nn" parses port but not with "xx.net:nn"
Date Fri, 14 Nov 2003 03:36:25 GMT
Hi David,

Could you be more specific about what you are trying and what error is 
occurring?  In particular the following would be helpful:

  - some sample code that explicitly shows what you are trying and where 
the failure occurs
  - the error message/stack trace that is printed when the error occurs, 
if applicable

Thanks,

Mike

On Nov 13, 2003, at 12:33 PM, Karr, David wrote:

> 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:
>
>    method.getHostConfiguration().
>     setHost(uri.getHost(), uri.getPort(), newProtocol);
>
> Apparently, the port value in the URI is -1.  I'm not sure how to solve
> this.
>
> 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
>


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


Mime
View raw message