-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Not sure if this is a documentation bug or an issue in addRoutes
The documentation specifies the invariant
snap-core/src/Snap/Internal/Http/Types.hs
Lines 462 to 470 in 0b45d71
| -- The following identity holds: | |
| -- | |
| -- > rqURI r == S.concat [ rqContextPath r | |
| -- > , rqPathInfo r | |
| -- > , let q = rqQueryString r | |
| -- > in if S.null q | |
| -- > then "" | |
| -- > else S.append "?" q | |
| -- > ] |
However, I have noticed when mounting a path via
addRoutes [("/foo/", fooHandler]that when dumping the request paths via
liftIO (print rq)
liftIO (print $ ((rqContextPath rq, rqPathInfo rq, rqQueryString rq), rqURI rq))You can see that the invariant breaks for the GET /foo HTTP/1.1 corner case:
GET /foo HTTP/1.1
accept: */*
user-agent: curl/7.58.0
host: localhost:8080
sn="localhost:8080" c=127.0.0.1:52732 s=127.0.0.1:8080 ctx=/foo/ clen=n/a
(("/foo/","",""),"/foo")
GET /foo/ HTTP/1.1
accept: */*
user-agent: curl/7.58.0
host: localhost:8080
sn="localhost:8080" c=127.0.0.1:52734 s=127.0.0.1:8080 ctx=/foo/ clen=n/a
(("/foo/","",""),"/foo/")
GET /foo// HTTP/1.1
accept: */*
user-agent: curl/7.58.0
host: localhost:8080
sn="localhost:8080" c=127.0.0.1:52736 s=127.0.0.1:8080 ctx=/foo/ clen=n/a
(("/foo/","/",""),"/foo//")
GET /foo/// HTTP/1.1
accept: */*
user-agent: curl/7.58.0
host: localhost:8080
sn="localhost:8080" c=127.0.0.1:52738 s=127.0.0.1:8080 ctx=/foo/ clen=n/a
(("/foo/","//",""),"/foo///")
Metadata
Metadata
Assignees
Labels
No labels