Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

ochttp.Handler.ServeHTTP func param r * http.Request did not modify r.MultipartForm correctly #1292

Open
@voctior

Description

@voctior

Please answer these questions before submitting a bug report.

What version of OpenCensus are you using?

v0.24.0

What version of Go are you using?

go version go1.19.2 darwin/arm64

What did you do?

// ochttp
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var tags addedTags
// ----- shallow copy
r, traceEnd := h.startTrace(w, r)
defer traceEnd()
w, statsEnd := h.startStats(w, r)
defer statsEnd(&tags)
handler := h.Handler
if handler == nil {
handler = http.DefaultServeMux
}
// ----- shallow copy
r = r.WithContext(context.WithValue(r.Context(), addedTagsKey{}, &tags))
handler.ServeHTTP(w, r)
}

// std http
func (c *conn) serve(ctx context.Context){
// w.req has not change
serverHandler{c.server}.ServeHTTP(w, w.req)
w.finishRequest()
}

What did you expect to see?

w.req has changed

What did you see instead?

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions