Skip to content

Commit

Permalink
Handle edge case if request cannot be created
Browse files Browse the repository at this point in the history
this is due to control chars in the URL.
  • Loading branch information
daveshanley committed May 2, 2024
1 parent a2b92d0 commit 00b6c0d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion daemon/clone_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ func CloneExistingRequest(request CloneRequest) *http.Request {

var newURL string
var newReq *http.Request

newURL = ReconstructURL(request.Request, request.Protocol, request.Host, request.BasePath, request.Port)

// create cloned request
newReq, _ = http.NewRequest(request.Request.Method, newURL, io.NopCloser(bytes.NewBuffer(b)))
var err error
newReq, err = http.NewRequest(request.Request.Method, newURL, io.NopCloser(bytes.NewBuffer(b)))

if err != nil {
return nil
}

// copy headers, drop those that are specified.
for k, v := range request.Request.Header {
Expand Down

0 comments on commit 00b6c0d

Please sign in to comment.