When a wikipedia.com
URL has a unencoded single quote or ampersand in the URL path, it sends a redirect with a Location header with the encoded character. For example:
HTTP/1.1 301 Moved Permanently
Date: Fri, 05 Aug 2016 17:33:36 GMT
Content-Type: text/html; charset=utf-8
I can get around the problem by adding a Raw-Request-URI to my requests. However, I'm never able to recognise a Location header which requires the encoded character because the parsing of responses uses the Uri object in the Location header. In my code, I can add a special case for wikipedia.com
requests, but I'd really like to be able to make it more general and handle any other servers which may also do the same.
Is there anyway to get access to the raw value of the Location header without it being passed into a Uri object?