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

Qt-interest Archive, August 2007
QHttp confusion


Message 1 in thread

Hi all,

I was trying to write a little mini-browser program and encountered a
problem with QHttp. I was trying to read this url using QHttp:

https://www.amazon.com/gp/pele/checkout/sign-in/select.html/104-6477577-8560717?ie=UTF8&cartID=002-0248022-4144864&associateTag=test&cblogo=https://ssl-images.amazon.com/images/G/01/x-locale/checkout/signin-banner.gif&HMAC=27pGAAdPHVl1KHJSBwcCdCt7mvE=&ty=1

if I copy and paste that link to a web browser, it displays amazon's user
login page, which is correct. But if I try to read it in my Qt code with
QHttp, I get this:

"<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL
/gp/pele/checkout/sign-in/select.html/104-6477577-8560717 was not found on
this server.</p>
</body></html>"

I wonder what I did wrong with my test code, which I provide here:

 QString strg = "
https://www.amazon.com/gp/pele/checkout/sign-in/select.html/104-6477577-8560717?ie=UTF8&cartID=002-0248022-4144864&associateTag=test&cblogo=https://ssl-images.amazon.com/images/G/01/x-locale/checkout/signin-banner.gif&HMAC=27pGAAdPHVl1KHJSBwcCdCt7mvE=&ty=1
";

    QHttpRequestHeader header("GET", strg);
    header.setValue("Host", "www.amazon.com");
    header.setValue("User-Agent", DEFAULT_USER_AGENT);
    m_http->setHost("www.amazon.com", ConnectionModeHttps);
    m_id = m_http->request(header);

Can anyone tell me what I do wrong here? Is there anyone able to read the
URL I provided above exactly like what it shows in a web browser?

Thank you,

JB

Message 2 in thread

Hi,

JB Wong schrieb:
> I wonder what I did wrong with my test code, which I provide here:
> 
>  QString strg = " 
> https://www.amazon.com/gp/pele/checkout/sign-in/select.html/104-6477577-8560717?ie=UTF8&cartID=002-0248022-4144864&associateTag=test&cblogo=https://ssl-images.amazon.com/images/G/01/x-locale/checkout/signin-banner.gif&HMAC=27pGAAdPHVl1KHJSBwcCdCt7mvE=&ty=1";;
> 
>     QHttpRequestHeader header("GET", strg);
>     header.setValue("Host", "www.amazon.com");
>     header.setValue("User-Agent", DEFAULT_USER_AGENT);
>     m_http->setHost("www.amazon.com", 
> ConnectionModeHttps);   
>     m_id = m_http->request(header);

when using the HTTP protocol the GET-parameter must not contain the host 
("http://www.amazon.de";)!

Change your line to
QString strg = "/gp/pele/...";
and everything should work fine.

Greetings,
Christoph

--
 [ signature omitted ]