summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@banu.com>2008-07-14 15:31:14 +0530
committerMukund Sivaraman <muks@banu.com>2008-07-14 15:31:14 +0530
commit7f12f71f94fd0f29a00f0e4d2b2cd09247cb0908 (patch)
treec1f552e80b95bee946d6b615cde337a772b2bbff
parent8b265582542d288fb5ff1bbda9b4d3e967c171dd (diff)
downloadtinyproxy-7f12f71f94fd0f29a00f0e4d2b2cd09247cb0908.tar.gz
tinyproxy-7f12f71f94fd0f29a00f0e4d2b2cd09247cb0908.zip
Add error number as a template parameter for error pages
-rw-r--r--doc/debug.html6
-rw-r--r--doc/default.html6
-rw-r--r--src/html-error.c14
3 files changed, 16 insertions, 10 deletions
diff --git a/doc/debug.html b/doc/debug.html
index 72d89c9..6ee3367 100644
--- a/doc/debug.html
+++ b/doc/debug.html
@@ -4,15 +4,15 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
-<title>{cause}</title>
+<title>{errno} {cause}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
-<h1>HTTP proxy error</h1>
+<h1>{cause}</h1>
-<p>The following error has occured at the HTTP proxy: {detail}</p>
+<p>{detail}</p>
<p>Here are the error variables:</p>
diff --git a/doc/default.html b/doc/default.html
index 0245254..67354b7 100644
--- a/doc/default.html
+++ b/doc/default.html
@@ -4,15 +4,15 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
-<title>{cause}</title>
+<title>{errno} {cause}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
-<h1>HTTP proxy error</h1>
+<h1>{cause}</h1>
-<p>The following error has occured at the HTTP proxy: {detail}</p>
+<p>{detail}</p>
<hr />
diff --git a/src/html-error.c b/src/html-error.c
index 6f4fd9e..860e424 100644
--- a/src/html-error.c
+++ b/src/html-error.c
@@ -248,20 +248,26 @@ add_error_variable(struct conn_s *connptr, char *key, char *val)
int
add_standard_vars(struct conn_s *connptr)
{
+ char errnobuf[16];
char timebuf[30];
- time_t global_time = time(NULL);
+ time_t global_time;
- strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S GMT",
- gmtime(&global_time));
+ snprintf(errnobuf, sizeof errnobuf, "%d", connptr->error_number);
+ ADD_VAR_RET("errno", errnobuf);
- ADD_VAR_RET("request", connptr->request_line);
ADD_VAR_RET("cause", connptr->error_string);
+ ADD_VAR_RET("request", connptr->request_line);
ADD_VAR_RET("clientip", connptr->client_ip_addr);
ADD_VAR_RET("clienthost", connptr->client_string_addr);
ADD_VAR_RET("version", VERSION);
ADD_VAR_RET("package", PACKAGE);
ADD_VAR_RET("website", "http://tinyproxy.banu.com/");
+
+ global_time = time(NULL);
+ strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S GMT",
+ gmtime(&global_time));
ADD_VAR_RET("date", timebuf);
+
return (0);
}