Rtos API example

Embed: (wiki syntax)

« Back to documentation index

httpd.h File Reference

httpd.h File Reference

HTTP server. More...

Go to the source code of this file.

Functions

void httpd_cgi_handler (const char *uri, int iNumParams, char **pcParam, char **pcValue#if defined(LWIP_HTTPD_FILE_STATE)&&LWIP_HTTPD_FILE_STATE, void *connection_state#endif)
 Define this generic CGI handler in your application.
void http_set_ssi_handler (tSSIHandler pfnSSIHandler, const char **ppcTags, int iNumTags)
 Set the SSI handler function (if LWIP_HTTPD_SSI_RAW==1, only the first argument is used)
err_t httpd_post_begin (void *connection, const char *uri, const char *http_request, u16_t http_request_len, int content_len, char *response_uri, u16_t response_uri_len, u8_t *post_auto_wnd)
 Called when a POST request has been received.
err_t httpd_post_receive_data (void *connection, struct pbuf *p)
 Called for each pbuf of data that has been received for a POST.
void httpd_post_finished (void *connection, char *response_uri, u16_t response_uri_len)
 Called when all data is received or when the connection is closed.

Detailed Description

HTTP server.

Definition in file httpd.h.


Function Documentation

void http_set_ssi_handler ( tSSIHandler  pfnSSIHandler,
const char **  ppcTags,
int  iNumTags 
)

Set the SSI handler function (if LWIP_HTTPD_SSI_RAW==1, only the first argument is used)

void httpd_cgi_handler ( const char *  uri,
int  iNumParams,
char **  pcParam,
char **pcValue#if defined(LWIP_HTTPD_FILE_STATE)&&  LWIP_HTTPD_FILE_STATE,
void *connection_state#  endif 
)

Define this generic CGI handler in your application.

It is called once for every URI with parameters. The parameters can be stored to

err_t httpd_post_begin ( void *  connection,
const char *  uri,
const char *  http_request,
u16_t  http_request_len,
int  content_len,
char *  response_uri,
u16_t  response_uri_len,
u8_t *  post_auto_wnd 
)

Called when a POST request has been received.

The application can decide whether to accept it or not.

Parameters:
connectionUnique connection identifier, valid until httpd_post_end is called.
uriThe HTTP header URI receiving the POST request.
http_requestThe raw HTTP request (the first packet, normally).
http_request_lenSize of 'http_request'.
content_lenContent-Length from HTTP header.
response_uriFilename of response file, to be filled when denying the request
response_uri_lenSize of the 'response_uri' buffer.
post_auto_wndSet this to 0 to let the callback code handle window updates by calling 'httpd_post_data_recved' (to throttle rx speed) default is 1 (httpd handles window updates automatically)
Returns:
ERR_OK: Accept the POST request, data may be passed in another err_t: Deny the POST request, send back 'bad request'.
void httpd_post_finished ( void *  connection,
char *  response_uri,
u16_t  response_uri_len 
)

Called when all data is received or when the connection is closed.

The application must return the filename/URI of a file to send in response to this POST request. If the response_uri buffer is untouched, a 404 response is returned.

Parameters:
connectionUnique connection identifier.
response_uriFilename of response file, to be filled when denying the request
response_uri_lenSize of the 'response_uri' buffer.
err_t httpd_post_receive_data ( void *  connection,
struct pbuf p 
)

Called for each pbuf of data that has been received for a POST.

ATTENTION: The application is responsible for freeing the pbufs passed in!

Parameters:
connectionUnique connection identifier.
pReceived data.
Returns:
ERR_OK: Data accepted. another err_t: Data denied, http_post_get_response_uri will be called.