[erlang-bugs] inets HTTP stream bugs

Ingela Anderton Andin <>
Thu Mar 5 16:25:18 CET 2009

Hi Steve, thank you for the patch.

Steve Vinoski wrote:
> The following problems were found in R12B-5 by my colleague Matt
> Evans, and he created and tested the attached patches for them.
> The inets HTTP code does not handle HTTP status code 206 (Partial
> Content) responses when using streaming. Handling this is required
> when a server streams only part of a file (i.e., a range) and thus
> returns 206 rather than 200. Without this fix, on Linux the client
> would just block and eat 100% of the CPU.
This part of the patch has been accepted for R13.

> The patches also include a new feature, httpc_response:user_action/4,
> which passes HTTP status codes other than 200 or 206 back to the
> client's receive loop for handling. This allows for the handling of
> redirects, for example. This adds a user_action message to the
> existing stream_start, stream, stream_end, etc. message types the
> client can handle. Without this addition it doesn't seem possible for
> the client to fully know what the server is doing.
Humm .. I am not quite sure this is needed. If the status code is not 
200 or 206
you should get the response {http, {RequestId, Result}}
that  expands to  {http, {RequestId, {status_line(), headers(), 
body()}}, where
status_line() = {http_version(), status_code(), reason_phrase()} that 
should do the
trick.  Maybe we could add some more examples to the user guide and 
probably a
few more test cases on streaming would not be a bad idea.  All a 
question about priorities
as usual.

Regards Ingela Erlang/OTP - Ericsson

More information about the erlang-bugs mailing list