hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject RE: DNS vs. IP question
Date Mon, 02 May 2005 21:57:19 GMT
On Mon, 2005-05-02 at 13:46 -0700, Dan Levine wrote:
> Thank you for the responses.  The two responses that talked about virtual
> hosts were easy to try and sounded great, but dont seem to do what I want.
> I want to be able to connect to a server via IP (without DNS lookup) and
> set/get a cookie based on a DNS name.  Does it sound like Virtual Host
> header should be able to do this?  It doesnt seem like it.  When I set the
> "Host" header (or the .setVirtualHost param) and go to a page that tries to
> set a cookie to the domain of that DNS name, it doesnt work.  Should it?

Dan, 
Actually it _should_ work. Since it does not it is _likely_ to be a bug
in HttpClient. At the same time there's also a chance of this being a
server side problem. Please post a wire/context log of the HTTP session
to this list and I'll take a look at it tomorrow

http://jakarta.apache.org/commons/httpclient/3.0/logging.html

> Roland, your approach sounds like it should work because that is exactly
> what I am trying to do -- skip around a DNS lookup but still be able to have
> the client "think" it is on a DNS address so it can set/check cookies
> hardcoded to that DNS for domain.  How do I "install" a custom
> ProtocolSocketFactory?  Where do ProtocolSocketFactory classes live in
> relation to HttpClient and HttpMethod objects?

As to the ProtocolSocketFactory you may find this guide useful. 

http://jakarta.apache.org/commons/httpclient/3.0/sslguide.html

It deals primarily with the SSL customization. However the same
technique can be used to customize plain socket connections.

Hope this helps,

Oleg


> 
> Thanks!
> 
> dan
> 
> > -----Original Message-----
> > From: Roland Weber [mailto:ROLWEBER@de.ibm.com]
> > Sent: Thursday, April 28, 2005 11:18 PM
> > To: HttpClient Project
> > Subject: Re: DNS vs. IP question
> >
> >
> > Hello Dan,
> >
> > HTTP always ends up on the IP level, sooner or later.
> > At one time, a connection to the target server has to
> > be opened, and that means that the IP address of the
> > server has to be known.
> > I assume you want to run test cases for hostnames
> > that are not registered in DNS, and you don't want
> > to hack the hostnames into /etc/hosts on the machine.
> > If that is the case, you can install a custom version of
> > o.a.c.h.protocol.ProtocolSocketFactory. That is the
> > place where hostname strings go in, and sockets
> > come out. There, you can implement your own mapping
> > from hostnames to IP addresses, without using DNS.
> >
> > hope that helps,
> >   Roland
> >
> >
> >
> >
> > "Dan Levine" <dlevine@captara.com>
> > 29.04.2005 00:05
> > Please respond to
> > "HttpClient Project"
> >
> >
> > To
> > <httpclient-dev@jakarta.apache.org>
> > cc
> >
> > Subject
> > DNS vs. IP question
> >
> >
> >
> >
> >
> >
> > Hello,
> >
> > First of all, thank you for HttpClient.  I am working with HtmlUnit Web
> > testing framework, and appreciate the underlying base this provides.
> >
> > For some tests I want to set up, I need to have the Web client call pages
> > via IP but act as if it is using a DNS.  (i.e. cookies etc behave as if
> > were
> > DNS, but the actual http calls fetch pages via IP.)  According to an
> > engineer I work with, this is common functionality for mock Web clients.
> > If
> > this functionality is exposed through HttpClient I'll work on
> > incorporating
> > that into HtmlUnit.  Please advise...
> >
> > Thank you!
> >
> > Dan
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> >
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 


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


Mime
View raw message