>As you can see the redirect location included in the response is
>relative, which is illegal. HttpClient has to normalize the
>redirect
>location URI by rewriting it as absolute. It also removes
>unnecessary
>escape sequences in the process, so '%29' becomes ')'.
>
>You can work the problem around by doing something like that
>---
>CloseableHttpClient client = HttpClients
> .custom()
> .setRedirectStrategy(new DefaultRedirectStrategy() {
> @Override
> protected URI createLocationURI(final String location)
>throws ProtocolException {
> return
>super.createLocationURI("http://www.mediafire.com" + location);
> }
> })
> .build();
>CloseableHttpResponse response = client.execute(
>new HttpGet(
>
>"http://www.mediafire.com/download/yx5bjvfxvkk89hj/Sheena.QOTJ-
>84).part4.rar"));
>try {
> EntityUtils.consume(response.getEntity());
>} finally {
> response.close();
>}
>---
>
>I would strongly suggest fixing at the server side, though.
>
>Oleg
Thank you very much for your help, Oleg. Since I am in no way
affiliated with Medafire, I unfortunately can't fix the server. I
did submit a support ticket requesting a fix though.
Since my client doesn't send requests just to mediafire.com, your
workaround isn't usable in my specific case. That said, I do have
other ideas for possible workarounds.
Thanks again,
DSA
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]