httpd: add "struct file*" parameter to httpd_cgi_handler() callback

This commit is contained in:
goldsimon 2018-02-02 09:29:52 +01:00
parent ab281cb750
commit 6706b3778e
3 changed files with 9 additions and 3 deletions

View File

@ -49,6 +49,8 @@ with newer versions.
* LWIP_HOOK_DHCP_APPEND_OPTIONS() has changed, see description in opt.h (options_out_len is not
available in struct dhcp any more)
* httpd LWIP_HTTPD_CGI_SSI: httpd_cgi_handler() has an additional parameter "struct fs_file *"
(2.0.2)
++ Application changes:

View File

@ -2304,9 +2304,9 @@ http_init_file(struct http_state *hs, struct fs_file *file, int is_09, const cha
{
count = extract_uri_parameters(hs, params);
}
httpd_cgi_handler(uri, count, http_cgi_params, http_cgi_param_vals
httpd_cgi_handler(file, uri, count, http_cgi_params, http_cgi_param_vals
#if defined(LWIP_HTTPD_FILE_STATE) && LWIP_HTTPD_FILE_STATE
, hs->handle->state
, file->state
#endif /* LWIP_HTTPD_FILE_STATE */
);
}

View File

@ -102,13 +102,17 @@ void http_set_cgi_handlers(const tCGI *pCGIs, int iNumHandlers);
#if LWIP_HTTPD_CGI || LWIP_HTTPD_CGI_SSI
#if LWIP_HTTPD_CGI_SSI
/* we have to prototype this struct here to make it available for the handler */
struct fs_file;
/** Define this generic CGI handler in your application.
* It is called once for every URI with parameters.
* The parameters can be stored to the object passed as connection_state, which
* is allocated to file->state via fs_state_init() from fs_open() or fs_open_custom().
* Content creation via SSI or complete dynamic files can retrieve the CGI params from there.
*/
extern void httpd_cgi_handler(const char* uri, int iNumParams, char **pcParam, char **pcValue
extern void httpd_cgi_handler(struct fs_file *file, const char* uri, int iNumParams,
char **pcParam, char **pcValue
#if defined(LWIP_HTTPD_FILE_STATE) && LWIP_HTTPD_FILE_STATE
, void *connection_state
#endif /* LWIP_HTTPD_FILE_STATE */