Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Content-Encoding: Gzip with Qt Webkit?

Content-Encoding: Gzip with Qt Webkit?

Scheduled Pinned Locked Moved Qt WebKit
9 Posts 6 Posters 12.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Ö Offline
    Ö Offline
    ÖlaufmKeks
    wrote on 12 Dec 2010, 14:13 last edited by
    #1

    Hi everyone :),
    I try to open a website which only supports "Content-Encoding: gzip". A custom made header with "Accept-Encoding: Identity" is completly ignored by the webserver...
    If I try to open this site in a QTWebKit widget... Guess what... Nothing happens :). I already recompiled QtWebKit in its newest version but the site still won't be rendered by WebKit :(...
    Is gzipped encoded content not supported in QTWebKit? Or is there another way to show this specific page with WebKit?
    Thanks in advance for every answer :)...

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fcrochik
      wrote on 12 Dec 2010, 15:04 last edited by
      #2

      Have you tried using firefox with firebug to get all the headers sent and received?
      The problem may be with the server filtering the user agent or something else (not the gzip content per se).

      Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

      1 Reply Last reply
      0
      • B Offline
        B Offline
        baysmith
        wrote on 12 Dec 2010, 21:27 last edited by
        #3

        Chrome also has some great features for web developers, under the Tools menu and off the Inspect element in the context menu.

        Nokia Certified Qt Specialist.

        1 Reply Last reply
        0
        • Ö Offline
          Ö Offline
          ÖlaufmKeks
          wrote on 8 Jan 2011, 12:35 last edited by
          #4

          First of all thanks four your answers so far :)...
          Secondly, sorry for my late answer, another project took too much time.

          So, I'm still stuck with this WebKit problem. I already recompiled WebKit and tried the QtTestBrowser on this page. QtTestBrowser throws a "Frame load interrupted by policy change", even if I change the User-Agent to Opera or any other (every other page works fine)...

          Then I tried curl. All I get is scrambled output which looks like gzip encoded data.
          If I run "curl --compressed http://specificsite" everything looks good with nice html output.

          This page works fine with midori, chrome, opera, firefox. But aurora won't render this page too...

          So I really guess this is a content-encoding: gzip problem... I'm thankful for every tip!!!

          1 Reply Last reply
          0
          • B Offline
            B Offline
            benjamin.poulain
            wrote on 8 Jan 2011, 14:02 last edited by
            #5

            Any chance to get and example to reproduce that?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              shayz
              wrote on 9 Jan 2011, 08:11 last edited by
              #6

              Hi,

              I have something of the same issue but I think Qt WebKit supports gzip but takes for ever to end the http load operation. For example, www.weather.com in Arora, takes 10-20 minutes to load.
              After some investigations, it seems that only when the underlying TCP connection closes, Qt Network (qhttpnetworkreply.cpp and qhttpnetworkconnectionchannel.cpp) 'understands' that the page has been fully received. Qt Network disregards the content length header if the page is gzipped -
              QHttpNetworkReplyPrivate::removeAutoDecompressHeader is called when the content encoding is gzip.

              --shay

              1 Reply Last reply
              0
              • T Offline
                T Offline
                Thijs
                wrote on 29 Jun 2011, 08:19 last edited by
                #7

                I've run into the same problem and come to the same conclusion:

                • QtWebKit doesn't support (all?) gzip content
                • This is because it strips the content length is removed by QtNetwork (as shayz mentioned) or because of missing end-of-stream marker (as mentioned in the bug reports below).
                • For most websites you can work around this issue by using a custom NetworkAccessManager and using : req.setRawHeader("Accept-Encoding", "none") inside createRequest() function

                Unfortunately there are some websites that always return gzipped content. Those are FUBAR, untill QtWebKit gets fixed :(

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  Thijs
                  wrote on 29 Jun 2011, 08:28 last edited by
                  #8

                  For future visitors, there are some relevant bug reports:

                  https://bugs.webkit.org/show_bug.cgi?id=58727
                  http://bugreports.qt.nokia.com/browse/QTBUG-16022

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    Thijs
                    wrote on 30 Jun 2011, 09:36 last edited by
                    #9

                    I made a small test-case which allowed me to find the cause. From the source code of qhttpnetworkconnection.cpp :

                    @
                    value = request.headerField("accept-encoding");
                    if (value.isEmpty()) {
                    #ifndef QT_NO_COMPRESS
                    request.setHeaderField("Accept-Encoding", "gzip");
                    request.d->autoDecompress = true;
                    #else
                    // if zlib is not available set this to false always
                    request.d->autoDecompress = false;
                    #endif
                    }
                    @

                    I believe this is a bug: If you manually set the "Accept-Encoding" header, autoDecompress becomes false (even if you set it to "gzip"). So QtWebKit will never decompress the data and it will not be able to render the page obviously.

                    [EDIT: code formatting, please use @-tags, not code, Volker]

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved