-const char cgi_rcs[] = "$Id: cgi.c,v 1.99 2007/08/05 13:42:22 fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.100 2007/10/17 18:40:53 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
*
* Revisions :
* $Log: cgi.c,v $
+ * Revision 1.100 2007/10/17 18:40:53 fabiankeil
+ * - Send CGI pages as HTTP/1.1 unless the client asked for HTTP/1.0.
+ * - White space fix.
+ *
* Revision 1.99 2007/08/05 13:42:22 fabiankeil
* #1763173 from Stefan Huehner: declare some more functions static.
*
else if (!strcmp(templatename, "forwarding-failed"))
{
const struct forward_spec * fwd = forward_url(csp->http, csp);
+ char *socks_type = NULL;
if (fwd == NULL)
{
log_error(LOG_LEVEL_FATAL, "gateway spec is NULL. This shouldn't happen!");
csp->error_message = strdup("Failure reason missing. Check the log file for details.");
}
if (!err) err = map(exports, "gateway", 1, fwd->gateway_host, 1);
- if (!err) err = map(exports, "forwarding-type", 1, (fwd->type == SOCKS_4) ?
- "socks4-" : "socks4a-", 1);
+
+ /*
+ * XXX: this is almost the same code as in cgi_show_url_info()
+ * and thus should be factored out and shared.
+ */
+ switch (fwd->type)
+ {
+ case SOCKS_4:
+ socks_type = "socks4-";
+ break;
+ case SOCKS_4A:
+ socks_type = "socks4a-";
+ break;
+ case SOCKS_5:
+ socks_type = "socks5-";
+ break;
+ default:
+ log_error(LOG_LEVEL_FATAL, "Unknown socks type: %d.", fwd->type);
+ }
+
+ if (!err) err = map(exports, "forwarding-type", 1, socks_type, 1);
if (!err) err = map(exports, "error-message", 1, html_encode(csp->error_message), 0);
if (!err) rsp->status = strdup("503 Forwarding failure");