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. Content-Length Header missing?
QtWS25 Last Chance

Content-Length Header missing?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qnetworkreplyhttp header
1 Posts 1 Posters 1.2k 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.
  • the_T Offline
    the_T Offline
    the_
    wrote on last edited by
    #1

    Hi,

    I try to download some (binary) from a server. The request page is a php script, that returns the files according some POST variables.

    my php script looks like this

    <?php
    //read $_POST and do some PDO things returning content as blob, size as int, contenttype as varchar
    $filesize = $res['size']; //size is set in the database
    $type = $res['contenttype'];
    $content = $res['content'];
    header("Content-Length: $filesize");
    header("Content-type: $type");
    echo $content;
    ?>
    

    If I request a file via browser (with jquery post), I get all headers, but with QNetworkAccessManager I am missing the Content-Length.

    qDebug() << "header: " << r->header(QNetworkRequest::ContentLengthHeader);
    

    says QVariant(Invalid)

    qDebug() << r->rawHeaderList();
    

    reads this:

    ("Date", "Server", "X-Powered-By", "Vary", "Content-Encoding", "Connection", "Transfer-Encoding", "Content-Type")
    

    Any ideas what went wrong here?

    -- No support in PM --

    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