Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ipfs/kubo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ffe6c8576e2d
Choose a base ref
...
head repository: ipfs/kubo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a2b0287a5f6f
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jan 20, 2016

  1. Add Server field in HTTP API

    Resolves #625
    Included in tests.
    
    License: MIT
    Signed-off-by: Jakub (Kubuxu) Sztandera <kubuxu@gmail.com>
    Kubuxu committed Jan 20, 2016

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    981b389 View commit details

Commits on Jan 22, 2016

  1. Merge pull request #2141 from Kubuxu/patch-1

    Add Server field in HTTP API response header
    jbenet committed Jan 22, 2016
    Copy the full SHA
    a2b0287 View commit details
Showing with 6 additions and 2 deletions.
  1. +4 −2 commands/http/handler.go
  2. +2 −0 test/sharness/t0230-channel-streaming-http-content-type.sh
6 changes: 4 additions & 2 deletions commands/http/handler.go
Original file line number Diff line number Diff line change
@@ -199,6 +199,10 @@ func guessMimeType(res cmds.Response) (string, error) {
}

func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req cmds.Request) {
h := w.Header()
// Expose our agent to allow identification
h.Set("Server", "go-ipfs/" + config.CurrentVersionNumber)

mime, err := guessMimeType(res)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
@@ -222,8 +226,6 @@ func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req
return
}

h := w.Header()

// Set up our potential trailer
h.Set("Trailer", StreamErrHeader)

2 changes: 2 additions & 0 deletions test/sharness/t0230-channel-streaming-http-content-type.sh
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ test_ls_cmd() {
printf "Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output\r\n" >>expected_output &&
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 "Server: go-ipfs/%s\r\n" $(ipfs version -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 &&
@@ -46,6 +47,7 @@ test_ls_cmd() {
printf "Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output\r\n" >>expected_output &&
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 "Server: go-ipfs/%s\r\n" $(ipfs version -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 &&