vapor/vapor

Double slash in URLs still breaks route matching with variable parts in vapor 4.92.0

weissi opened this issue · 2 comments

Consider this route

app.get(":variable", "fixed") { request in
    return "ok \(#line)"
}

this should work fine for http://127.0.0.1:8080/testTeam/fixed as well as http://127.0.0.1:8080//testTeam/fixed. Unfortunately, it doesn't work for http://127.0.0.1:8080//testTeam/fixed.

Actual:

$ curl http://127.0.0.1:8080/testTeam/fixed
ok 82
$ curl http://127.0.0.1:8080/testTeam//fixed
ok 82
$ curl http://127.0.0.1:8080//testTeam/fixed
{"reason":"Not Found","error":true}
$ curl http://127.0.0.1:8080//testTeam//fixed
{"error":true,"reason":"Not Found"}

Expected:

all printing ok 82.

Version:

vapor 4.92.0

@weissi Can you show the output when invoking curl with -v so I can see what actual request is being sent?

vlm commented

@gwynne

> curl -v http://127.0.0.1:8080//testTeam//fixed
*   Trying 127.0.0.1:8080...
* Connected to 127.0.0.1 (127.0.0.1) port 8080
> GET //testTeam//fixed HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/8.4.0
> Accept: */*