You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Oleg Kalnichevski <ol...@apache.org> on 2008/02/07 11:47:26 UTC

Re: [jira] Commented: (HTTPCLIENT-735) allow unsetting of DEFAULT_PROXY and FORCED_ROUTE parameters in the client stack

On Wed, 2008-02-06 at 23:18 +0100, Roland Weber wrote:
> Hi Oleg,
> 
> > Why not make NO_HOST a little prettier? 
> > 
> > public static final HttpHost NO_HOST = new HttpHost("", -1, "");
> 
> I chose an IP address for the host to make sure that
> there will be no DNS lookup (though there might still
> be a reverse lookup). Can we rely on an exception
> being triggered for an empty string?

I believe so. We can expect any sane hostname resolution system to not
resolve a blank hostname to an IP.

>  And can we rely
> on ourselves not adding empty string checks to the
> HttpHost constructor?
> 

I believe so. This is what unit tests are for.

> -1 is a magic number used in HttpHost, I wanted to
> avoid that.
> 

But there is nothing that really prevents it from being used in NO_HOST,
is there?


> I also want to be able to identify NO_HOST when it
> appears in debug output, which is easier if the
> attributes are not empty.
> 

I believe this is just a matter of having a reasonable #toString()
implementation.

Cheers

Oleg


> cheers,
>   Roland
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 
> 


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


Re: [jira] Commented: (HTTPCLIENT-735) allow unsetting of DEFAULT_PROXY and FORCED_ROUTE parameters in the client stack

Posted by Roland Weber <os...@dubioso.net>.
Hi Oleg,

>>> Why not make NO_HOST a little prettier? 

I've changed it to "no-host://127.0.0.255:0"
which is a valid HttpHost instance but still
unlikely to collide with any real host.

>> And can we rely
>> on ourselves not adding empty string checks to the
>> HttpHost constructor?
> 
> I believe so.

I thought you'd know me better by now :-)

> This is what unit tests are for.

No, this is what unit tests are for...

  try {
     new HttpHost("");
     fail("empty hostname not detected");
  } catch (IllegalArgumentException iax) {
    // expected
  }


>> I also want to be able to identify NO_HOST when it
>> appears in debug output, which is easier if the
>> attributes are not empty.
> 
> I believe this is just a matter of having a reasonable #toString()
> implementation.

Are you suggesting to move NO_HOST to core so that
HttpHost.toString can do something special about it?

cheers,
  Roland


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