Omit the version number from headers and HTML responses (#543)
Omit the version number from headers, HTML responses, and templates
This commit is contained in:
parent
72b93f6d4b
commit
d652ed8538
@ -30,9 +30,6 @@
|
|||||||
<dt>clienthost</dt>
|
<dt>clienthost</dt>
|
||||||
<dd>{clienthost}</dd>
|
<dd>{clienthost}</dd>
|
||||||
|
|
||||||
<dt>version</dt>
|
|
||||||
<dd>{version}</dd>
|
|
||||||
|
|
||||||
<dt>package</dt>
|
<dt>package</dt>
|
||||||
<dd>{package}</dd>
|
<dd>{package}</dd>
|
||||||
|
|
||||||
@ -49,7 +46,7 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<p><em>Generated by <a href="{website}">{package}</a> version {version}.</em></p>
|
<p><em>Generated by <a href="{website}">{package}</a>.</em></p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<p><em>Generated by <a href="{website}">{package}</a> version {version}.</em></p>
|
<p><em>Generated by <a href="{website}">{package}</a>.</em></p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Stats [{package} v{version}]</title>
|
<title>Stats [{package}]</title>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
@ -62,7 +62,7 @@
|
|||||||
<div id="inner">
|
<div id="inner">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">{package} v{version} statistics</th>
|
<th colspan="2">{package} statistics</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td class="right">Open connections</td>
|
<td class="right">Open connections</td>
|
||||||
|
@ -140,14 +140,14 @@ int send_http_headers (
|
|||||||
{
|
{
|
||||||
const char headers[] =
|
const char headers[] =
|
||||||
"HTTP/1.%u %d %s\r\n"
|
"HTTP/1.%u %d %s\r\n"
|
||||||
"Server: %s/%s\r\n"
|
"Server: %s\r\n"
|
||||||
"Content-Type: text/html\r\n"
|
"Content-Type: text/html\r\n"
|
||||||
"%s"
|
"%s"
|
||||||
"Connection: close\r\n" "\r\n";
|
"Connection: close\r\n" "\r\n";
|
||||||
|
|
||||||
return (write_message (connptr->client_fd, headers,
|
return (write_message (connptr->client_fd, headers,
|
||||||
connptr->protocol.major != 1 ? 0 : connptr->protocol.minor,
|
connptr->protocol.major != 1 ? 0 : connptr->protocol.minor,
|
||||||
code, message, PACKAGE, VERSION,
|
code, message, PACKAGE,
|
||||||
extra));
|
extra));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ int send_http_error_message (struct conn_s *connptr)
|
|||||||
"<h1>%s</h1>\n"
|
"<h1>%s</h1>\n"
|
||||||
"<p>%s</p>\n"
|
"<p>%s</p>\n"
|
||||||
"<hr />\n"
|
"<hr />\n"
|
||||||
"<p><em>Generated by %s version %s.</em></p>\n" "</body>\n"
|
"<p><em>Generated by %s.</em></p>\n" "</body>\n"
|
||||||
"</html>\n";
|
"</html>\n";
|
||||||
|
|
||||||
const char p_auth_str[] =
|
const char p_auth_str[] =
|
||||||
@ -199,7 +199,7 @@ int send_http_error_message (struct conn_s *connptr)
|
|||||||
connptr->error_number,
|
connptr->error_number,
|
||||||
connptr->error_string,
|
connptr->error_string,
|
||||||
connptr->error_string,
|
connptr->error_string,
|
||||||
detail, PACKAGE, VERSION));
|
detail, PACKAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = send_html_file (infile, connptr);
|
ret = send_html_file (infile, connptr);
|
||||||
|
11
src/reqs.c
11
src/reqs.c
@ -308,7 +308,7 @@ static int send_connect_method_response (struct conn_s *connptr)
|
|||||||
{
|
{
|
||||||
return write_message (connptr->client_fd,
|
return write_message (connptr->client_fd,
|
||||||
"HTTP/1.%u 200 Connection established\r\n"
|
"HTTP/1.%u 200 Connection established\r\n"
|
||||||
"Proxy-agent: " PACKAGE "/" VERSION "\r\n"
|
"Proxy-agent: " PACKAGE "\r\n"
|
||||||
"\r\n", connptr->protocol.major != 1 ? 0 :
|
"\r\n", connptr->protocol.major != 1 ? 0 :
|
||||||
connptr->protocol.minor);
|
connptr->protocol.minor);
|
||||||
}
|
}
|
||||||
@ -881,15 +881,14 @@ write_via_header (int fd, orderedmap hashofheaders,
|
|||||||
data = orderedmap_find (hashofheaders, "via");
|
data = orderedmap_find (hashofheaders, "via");
|
||||||
if (data) {
|
if (data) {
|
||||||
ret = write_message (fd,
|
ret = write_message (fd,
|
||||||
"Via: %s, %hu.%hu %s (%s/%s)\r\n",
|
"Via: %s, %hu.%hu %s (%s)\r\n",
|
||||||
data, major, minor, hostname, PACKAGE,
|
data, major, minor, hostname, PACKAGE);
|
||||||
VERSION);
|
|
||||||
|
|
||||||
orderedmap_remove (hashofheaders, "via");
|
orderedmap_remove (hashofheaders, "via");
|
||||||
} else {
|
} else {
|
||||||
ret = write_message (fd,
|
ret = write_message (fd,
|
||||||
"Via: %hu.%hu %s (%s/%s)\r\n",
|
"Via: %hu.%hu %s (%s)\r\n",
|
||||||
major, minor, hostname, PACKAGE, VERSION);
|
major, minor, hostname, PACKAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
10
src/stats.c
10
src/stats.c
@ -87,9 +87,9 @@ err_minus_one:
|
|||||||
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
|
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
|
||||||
"\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
|
"\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
|
||||||
"<html>\n"
|
"<html>\n"
|
||||||
"<head><title>%s version %s run-time statistics</title></head>\n"
|
"<head><title>%s run-time statistics</title></head>\n"
|
||||||
"<body>\n"
|
"<body>\n"
|
||||||
"<h1>%s version %s run-time statistics</h1>\n"
|
"<h1>%s run-time statistics</h1>\n"
|
||||||
"<p>\n"
|
"<p>\n"
|
||||||
"Number of open connections: %lu<br />\n"
|
"Number of open connections: %lu<br />\n"
|
||||||
"Number of requests: %lu<br />\n"
|
"Number of requests: %lu<br />\n"
|
||||||
@ -98,13 +98,13 @@ err_minus_one:
|
|||||||
"Number of refused connections due to high load: %lu\n"
|
"Number of refused connections due to high load: %lu\n"
|
||||||
"</p>\n"
|
"</p>\n"
|
||||||
"<hr />\n"
|
"<hr />\n"
|
||||||
"<p><em>Generated by %s version %s.</em></p>\n" "</body>\n"
|
"<p><em>Generated by %s.</em></p>\n" "</body>\n"
|
||||||
"</html>\n",
|
"</html>\n",
|
||||||
PACKAGE, VERSION, PACKAGE, VERSION,
|
PACKAGE, PACKAGE,
|
||||||
stats->num_open,
|
stats->num_open,
|
||||||
stats->num_reqs,
|
stats->num_reqs,
|
||||||
stats->num_badcons, stats->num_denied,
|
stats->num_badcons, stats->num_denied,
|
||||||
stats->num_refused, PACKAGE, VERSION);
|
stats->num_refused, PACKAGE);
|
||||||
|
|
||||||
if (send_http_message (connptr, 200, "OK",
|
if (send_http_message (connptr, 200, "OK",
|
||||||
message_buffer) < 0) {
|
message_buffer) < 0) {
|
||||||
|
@ -39,7 +39,7 @@ send_http_message (struct conn_s *connptr, int http_code,
|
|||||||
const char *error_title, const char *message)
|
const char *error_title, const char *message)
|
||||||
{
|
{
|
||||||
static const char *headers[] = {
|
static const char *headers[] = {
|
||||||
"Server: " PACKAGE "/" VERSION,
|
"Server: " PACKAGE,
|
||||||
"Content-type: text/html",
|
"Content-type: text/html",
|
||||||
"Connection: close"
|
"Connection: close"
|
||||||
};
|
};
|
||||||
|
@ -26,9 +26,8 @@ use Pod::Usage;
|
|||||||
|
|
||||||
my $EOL = "\015\012";
|
my $EOL = "\015\012";
|
||||||
|
|
||||||
my $VERSION = "0.1";
|
|
||||||
my $NAME = "Tinyproxy-Web-Client";
|
my $NAME = "Tinyproxy-Web-Client";
|
||||||
my $user_agent = "$NAME/$VERSION";
|
my $user_agent = "$NAME";
|
||||||
my $user_agent_header = "User-Agent: $user_agent$EOL";
|
my $user_agent_header = "User-Agent: $user_agent$EOL";
|
||||||
my $http_version = "1.0";
|
my $http_version = "1.0";
|
||||||
my $method = "GET";
|
my $method = "GET";
|
||||||
|
@ -31,9 +31,8 @@ use Getopt::Long;
|
|||||||
use Pod::Usage;
|
use Pod::Usage;
|
||||||
use Fcntl ':flock'; # import LOCK_* constants
|
use Fcntl ':flock'; # import LOCK_* constants
|
||||||
|
|
||||||
my $VERSION = "0.1";
|
|
||||||
my $NAME = "Tinyproxy-Test-Web-Server";
|
my $NAME = "Tinyproxy-Test-Web-Server";
|
||||||
my $server_header = "Server: $NAME/$VERSION";
|
my $server_header = "Server: $NAME";
|
||||||
|
|
||||||
my $EOL = "\015\012";
|
my $EOL = "\015\012";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user