Follow RFC 2616 and httpbis specifications when handling redirects
MinGW compatibility fixes