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

dag put and block put return different headers #4721

Closed
vmx opened this issue Feb 19, 2018 · 3 comments
Closed

dag put and block put return different headers #4721

vmx opened this issue Feb 19, 2018 · 3 comments

Comments

@vmx
Copy link
Member

vmx commented Feb 19, 2018

Version information:

go-ipfs version: 0.4.14-dev-25eeb1e25
Repo version: 6
System version: amd64/linux
Golang version: go1.9.2

Type: Bug

Description:

When using the HTTP API, a put to dag returns X-Chunked-Output: 1 in the header, while a put to block does not. Example:

$ curl --verbose -F 'data=@/home/vmx/src/pl/somedata.dag-pb' 'http://localhost:5001/api/v0/dag/put?format=dag-pb&input-enc=raw'
*   Trying ::1...
* TCP_NODELAY set
* connect to ::1 port 5001 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 5001 (#0)
> POST /api/v0/dag/put?format=dag-pb&input-enc=raw HTTP/1.1
> Host: localhost:5001
> User-Agent: curl/7.57.0
> Accept: */*
> Content-Length: 218
> Content-Type: multipart/form-data; boundary=------------------------5182c92cb3445de0
> 
< 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.14-dev
< Trailer: X-Stream-Error
< Vary: Origin
< X-Chunked-Output: 1
< Date: Mon, 19 Feb 2018 23:15:00 GMT
< Transfer-Encoding: chunked
< 
{"Cid":{"/":"Qmd7xRhW5f29QuBFtqu3oSD27iVy35NRB91XFjmKFhtgMr"}}
* Connection #0 to host localhost left intact
$ curl --verbose -F 'data=@/home/vmx/src/pl/somedata.dag-pb' 'http://localhost:5001/api/v0/block/put?format=v0&mhtype=sha2-256&mhlen=-1'
*   Trying ::1...
* TCP_NODELAY set
* connect to ::1 port 5001 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 5001 (#0)
> POST /api/v0/block/put?format=v0&mhtype=sha2-256&mhlen=-1 HTTP/1.1
> Host: localhost:5001
> User-Agent: curl/7.57.0
> Accept: */*
> Content-Length: 218
> Content-Type: multipart/form-data; boundary=------------------------f2d349cb3ff0e2f3
> 
< 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.14-dev
< Trailer: X-Stream-Error
< Vary: Origin
< Date: Mon, 19 Feb 2018 23:16:30 GMT
< Transfer-Encoding: chunked
< 
{"Key":"Qmd7xRhW5f29QuBFtqu3oSD27iVy35NRB91XFjmKFhtgMr","Size":11}
* Connection #0 to host localhost left intact
@vmx
Copy link
Member Author

vmx commented Feb 20, 2018

Please note that in the linked issue above, this header triggers a different code paths. So it should be revisited when this header should actually be set.

@vmx vmx changed the title dag put and object put return different headers dag put and block put return different headers Feb 20, 2018
@lidel
Copy link
Member

lidel commented Oct 31, 2018

cc #5711

@Stebalien
Copy link
Member

This is because block put accepts one input while dag put accepts multiple. Honestly, they should both accept multiple blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants