All incoming data by default. May be set to -1 to get a maximum of data.
:returns: a string containing the data found or nil.
+.. js:function:: HTTPMessage.closed(http_msg)
+
+ This function returns true if the input of the HTTP message **http_msg** is
+ closed, meaning the underlying channel will not receive data anymore, either
+ because the end of the stream was reached or an error was detected. When
+ called by a filter, the result is relative to the data visible by this
+ filter: if an earlier filter holds back some data, the function always
+ returns false, even if the input is closed, because the held data may still
+ be exposed to the current filter.
+
+ Unlike :js:func:`HTTPMessage.eom()`, which relies on the message framing,
+ this function returns true even if the end of the message was never reached.
+ For instance, if a truncated request is received, the input is closed but no
+ end of message was reported.
+
+ :param class_httpmessage http_msg: The manipulated HTTP message.
+ :returns: a boolean
+
.. js:function:: HTTPMessage.eom(http_msg)
This function returns true if the end of message is reached for the HTTP
return 1;
}
+/* Returns true if the HTTP message is closed */
+__LJMP static int hlua_http_msg_is_closed(lua_State *L)
+{
+ struct http_msg *msg;
+ struct htx *htx;
+ int closed;
+
+ MAY_LJMP(check_args(L, 1, "closed"));
+ msg = MAY_LJMP(hlua_checkhttpmsg(L, 1));
+ htx = htxbuf(&msg->chn->buf);
+ closed = hlua_http_msg_fully_visible(L, msg, htx) && channel_input_closed(msg->chn);
+ lua_pushboolean(L, closed);
+ return 1;
+}
+
/* Returns true if the HTTP message EOM was received */
__LJMP static int hlua_http_msg_is_eom(lua_State *L)
{
hlua_class_function(L, "set_body_len",hlua_http_msg_set_body_len);
hlua_class_function(L, "is_full", hlua_http_msg_is_full);
hlua_class_function(L, "may_recv", hlua_http_msg_may_recv);
+ hlua_class_function(L, "closed", hlua_http_msg_is_closed);
hlua_class_function(L, "eom", hlua_http_msg_is_eom);
hlua_class_function(L, "input", hlua_http_msg_get_in_len);
hlua_class_function(L, "output", hlua_http_msg_get_out_len);