Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-41061

QNetworkReply Location header retrieval can't handle Network-Path Reference URI

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • Some future release
    • 5.3.1, 5.12.0
    • Network: HTTP
    • None

    Description

      I am using QNetworkReply and grabbing the Location header for redirects like this:

      	// redirection
      	const QVariant location = reply->header(QNetworkRequest::LocationHeader);
      	QString redirectURL;
      	if(location.isValid())
      	{
      		redirectURL = location.toString();
      	}
      

      When the server replies with a Network-Path Reference URI (see http://tools.ietf.org/html/rfc3986#section-4.2), which begins with two slashes, the location header is reported to be invalid and the code does not follow the redirect.

      Example Location header:

      Location: //addons.cursecdn.com/files/2213\117/appliedenergistics2-rv1-beta-19.jar
      

      The meaning of the // is that the URL is relative to the scheme used for the request.

      So, the location IS valid (unlike what Qt reports) and the value reported by Qt should be:

      {scheme of the request URL}://addons.cursecdn.com/files/2213\117/appliedenergistics2-rv1-beta-19.jar
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            peter-har Peter Hartmann
            peterix Petr Mrazek
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes