src/__unused/t_htp_str.c
static int
lt_htp_str_finish( lua_State *L )
{
	struct t_htp_str *s = t_htp_str_check_ud( L, 1, 1 );
	size_t            sz;  /// length of optional string handed in
	char             *b;
	size_t            c   = 0;
	luaL_Buffer       lB;

	// the first action ever called on the stream, prep header first
	if (T_HTP_STR_SEND != s->state)
	{
		luaL_checklstring( L, 2, &sz );
		luaL_buffinit( L, &lB );
		c = t_htp_str_formHeader( L, &lB, s, 200, NULL, (int) sz, 0 );
		lua_pushvalue( L, 2 );
		luaL_addvalue( &lB );
		luaL_pushresult( &lB );
		t_htp_str_addbuffer( L, s, lB.n, 1 );
	}
	else
	{
		if (LUA_TSTRING == lua_type( L, 2 ))
		{
			luaL_checklstring( L, 2, &sz );
			if (! s->rsCl)   // chunked
			{
				luaL_buffinit( L, &lB );
				b = luaL_prepbuffer( &lB );
				c = sprintf( b, "%zx\r\n", sz );
				luaL_addsize( &lB, c );
				lua_pushvalue( L, 2 );
				luaL_addvalue( &lB );
				luaL_addlstring( &lB, "\r\n0\r\n\r\n", 7 );
				luaL_pushresult( &lB );
				t_htp_str_addbuffer( L, s, lB.n, 1 );
			}
			else
			{
				lua_pushvalue( L, 2 );
				t_htp_str_addbuffer( L, s, sz, 1 );
			}
		}
		else
		{
			if (! s->rsCl)   // chunked
			{
				lua_pushstring( L, "0\r\n\r\n" );
				t_htp_str_addbuffer( L, s, 5, 1 );
			}
		}
	}
	/*if ( 0 == s->obc )
	{
		if ( ! s->kpAlv)
		{
			lua_pushcfunction( L, lt_htp_str__gc );
			lua_pushvalue( L, 1 );
			lua_call( L, 1, 0 );
		}
		else
			s->state = T_htp_str_S_ZERO;
	}
	*/

	s->state = T_HTP_STR_FINISH;

	return 0;
}
/**--------------------------------------------------------------------------
 * Finish of sending the T.Http.Message response.
 * \param   L    The lua state.
 * \lparam  Http.Message instance.
 * \lparam  string.
 * \return  int    # of values pushed onto the stack.
 * --------------------------------------------------------------------------*/
Finish of sending the T.Http.Message response.
\param   L    The lua state.
Finish of sending the T . Http . Message response . \ param L The lua state .
static int
lt_htp_str_finish( lua_State *L )
{
	struct t_htp_str *s = t_htp_str_check_ud( L, 1, 1 );
	size_t            sz;  
	char             *b;
	size_t            c   = 0;
	luaL_Buffer       lB;
	if (T_HTP_STR_SEND != s->state)
	{
		luaL_checklstring( L, 2, &sz );
		luaL_buffinit( L, &lB );
		c = t_htp_str_formHeader( L, &lB, s, 200, NULL, (int) sz, 0 );
		lua_pushvalue( L, 2 );
		luaL_addvalue( &lB );
		luaL_pushresult( &lB );
		t_htp_str_addbuffer( L, s, lB.n, 1 );
	}
	else
	{
		if (LUA_TSTRING == lua_type( L, 2 ))
		{
			luaL_checklstring( L, 2, &sz );
			if (! s->rsCl)   
			{
				luaL_buffinit( L, &lB );
				b = luaL_prepbuffer( &lB );
				c = sprintf( b, "%zx\r\n", sz );
				luaL_addsize( &lB, c );
				lua_pushvalue( L, 2 );
				luaL_addvalue( &lB );
				luaL_addlstring( &lB, "\r\n0\r\n\r\n", 7 );
				luaL_pushresult( &lB );
				t_htp_str_addbuffer( L, s, lB.n, 1 );
			}
			else
			{
				lua_pushvalue( L, 2 );
				t_htp_str_addbuffer( L, s, sz, 1 );
			}
		}
		else
		{
			if (! s->rsCl)   
			{
				lua_pushstring( L, "0\r\n\r\n" );
				t_htp_str_addbuffer( L, s, 5, 1 );
			}
		}
	}
	s->state = T_HTP_STR_FINISH;
	return 0;
}
static int lt_htp_str_finish ( lua_State * L ) { struct t_htp_str * s = t_htp_str_check_ud ( L , 1 , 1 ) ; size_t sz ; char * b ; size_t c = 0 ; luaL_Buffer lB ; if ( T_HTP_STR_SEND != s -> state ) { luaL_checklstring ( L , 2 , & sz ) ; luaL_buffinit ( L , & lB ) ; c = t_htp_str_formHeader ( L , & lB , s , 200 , NULL , ( int ) sz , 0 ) ; lua_pushvalue ( L , 2 ) ; luaL_addvalue ( & lB ) ; luaL_pushresult ( & lB ) ; t_htp_str_addbuffer ( L , s , lB . n , 1 ) ; } else { if ( LUA_TSTRING == lua_type ( L , 2 ) ) { luaL_checklstring ( L , 2 , & sz ) ; if ( ! s -> rsCl ) { luaL_buffinit ( L , & lB ) ; b = luaL_prepbuffer ( & lB ) ; c = sprintf ( b , " \r \n " , sz ) ; luaL_addsize ( & lB , c ) ; lua_pushvalue ( L , 2 ) ; luaL_addvalue ( & lB ) ; luaL_addlstring ( & lB , " \r \n \r \n \r \n " , 7 ) ; luaL_pushresult ( & lB ) ; t_htp_str_addbuffer ( L , s , lB . n , 1 ) ; } else { lua_pushvalue ( L , 2 ) ; t_htp_str_addbuffer ( L , s , sz , 1 ) ; } } else { if ( ! s -> rsCl ) { lua_pushstring ( L , " \r \n \r \n " ) ; t_htp_str_addbuffer ( L , s , 5 , 1 ) ; } } } s -> state = T_HTP_STR_FINISH ; return 0 ; }
Finish of sending the T.Http.Message response.
Finish of sending the T . Http . Message response .
/// length of optional string handed in // the first action ever called on the stream, prep header first // chunked // chunked /*if ( 0 == s->obc )
	{
		if ( ! s->kpAlv)
		{
			lua_pushcfunction( L, lt_htp_str__gc );
			lua_pushvalue( L, 1 );
			lua_call( L, 1, 0 );
		}
		else
			s->state = T_htp_str_S_ZERO;
	}
	*/