[racket] #:headers not working with dispatch

From: Guillaume Coré (g at fridim.org)
Date: Mon Nov 18 18:40:20 EST 2013

Hi again racketers,

In doubt, I just tried on racket stable 5.3.6, same thing :

fridim at web:~$ curl -I localhost:8000   # working.rkt
HTTP/1.1 200 Okay
Date: Tue, 19 Nov 2013 03:43:57 GMT
Last-Modified: Tue, 19 Nov 2013 03:43:57 GMT
Server: Racket
Content-Type: text/html; charset=utf-8
Cache-Control: max-age=0
Transfer-Encoding: chunked

fridim at web:~$ curl -I localhost:8000  # not_working.rkt
HTTP/1.1 200 OK
Date: Tue, 19 Nov 2013 03:44:28 GMT
Last-Modified: Fri, 09 Aug 2013 22:38:27 GMT
Server: Racket
Content-Type: text/html
Accept-Ranges: bytes
Content-Length: 853

Should I go for a bug report ?

Thanks,
Guillaume

On 11/17/2013 04:37 PM, Guillaume Coré wrote:
> Hi,
> 
> Here is a simple case where #:headers works (working.rkt attached)
> 
> Now the same thing but using dispatch (not_working.rkt attached) does
> not return the header. I'm a bit lost here.
> 
> 
> I was told on IRC to try to compare the return values of both (start)
> with/without dispatch. I did but both seems to return the expected header :
> 
> (define (start request)
>   (response/xexpr (index request)
>                   #:headers (list (make-header #"Cache-Control"
> #"max-age=0"))))
> 
> (define (start2 request)
>   (response/xexpr (site-dispatch request)
>                   #:headers (list (make-header #"Cache-Control"
> #"max-age=0"))))
> 
> 
> (define (url->request u)
>     (make-request #"GET" (string->url u) empty
>                   (delay empty) #f "1.2.3.4" 80 "4.3.2.1"))
> 
> (response-headers (start (url->request "http://localhost:8000/")))
> ;-> '(#(struct:header #"Cache-Control" #"max-age=0"))
> (response-headers (start2 (url->request "http://localhost:8000/")))
> ;-> '(#(struct:header #"Cache-Control" #"max-age=0"))
> 
> I'm using v5.90.0.10
> 
> Any idea ?
> 
> Regards,
> Guillaume
> 
> 
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL: <http://lists.racket-lang.org/users/archive/attachments/20131118/aab5d4dd/attachment.sig>

Posted on the users mailing list.