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 Sam Wilson <te...@hotmail.com> on 2016/04/08 18:12:52 UTC

RedirectStrategy and HttpHost

Hey httpclient-users,

I've got another question for you!

To make requests to a particular IP with a certain host I'm using:

	HttpClient.execute(HttpHost tgt, HttpRequest req)

For example I'd give 127.0.0.1 as the target, while the request points 
to www.example.com. This works fine and dandy (as long as I don't use -1 
as the port, but that's another issue.)

Now, I'd also like to similarly override the target when handling HTTP 
redirects, but alas RedirectStrategy.getRedirect only returns a request. 
How should I achieve what I want?

I'm probably missing something really dumb here, so please forgive me if 
I am.

Thanks,
Sam

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


Re: RedirectStrategy and HttpHost

Posted by Sam Wilson <te...@hotmail.com>.
On 4/9/16 5:46 AM, Oleg Kalnichevski wrote:
> On Fri, 2016-04-08 at 12:12 -0400, Sam Wilson wrote:
>> Hey httpclient-users,
>>
>> I've got another question for you!
>>
>> To make requests to a particular IP with a certain host I'm using:
>>
>> 	HttpClient.execute(HttpHost tgt, HttpRequest req)
>>
>> For example I'd give 127.0.0.1 as the target, while the request points
>> to www.example.com. This works fine and dandy (as long as I don't use -1
>> as the port, but that's another issue.)
>>
>> Now, I'd also like to similarly override the target when handling HTTP
>> redirects, but alas RedirectStrategy.getRedirect only returns a request.
>> How should I achieve what I want?
>>
>
> By rewriting the redirect URI.

Won't that break SNI?

Sam

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


Re: RedirectStrategy and HttpHost

Posted by Sam Wilson <te...@hotmail.com>.
On 4/9/16 12:19 PM, Sam Wilson wrote:
> On 4/9/16 5:46 AM, Oleg Kalnichevski wrote:
>> On Fri, 2016-04-08 at 12:12 -0400, Sam Wilson wrote:
>>> Hey httpclient-users,
>>>
>>> I've got another question for you!
>>>
>>> To make requests to a particular IP with a certain host I'm using:
>>>
>>>     HttpClient.execute(HttpHost tgt, HttpRequest req)
>>>
>>> For example I'd give 127.0.0.1 as the target, while the request points
>>> to www.example.com. This works fine and dandy (as long as I don't use -1
>>> as the port, but that's another issue.)
>>>
>>> Now, I'd also like to similarly override the target when handling HTTP
>>> redirects, but alas RedirectStrategy.getRedirect only returns a request.
>>> How should I achieve what I want?
>>>
>>
>> By rewriting the redirect URI.
>
> Won't that break SNI?

Actually, would it be possible to use HttpRequestWrapper? That seems to 
combine a target with a request. I see the target does get used in 
ProtocolExec, though I don't know how all the pieces fit together, or if 
ProtocolExec is even relevant.

Sam

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


Re: RedirectStrategy and HttpHost

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2016-04-08 at 12:12 -0400, Sam Wilson wrote:
> Hey httpclient-users,
> 
> I've got another question for you!
> 
> To make requests to a particular IP with a certain host I'm using:
> 
> 	HttpClient.execute(HttpHost tgt, HttpRequest req)
> 
> For example I'd give 127.0.0.1 as the target, while the request points 
> to www.example.com. This works fine and dandy (as long as I don't use -1 
> as the port, but that's another issue.)
> 
> Now, I'd also like to similarly override the target when handling HTTP 
> redirects, but alas RedirectStrategy.getRedirect only returns a request. 
> How should I achieve what I want?
> 

By rewriting the redirect URI.

Oleg


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