io.sockets.secure.unix: fix socket shutdown handling to make http.client work with https://www.google.com
parent
cc06c4e51f
commit
4270c6cce6
|
@ -1,4 +1,4 @@
|
||||||
! Copyright (C) 2007, 2010, Slava Pestov, Elie CHAFTARI.
|
! Copyright (C) 2007, 2011, Slava Pestov, Elie CHAFTARI.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors unix byte-arrays kernel sequences namespaces
|
USING: accessors unix byte-arrays kernel sequences namespaces
|
||||||
math math.order combinators init alien alien.c-types
|
math math.order combinators init alien alien.c-types
|
||||||
|
@ -15,14 +15,18 @@ M: openssl ssl-supported? t ;
|
||||||
|
|
||||||
M: ssl-handle handle-fd file>> handle-fd ;
|
M: ssl-handle handle-fd file>> handle-fd ;
|
||||||
|
|
||||||
: syscall-error ( r -- * )
|
: syscall-error ( handle r -- event )
|
||||||
ERR_get_error dup zero? [
|
nip
|
||||||
drop
|
ERR_get_error [
|
||||||
{
|
{
|
||||||
{ -1 [ errno ECONNRESET = [ premature-close ] [ (io-error) ] if ] }
|
{ -1 [ errno ECONNRESET = [ premature-close ] [ (io-error) ] if ] }
|
||||||
{ 0 [ premature-close ] }
|
! OpenSSL docs say this it is an error condition for
|
||||||
|
! a server to not send a close notify, but web
|
||||||
|
! servers in the wild don't seem to do this, for
|
||||||
|
! example https://www.google.com.
|
||||||
|
{ 0 [ f ] }
|
||||||
} case
|
} case
|
||||||
] [ nip (ssl-error) ] if ;
|
] [ nip (ssl-error) ] if-zero ;
|
||||||
|
|
||||||
: check-accept-response ( handle r -- event )
|
: check-accept-response ( handle r -- event )
|
||||||
over handle>> over SSL_get_error
|
over handle>> over SSL_get_error
|
||||||
|
|
Loading…
Reference in New Issue