Thanks for your reply.
The Qt Assistant doesn't talk anything about Https and therefore I got the doubt.
Mithin
www.mithin.in
"s" stands for "secure", you need an SSL layer to have https. In Qt3 you can use a Qt Cryptographic Architecture (QCA - see our links section) or QtSSLSocket - a Qt Solution from Trolltech. With Qt4 you can use the Qt Solution as well. Alternatively you'll need to provide your own SSL layer implementation. The application layer (HTTP) remains the same.
I found this python code which does not perform any kind of encryption
Qt Code:
import re, httplib2 h = httplib2.Http() auth_uri = 'https://www.google.com/accounts/ClientLogin' headers = {'Content-Type': 'application/x-www-form-urlencoded'} myrequest = "Email=YOUR_GMAIL_ADDRESS&Passwd=GMAIL_PASSWORD&service=blogger&service=Whatever-TestApp-0.0" response, content = h.request(auth_uri, 'POST', body=myrequest, headers=headers) # Extract the auth token from the returned content, and print it to stdout. print re.search('Auth=(\S*)', content).group(1)To copy to clipboard, switch view to plain text mode
There is also similar perl code which does not perform any encryption.
Will the correspoding Qt code work or will I still need to encrypt the data and then send ?
I would be greatful to you if can explain this to me like I am a 4 year old kid, with some example.
Thanks a lot.
Mithin
www.mithin.in
How do you know the code doesn't perform encryption? Maybe the library does that transparently? You could just post a regular http request and see what happens...
This is what I did
Qt Code:
connect(&http,SIGNAL(done(bool)),this,SLOT(httpDone(bool))); connect(&http,SIGNAL(readyRead(const QHttpResponseHeader &)),this,SLOT(readyRead(const QHttpResponseHeader &))); http.setHost("www.google.com"); "&service=cl&source=Gulp-CalGulp-1.05"; header.setValue("Host", "https://www.google.com") ; header.setContentType( "application/x-www-form-urlencoded" ) ;To copy to clipboard, switch view to plain text mode
Qt Code:
{ //QString str = header.reasonPhrase(); }To copy to clipboard, switch view to plain text mode
I got result as
Qt Code:
<HTML> <HEAD> <TITLE>Moved Temporarily</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Moved Temporarily</H1> The document has moved <A HREF="https://https/accounts/ClientLogin">here</A>. </BODY> </HTML>To copy to clipboard, switch view to plain text mode
Probably Qt itself is generating this.
Can you please give me some minimal example on how I encrypt the data and send ?
Thanks a lot.
Mithin
www.mithin.in
I did one more experiment. Here it is
Qt Code:
<html> <body> <form action="https://www.google.com/accounts/ClientLogin" method="post"> <input type="hidden" name="service" value="cl" /> <input type="hidden" name="source" value="some-app-1.0" /> Email : <input type="text" name="Email" /> <br/> Password: <input type="password" name="Passwd" /> <br/> <input type="submit" name="Submit" value="Login"> </form> </body> </html>To copy to clipboard, switch view to plain text mode
The response to this was what google sends and this code works correctly.
Isn't this similar to the code above?
Maybe I have got the basics itself wrong.
Please help.
Thanks a lot
Mithin
www.mithin.in
The problem is that QHttp doesn't handle https (SSL). Without introducing the SSL layer you won't be able to send a https request.
Bookmarks