You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by nitya vyas <ni...@gmail.com> on 2007/09/07 07:59:38 UTC

http - https issue

Hi all,
I have in my application one static object of httpClient which i have
created with SSL implementation like below.

Protocol stricthttps = new Protocol("https", new
StrictSSLProtocolSocketFactory(true),443);

  httpClient = new HttpClient();
  httpClient.getHostConfiguration().setHost("hostName", 443, "https");

Now when i make a request and when create a method object i construct URL
with "http" this makes the request go as http and not as https eventhough
httpClient object is constructed by https. ( httpClient.executeMehod(get or
post method); )

Does this mean that i will have to make all such urls https and not http??
is there any way so that i can make all requests https globally??

Re: http - https issue

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2007-09-07 at 18:53 +0530, nitya vyas wrote:
> another server which does not have any SSL configurations done requires http
> requests. This one is for internal initial testing purpose. So there i have
> to have http requests.. and there even if i ve created httpClient object
> with https theres no problem as all method urls are http and all request
> thus go as http..
> 
> So does it mean that I will need to create all method urls with https for
> client server and with http for internal testing server.??
> 

Try this: 

Protocol stricthttps = new Protocol(
  "https", 
  new StrictSSLProtocolSocketFactory(true), 
  443);

Protocol.registerProtocol("http", stricthttps);

Oleg

> thanks
> 
> On 9/7/07, Oleg Kalnichevski <ol...@apache.org> wrote:
> >
> > On Fri, 2007-09-07 at 11:29 +0530, nitya vyas wrote:
> > > Hi all,
> > > I have in my application one static object of httpClient which i have
> > > created with SSL implementation like below.
> > >
> > > Protocol stricthttps = new Protocol("https", new
> > > StrictSSLProtocolSocketFactory(true),443);
> > >
> > >   httpClient = new HttpClient();
> > >   httpClient.getHostConfiguration().setHost("hostName", 443, "https");
> > >
> > > Now when i make a request and when create a method object i construct
> > URL
> > > with "http" this makes the request go as http and not as https
> > eventhough
> > > httpClient object is constructed by https. ( httpClient.executeMehod(get
> > or
> > > post method); )
> > >
> > > Does this mean that i will have to make all such urls https and not
> > http??
> > > is there any way so that i can make all requests https globally??
> >
> > If you want HTTPS why are using HTTP in request URIs?
> >
> > Oleg
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
> >


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


Re: http - https issue

Posted by nitya vyas <ni...@gmail.com>.
another server which does not have any SSL configurations done requires http
requests. This one is for internal initial testing purpose. So there i have
to have http requests.. and there even if i ve created httpClient object
with https theres no problem as all method urls are http and all request
thus go as http..

So does it mean that I will need to create all method urls with https for
client server and with http for internal testing server.??

thanks

On 9/7/07, Oleg Kalnichevski <ol...@apache.org> wrote:
>
> On Fri, 2007-09-07 at 11:29 +0530, nitya vyas wrote:
> > Hi all,
> > I have in my application one static object of httpClient which i have
> > created with SSL implementation like below.
> >
> > Protocol stricthttps = new Protocol("https", new
> > StrictSSLProtocolSocketFactory(true),443);
> >
> >   httpClient = new HttpClient();
> >   httpClient.getHostConfiguration().setHost("hostName", 443, "https");
> >
> > Now when i make a request and when create a method object i construct
> URL
> > with "http" this makes the request go as http and not as https
> eventhough
> > httpClient object is constructed by https. ( httpClient.executeMehod(get
> or
> > post method); )
> >
> > Does this mean that i will have to make all such urls https and not
> http??
> > is there any way so that i can make all requests https globally??
>
> If you want HTTPS why are using HTTP in request URIs?
>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>

Re: http - https issue

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2007-09-07 at 11:29 +0530, nitya vyas wrote:
> Hi all,
> I have in my application one static object of httpClient which i have
> created with SSL implementation like below.
> 
> Protocol stricthttps = new Protocol("https", new
> StrictSSLProtocolSocketFactory(true),443);
> 
>   httpClient = new HttpClient();
>   httpClient.getHostConfiguration().setHost("hostName", 443, "https");
> 
> Now when i make a request and when create a method object i construct URL
> with "http" this makes the request go as http and not as https eventhough
> httpClient object is constructed by https. ( httpClient.executeMehod(get or
> post method); )
> 
> Does this mean that i will have to make all such urls https and not http??
> is there any way so that i can make all requests https globally??

If you want HTTPS why are using HTTP in request URIs?

Oleg


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