summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-07-05 11:01:17 -0400
committerNick Mathewson <nickm@torproject.org>2017-07-05 11:01:17 -0400
commit03b6cfd5911740471eac13e82f678fe50b4d18f9 (patch)
tree5cd63faf6300191195ef3f7359f91b982240119f /src/or/control.c
parent6595f55020e4a73e2ccf7e87dcea4c1f0362f4aa (diff)
downloadtor-03b6cfd5911740471eac13e82f678fe50b4d18f9.tar.gz
tor-03b6cfd5911740471eac13e82f678fe50b4d18f9.zip
Extract "not an HTTP proxy" messages.
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/or/control.c b/src/or/control.c
index ee9a3ae29b..20a0b0b89e 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -4888,6 +4888,32 @@ peek_connection_has_http_command(connection_t *conn)
return peek_buf_has_http_command(conn->inbuf);
}
+const char CONTROLPORT_IS_NOT_AN_HTTP_PROXY_MSG[] =
+ "HTTP/1.0 501 Tor ControlPort is not an HTTP proxy"
+ "\r\nContent-Type: text/html; charset=iso-8859-1\r\n\r\n"
+ "<html>\n"
+ "<head>\n"
+ "<title>Tor's ControlPort is not an HTTP proxy</title>\n"
+ "</head>\n"
+ "<body>\n"
+ "<h1>Tor's ControlPort is not an HTTP proxy</h1>\n"
+ "<p>\n"
+ "It appears you have configured your web browser to use Tor's control port"
+ " as an HTTP proxy.\n"
+ "This is not correct: Tor's default SOCKS proxy port is 9050.\n"
+ "Please configure your client accordingly.\n"
+ "</p>\n"
+ "<p>\n"
+ "See <a href=\"https://www.torproject.org/documentation.html\">"
+ "https://www.torproject.org/documentation.html</a> for more "
+ "information.\n"
+ "<!-- Plus this comment, to make the body response more than 512 bytes, so "
+ " IE will be willing to display it. Comment comment comment comment "
+ " comment comment comment comment comment comment comment comment.-->\n"
+ "</p>\n"
+ "</body>\n"
+ "</html>\n";
+
/** Called when data has arrived on a v1 control connection: Try to fetch
* commands from conn->inbuf, and execute them.
*/
@@ -4930,30 +4956,7 @@ connection_control_process_inbuf(control_connection_t *conn)
/* If the user has the HTTP proxy port and the control port confused. */
if (conn->base_.state == CONTROL_CONN_STATE_NEEDAUTH &&
peek_connection_has_http_command(TO_CONN(conn))) {
- connection_write_str_to_buf("HTTP/1.0 501 Tor ControlPort is not a proxy"
-"\r\nContent-Type: text/html; charset=iso-8859-1\r\n\r\n"
-"<html>\n"
-"<head>\n"
-"<title>Tor's ControlPort is not proxy</title>\n"
-"</head>\n"
-"<body>\n"
-"<h1>Tor's ControlPort is not a proxy</h1>\n"
-"<p>\n"
-"It appears you have configured your web browser to use Tor's control port"
-" as an HTTP proxy.\n"
-"This is not correct: Tor's default SOCKS proxy port is 9050.\n"
-"Please configure your client accordingly.\n"
-"</p>\n"
-"<p>\n"
-"See <a href=\"https://www.torproject.org/documentation.html\">"
- "https://www.torproject.org/documentation.html</a> for more "
- "information.\n"
-"<!-- Plus this comment, to make the body response more than 512 bytes, so "
-" IE will be willing to display it. Comment comment comment comment "
-" comment comment comment comment comment comment comment comment.-->\n"
-"</p>\n"
-"</body>\n"
-"</html>\n", conn);
+ connection_write_str_to_buf(CONTROLPORT_IS_NOT_AN_HTTP_PROXY_MSG, conn);
log_notice(LD_CONTROL, "Received HTTP request on ControlPort");
connection_mark_and_flush(TO_CONN(conn));
return 0;