How to remove the Authorization header from a http request



  • I want to remove the 'Authorization: ' header from my GET request fired. QT by default adds it.

    Sample of request fired -
    GET https://mywebsiteurl.com/remote.php/webdav/3.txt HTTP/1.1

    Authorization: Basic Og==
    User-Agent: Mozilla/5.0 (Linux) myapp/1.2.1
    Connection: Keep-Alive
    Accept-Encoding: gzip, deflate
    Accept-Language: en-US,*

    I don't want the Authorization header. I completely want to remove it from my request fired.
    End result should be as below-

    GET https://mywebsiteurl.com/remote.php/webdav/3.txt HTTP/1.1
    User-Agent: Mozilla/5.0 (Linux) myapp/1.2.1
    Connection: Keep-Alive
    Accept-Encoding: gzip, deflate
    Accept-Language: en-US,*

    I have written sample code -

    QNetworkAccessManager* mgr = new QNetworkAccessManager();
    ....
    QNetworkRequest req;
    req.setUrl(QUrl("sampleURL") );
    mgr->get(req);
    .....
    Thanks in advance..!!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.