[racket] Using get-pure-port

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Aug 18 18:02:49 EDT 2011

Two hours ago, Shogo Yamazaki wrote:
> Thanks for your help.
> The way you suggested worked for me.
> By the way, I found that adding a line to the definition of
> http-pipe-data in url-unit.rkt might resolve my problem either.
> But I hardly understand what I'm doing.
> (define (http-pipe-data chunked? ip op)
>   (if chunked?
>       (http-pipe-chunk ip op)
>       (begin
>         (copy-port ip op)
>         (close-input-port ip) ;### I added this line ###
>         (flush-output op)
>         (close-output-port op))))

Instead of the above, I've committed:

  (define (purify-http-port in-port)
    (define-values (in-pipe out-pipe) (make-pipe))
     (λ ()
       (define status (http-read-status in-port))
       (define chunked? (http-read-headers in-port))
       (http-pipe-data chunked? in-port out-pipe)
       (close-input-port in-port)))    ; <------------- this

instead, so it's done in a more obvious place.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.