[Qt-interest] validate url using QHttp

Markus Goetz Markus.Goetz at nokia.com
Wed Nov 11 09:46:02 CET 2009


ext Ross Driedger wrote:
> On Tue, 10 Nov 2009 18:59:35 -0500, <qt-interest-request at trolltech.com>  
> wrote:
>
>   
>> Message: 1
>> Date: Wed, 11 Nov 2009 01:12:16 +0200
>> From: Mystical Groovy <mysticalgr at gmail.com>
>> Subject: [Qt-interest] validate url using QHttp
>> To: "qt-interest at trolltech.com" <qt-interest at trolltech.com>
>> Message-ID:
>> 	<4877b36e0911101512n70cbee40i5acb23444cafea71 at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>> Hello all,
>> Im using QFtp and errorString() to see if its an ftp repository is live,  
>> for
>> ex if errorString returns no error, the host is alive, else theres a  
>> problem
>> //check ftp vadility
>>     
>
> There is a big difference between ftp and http: the first is 'stateful'  
> and the other is 'stateless'.  In short, you can set up an http connection  
> to an invalid address, but you won't be aware that it is invalid until you  
> try to get any data from it.  For ftp, the client and server negotiate the  
> connection before you try to transfer files.
>
> Try a GET to an invalid URL and see what happens.
>
> Here is a good start to the necessary reading you will need to really  
> understand what is happening:
> <http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>
>
>   
Ross is right. What you could do is use QNetworkAccessManager and use 
the HTTP HEAD method with its head() function and then look for error() 
signal and finished() signal if it succeeds.

Markus



More information about the Qt-interest-old mailing list