Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Is there any difference between QNetworkAccessManager::sendCustomRequest(request, "GET", QByteArray()) and QNetworkAccessManager::get(request);



  • Hi,
    today, I found
    when I use QNetworkAccessManager::sendCustomRequest(request, "GET", QByteArray()) , I got 403
    but when I use QNetworkAccessManager::get(request), I can got response.

    after analyzing HTTP request, I found
    when I use QNetworkAccessManager::sendCustomRequest(request, "GET", QByteArray())
    There will be an extra line:

    Content-Length: 0
    

    Is there any difference between these two methods?
    Or, the extra line will cause some server parse error or something else?


  • Qt Champions 2019

    As you can see there is a difference. I would guess the content-length:0 comes from the empty QByteArray() you pass to the sendCustomRequest() function.
    Why the server behaves differently is out of our scope (and Qt's scope)


Log in to reply