httpc:request pipelining example and blocking problem

Yao Bao free7by@REDACTED
Sat Dec 18 02:19:59 CET 2021


It is good to see users of inets still exists even though for exercises. And
luckily, it still exists within Erlang/OTP by default.

Tried inets httpd to build a simple http server, it works fine. Someday I
might finally realize some advanced features of a modern http server
provides is essential to my application, but I prefer starting from basic/poor

For your question:
1. Haven't use inets httpc, so no advice personally.
2. If it worked with Ruby based service but not Erlang 19 based Cowboy based
service, the problem might be the communication. If the http request and response
works fine, and the process just blocks, I would guess the problem comes from the
"driver" of the inets httpc, it receives the http message, and turn it into an Erlang
message, might be the Erlang message which been putted into process's mailbox
does not match any of the designed pattern, so the "receive" expression blocks and
timed out. Or, the http driver does not send message back to the client process for
some reason.

More information about your situation would be helpful for us to find the problem:
- which version of inets httpc (and version of Erlang/OTP) do you use?
- which version of Cowboy (you mentioned Erlang 19) do you use?

The source code of inets httpc is not huge, if you want to know where exactly the
message is lost, give it a try to dig the source code.


> I'm trying to exclusively use inets httpc for some simple REST request.  Please
> do NOT suggest other Erlang HTTP clients; the exercise is to only use inets
> httpc.  The docs for the httpc client are pretty poor and online searches
> haven't helped.
> Two questions:
> 1. Does anyone have an example of using inets httpc to do pipeline requests?
> 2. I've managed a single asynchronous request to a Ruby based service which
> worked fine.  Now when I try make a request to an Erlang Cowboy based service
> (an old Erlang 19 3rd party application), the request goes through and the reply
> sent (as observed using tcpdump), but the process blocks until the timeout,
> never returning the response.
> -- 
> Anthony C Howe         	                                       SnertSoft
> achowe@REDACTED     Twitter: SirWumpus            BarricadeMX & Milters

More information about the erlang-questions mailing list