Fix return value of http_RecvPostMessage and update httpparser.c's comments

This commit is contained in:
Peng 2013-10-28 20:21:36 +08:00 committed by Marcelo Roberto Jimenez
parent 06aa3b17c4
commit 062ac0c926
3 changed files with 52 additions and 28 deletions

View File

@ -2,6 +2,10 @@
Version 1.6.19
*******************************************************************************
2013-10-28 Peng <howtofly(at)gmail.com>
Fix return value of http_RecvPostMessage and update httpparser.c's comments
2013-10-17 Peng <howtofly(at)gmail.com>
Fix return value of process_request and related subroutines

View File

@ -138,7 +138,7 @@ static UPNP_INLINE void scanner_init(OUT scanner_t *scanner, IN membuffer *bufpt
* Parameters :
* IN char c ; character to be tested against used separator values
*
* Description : Finds the separator character.
* Description : Determines if the passed value is a separator
*
************************************************************************/
static UPNP_INLINE int is_separator_char(IN int c)
@ -152,7 +152,7 @@ static UPNP_INLINE int is_separator_char(IN int c)
* Parameters :
* IN char c ; character to be tested for separator values
*
* Description : Calls the function to indentify separator character
* Description : Determines if the passed value is permissible in token
*
************************************************************************/
static UPNP_INLINE int is_identifier_char(IN int c)
@ -180,7 +180,7 @@ static UPNP_INLINE int is_control_char(IN int c)
* Parameters :
* IN char cc ; character to be tested for CR/LF
*
* Description : Checks to see if the passed in value is CR/LF
* Description : Determines if the passed value is permissible in qdtext
*
************************************************************************/
static UPNP_INLINE int is_qdtext_char(IN int c)
@ -516,8 +516,9 @@ http_header_t *httpmsg_find_hdr(
* Description : skips blank lines at the start of a msg.
*
* Return : parse_status_t ;
*
* Note :
* PARSE_OK
* PARSE_INCOMPLETE -- not enuf chars to get a token
* PARSE_FAILURE -- bad msg format
************************************************************************/
static UPNP_INLINE parse_status_t skip_blank_lines(INOUT scanner_t *scanner)
{
@ -1127,6 +1128,7 @@ static parse_status_t vfmatch(
* PARSE_OK
* PARSE_NO_MATCH
* PARSE_INCOMPLETE
* PARSE_FAILURE - bad input
************************************************************************/
static parse_status_t match(
INOUT scanner_t *scanner,
@ -1159,6 +1161,7 @@ static parse_status_t match(
* PARSE_OK
* PARSE_NO_MATCH -- failure to match pattern 'fmt'
* PARSE_FAILURE -- 'str' is bad input
* PARSE_INCOMPLETE
************************************************************************/
parse_status_t
matchstr( IN char *str,
@ -1233,6 +1236,8 @@ parser_init( OUT http_parser_t * parser )
* PARSE_OK
* PARSE_SUCCESS
* PARSE_FAILURE
* PARSE_INCOMPLETE
* PARSE_NO_MATCH
************************************************************************/
static parse_status_t
parser_parse_requestline( INOUT http_parser_t * parser )
@ -1349,12 +1354,13 @@ parser_parse_requestline( INOUT http_parser_t * parser )
* Parameters:
* INOUT http_parser_t* parser ; HTTP Parser object
*
* Description: Get HTTP Method, URL location and version information.
* Description: Get HTTP version information, status code and status msg.
*
* Returns:
* PARSE_OK
* PARSE_SUCCESS
* PARSE_FAILURE
* PARSE_INCOMPLETE
* PARSE_NO_MATCH
************************************************************************/
parse_status_t parser_parse_responseline(INOUT http_parser_t *parser)
{
@ -1426,12 +1432,14 @@ parse_status_t parser_parse_responseline(INOUT http_parser_t *parser)
* Parameters:
* INOUT http_parser_t* parser ; HTTP Parser object
*
* Description: Get HTTP Method, URL location and version information.
* Description: Read HTTP header fields.
*
* Returns:
* PARSE_OK
* PARSE_SUCCESS
* PARSE_FAILURE
* PARSE_INCOMPLETE
* PARSE_NO_MATCH
************************************************************************/
parse_status_t parser_parse_headers(INOUT http_parser_t *parser)
{
@ -1572,7 +1580,6 @@ parse_status_t parser_parse_headers(INOUT http_parser_t *parser)
*
* Returns:
* PARSE_INCOMPLETE
* PARSE_FAILURE -- entity length > content-length value
* PARSE_SUCCESS
************************************************************************/
static UPNP_INLINE parse_status_t
@ -1619,9 +1626,10 @@ parser_parse_entity_using_clen( INOUT http_parser_t * parser )
* Description: Read data in the chunks
*
* Returns:
* PARSE_CONTINUE_1
* PARSE_INCOMPLETE
* PARSE_FAILURE -- entity length > content-length value
* PARSE_SUCCESS
* PARSE_FAILURE
* PARSE_NO_MATCH
************************************************************************/
static UPNP_INLINE parse_status_t parser_parse_chunky_body(
INOUT http_parser_t *parser)
@ -1663,8 +1671,9 @@ static UPNP_INLINE parse_status_t parser_parse_chunky_body(
* Description: Read headers at the end of the chunked entity
*
* Returns:
* PARSE_NO_MATCH
* PARSE_INCOMPLETE
* PARSE_FAILURE -- entity length > content-length value
* PARSE_FAILURE
* PARSE_SUCCESS
************************************************************************/
static UPNP_INLINE parse_status_t
@ -1699,12 +1708,12 @@ parser_parse_chunky_headers( INOUT http_parser_t * parser )
* Parameters:
* INOUT http_parser_t* parser - HTTP Parser Object
*
* Description: Read headers at the end of the chunked entity
* Description: Read entity using chunked transfer encoding
*
* Returns:
* PARSE_INCOMPLETE
* PARSE_FAILURE -- entity length > content-length value
* PARSE_SUCCESS
* PARSE_FAILURE
* PARSE_NO_MATCH
* PARSE_CONTINUE_1
************************************************************************/
static UPNP_INLINE parse_status_t
@ -1753,7 +1762,7 @@ parser_parse_chunky_entity( INOUT http_parser_t * parser )
* Parameters:
* INOUT http_parser_t* parser ; HTTP Parser object
*
* Description: Read headers at the end of the chunked entity
* Description: Keep reading entity until the connection is closed.
*
* Returns:
* PARSE_INCOMPLETE_ENTITY
@ -1790,9 +1799,9 @@ parser_parse_entity_until_close( INOUT http_parser_t * parser )
* Description: Determines method to read entity
*
* Returns:
* PARSE_OK
* PARSE_CONTINUE_1
* PARSE_FAILURE
* PARSE_COMPLETE -- no more reading to do
* PARSE_SUCCESS -- no more reading to do
************************************************************************/
UPNP_INLINE parse_status_t
parser_get_entity_read_method( INOUT http_parser_t * parser )
@ -1888,17 +1897,19 @@ parser_get_entity_read_method( INOUT http_parser_t * parser )
* Parameters:
* INOUT http_parser_t* parser ; HTTP Parser object
*
* Description: Determines method to read entity
* Description: Read HTTP entity body
*
* Returns:
* PARSE_OK
* PARSE_FAILURE
* PARSE_COMPLETE -- no more reading to do
* PARSE_NO_MATCH
* PARSE_INCOMPLETE
* PARSE_INCOMPLETE_ENTITY
* PARSE_SUCCESS -- no more reading to do
************************************************************************/
UPNP_INLINE parse_status_t
parser_parse_entity( INOUT http_parser_t * parser )
{
parse_status_t status = PARSE_OK;
parse_status_t status;
assert( parser->position == POS_ENTITY );
@ -1929,6 +1940,7 @@ parser_parse_entity( INOUT http_parser_t * parser )
break;
default:
status = PARSE_FAILURE;
assert( 0 );
}
@ -1989,7 +2001,11 @@ parser_response_init( OUT http_parser_t * parser,
* parser object the actual parsing function is invoked
*
* Returns:
* void
* PARSE_SUCCESS
* PARSE_FAILURE
* PARSE_INCOMPLETE
* PARSE_INCOMPLETE_ENTITY
* PARSE_NO_MATCH
************************************************************************/
parse_status_t
parser_parse( INOUT http_parser_t * parser )
@ -2044,11 +2060,14 @@ parser_parse( INOUT http_parser_t * parser )
* buffer
* IN size_t buf_length ; Size of the buffer
*
* Description: The parser function. Depending on the position of the
* parser object the actual parsing function is invoked
* Description: Append date to HTTP parser, and do the parsing.
*
* Returns:
* void
* PARSE_SUCCESS
* PARSE_FAILURE
* PARSE_INCOMPLETE
* PARSE_INCOMPLETE_ENTITY
* PARSE_NO_MATCH
************************************************************************/
parse_status_t
parser_append( INOUT http_parser_t * parser,

View File

@ -1338,7 +1338,8 @@ static int process_request(
* \return
* \li \c HTTP_INTERNAL_SERVER_ERROR
* \li \c HTTP_UNAUTHORIZED
* \li \c HTTP_REQUEST_RANGE_NOT_SATISFIABLE
* \li \c HTTP_BAD_REQUEST
* \li \c HTTP_SERVICE_UNAVAILABLE
* \li \c HTTP_OK
*/
static int http_RecvPostMessage(
@ -1424,7 +1425,7 @@ static int http_RecvPostMessage(
goto ExitFunction;
}
} else {
ret_code = num_read;
ret_code = HTTP_SERVICE_UNAVAILABLE;
goto ExitFunction;
}
}