Add a getter for the HTTP referer

This commit is contained in:
Martin Willi 2010-03-09 15:03:57 +01:00
parent d12ad4748a
commit a3920abb76
2 changed files with 16 additions and 0 deletions

View File

@ -231,6 +231,14 @@ static void redirect(private_request_t *this, char *fmt, ...)
FCGX_FPrintF(this->req.out, "\n\n");
}
/**
* Implementation of request_t.get_referer.
*/
static char* get_referer(private_request_t *this)
{
return FCGX_GetParam("HTTP_REFERER", this->req.envp);
}
/**
* Implementation of request_t.to_referer.
*/
@ -396,6 +404,7 @@ request_t *request_create(int fd, bool debug)
this->public.session_closed = (bool(*)(request_t*))session_closed;
this->public.close_session = (void(*)(request_t*))close_session;
this->public.redirect = (void(*)(request_t*, char *fmt,...))redirect;
this->public.get_referer = (char*(*)(request_t*))get_referer;
this->public.to_referer = (void(*)(request_t*))to_referer;
this->public.render = (void(*)(request_t*,char*))render;
this->public.streamf = (int(*)(request_t*, char *format, ...))streamf;

View File

@ -105,6 +105,13 @@ struct request_t {
*/
void (*redirect)(request_t *this, char *fmt, ...);
/**
* Get the HTTP referer.
*
* @return HTTP referer
*/
char* (*get_referer)(request_t *this);
/**
* Redirect the client to the referer.
*/