Since the HTTP applet uses its own buffers, it only waits for the input
buffer to be allocated before parsing the request, so it may run on an
empty buffer and crash on BUG_ON() when it is woken up before the request
was transferred, e.g. when the stream yields after the applet creation.
Let's wait for some input data instead, as the other HTTP applets do.
This was introduced by commit
48df877da ("MEDIUM: hlua: Update the http
applet to use its own buffers") in 3.3-dev4, so it must be backported to
3.3.
int app_idx = 1 - hlua->nargs; /* index of the HTTP applet object in the lua stask */
inbuf = applet_get_inbuf(ctx);
- if (!inbuf) {
+ if (!inbuf || !applet_htx_input_data(ctx)) {
applet_need_more_data(ctx);
yield = 1;
goto out;