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

Chunked encoding of HTTP 407 response is not supported

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.13.0
    • None

    Description

      QNetworkAccessManager fails to connect through a HTTP proxy (in my case a Basic auth proxy) if the HTTP 407 Proxy Authentication Required message from the proxy server uses chunked encoding.

      Response parsing fails in the QHttpNetworkReplyPrivate::parseStatus function in this snippet:

          if (status.length() < minLength
              || !status.startsWith(httpMagic)
              || status.at(dotPos) != '.'
              || status.at(spacePos) != ' ') {
              // I don't know how to parse this status line
              return false;
          }
      

      The problem is that at this point, `status` contains the length of the current chunk in hex, but the code tries to interpret this as a simple HTTP header and fails. After this error, the connection to the server is closed immediately.

      This is the HTTP conversion that occurs:

      CONNECT index.hu:443 HTTP/1.1
      Proxy-Connection: keep-alive
      Host: index.hu
      User-Agent: Mozilla/5.0
      
      HTTP/1.1 407 Proxy Authentication Required
      Server: FreeProxy/4.50
      Date: Mon, 24 Jun 2019 08:08:04 GMT
      Content-Type: text/html
      Transfer-Encoding: Chunked
      Proxy-Authenticate: Basic realm="Basicauthproxy"
      Proxy-Connection: Close
      
      7E3
      // ... contents
      0
      

      Attachments

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

        Activity

          People

            cnn Qt Core & Network
            tomikaa87qt Tamas Karpati
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes