Skip to content

Instantly share code, notes, and snippets.

@yamasushi
Created July 20, 2012 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamasushi/3153651 to your computer and use it in GitHub Desktop.
Save yamasushi/3153651 to your computer and use it in GitHub Desktop.
http-getから入力ポートをつくりだすための試験場
(use rfc.http)
(define (dump-receiver)
(lambda (code hdrs total retr)
#?= code
#?= hdrs
(let loop [ ]
(receive (port size) (retr)
#?= port
#?= size
(cond
[ (eqv? size 0) #t]
[ (or (not size) (> size 0) )
(debug-print (read-block size port))
(loop) ])))))
(define (main args)
(debug-print (http-get "www.google.com" "/"
:receiver (dump-receiver) ) ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment