aboutsummaryrefslogtreecommitdiffstats
path: root/src/manager/lib/request.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2007-10-19 19:40:53 +0000
committerMartin Willi <martin@strongswan.org>2007-10-19 19:40:53 +0000
commit0e0e7d5b712e6839e1ee930d9cad27bf16d6fce1 (patch)
tree6bf8555861a5d2763ab1b68d65d5e44b5447100c /src/manager/lib/request.c
parentb82e823141dcf0992eace4c6da6008872516ca42 (diff)
downloadstrongswan-0e0e7d5b712e6839e1ee930d9cad27bf16d6fce1.tar.bz2
strongswan-0e0e7d5b712e6839e1ee930d9cad27bf16d6fce1.tar.xz
request_t.redirect takes variable argument list
request_t.serve to serve non-template data fixed dispatcher thread locking code
Diffstat (limited to 'src/manager/lib/request.c')
-rw-r--r--src/manager/lib/request.c25
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;