diff options
Diffstat (limited to 'src/manager/lib/request.c')
-rw-r--r-- | src/manager/lib/request.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/manager/lib/request.c b/src/manager/lib/request.c index 4623b3860..2e18bded5 100644 --- a/src/manager/lib/request.c +++ b/src/manager/lib/request.c @@ -179,12 +179,18 @@ static void add_cookie(private_request_t *this, char *name, char *value) /** * Implementation of request_t.redirect. */ -static void redirect(private_request_t *this, char *location) +static void redirect(private_request_t *this, char *fmt, ...) { + va_list args; + FCGX_FPrintF(this->req->out, "Status: 303 See Other\n"); - FCGX_FPrintF(this->req->out, "Location: %s%s%s\n\n", + FCGX_FPrintF(this->req->out, "Location: %s%s", FCGX_GetParam("SCRIPT_NAME", this->req->envp), - *location == '/' ? "" : "/", location); + *fmt == '/' ? "" : "/"); + va_start(args, fmt); + FCGX_VFPrintF(this->req->out, fmt, args); + va_end(args); + FCGX_FPrintF(this->req->out, "\n\n"); } /** @@ -196,6 +202,16 @@ static char* get_base(private_request_t *this) } /** + * Implementation of request_t.serve. + */ +static void serve(private_request_t *this, char *headers, chunk_t chunk) +{ + FCGX_FPrintF(this->req->out, "%s\n\n", headers); + + FCGX_PutStr(chunk.ptr, chunk.len, this->req->out); +} + +/** * Implementation of request_t.render. */ static void render(private_request_t *this, char *template) @@ -254,8 +270,9 @@ request_t *request_create(FCGX_Request *request, bool debug) this->public.add_cookie = (void(*)(request_t*, char *name, char *value))add_cookie; this->public.get_cookie = (char*(*)(request_t*,char*))get_cookie; this->public.get_query_data = (char*(*)(request_t*, char *name))get_query_data; - this->public.redirect = (void(*)(request_t*, char *location))redirect; + this->public.redirect = (void(*)(request_t*, char *fmt,...))redirect; this->public.render = (void(*)(request_t*,char*))render; + this->public.serve = (void(*)(request_t*,char*,chunk_t))serve; this->public.set = (void(*)(request_t*, char *, char*))set; this->public.setf = (void(*)(request_t*, char *format, ...))setf; this->public.destroy = (void(*)(request_t*))destroy; |