Why QHttpRequestHeader / QHttpResponseHeader are deprecated?



  • I just moved to new Qt and discovered that QHttpRequestHeader / QHttpResponseHeader classes are obsolete.

    What is a reason and what should I use instead in order to implement http requests? I am aware about QNetworkAccessManager class and it is very convenient for client implementation but it is pretty unusable for server implementation.



  • This classes worked with QHttp, which also obsolete.

    How do you use QHttp class for server implementation? IMHO it is only client class.
    Servers traditionally realized on sockets (QTcpSocket for example).



  • Yes, you are right, QTcpSocket is a right way to implement server on low level.

    But then http server should accept http header, parse it, analyse it and send http response. QHttpRequestHeader / QHttpResponseHeader classes are very convenient for that and they save some manual parsing.

    So, probably the right question is: "why QHttp class is obsolete"?



  • QNetworkAccessManager is much more flexible and not limited to a single protocol. With QHttp/QFtp you had to decide on the application level which protocol to use, with QNAM you leave that to the network layer and only pass an URL to it.

    You can still use QHttpRequestHeader and QHttpResponseHeader for your purposes. As Qt 4 will be source compatible for its lifetime you must not worry that it vanishes sometime in the future. That could only happen with a Qt 5.



  • Thank you, I just worried QHttp class will be out some time if it obsolete now.

    QNetworkAccessManager is very client-oriented. I didn't find a way use it for server implementation.



  • It's not meant for that purpose and I seriously doubt that it would be helpful in any way.


Log in to reply
 

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