[Qt-interest] weird problem with QNetworkAccessManager and posting-requests

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Thu Apr 28 09:38:28 CEST 2011


> I'm using Qt 4.7.2 (gentoo-linux).
>
> I just have rewritten the program as you suggested and yes, I did a
> little unnecessary work, but the problem persists. The code looks
> currently like this:
>
> netManager = new QNetworkAccessManager(this);
> connect(netManager, SIGNAL(finished(QNetworkReply*)), this,SLOT(replyFinished(QNetworkReply*)));
> QNetworkRequest  request(QUrl("http://www.zlug.org/~bebl/php/swformtest/swloginform.php"));
> QUrl  post;
> post.addQueryItem("SCX","1024");
> post.addQueryItem("SCY","768");
> post.addQueryItem("WSCX","1008");
> post.addQueryItem("WSCY","593");
> post.addQueryItem("FORM_USERNAME",username);  // possible none-Latin-1-Chars
> post.addQueryItem("FORM_PASS",password);  // possible none-Latin-1-Chars
> post.addQueryItem("LOGON","Login");
> post.addQueryItem("NOREFRESH","1");
> post.addQueryItem("NOGFX","1");
> debugOutput("LoginThread::run:  ascertained  post-data:  "+post.encodedQuery());
> netManager->post(request,  post.encodedQuery());
>
> As you can see, I currently do only the absolute necessary. (my self-written wwwEncoder was built according the rules of http://tools.ietf.org/html/rfc1738 .. so it should work the same way as QUrl ;) ). I also changed the webserver, as you can see.

Hmmm...the FIN flag would mean the client aborted or tore down its TCP
connection, right? And probably that explains why the finished signal
is not emitted.

Could there be any other code path where you're aborting this request?

As for the double append, i have no clue. :/

Does this webserver support GET request for the same action (the one
you're trying to do with POST)? If it does, maybe you can check to see
if GET behaves properly.

HTH,
-mandeep



More information about the Qt-interest-old mailing list