Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Headers and Cookies of QNetworkRequest - really necessary ?

Headers and Cookies of QNetworkRequest - really necessary ?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 642 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.
  • cpperC Offline
    cpperC Offline
    cpper
    wrote on last edited by
    #1

    This question is not so much about Qt itself, hopefully it's not a problem.
    I'm writing a program to log into a game a get some information from the account. Studying the network tab in chrome's dev options, I got the headers and cookies of the requests and made my own post and get requests, and everything works fine.
    The requests contain 13 headers, typically : Accept,Accept-Encoding,Accept-Language,Cache-Control,Connection,Content-Length,Content-Type,Host,Origin,Pragma,Referer,Upgrade-Insecure-Requests,User-Agent , plus the Cookie header which contains at least 3 cookie values. Out of curiosity I removed all of these, and the reply content is the exact same as before. So, do I actually have to set all this headers to the values displayed in dev options ? Is there a benefit of setting these up ?

    1 Reply Last reply
    0
    • Chris HennesC Offline
      Chris HennesC Offline
      Chris Hennes
      wrote on last edited by
      #2

      You don't have to set headers. What they affect is going to depend on the details of the implementation on the server. For example, if you set User-Agent to an old version of Explorer you might instead get a page telling you the site is incompatible. It sounds like in your case you can simply omit the headers without issue. You may be making your app more fragile, since the site's handling of those headers could change at any time to matter, but since my recollection is that you are writing screen-scraping software you have bigger fragility issues anyway.

      Chris Hennes, Pioneer Library System

      1 Reply Last reply
      2
      • cpperC Offline
        cpperC Offline
        cpper
        wrote on last edited by
        #3

        Thanks Chris :)

        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