tink_http
tink_http copied to clipboard
Chunked responses
This came up in #18.
To my understanding, this could be implemented as a function of type OutgoingResponse->OutgoingResponse
. If the argument already has a Content-Length
it would be returned as is, otherwise a new response would be constructed that uses chunked encoding. The tricky bit is in writing the IdealSource->IdealSource
transformation for the body.
Not sure when I'll get around to do this. Volunteers are welcome. Or let me know if this becomes a pressing issue ;)
was trying to implement OutgoingResponse.chunked()
. It turns out that nodejs uses chunked encoding by default, meaning that one doesn't need to set content-length nor transfer-encoding header. Simply write()
to the ServerResponse object and end()
it, nodejs will take care of the rest (adda transfer-encoding: chunked
header and sends body in chunked style).
So if we transform the body into "chunked style" and send through nodejs, it will be shown "as-is" on the receiver side.
So I mean this should probably be handled at container level
So I mean this should probably be handled at container level
Yes and no. First, there should be a standalone functionality that is of type IncomingRequestHeader->OutgoingReponse->OutgoingResponse
that is able to fix a response so that makes sure the content-length
, transfer-encoding
and connection
headers fit with one another and what the client supports (e.g. support for chunked responses must be announced by the client IIRC, otherwise connection: closed must be used).
same problem here, tink_http ( PHP7 target ) throws the same error when acessing Google Geocoding API ( i.e "https://maps.googleapis.com/maps/api/geocode/json?address=Place%20de%20l%27%C3%A9toile%20Paris" )
Error#500: Chunked encoding is not supported and the content-length header is required. @ tink.http.clients.SocketClient.request:74
Wait, Why are both these issues closed?
Which ones? ^^
Regarding SocketClient
not supporting chunked responses. Got bogged down with the Chunked implementation thus far.
chunked encoding is not implemented in the SocketClient right now, and this issue is an umbrella covering that and all other chunk-related things.