Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate Transfer-Encoding header #2229

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions commands/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
channelHeader = "X-Chunked-Output"
uaHeader = "User-Agent"
contentTypeHeader = "Content-Type"
contentLengthHeader = "Content-Length"
contentLengthHeader = "X-Content-Length"
contentDispHeader = "Content-Disposition"
transferEncodingHeader = "Transfer-Encoding"
applicationJson = "application/json"
Expand Down Expand Up @@ -255,7 +255,6 @@ func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req
}

h.Set(contentTypeHeader, mime)
h.Set(transferEncodingHeader, "chunked")

// set 'allowed' headers
h.Set("Access-Control-Allow-Headers", "X-Stream-Output, X-Chunked-Output")
Expand Down
6 changes: 6 additions & 0 deletions test/sharness/t0060-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ test_expect_success "'ipfs config Identity.PeerID' works" '
PEERID=$(ipfs config Identity.PeerID)
'

# see https://github.com/ipfs/go-ipfs/issues/2190
test_expect_success "test for duplicate Transfer-Encoding Header" '
curl -v -i http://localhost:5001/api/v0/version 2> curl_output &&
test $(grep -c "Transfer-Encoding" curl_output) -eq 1
'

test_expect_success "'ipfs swarm addrs local' works" '
ipfs swarm addrs local >local_addrs
'
Expand Down
2 changes: 0 additions & 2 deletions test/sharness/t0230-channel-streaming-http-content-type.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ test_ls_cmd() {
printf "Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output\r\n" >>expected_output &&
printf "Content-Type: text/plain\r\n" >>expected_output &&
printf "Trailer: X-Stream-Error\r\n" >>expected_output &&
printf "Transfer-Encoding: chunked\r\n" >>expected_output &&
printf "X-Chunked-Output: 1\r\n" >>expected_output &&
printf "Transfer-Encoding: chunked\r\n" >>expected_output &&
printf "\r\n" >>expected_output &&
Expand All @@ -47,7 +46,6 @@ test_ls_cmd() {
printf "Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output\r\n" >>expected_output &&
printf "Content-Type: application/json\r\n" >>expected_output &&
printf "Trailer: X-Stream-Error\r\n" >>expected_output &&
printf "Transfer-Encoding: chunked\r\n" >>expected_output &&
printf "X-Chunked-Output: 1\r\n" >>expected_output &&
printf "Transfer-Encoding: chunked\r\n" >>expected_output &&
printf "\r\n" >>expected_output &&
Expand Down