Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. XMLHttpRequest and cookies ?

XMLHttpRequest and cookies ?

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 6.6k 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.
  • B Offline
    B Offline
    brouits
    wrote on last edited by
    #1

    Hello,

    I appears that XMLHttpRequest does not seem to support cookies in the folling scenario:

    1. client send an authentified xmlhttprequest

    2. server sets various cookies for a '302 Found' (moved temporally)

    3. client re-connects to the next URL (same as the previous) and should send the cookies

    4. server actually serves the desired resource

    With QML, the scenario becomes:

    1.(same)

    2.(same)

    3: the client does not send the cookies

    4.the server and the client indefinitely loop on 2 + 3 until loop detection.

    I tried to subclass QNetworkManagerFactory and QNetworkCookieJar in C++ and launch the declarative viewer from C++ to permit cookies to be sent. However, the cookies are still not sent (verified with a tcp dump).

    I am out of idea.
    I am using Qt 4.7 git version (commit 8cb399e2c2ba47cdf3b27c7c5cb4d8d35702a068)
    Thanks for any idea and suggestions.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      brouits
      wrote on last edited by
      #2

      Moreover, it appears that XMLHttpRequest implementation in QML seem not to handle authentication, even if the request.withCredential is ste to true.

      Sniffing the network interface did not give me the autheticated reply from my QML script. while i gave user and password as parameter.

      Can someone confirm that authentication is not yet implemented in QML implementation of XMLHttpRequest ?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        midnite
        wrote on last edited by
        #3

        Hello,

        I work with brouits, author of this topic.

        We have found how to manage cookies by building a binary to use instead of qmlviewer. To do it we have subclassed QDeclarativeNetworkAccessManagerFactory.

        We still have problems with authentication. It seems that xmlHttpRequest does not take the "user" and "password" arguments into account. We bypassed this problem by putting credentials in the "Authorization" header, but we have to request data twice the first time because the call stops on the 401 HTTP Response.

        Any help will be greatly appreciated :-)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mbrasser
          wrote on last edited by
          #4

          Hi,

          If these things are working correctly with other (e.g. webkit) xmlhttprequest implementations, then it is likely a bug in the QML implementation. Is it possible to provide an example or specific instructions to reproduce in the "bugtracker":http://bugreports.qt.nokia.com, so we can further track this down?

          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