summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2001-12-17 19:10:56 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2001-12-17 19:10:56 +0000
commitfaf655c5db2a10e2af0c7a95de9c70b412800ea7 (patch)
tree1638edf1a4ac33b22ea47163844db16df63ffd28 /src
parenta62834808aff30faa2aa017a73e9fb5b2e8646ac (diff)
downloadtinyproxy-faf655c5db2a10e2af0c7a95de9c70b412800ea7.tar.gz
tinyproxy-faf655c5db2a10e2af0c7a95de9c70b412800ea7.zip
Added the code to log the request when in tunnelling mode.
Diffstat (limited to 'src')
-rw-r--r--src/reqs.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/reqs.c b/src/reqs.c
index aee7b82..d0c9cde 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -1,4 +1,4 @@
-/* $Id: reqs.c,v 1.43 2001-12-17 00:11:32 rjkaes Exp $
+/* $Id: reqs.c,v 1.44 2001-12-17 19:10:56 rjkaes Exp $
*
* This is where all the work in tinyproxy is actually done. Incoming
* connections have a new thread created for them. The thread then
@@ -42,6 +42,11 @@
#define HTTP503ERROR "Internal server error."
/*
+ * Maximum length of a HTTP line
+ */
+#define HTTP_LINE_LENGTH (1024 * 16)
+
+/*
* Macro to help test if the Upstream proxy supported is compiled in and
* enabled.
*/
@@ -183,7 +188,6 @@ extract_ssl_url(const char *url, struct request_s *request)
/*
* Create a connection for HTTP connections.
*/
-#define HTTP_LINE_LENGTH (1024 * 16)
static int
establish_http_connection(struct conn_s *connptr, struct request_s *request)
{
@@ -886,6 +890,7 @@ handle_connection(int fd)
"You do not have authorization for using this service.");
goto send_error;
}
+
#ifdef TUNNEL_SUPPORT
/*
* If tunnel has been configured then redirect any connections to
@@ -894,6 +899,21 @@ handle_connection(int fd)
* - rjkaes
*/
if (config.tunnel_name && config.tunnel_port != -1) {
+ char *request_buf;
+ size_t len;
+ int pos;
+
+ request_buf = safemalloc(HTTP_LINE_LENGTH);
+ if (request_buf) {
+ len = recv(connptr->client_fd, request_buf, HTTP_LINE_LENGTH - 1, MSG_PEEK);
+ for (pos = 0; pos < len && request_buf[pos] != '\n'; pos++)
+ ;
+ request_buf[pos] = '\0';
+
+ log_message(LOG_CONN, "Request: %s", request_buf);
+
+ safefree(request_buf);
+ }
log_message(LOG_INFO, "Redirecting to %s:%d",
config.tunnel_name, config.tunnel_port);