View Full Version : Qhttp::request(...) method and GET request
mikhailt
12th September 2006, 23:04
It looks like Qhttp::request(const QHttpRequestHeader &header, QIODevice *data, QIODevice *to)
method does not send request parameters for GET request.
Method Qhttp::request(header,data ...) sends a request type defined in header.
And this can be POST,GET etc.
Qhttp::request(header,data ...) should send request parameters as data variable. It is OK for POST.
But it does not send it for GET :confused:
I do not want to use Qhttp::get() method because I need to send a special defined request header to server.
wysota
12th September 2006, 23:17
What parameters do you mean? You mean the query string? (?xxx=yyy&aaa=bbb) For get requests the query string is part of the path.
mikhailt
14th September 2006, 22:19
Yes, I mean the query string (?xxx=yyy&aaa=bbb) that is a part of path
But there is NO path variabel in Qhttp::request() :confused:
Qhttp::request (QHttpRequestHeader& header, QIODevice* data, QIODevice* to)
and this is a problem!
jacek
14th September 2006, 22:22
But there is NO path variabel in Qhttp::request()
Because it's inside QHttpRequestHeader:
QHttpRequestHeader::QHttpRequestHeader ( const QString & method, const QString & path, int majorVer = 1, int minorVer = 1 )
Constructs a HTTP request header for the method method, the request-URI path and the protocol-version majorVer and minorVer.
mikhailt
15th September 2006, 12:26
jacek yes exactly!
I have found the solution!
When the custom request header is being constructed for GET request,
then all request parameters must be added there (to Path).
As a string like "?aaa=123&ccc=456"
QString strPath = RealURLPath;
if (GET == RequestType) Path += "?aaa=123&ccc=456";
QHttpRequestHeader* pHeader = new QHttpRequestHeader(RequestType, Path);
It should not be done for POST request.
Then we can send both POST and GET requests with custom header and request parameters through Qhttp::request() method.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.