Skip to content

net/http: ServeMux should not cleanup requests path and redirect by default #19481

Closed
@ipostelnik

Description

@ipostelnik

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.7.3 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"

What did you do?

http.ServerMux always forces a redirect to cleaned up path (e.g. . and .. removed, empty path components removed, etc..). Specifically, removing an empty component can change the meaning of the URI. In a general case, the handlers should be able to see raw requested URI and decide how the want to handle it. FileSystem handler may want to cleanup paths in this way, but for other cases this is unexpected behavior.

What did you expect to see?

Request for /foo//bar gets redirected to /foo/bar.

What did you see instead?

Request for /foo//bar gets dispatched to the proper handler that matches this URI without cleanup.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions