-const char cgi_rcs[] = "$Id: cgi.c,v 1.121 2009/06/11 11:46:22 fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.122 2009/06/11 11:47:16 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
rsp->status = strdup("504 Connection timeout");
rsp->reason = RSP_REASON_CONNECTION_TIMEOUT;
}
+ else if (!strcmp(templatename, "no-server-data"))
+ {
+ rsp->status = strdup("502 No data received from server or forwarder");
+ rsp->reason = RSP_REASON_NO_SERVER_DATA;
+ }
if (rsp->status == NULL)
{
-const char jcc_rcs[] = "$Id: jcc.c,v 1.254 2009/06/11 11:44:25 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.255 2009/06/11 11:46:22 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
"Connection: close\r\n\r\n"
"Bad request. Privoxy was unable to extract the destination.\r\n";
-/* XXX: should be a template */
-static const char NO_SERVER_DATA_RESPONSE[] =
- "HTTP/1.0 502 Server or forwarder response empty\r\n"
- "Proxy-Agent: Privoxy " VERSION "\r\n"
- "Content-Type: text/plain\r\n"
- "Connection: close\r\n\r\n"
- "Empty server or forwarder response.\r\n"
- "The connection has been closed but Privoxy didn't receive any data.\r\n";
-
/* XXX: should be a template */
static const char INVALID_SERVER_HEADERS_RESPONSE[] =
"HTTP/1.0 502 Server or forwarder response invalid\r\n"
{
log_error(LOG_LEVEL_ERROR, "Empty server or forwarder response.");
log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 502 0", csp->ip_addr_str, http->cmd);
- write_socket(csp->cfd, NO_SERVER_DATA_RESPONSE, strlen(NO_SERVER_DATA_RESPONSE));
+ send_crunch_response(csp, error_response(csp, "no-server-data"));
free_http_request(http);
mark_server_socket_tainted(csp);
return;
#ifndef PROJECT_H_INCLUDED
#define PROJECT_H_INCLUDED
/** Version string. */
-#define PROJECT_H_VERSION "$Id: project.h,v 1.140 2009/06/08 16:47:07 fabiankeil Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.141 2009/06/11 11:46:22 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/project.h,v $
#define RSP_REASON_OUT_OF_MEMORY 9
#define RSP_REASON_INTERNAL_ERROR 10
#define RSP_REASON_CONNECTION_TIMEOUT 11
+#define RSP_REASON_NO_SERVER_DATA 12
/**
* Response generated by CGI, blocker, or error handler
--- /dev/null
+##########################################################
+#
+# no-server-data Error Output template for Privoxy.
+#
+##########################################################
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+
+<head>
+ <title>502 - No server or forwarder data received (Privoxy@@my-hostname@)</title>
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <meta http-equiv="Content-Script-Type" content="text/javascript">
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <meta name="robots" content="noindex,nofollow">
+ <link rel="shortcut icon" href="@default-cgi@error-favicon.ico">
+ <style type="text/css">
+#include cgi-style.css
+ </style>
+</head>
+
+<body>
+
+ <table summary="" cellpadding="20" cellspacing="10" border="0" width="100%">
+ <tr>
+ <td class="status">
+ 502
+ </td>
+ <td class="title" style="width: 100%">
+
+#include mod-title
+
+ </td>
+ </tr>
+
+<!-- @if-unstable-start -->
+# This will only appear if CODE_STATUS is "alpha" or "beta". See configure.in
+ <tr>
+ <td class="warning" colspan="2">
+
+#include mod-unstable-warning
+
+ </td>
+ </tr>
+<!-- if-unstable-end@ -->
+
+ <tr>
+ <td class="warning" colspan=2>
+ <h2>No server or forwarder data received</h2>
+ <p>Your request for <a href="@protocol@@hostport@@path@"><b>@protocol@@hostport@@path@</b></a>
+ could not be fulfilled, because the connection to <b>@host@</b> (@host-ip@) has been closed
+ before Privoxy received any data for this request.
+ </p>
+ <p>This is often a temporary failure, so you might just
+ <a href="@protocol@@hostport@@path@">try again</a>.
+ </p>
+ <p>
+ If you get this message very often, consider disabling
+ <a href="@user-manual@config.html#CONNECTION-SHARING">connection-sharing</a>
+ (which should be off by default). If that doesn't help, you may have to additionally
+ disable support for connection keep-alive by setting
+ <a href="@user-manual@config.html#KEEP-ALIVE-TIMEOUT">keep-alive-timeout</a>
+ to 0.
+ </p>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="box" colspan="2">
+ <h2>More Privoxy:</h2>
+ <ul>@menu@<li><a href="@user-manual@">Documentation</a></li></ul>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="info" colspan="2">
+
+#include mod-support-and-service
+
+ </td>
+ </tr>
+
+<!-- @if-have-help-info-start -->
+ <tr>
+ <td class="info" colspan="2">
+
+#include mod-local-help
+
+ </td>
+ </tr>
+<!-- if-have-help-info-end@ -->
+
+ </table>
+
+</body>
+</html>