tink_http icon indicating copy to clipboard operation
tink_http copied to clipboard

Chunked responses

Open back2dos opened this issue 8 years ago • 7 comments

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 ;)

back2dos avatar May 24 '16 09:05 back2dos

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

kevinresol avatar May 28 '17 16:05 kevinresol

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).

back2dos avatar May 28 '17 17:05 back2dos

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

bablukid avatar Dec 04 '19 19:12 bablukid

Wait, Why are both these issues closed?

0b1kn00b avatar Apr 23 '20 12:04 0b1kn00b

Which ones? ^^

back2dos avatar Apr 23 '20 15:04 back2dos

Regarding SocketClient not supporting chunked responses. Got bogged down with the Chunked implementation thus far.

0b1kn00b avatar Apr 25 '20 08:04 0b1kn00b

chunked encoding is not implemented in the SocketClient right now, and this issue is an umbrella covering that and all other chunk-related things.

kevinresol avatar Apr 25 '20 08:04 kevinresol