Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

rpc breaks on Transfer-Encoding: chunked #2320

Open
mxork opened this issue Feb 9, 2022 · 9 comments
Open

rpc breaks on Transfer-Encoding: chunked #2320

mxork opened this issue Feb 9, 2022 · 9 comments

Comments

@mxork
Copy link

mxork commented Feb 9, 2022

trufflesuite/ganache:v7.0.2

# network host just for convenience...
docker run -it --rm --network host trufflesuite/ganache:v7.0.2 
# not chunked - OK
curl -vv http://localhost:8545 -H "Content-Type: application/json" --data '{"id":0,"jsonrpc":"2.0","method":"eth_accounts"}'    
*   Trying 127.0.0.1:8545...
* Connected to localhost (127.0.0.1) port 8545 (#0)
> POST / HTTP/1.1
> Host: localhost:8545
> User-Agent: curl/7.80.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 48
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200
< Content-Type: application/json
< Content-Length: 485
< 
* Connection #0 to host localhost left intact
{"id":0,"jsonrpc":"2.0","result":["0x157609c1d4adbfa016b3e2e89d6948c262c55f04","0x5250d86009692dc42901f42a431e6cd619c6bb40","0x4600010d0c9bf5054882839695cf48e348e59734","0x1c874ee0c60b979d65aa2d4e2a5b369463c09804","0x91f3bff1eb3ed88a9b3978ec02ccaa393a0fba05","0x37d2cd0ac2d9e5ec3535baab860037b82d6325e9","0xf1bc0e8a716e106dd0856ee7543ab152ce83d1e4","0xcdfea7d950446c415bd66bcce7079ddc664577e2","0x90261a5cf492debd03ce1390aaabaadace4741ec","0x9ba760a678ef0e24f25f4804a08424cb8ea262aa"]}
# chunked - BAD
curl -vv http://localhost:8545 -H "Content-Type: application/json" -H "Transfer-Encoding: chunked" --data '{"id":0,"jsonrpc":"2.0","method":"eth_accounts"}'    
*   Trying 127.0.0.1:8545...
* Connected to localhost (127.0.0.1) port 8545 (#0)
> POST / HTTP/1.1
> Host: localhost:8545
> User-Agent: curl/7.80.0
> Accept: */*
> Content-Type: application/json
> Transfer-Encoding: chunked
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 400
< Content-Type: text/plain
< Content-Length: 45
< 
* Connection #0 to host localhost left intact
400 Bad Request: Unexpected end of JSON input
@davidmurdoch
Copy link
Member

related: uNetworking/uWebSockets.js#669

@davidmurdoch
Copy link
Member

I'm able to reproduce. I'm curious what your use case is, do you mind sharing?

@mxork
Copy link
Author

mxork commented Feb 9, 2022

No legitimate use case here; I'm using an http/1.1 client library which uselessly opts into using Transfer-Encoding: chunked. I think its fair to say the issue is on the library's side.

Feel free to close.

@davidmurdoch
Copy link
Member

Interesting. Ganache should support it so we'll leave it open, thanks!

@mxork
Copy link
Author

mxork commented Feb 10, 2022

Related issue: the http server is emitting an invalid HTTP/1.1 status line, eg.:

HTTP/1.1 400

The RFC is quite clear, however (https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1):

        Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF

The Reason-Phrase is allowed to be an empty string, but the separating space is not optional.

I'm unsure whether to open another issue for this, or if https://github.com/uNetworking/uWebSockets.js is where the buck stops.

@davidmurdoch
Copy link
Member

We should probably just send back the reason string ourselves, though uWS.js might appreciate an Issue on their side too.

@davidmurdoch davidmurdoch moved this to Inbox in Ganache Jul 19, 2022
@davidmurdoch davidmurdoch moved this from Inbox to Backlog in Ganache Jul 19, 2022
@MicaiahReid
Copy link
Contributor

Closing as won't fix because it doesn't look like uNetworking/uWebSockets.js#669 will get fixed.

Repository owner moved this from Backlog to Done in Ganache Jul 21, 2022
@davidmurdoch davidmurdoch closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2022
@uNetworkingAB
Copy link

I'm planning on fixing this. Did not know anyone wanted it fixed.

@davidmurdoch davidmurdoch reopened this Oct 6, 2022
@uNetworkingAB
Copy link

Fixed, will be part of next release

@davidmurdoch davidmurdoch moved this from Done to Backlog in Ganache Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

4 participants