Re: [Chicken-users] md5 egg documentation wrong
On Dec 15, 2011, at 10:16 AM, obscurolocon...@googlemail.com wrote: > The documentation for the md5 egg states: > >> Any Scheme-object can be the SOURCE for a digest. > > But that seems to be wrong: It is wrong, or at least incomplete, without the sentence below it in the doc: "See [[message-digest]] for more information." Misleading in any case. The "Message Digest" doc section "Common Argument Definitions" has a discussion of the interpretation of the "SOURCE" argument. Only something that can easily be massaged into a byte-vector is supported. Using the 'message-digest-chunk-converter' & the "s11n" egg 'serialize' (to a string port) it should be possible to get a digest of a cons cell. (Be nice if blob-ports existed.) Example: #;1> (use s11n ports) #;2> (call-with-output-string (cut serialize '(1 . 2) <>)) "\x05\x02\x00\x00\x00\x00\x00\x00\x03\x03\x03\x00\x00\x00\x00\x00\x00\x00\x03\x05\x00\x00\x00\x00\x00\x00\x00" So: (message-digest-chunk-converter (lambda (obj) (call-with-output-string (cut serialize obj <> should be enough. Sorry, Kon > >> (md5-digest (cons 1 2)) > > Error: (message-digest-update-object) indigestible object: (1 . 2) > > ___ > Chicken-users mailing list > Chicken-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] with-input-from-request does not close SSL socket
On Wed, Dec 14, 2011 at 08:15:30PM +0100, obscurolocon...@googlemail.com wrote: > 2011/12/14 Peter Bex : > > > > Hm, that ought to work. Perhaps there's a bug in the openssl egg. > > Yes it is a openssl problem. > > I was able to solve the problem by replacing http-client with the > following code: > [snip] > > Without explicitly closing the two ports, I got the same socket leaking. That's normal for any socket, even for regular tcp sockets. You have to close both ends before the underlying connection is closed. This also exactly what http-client is doing when you call the close-connection! procedure. Have you checked that there's no trailing data? I believe ssax:xml->sxml reads only until the closing tag of the root node. Maybe there's a newline or a space following that which is not consumed, and hence the socket stays open until you clear out all data. If you are still having trouble, please post a full example including the URI that's doing this. I can't reproduce this with for example (with-input-from-request "https://bitbucket.org"; #f read-lines) This immediately closes the socket (I guess bitbucket prefers HTTP/1.0 or uses Connection: close, I didn't bother to check). (with-input-from-request "https://github.com"; #f read-lines) This server seems to keep around the connection for a while via HTTP/1.1 but as soon as I run (close-connection! (uri-reference "https://github.com";)) the socket disappears from /proc/PID/fd. Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] md5 egg documentation wrong
The documentation for the md5 egg states: > Any Scheme-object can be the SOURCE for a digest. But that seems to be wrong: > (md5-digest (cons 1 2)) Error: (message-digest-update-object) indigestible object: (1 . 2) ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users