Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, March 2008
QHostInfo and QHttp can't find host


Message 1 in thread

Hi,

I am having some trouble using the network from Qt 4.4 beta 1.
I am trying to retreive a webpage using QHttp. However, I get a "Host 
bla.blah.com not found" error. Checking with QHostInfo yields the same 
results.

The interesting thing is that a normal webbrowser *is* able to retreive the 
page without problems.

Does anyone have any suggestions what the problem may be?

Regards,

André
 

--
 [ signature omitted ] 

Message 2 in thread


"André Somers" <andre@xxxxxxxxxxxxxxxx> wrote in message 
news:fr3cgb$s24$1@xxxxxxxxxxxxxxxx
> Hi,
>
> I am having some trouble using the network from Qt 4.4 beta 1.
> I am trying to retreive a webpage using QHttp. However, I get a "Host 
> bla.blah.com not found" error. Checking with QHostInfo yields the same 
> results.
>
> The interesting thing is that a normal webbrowser *is* able to retreive 
> the page without problems.
>
> Does anyone have any suggestions what the problem may be?

I solved the issue myself. It was a stupid matter of erroneously including 
the protocol (http://) in the hostname. That of course does not work.

While the host now seems to be reached, I still have a problem: there does 
not seem be any data to read! While the webpage displays nicely in FireFox, 
I get no available data after the requestReady() signal is fired. 
QHttp::availableData() returns 0. QHttp::lastResponse().statusCode() returns 
200, indicating a successfull HTTP request.
Looking out the state change output during the run, it seems that most time 
is spend in state 3.

Any hints?

André

 

--
 [ signature omitted ] 

Message 3 in thread

> While the host now seems to be reached, I still have a problem: there does 
> not seem be any data to read! While the webpage displays nicely in 
> FireFox, I get no available data after the requestReady() signal is fired. 
> QHttp::availableData() returns 0. QHttp::lastResponse().statusCode() 
> returns 200, indicating a successfull HTTP request.
> Looking out the state change output during the run, it seems that most 
> time is spend in state 3.

At the risk of seemingly talking to myself:
I have found the problem. The problem was at the webserver, who simply did 
not send any data if the user-agent string was set to something it did not 
think was valid. Using the request header to set a bogus user agent string 
solved the problem.

Thanks.

André
 

--
 [ signature omitted ] 

Message 4 in thread

André Somers wrote:
>> While the host now seems to be reached, I still have a problem: there 
>> does not seem be any data to read! While the webpage displays nicely 
>> in FireFox, I get no available data after the requestReady() signal 
>> is fired. QHttp::availableData() returns 0. 
>> QHttp::lastResponse().statusCode() returns 200, indicating a 
>> successfull HTTP request.
>> Looking out the state change output during the run, it seems that 
>> most time is spend in state 3.
>
> At the risk of seemingly talking to myself:
> I have found the problem. The problem was at the webserver, who simply 
> did not send any data if the user-agent string was set to something it 
> did not think was valid. Using the request header to set a bogus user 
> agent string solved the problem.
In the interest of, you know, keeping choice alive, I'd recommend 
pinging the server's admin to reconfigure the "valid" user-agent strings...

--Jeff

--
 [ signature omitted ]