|
|
Home » U++ Library support » U++ MT-multithreading and servers » https - how to?
https - how to? [message #7937] |
Thu, 01 February 2007 09:21 |
WebChaot
Messages: 53 Registered: September 2006 Location: Austria, Vienna
|
Member |
|
|
Hi all!
I played around with HttpClient a few weeks ago. Works fine - but then I tried to use https. But I didnt get the demo running. I tried to include openssl - but without success.
Is there any demo of a "HttpsClient"?
Thanks,
WebChaot.
|
|
|
|
|
|
|
|
Re: https - how to? [message #9187 is a reply to message #7937] |
Fri, 20 April 2007 10:37 |
WebChaot
Messages: 53 Registered: September 2006 Location: Austria, Vienna
|
Member |
|
|
>>> PS: If you have any problems just let me know
Thanks - now I have some
>>> I am sorry, but it seems like OpenSSL is NOT included in Upp.
I downloaded openssl. First I got an linker error (file not found: libout32/xy.a) - but then I copied the *.a files to new mingw-dir libout32 and it works.
Then I put the code of your xmlrpc into my program (because I do not know, how to do all that stuff):
--------------------------------
if(usessl)
{
if(sslcontext.IsEmpty())
{
SSL_METHOD *meth=TLSv1_client_method();
sslcontext.Create(meth);
sslcontext.VerifyPeer(false);
}
if(!SSLClientSocket(http.socket,sslcontext,http.host,http.po rt))
{
PromptOK("No SSL");
return;
}
MyResult = http.Execute();
--------------------------------
1. What I get, when I download an URL (https://...) is only a "No SSL" which still results from SSLClientSocket. Is there any way to check, whats wrong now?
And how does it work? When I disable usessl, but connect to an "https"-site, I get a response. Will I have to parse URL for the "s" by code to check, if I have to "usessl"?
First I want to get any response from a https-site. Then I will continue to play around with certificates.
2. I tried to get content of an local webserver via http://192.168.x.y (without ssl) and the program hang up. Does it not work with ip-adresses?
3. After first run I got an error message because of missing msvcr71.dll. I downloaded it and copied to windows dir. As I read its a c-runtime-library. I thought, when I have all openssl-sources I would not need any extra dll. Is there a way to include openssl without a dll (because I only want one exe-file, if possible)?
WebChaot
PS: We could talk in german too - but this forum is international - greetings from Vienna
[Updated on: Fri, 20 April 2007 11:07] Report message to a moderator
|
|
|
Re: https - how to? [message #9236 is a reply to message #9187] |
Mon, 23 April 2007 08:55 |
fallingdutch
Messages: 258 Registered: July 2006
|
Experienced Member |
|
|
Hi WebChaot, sorry for the late reply, my box was down.
WebChaot wrote on Fri, 20 April 2007 10:37 |
if(usessl)
{
if(sslcontext.IsEmpty())
{
SSL_METHOD *meth=TLSv1_client_method();
sslcontext.Create(meth);
sslcontext.VerifyPeer(false);
}
if(!SSLClientSocket(http.socket,sslcontext,http.host,http.po rt))
{
PromptOK("No SSL");
return;
}
MyResult = http.Execute();
1. What I get, when I download an URL (https://...) is only a "No SSL" which still results from SSLClientSocket. Is there any way to check, whats wrong now?
|
The bold line could be the problem, i used the newest encryption in my server/client but the webserver you are connecting might not be - so you should use one of the following const SSL_METHOD *SSLv2_client_method(void);
const SSL_METHOD *SSLv3_client_method(void);
Quote: |
And how does it work? When I disable usessl, but connect to an "https"-site, I get a response. Will I have to parse URL for the "s" by code to check, if I have to "usessl"?
|
Many Servers reply with a "you should connect to this server usring ssl" site.
Well if you just have a url: Yes because in normal case https is on port 443 and http on port 80. So you even have to connect to different ports.
Quote: |
First I want to get any response from a https-site. Then I will continue to play around with certificates.
|
i hope you will be able if you play around with the changes above
Quote: |
2. I tried to get content of an local webserver via http://192.168.x.y (without ssl) and the program hang up. Does it not work with ip-adresses?
|
what do you set as port and host?
you have to set the ip as host and port to 80 to connect to a http-server
Quote: |
3. After first run I got an error message because of missing msvcr71.dll. I downloaded it and copied to windows dir. As I read its a c-runtime-library. I thought, when I have all openssl-sources I would not need any extra dll. Is there a way to include openssl without a dll (because I only want one exe-file, if possible)?
|
I am Sorry, but i don't know - using linux here, but will soon play with windows, too.
greetings from Baden-Württemberg
Bas
|
|
|
Re: https - how to? [message #9262 is a reply to message #7937] |
Tue, 24 April 2007 14:07 |
WebChaot
Messages: 53 Registered: September 2006 Location: Austria, Vienna
|
Member |
|
|
Hi fallingdutch!
Thanks for your help! Step for step it works. The problem was "URL". When I assign values manually (Port, Host, ...) it works. Now I have to pack all the stuff into a thread, because I dont want the application to freeze. I know the solution from forum with the callback in execute - but its not really fluid.
>>> First I want to get any response from a https-site. Then I will continue to play around with certificates.
Is there any way to read values out (certid, cn, ...) of server certificate? I cant find any method to do this.
WebChaot.
[Updated on: Wed, 25 April 2007 08:30] Report message to a moderator
|
|
|
|
|
Re: https - how to? [message #9303 is a reply to message #7937] |
Thu, 26 April 2007 09:24 |
WebChaot
Messages: 53 Registered: September 2006 Location: Austria, Vienna
|
Member |
|
|
Hi fallingdutch!
All seems to work ok, but ...
I implemented SSL in httpcli-Demo and in my own program.
In httpcli I allways get an zero return error from ssl socket - but code 200 from http - so all works fine, but I dont know, what I should do with this error.
In my own program on first download all works fine and I get the same error after first try (error: 0 - invalid server response...).
[error] socket(1904) / SSL_read: SSL_ERROR_ZERO_RETURN (6)
[status 200] HTTP/1.1 200 OK
Do you know whats wrong with ssl? Did you have similar responses in past?
Thanks,
WebChaot.
Here the lines I added to httpcli, which results in the error described above:
===========================================
if(sslcontext.IsEmpty())
{
sslcontext.Create(SSLv2_client_method());
sslcontext.VerifyPeer(false);
}
if(!SSLClientSocket(client.socket,sslcontext,client.host,cli ent.port))
{
puts("No SSL");
return;
}
if (!client.socket.IsOpen())
{
puts("No Socket");
return;
}
puts(client.socket.GetInfo(SSLInfoCertSubjectName()).ToStrin g());
String content = client.ExecuteRedirect();
puts("[error] " + Nvl(client.GetError(), "OK (no error)"));
puts(NFormat("[status %d] %s\n", client.GetStatusCode(), client.GetStatusLine()));
===========================================
[Updated on: Thu, 26 April 2007 09:25] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Mar 29 15:51:21 CET 2024
Total time taken to generate the page: 0.01023 seconds
|
|
|