That does sound like a nicer interface, but it doesn't seem to work. Here's
how I'm testing (on osx and linux). This script hangs for a while and then
exits with "Error: (ssl-get-char) SSL read timed out". If I apply this patch
and swap out the close-output-port for the tcp-shutdown, the script finishes
quickly.
If the intention is to have close-output-port cause the TCP/IP "FIN", then this
patch is the wrong thing to do.
#!/usr/local/bin/csi -script
(require-extension openssl)
(define (read-all f)
(let loop ((bytes (list))
(c (read-byte f)))
(if (eof-object? c)
(list->string (map integer->char (reverse bytes)))
(loop (cons c bytes) (read-byte f)))))
(let-values (((insock outsock) (ssl-connect "www.google.com" 443)))
(write-string (string-append
"GET / HTTP/1.1\r\n"
"Host: www.google.com\r\n"
"Accept: */*\r\n"
"\r\n")
#f
outsock)
(close-output-port outsock)
;; (tcp-shutdown (ssl-port->tcp-port outsock) tcp/wr)
(display (read-all insock))
(newline))
On Wed, Jul 25, 2012 at 6:48 PM, Jim Ursetto <[email protected]> wrote:
> If you close the input or output port (e.g. with close-output-port) then the
> tcp unit will shutdown that half of the conversation. Does that not work?
> Jim
>
> On Jul 25, 2012, at 12:18, Seth Alves <[email protected]> wrote:
>
>>
>> I have some code that uses the openssl egg. I'm not able to find a way (as
>> a client) to send eof to the server. Neither the openssl egg nor the tcp
>> module provide any sort of "shutdown". The socket egg provides shutdown,
>> but the openssl egg is based on tcp.
>>
>> With this patch
>>
>> http://paste.lisp.org/display/130677
>>
>> I can do something like
>>
>> (tcp-shutdown (ssl-port->tcp-port (cadr ssl-sock)) 1)
>>
>> I cargo-culted this patch, so I wont be surprised if it has problems.
>>
>> -seth
>>
>> _______________________________________________
>> Chicken-hackers mailing list
>> [email protected]
>> https://lists.nongnu.org/mailman/listinfo/chicken-hackers
_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers