Skip to content

net/http: StripPrefix regression from fix for #30165 #31622

Closed
@twmb

Description

@twmb

The fix for #30165 breaks code relying on the stripped prefix to elide a leading /. If code relies on equality testing of r.URL.Path after stripping a leading /path/, that code will break due to the new leading /.

I raise this only because I have a test that ensures a response cannot change; that test failed on tip.

What did you do?

https://play.golang.org/p/84ozdbcJ8dm

What did you expect to see?

=== RUN   TestPathStrip
--- PASS: TestPathStrip (0.00s)
PASS

What did you see instead?

--- FAIL: TestPathStrip (0.00s)
    junk_test.go:26: got "/foo" != exp "foo"
FAIL
exit status 1

Does this issue reproduce with the latest release (go1.12.4)?

No, tip only.

System details

go version devel +e40dffe55a Mon Apr 22 23:03:04 2019 +0000 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/twmb/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/twmb/go"
GOPROXY=""
GORACE=""
GOROOT="/home/twmb/go/go"
GOTMPDIR=""
GOTOOLDIR="/home/twmb/go/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/twmb/testing/go.mod"
GOROOT/bin/go version: go version devel +e40dffe55a Mon Apr 22 23:03:04 2019 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +e40dffe55a Mon Apr 22 23:03:04 2019 +0000
uname -sr: Linux 4.15.0-47-generic
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic
gdb --version: GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions