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

QNetworkReply::errorString shows misleading "server replied:" with no reason phrase for HTTP/2/3 responses

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.11.0 FF
    • 6.9.1
    • Network: HTTP
    • None
    • Linux/Wayland, Windows
    • cdd0b0b86 (dev), 1d8184465 (6.10)

      When making a request over HTTP/2 that returns an error status code (e.g. 500), QNetworkReply::errorString() produces output like:
      Error transferring https://api.example.com/ - server replied:
       
      The message template assumes that a reason phrase is present. However, HTTP/2 and HTTP/3 do not carry a reason phrase (RFC 7540 §8.1.2.4), so the field is always empty. This leaves a confusing dangling "server replied:" with nothing after it.
       
      Steps to Reproduce

      1. Create a simple QNetworkAccessManager GET request to an endpoint that returns HTTP/2 500 with no body.
      1. Connect to the finished() signal and call reply->errorString()
      1. Observe that the string ends with "server replied: " and nothing else.

      Expected Result
      errorString() should omit the "server replied:" part if the reason phrase is empty, or use a neutral fallback such as "server returned status 500".

      Actual Result
      Output contains "server replied:" with nothing after it.

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

            manordheim Mårten Nordheim
            nbolton Nick Bolton
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes