Anylsite / anyledger-backend

Backend for AnyLedger Hub
1 stars 1 forks source link

Proxy to translate chunked encoding to content-length #4

Open pcppcp opened 5 years ago

pcppcp commented 5 years ago

As the Zephyr's http client doesn't support chunked encoding responses, we can't use parity as an ethereum node. But creating middleware that makes a request to Parity and fixes the headers shouldn't be difficult.

example of Parity request & response

POST / HTTP/1.1
Host: localhost:8545
User-Agent: curl/7.60.0
Accept: */*
Content-Type: application/json
Content-Length: 68

{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":987}

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 20 Oct 2018 11:07:09 GMT

73
{"jsonrpc":"2.0","result":"Parity-Ethereum//v2.0.8-stable-ef8f95e-20181015/x86_64-linux-gnu/rustc1.29.0","id":987}

0
randomshinichi commented 5 years ago

Will be useful when we want to use Infura instead of our own nodes (which is a real PITA with current ropsten fork problems)