Johannes, No, we must not prepend a / as this would change the semantics. Instead the resulting URI must be resolved against the request URI:
Request URI = http://www.example.org/a/b/foo.html Location: bar.html => http://www.example.org/a/b/bar.html versus Request URI = http://www.example.org/a/b/foo.html Location: /bar.html => http://www.example.org/bar.html See the URI.resolve method. Ortwin Johannes Koch wrote: > Hi > > In org.apache.http.impl.client.DefaultRedirectHandler's getLocationURI > method, the location URI is adjusted if > ClientPNames.REJECT_RELATIVE_REDIRECT is false. However there are 'evil' > cases where the location header value does not start with a '/'. So the > resulting URI looks like > > http://www.example.orgfoo.bar > > instead of > > http://www.example.org/foo.bar > > . Do you think, this should also be part of the adjustment? > > Something like > > String path = uri.getPath().startsWith("/") ? uri.getPath() : "/" + > uri.getPath(); > uri = new URI(target.getSchemeName(), null, target.getHostName(), > target.getPort(), path, uri.getQuery(), uri.getFragment()); > > should do the job. -- [web] http://www.odi.ch/ [blog] http://www.odi.ch/weblog/ [pgp] key 0x81CF3416 finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
