Results 1 to 1 of 1

Thread: Cannot set "Connection: close" in QNetworkRequest

  1. #1
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Cannot set "Connection: close" in QNetworkRequest

    I add

    Qt Code:
    1. m_request.setRawHeader("Connection", "close");
    To copy to clipboard, switch view to plain text mode 

    but checking with Wireshark, I see that the header contains a "Keep-Alive".

    I debugged Qt and seen that "network/access/qhttpnetworkconnection.cpp"
    sets the Keep-Alive ignoring my header.

    Qt Code:
    1. void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair)"
    2. ...
    3. if (networkProxy.type() == QNetworkProxy::HttpCachingProxy) {
    4. value = request.headerField("proxy-connection");
    5. if (value.isEmpty())
    6. request.setHeaderField("Proxy-Connection", "Keep-Alive");
    7. } else {
    8. #endif
    9. value = request.headerField("connection");
    10. if (value.isEmpty())
    11. request.setHeaderField("Connection", "Keep-Alive");
    12. #ifndef QT_NO_NETWORKPROXY
    13. }
    To copy to clipboard, switch view to plain text mode 

    Does someone know how to set a "Connection: close"?


    Added after 25 minutes:


    It seems not possible:
    https://bugreports.qt.io/browse/QTBUG-9463
    Last edited by trallallero; 17th July 2018 at 10:51.

Similar Threads

  1. Replies: 1
    Last Post: 20th November 2015, 11:02
  2. QButtonBox, QDialog should not close on "Abort" or "Cancel"
    By HappyCoder in forum Qt Programming
    Replies: 8
    Last Post: 10th September 2015, 14:10
  3. Replies: 3
    Last Post: 16th March 2015, 08:31
  4. Replies: 4
    Last Post: 30th August 2014, 13:05
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.