Remove to_referer() method, as it fails if no referer was given

This commit is contained in:
Martin Willi
2010-04-07 15:36:22 +02:00
parent f7c32feec0
commit 54e354f2d6
2 changed files with 10 additions and 29 deletions
+10 -24
View File
@@ -203,15 +203,21 @@ static char* get_query_data(private_request_t *this, char *name)
return hdf_get_valuef(this->hdf, "Query.%s", name); return hdf_get_valuef(this->hdf, "Query.%s", name);
} }
/**
* Implementation of request_t.get_base.
*/
static char* get_base(private_request_t *this)
{
return FCGX_GetParam("SCRIPT_NAME", this->req.envp);
}
/** /**
* Implementation of request_t.add_cookie. * Implementation of request_t.add_cookie.
*/ */
static void add_cookie(private_request_t *this, char *name, char *value) static void add_cookie(private_request_t *this, char *name, char *value)
{ {
thread_this->set(thread_this, this); thread_this->set(thread_this, this);
cgi_cookie_set (this->cgi, name, value, cgi_cookie_set (this->cgi, name, value, get_base(this), NULL, NULL, 0, 0);
FCGX_GetParam("SCRIPT_NAME", this->req.envp),
NULL, NULL, 0, 0);
} }
/** /**
@@ -222,8 +228,7 @@ static void redirect(private_request_t *this, char *fmt, ...)
va_list args; va_list args;
FCGX_FPrintF(this->req.out, "Status: 303 See Other\n"); FCGX_FPrintF(this->req.out, "Status: 303 See Other\n");
FCGX_FPrintF(this->req.out, "Location: %s%s", FCGX_FPrintF(this->req.out, "Location: %s%s", get_base(this),
FCGX_GetParam("SCRIPT_NAME", this->req.envp),
*fmt == '/' ? "" : "/"); *fmt == '/' ? "" : "/");
va_start(args, fmt); va_start(args, fmt);
FCGX_VFPrintF(this->req.out, fmt, args); FCGX_VFPrintF(this->req.out, fmt, args);
@@ -239,24 +244,6 @@ static char* get_referer(private_request_t *this)
return FCGX_GetParam("HTTP_REFERER", this->req.envp); return FCGX_GetParam("HTTP_REFERER", this->req.envp);
} }
/**
* Implementation of request_t.to_referer.
*/
static void to_referer(private_request_t *this)
{
FCGX_FPrintF(this->req.out, "Status: 303 See Other\n");
FCGX_FPrintF(this->req.out, "Location: %s\n\n",
FCGX_GetParam("HTTP_REFERER", this->req.envp));
}
/**
* Implementation of request_t.get_base.
*/
static char* get_base(private_request_t *this)
{
return FCGX_GetParam("SCRIPT_NAME", this->req.envp);
}
/** /**
* Implementation of request_t.session_closed. * Implementation of request_t.session_closed.
*/ */
@@ -405,7 +392,6 @@ request_t *request_create(int fd, bool debug)
this->public.close_session = (void(*)(request_t*))close_session; this->public.close_session = (void(*)(request_t*))close_session;
this->public.redirect = (void(*)(request_t*, char *fmt,...))redirect; this->public.redirect = (void(*)(request_t*, char *fmt,...))redirect;
this->public.get_referer = (char*(*)(request_t*))get_referer; 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.render = (void(*)(request_t*,char*))render;
this->public.streamf = (int(*)(request_t*, char *format, ...))streamf; this->public.streamf = (int(*)(request_t*, char *format, ...))streamf;
this->public.serve = (void(*)(request_t*,char*,chunk_t))serve; this->public.serve = (void(*)(request_t*,char*,chunk_t))serve;
-5
View File
@@ -112,11 +112,6 @@ struct request_t {
*/ */
char* (*get_referer)(request_t *this); char* (*get_referer)(request_t *this);
/**
* Redirect the client to the referer.
*/
void (*to_referer)(request_t *this);
/** /**
* Set a template value. * Set a template value.
* *