upnp/src/genlib/miniserver/miniserver.c
static void handle_request(
	/*! [in] Request Message to be handled. */
	void *args)
{
	SOCKINFO info;
	int http_error_code;
	int ret_code;
	int major = 1;
	int minor = 1;
	http_parser_t parser;
	http_message_t *hmsg = NULL;
	int timeout = HTTP_DEFAULT_TIMEOUT;
	struct mserv_request_t *request = (struct mserv_request_t *)args;
	SOCKET connfd = request->connfd;

	UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
		"miniserver %d: READING\n", connfd );
	/* parser_request_init( &parser ); */ /* LEAK_FIX_MK */
	hmsg = &parser.msg;
	ret_code = sock_init_with_ip(
		&info, connfd, (struct sockaddr *)&request->foreign_sockaddr);
	if (ret_code != UPNP_E_SUCCESS) {
		free(request);
		httpmsg_destroy(hmsg);
		return;
	}
	/* read */
	ret_code = http_RecvMessage(
		&info, &parser, HTTPMETHOD_UNKNOWN, &timeout, &http_error_code);
	if (ret_code != 0) {
		goto error_handler;
	}
	UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__,
		"miniserver %d: PROCESSING...\n", connfd);
	/* dispatch */
	http_error_code = dispatch_request(&info, &parser);
	if (http_error_code != 0) {
		goto error_handler;
	}
	http_error_code = 0;

error_handler:
	if (http_error_code > 0) {
		if (hmsg) {
			major = hmsg->major_version;
			minor = hmsg->minor_version;
		}
		handle_error(&info, http_error_code, major, minor);
	}
	sock_destroy(&info, SD_BOTH);
	httpmsg_destroy(hmsg);
	free(request);

	UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__,
		"miniserver %d: COMPLETE\n", connfd);
}
/*!
 * \brief Receive the request and dispatch it for handling.
 */
\brief Receive the request and dispatch it for handling.
\ brief Receive the request and dispatch it for handling .
static void handle_request(
	void *args)
{
	SOCKINFO info;
	int http_error_code;
	int ret_code;
	int major = 1;
	int minor = 1;
	http_parser_t parser;
	http_message_t *hmsg = NULL;
	int timeout = HTTP_DEFAULT_TIMEOUT;
	struct mserv_request_t *request = (struct mserv_request_t *)args;
	SOCKET connfd = request->connfd;
	UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
		"miniserver %d: READING\n", connfd );
	hmsg = &parser.msg;
	ret_code = sock_init_with_ip(
		&info, connfd, (struct sockaddr *)&request->foreign_sockaddr);
	if (ret_code != UPNP_E_SUCCESS) {
		free(request);
		httpmsg_destroy(hmsg);
		return;
	}
	ret_code = http_RecvMessage(
		&info, &parser, HTTPMETHOD_UNKNOWN, &timeout, &http_error_code);
	if (ret_code != 0) {
		goto error_handler;
	}
	UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__,
		"miniserver %d: PROCESSING...\n", connfd);
	http_error_code = dispatch_request(&info, &parser);
	if (http_error_code != 0) {
		goto error_handler;
	}
	http_error_code = 0;
error_handler:
	if (http_error_code > 0) {
		if (hmsg) {
			major = hmsg->major_version;
			minor = hmsg->minor_version;
		}
		handle_error(&info, http_error_code, major, minor);
	}
	sock_destroy(&info, SD_BOTH);
	httpmsg_destroy(hmsg);
	free(request);
	UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__,
		"miniserver %d: COMPLETE\n", connfd);
}
static void handle_request ( void * args ) { SOCKINFO info ; int http_error_code ; int ret_code ; int major = 1 ; int minor = 1 ; http_parser_t parser ; http_message_t * hmsg = NULL ; int timeout = HTTP_DEFAULT_TIMEOUT ; struct mserv_request_t * request = ( struct mserv_request_t * ) args ; SOCKET connfd = request -> connfd ; UpnpPrintf ( UPNP_INFO , MSERV , __FILE__ , __LINE__ , " \n " , connfd ) ; hmsg = & parser . msg ; ret_code = sock_init_with_ip ( & info , connfd , ( struct sockaddr * ) & request -> foreign_sockaddr ) ; if ( ret_code != UPNP_E_SUCCESS ) { free ( request ) ; httpmsg_destroy ( hmsg ) ; return ; } ret_code = http_RecvMessage ( & info , & parser , HTTPMETHOD_UNKNOWN , & timeout , & http_error_code ) ; if ( ret_code != 0 ) { goto error_handler ; } UpnpPrintf ( UPNP_INFO , MSERV , __FILE__ , __LINE__ , " \n " , connfd ) ; http_error_code = dispatch_request ( & info , & parser ) ; if ( http_error_code != 0 ) { goto error_handler ; } http_error_code = 0 ; error_handler : if ( http_error_code > 0 ) { if ( hmsg ) { major = hmsg -> major_version ; minor = hmsg -> minor_version ; } handle_error ( & info , http_error_code , major , minor ) ; } sock_destroy ( & info , SD_BOTH ) ; httpmsg_destroy ( hmsg ) ; free ( request ) ; UpnpPrintf ( UPNP_INFO , MSERV , __FILE__ , __LINE__ , " \n " , connfd ) ; }
\brief Receive the request and dispatch it for handling.
\ brief Receive the request and dispatch it for handling .
/*! [in] Request Message to be handled. */ /* parser_request_init( &parser ); */ /* LEAK_FIX_MK */ /* read */ /* dispatch */