HTTPReadPostName Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
HTTPReadPostName Function
C
HTTP_READ_STATUS HTTPReadPostName(
    BYTE* cData, 
    WORD wLen
);
Description

Reads a name from a URL encoded string in the TCP buffer. This function is meant to be called from an HTTPExecutePost callback to facilitate easier parsing of incoming data. This function also prevents buffer overflows by forcing the programmer to indicate how many bytes are expected. At least 2 extra bytes are needed in cData over the maximum length of data expected to be read. 

This function will read until the next '=' character, which indicates the end of a name parameter. It assumes that the front of the buffer is the beginning of the name paramter to be read. 

This function properly updates curHTTP.byteCount by decrementing it by the number of bytes read. It also removes the delimiting '=' from the buffer.

Preconditions

Front of TCP buffer is the beginning of a name parameter, and the rest of the TCP buffer contains a URL-encoded string with a name parameter terminated by a '=' character.

Parameters
Parameters 
Description 
cData 
where to store the name once it is read 
wLen 
how many bytes can be written to cData 
Return Values
Return Values 
Description 
HTTP_READ_OK 
name was successfully read 
HTTP_READ_TRUNCTATED 
entire name could not fit in the buffer, so the value was truncated and data has been lost 
HTTP_READ_INCOMPLETE 
entire name was not yet in the buffer, so call this function again later to retrieve 
Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.