Jafar,
 
Thank you for answer.
Unfortunately, your receipts didn't help. open() always fails and returns &null. So no HTTP status returns.
I have copied cerificate from sourceforge site with help of Google Chrome (Certificate Export Wizard). And tried to set environment variables. The same result.
Then I tried to add path to openssl DLL files to system path.The same result.
Then I tried to use option "m-" in open(). The same result.
Some other thoughts?
Best regards,
Sergey
 
13.09.2016, 18:56, "Jafar Al-Gharaibeh" <to.ja...@gmail.com>:
Sergey,
 
   Without SSL, your program probably succeeds in opening a socket to the server but since your program doesn't speak ssl it will get nothing, or more accurately you probably are getting an http redirect response  telling you to move from port 80 (http) to port 443 (https). You can confirm that this is the case (or not) by doing something like this:
 
procedure main()
url := "https://sourceforge.net/p/unicon/discussion/"
web := open(url, "m") | stop("Can't open " || url)
web["Status-Code"] == 200 | stop("Error : ", web["Status-Code"], ":", web["Reason-Phrase"])
while s := read(web) do write(s)
close(web)
end
 
If you have SSL enabled, then there are multiple ways your porgram could fail. 
 
  1-  A bug in the underlying implementation: SSL is still Alpha state in unicon.
  2-  Your program couldn't find your trust store or a certificate for the specific website. You can set SSL_CERT_FILE or SSL_CERT_DIR environment variables. Most web browsers allow you to view/save the certificate for a specific website. You can use that feature to save the certificate in a specific location and then you can set SSL_CERT_FILE to its location.
3- You have a certificate but it is invalid (revoked, expired, etc.)
 
Initially we allowed connections to website with unverifiable certificates, but we changed this recently to only allow  valid certificates by default because users will assume that https connection would be secure (by default). You can override that by adding a dash "-" after the mode "m". So it is:
 
web := open(url, "m-") | stop("Can't open " || url)  
 
Again,  SSL is still experimental and we might change the behavior/options before we finalize the user interface.
 
Feedback is always welcome.
 
Cheers,
Jafar

On Tue, Sep 13, 2016 at 6:49 AM Sergey Logichev <slogic...@yandex.ru> wrote:
Hello to all!
 
After Brian's message about already implemented SSL support in Unicon I have tried to build it for MS Windows.
I have got current unicon's sources from repository and used mingw with gcc version 5.3 and openssl libraries from https://sourceforge.net/projects/gnuwin32.
To build sucessfully I had to edit two config files at config\win32\gcc\ directory:
1) libdefine.h : add line #define WANT_SSL 1
2) makedefs.top : add include path to openssl *.h files to ISFLAG variable.
and copy SSL libraries libcrypto.a and libssl.a to lib folder of mingw.
Build completed successfully and now I can see SSL in unicon's features:

secure sockets layer encryption
CCompiler MinGW gcc 5.3.0

However when I try to open existing https resource from unicon program it fails. For example, the program

procedure main()
url := "https://sourceforge.net/p/unicon/discussion/"
web := open(url, "m") | stop("Can't open " || url)
while s := read(web) do write(s)
close(web)
end

prints "Can't open https://sourceforge.net/p/unicon/discussion/".

But if I use unicon's build without SSL the url is opened but looks like as empty.

What's the reason of such behaviour? I don't understand.

Sergey

------------------------------------------------------------------------------
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group
 
--

-- Sent From My Smartphone

------------------------------------------------------------------------------
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to