Add error number as a template parameter for error pages

This commit is contained in:
Mukund Sivaraman 2008-07-14 15:31:14 +05:30
parent 8b26558254
commit 7f12f71f94
3 changed files with 16 additions and 10 deletions

View File

@ -4,15 +4,15 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <head>
<title>{cause}</title> <title>{errno} {cause}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head> </head>
<body> <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> <p>Here are the error variables:</p>

View File

@ -4,15 +4,15 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <head>
<title>{cause}</title> <title>{errno} {cause}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head> </head>
<body> <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 /> <hr />

View File

@ -248,20 +248,26 @@ add_error_variable(struct conn_s *connptr, char *key, char *val)
int int
add_standard_vars(struct conn_s *connptr) add_standard_vars(struct conn_s *connptr)
{ {
char errnobuf[16];
char timebuf[30]; 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", snprintf(errnobuf, sizeof errnobuf, "%d", connptr->error_number);
gmtime(&global_time)); ADD_VAR_RET("errno", errnobuf);
ADD_VAR_RET("request", connptr->request_line);
ADD_VAR_RET("cause", connptr->error_string); 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("clientip", connptr->client_ip_addr);
ADD_VAR_RET("clienthost", connptr->client_string_addr); ADD_VAR_RET("clienthost", connptr->client_string_addr);
ADD_VAR_RET("version", VERSION); ADD_VAR_RET("version", VERSION);
ADD_VAR_RET("package", PACKAGE); ADD_VAR_RET("package", PACKAGE);
ADD_VAR_RET("website", "http://tinyproxy.banu.com/"); 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); ADD_VAR_RET("date", timebuf);
return (0); return (0);
} }