X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7c2aa951ed9e7d0010fd58d59dc1e98c9d5e2800..2ea729f97166cb5fda4a6ca0818f0a0ab15388ab:/lib/controller/federation.go?ds=sidebyside diff --git a/lib/controller/federation.go b/lib/controller/federation.go index 1a0b78be2b..557c7c3563 100644 --- a/lib/controller/federation.go +++ b/lib/controller/federation.go @@ -11,6 +11,7 @@ import ( "fmt" "io" "io/ioutil" + "mime" "net/http" "net/url" "regexp" @@ -61,7 +62,11 @@ func (h *Handler) remoteClusterRequest(remoteID string, req *http.Request) (*htt // downstream proxy steps. func loadParamsFromForm(req *http.Request) error { var postBody *bytes.Buffer - if req.Body != nil && req.Header.Get("Content-Type") == "application/x-www-form-urlencoded" { + if ct := req.Header.Get("Content-Type"); ct == "" { + // Assume application/octet-stream, i.e., no form to parse. + } else if ct, _, err := mime.ParseMediaType(ct); err != nil { + return err + } else if ct == "application/x-www-form-urlencoded" && req.Body != nil { var cl int64 if req.ContentLength > 0 { cl = req.ContentLength