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

QNetworkRequest Does Not Allow Non-Normalized Headers

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2: Important P2: Important
    • None
    • 6.9
    • Network, Network: HTTP
    • None
    • Qt 6.9
      macOS, Linux, and Windows
      PySide/Qt for Python is also affected
    • All

      Some servers and systems provided by third parties are not standards compliant and only accept headers like Authorization when capitalized in specific ways. Unfortunately this seems common for network controlled devices that often don't receive firmware updates to bring them into compliance.

      In earlier versions of Qt this was a non-issue, we could use setRawHeader() to force a specific casing as necessary.

      Now, when we use setRawHeader() the header name is converted into a HeaderName, which uses the HeaderName(QAnyStringView name) constructor and that forcefully normalizes the name using normalizedName(QAnyStringView name). This also affects using QHttpHeaders directly with the append, insert, etc. methods since they also use the HeaderName(QAnyStringView name) constructor.

      For the most cases this seems very appropriate, but I also think there should be a way to bypass the normalization on demand. Perhaps via an attribute on QNetworkRequest or flag on QHttpHeaders that could be set.

      I haven't been able to find any documentation or code that seems to enable this and it is blocking me from upgrading.

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

            manordheim MÃ¥rten Nordheim
            chipolux NaKyle Wright
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes