src/__unused/t_htp_str.c
static int
t_htp_str_addbuffer( lua_State *L, struct t_htp_str *s, size_t l, int last )
{
	struct t_htp_con *c = s->con;
	struct t_htp_buf *b = malloc( sizeof( struct t_htp_buf ) );

	printf( "Add Buffer: %zu bytes\n", l );
	b->bl   = l;
	b->sl   = 0;
	b->bR   = luaL_ref( L, LUA_REGISTRYINDEX );
	b->nxt  = NULL;
	b->prv  = NULL;
	lua_pushvalue( L, 1 );
	b->sR   = luaL_ref( L, LUA_REGISTRYINDEX );
	b->last = last;

	if (NULL == c->buf_head)
	{
		c->buf_head = b;
		c->buf_tail = b;
		// wrote the first line to the buffer, can also happen if
		// current buffer is flushed but response is incomplete
		p_ael_addhandle_impl( L, c->srv->ael, c->sck->fd, T_AEL_WR );
		c->srv->ael->fdSet[ c->sck->fd ]->msk = T_AEL_RW;
	}
	else
	{
		c->buf_tail->nxt = b;
		b->prv           = c->buf_tail;
		c->buf_tail      = b;
	}
	return 1;
}
/**--------------------------------------------------------------------------
 * Add a new buffer chunk to the Linked List buffer in t_htp_con.
 * General handling of buffers within the connection.  It does expect a Lua
 * string on top of the stack which will be wrapped into a linked list element.
 * It also expects the t_htp_str element on stack position 1. If the current
 * buffer head is null, the connections socket must also be added to the
 * EventLoop for outgoing connections.
 * \param   L        The lua state.
 * \param   integer  The string length of the chunk on stack.
 * \return  int    # of values pushed onto the stack.
 * --------------------------------------------------------------------------*/
Add a new buffer chunk to the Linked List buffer in t_htp_con.
General handling of buffers within the connection.  It does expect a Lua
string on top of the stack which will be wrapped into a linked list element.
It also expects the t_htp_str element on stack position 1. If the current
buffer head is null, the connections socket must also be added to the
EventLoop for outgoing connections.
\param   L        The lua state.
\param   integer  The string length of the chunk on stack.
\return  int    # of values pushed onto the stack.
Add a new buffer chunk to the Linked List buffer in t_htp_con . General handling of buffers within the connection . It does expect a Lua string on top of the stack which will be wrapped into a linked list element . It also expects the t_htp_str element on stack position 1 . If the current buffer head is null the connections socket must also be added to the EventLoop for outgoing connections . \ param L The lua state . \ param integer The string length of the chunk on stack . \ return int # of values pushed onto the stack .
static int
t_htp_str_addbuffer( lua_State *L, struct t_htp_str *s, size_t l, int last )
{
	struct t_htp_con *c = s->con;
	struct t_htp_buf *b = malloc( sizeof( struct t_htp_buf ) );
	printf( "Add Buffer: %zu bytes\n", l );
	b->bl   = l;
	b->sl   = 0;
	b->bR   = luaL_ref( L, LUA_REGISTRYINDEX );
	b->nxt  = NULL;
	b->prv  = NULL;
	lua_pushvalue( L, 1 );
	b->sR   = luaL_ref( L, LUA_REGISTRYINDEX );
	b->last = last;
	if (NULL == c->buf_head)
	{
		c->buf_head = b;
		c->buf_tail = b;
		p_ael_addhandle_impl( L, c->srv->ael, c->sck->fd, T_AEL_WR );
		c->srv->ael->fdSet[ c->sck->fd ]->msk = T_AEL_RW;
	}
	else
	{
		c->buf_tail->nxt = b;
		b->prv           = c->buf_tail;
		c->buf_tail      = b;
	}
	return 1;
}
static int t_htp_str_addbuffer ( lua_State * L , struct t_htp_str * s , size_t l , int last ) { struct t_htp_con * c = s -> con ; struct t_htp_buf * b = malloc ( sizeof ( struct t_htp_buf ) ) ; printf ( " \n " , l ) ; b -> bl = l ; b -> sl = 0 ; b -> bR = luaL_ref ( L , LUA_REGISTRYINDEX ) ; b -> nxt = NULL ; b -> prv = NULL ; lua_pushvalue ( L , 1 ) ; b -> sR = luaL_ref ( L , LUA_REGISTRYINDEX ) ; b -> last = last ; if ( NULL == c -> buf_head ) { c -> buf_head = b ; c -> buf_tail = b ; p_ael_addhandle_impl ( L , c -> srv -> ael , c -> sck -> fd , T_AEL_WR ) ; c -> srv -> ael -> fdSet [ c -> sck -> fd ] -> msk = T_AEL_RW ; } else { c -> buf_tail -> nxt = b ; b -> prv = c -> buf_tail ; c -> buf_tail = b ; } return 1 ; }
Add a new buffer chunk to the Linked List buffer in t_htp_con.
Add a new buffer chunk to the Linked List buffer in t_htp_con .
// wrote the first line to the buffer, can also happen if // current buffer is flushed but response is incomplete