[Qt-interest] QHttp getting empty response
Thiago Macieira
thiago at kde.org
Tue Sep 27 21:08:14 CEST 2011
On Tuesday, 27 de September de 2011 12:54:52 Paul Miller wrote:
> On 9/27/2011 10:47 AM, Thiago Macieira wrote:
> > On Tuesday, 27 de September de 2011 10:31:24 Paul Miller wrote:
> >> I have some QHttp code using Qt 4.7
> >
> > You should use QNetworkAccessManager, which has been available since 4.4.
>
> Okay I ported to QNetworkAccessManager and I keep getting 301 "Moved
> Permanently" errors from the server now.
>
> I am building the request like this:
>
> QNetworkRequest req(server_url);
> reply = net->post(req, queryString.toUtf8());
>
> Which is similar to what I was doing before (URL was just the host,
> query data is my query string - basically a bunch of form name=value pairs).
>
> My server guy tells me the request isn't even getting to him.
>
> No matter what I try I always get back a web page from the server with a
> 301 error telling me the document has been permanently moved, with the
> new address being the URL in the request.
>
> I also tried it with a GET which should have sent me a different page at
> least and that generated the same result as well.
If you're getting a 301 Moved, it's because the server sent that. You should
send the request again at the right address -- note the rules about re-POSTing
in RFC 2616 though.
Now, it could be that something on your Windows 7 host is blocking the request
and asking you to post again. If that's the case, it's totally out of our
control.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110927/8b850e0d/attachment.bin
More information about the Qt-interest-old
mailing list