edicl / drakma

HTTP client written in Common Lisp
http://edicl.github.io/drakma/
248 stars 58 forks source link

http-request http://lisp.org example triggers socket error (A non-blocking socket operation could not be completed immediately.) #139

Open kensan73 opened 11 months ago

kensan73 commented 11 months ago

Hello,

Total common lisp newbie here.

On Windows 11, portacle using sbcl I do

(ql:quickload :drakma)
(setf drakma:*header-stream* *standard-output*)
(drakma:http-request "http://lisp.org/")

and I see

image

I'm sure I'm doing something wrong, thanks for any help!

avodonosov commented 10 months ago

Works for me on linux and SBCL 2.2.9:

CL-USER> (ql:quickload :drakma)
(setf drakma:*header-stream* *standard-output*)
To load "drakma":
  Load 1 ASDF system:
    drakma
; Loading "drakma"
..................................................
[package puri]....................................
[package chipz]...................................
[package drakma]........
#<SYNONYM-STREAM :SYMBOL SWANK::*CURRENT-STANDARD-OUTPUT* {1001040153}>

CL-USER> (drakma:http-request "http://lisp.org/")
GET / HTTP/1.1
Host: lisp.org
User-Agent: Drakma/2.0.9 (SBCL 2.2.9; Linux; 5.15.0-87-generic; http://weitz.de/drakma/)
Accept: */*
Connection: close

HTTP/1.1 308 Permanent Redirect
Date: Mon, 30 Oct 2023 21:59:04 GMT
Content-Type: text/html
Content-Length: 164
Connection: close
Location: https://lisp.org

"<html>
<head><title>308 Permanent Redirect</title></head>
<body>
<center><h1>308 Permanent Redirect</h1></center>
<hr><center>nginx</center>
</body>
</html>
"
308
((:DATE . "Mon, 30 Oct 2023 21:59:04 GMT") (:CONTENT-TYPE . "text/html")
 (:CONTENT-LENGTH . "164") (:CONNECTION . "close")
 (:LOCATION . "https://lisp.org"))
#<PURI:URI http://lisp.org/>
#<FLEXI-STREAMS:FLEXI-IO-STREAM {1004E84A83}>
T
"Permanent Redirect"
kensan73 commented 10 months ago

Worked for me on MacOS!
image

3b commented 2 months ago

seems to be usocket/usocket#106, which has a workaround in the code, but I think the workaround only worked if trivial-features got loaded first. Should work more reliably with current usocket.