HttpBodyParser.h File Reference
#include "HttpCommon.h"
#include "HttpRequest.h"
Include dependency graph for HttpBodyParser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

using HttpBodyParserDelegate = Delegate< size_t(HttpRequest &request, const char *at, int length)>
 Body parser callback delegate. More...
 
using BodyParsers = HashMap< String, HttpBodyParserDelegate >
 Maps body parsers to a specific content type. More...
 

Functions

size_t formUrlParser (HttpRequest &request, const char *at, int length)
 Parses application/x-www-form-urlencoded body data. More...
 
size_t bodyToStringParser (HttpRequest &request, const char *at, int length)
 Stores the complete body into memory. More...
 

Variables

const int PARSE_DATASTART = -1
 special length values passed to parse functions More...
 
const int PARSE_DATAEND = -2
 End of incoming data. More...
 

Typedef Documentation

◆ BodyParsers

Maps body parsers to a specific content type.

◆ HttpBodyParserDelegate

using HttpBodyParserDelegate = Delegate<size_t(HttpRequest& request, const char* at, int length)>

Body parser callback delegate.

Parameters
request
at
lengthNegative lengths have special meanings
See also
PARSE_DATASTART
PARSE_DATAEND
Returns
parsed bytes

Function Documentation

◆ bodyToStringParser()

size_t bodyToStringParser ( HttpRequest request,
const char *  at,
int  length 
)

Stores the complete body into memory.

See also
HttpBodyParserDelegate
Note
The content later can be retrieved by calling request.getBody()

◆ formUrlParser()

size_t formUrlParser ( HttpRequest request,
const char *  at,
int  length 
)

Parses application/x-www-form-urlencoded body data.

See also
HttpBodyParserDelegate

Variable Documentation

◆ PARSE_DATAEND

const int PARSE_DATAEND = -2

End of incoming data.

◆ PARSE_DATASTART

const int PARSE_DATASTART = -1

special length values passed to parse functions

{ Start of incoming data