orthecreedence / cl-async

Asynchronous IO library for Common Lisp.
MIT License
273 stars 40 forks source link

WIP Acknowledge init change for libssl 1 #155

Closed foretspaisibles closed 6 years ago

foretspaisibles commented 6 years ago

I started to work on a fix for #154.

It seems that initialisation rules for SSL changed with version 1, see:

https://wiki.openssl.org/index.php/Library_Initialization

unfortunately the library version number is not static data but is hidden in a macro. Using this patch we can `(ql:quickload "cl-async-ssl") in Debian Stretch for instance. However the library does not seem to be correctly initialised because the following code fails with

Error: #<TCP-SSL-ERROR NIL: 336236705: error creating SSL context: library has no ciphers {1002489F13}>
(ql:quickload "drakma-async")
(defun my-http-request ()
  (blackbird:catcher
    (blackbird:multiple-promise-bind (body status headers)
        (das:http-request "https://www.google.com/")
      (format t "Status: ~a~%" status)
      (format t "Headers: ~s~%" headers)
      (format t "Body: ~a~%" (if (stringp body) body (babel:octets-to-string body))))
    (drakma-async:http-eof ()
      (format t "Server hung up unexpectedly =[~%"))
    (error (e)
      (format t "Error: ~a~%" e))))

(as:start-event-loop #'my-http-request)

I am not familiar with libssl so maybe has someone else an idea about how to really fix this?

orthecreedence commented 6 years ago

Sorry for the lag. I think this is the absolute best way of doing this (foreign symbol detection vs trying to set up some always-breaking version-to-available-function matrix). Thanks for the contribution =]

foretspaisibles commented 5 years ago

Thanks! :) – I guess I'm beating you at lagging. ;)