Add a getter for the HTTP referer
[strongswan.git] / src / libfast / request.c
index 3f4894c..0f743e3 100644 (file)
@@ -232,6 +232,14 @@ static void redirect(private_request_t *this, char *fmt, ...)
 }
 
 /**
+ * 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.
  */
 static void to_referer(private_request_t *this)
@@ -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;