Repository navigation
Closed
Labels
kind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)status/deferredConscious decision to pause or backlogConscious decision to pause or backlogtopic/apiTopic apiTopic api
Description
Version information:
go-ipfs version: 0.4.5-dev-17c629d
Repo version: 4
System version: amd64/linux
Golang version: go1.7.1
Type: Bug
Priority: P4
Description:
Submitting a file via HTTP API /add endpoint only works forcing curl to use HTTP/1.0. Could be a Go's multipart issue, but I couldn't find anything related.
curl -v "http://localhost:5001/api/v0/add" -F file=@test/file1
* Trying ::1...
* connect to ::1 port 5001 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 5001 (#0)
> POST /api/v0/add HTTP/1.1
> Host: localhost:5001
> User-Agent: curl/7.46.0
> Accept: */*
> Content-Length: 199
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------4f4400ca441bcea2
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Content-Type: application/json
< Server: go-ipfs/0.4.5-dev
< Trailer: X-Stream-Error
< Vary: Origin
< X-Chunked-Output: 1
< Date: Thu, 27 Oct 2016 14:00:16 GMT
< Connection: close
< Transfer-Encoding: chunked
<
* Illegal or missing hexadecimal sequence in chunked-encoding
* Closing connection 0
curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding
The curl message is because the daemon sends back an err: multipart: NextPart: unexpected EOF and curl is expecting a chunked-encoding (this is logged by the daemon too)
In fact, curl is expecting a 100-continue response in the first place too keep sending chunks, but that is not provided. Upload works downgrading to HTTP/1.0 though:
curl -0 -v "http://localhost:5001/api/v0/add" -F file=@test/file1
* Trying ::1...
* connect to ::1 port 5001 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 5001 (#0)
> POST /api/v0/add HTTP/1.0
> Host: localhost:5001
> User-Agent: curl/7.46.0
> Accept: */*
> Content-Length: 199
> Content-Type: multipart/form-data; boundary=------------------------0df218876d338326
>
< HTTP/1.1 200 OK
< x-chunked-output: 1
< content-type: application/json; charset=utf-8
< vary: origin,accept-encoding
< cache-control: no-cache
< content-length: 73
< Date: Thu, 27 Oct 2016 14:36:25 GMT
< Connection: close
<
{"Name":"file1","Hash":"QmdytmR4wULMd3SLo6ePF4s3WcRHWcpnJZ7bHhoj3QB13v"}
* Closing connection 0
Metadata
Metadata
Assignees
Labels
kind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)status/deferredConscious decision to pause or backlogConscious decision to pause or backlogtopic/apiTopic apiTopic api
Activity
whyrusleeping commentedon Oct 28, 2016
Thats interesting... Lets look into this a bit more. Is this just a curl thing? or do other tools/libs work the same way?
hsanjuan commentedon Oct 29, 2016
So far I can say that:
I have just tried curl though.
Stebalien commentedon Sep 5, 2017
This appears to work now. Please reopen if it's still a problem.