Respond with 400 and a short text message
authorFabian Keil <fk@fabiankeil.de>
Wed, 6 Sep 2006 13:03:04 +0000 (13:03 +0000)
committerFabian Keil <fk@fabiankeil.de>
Wed, 6 Sep 2006 13:03:04 +0000 (13:03 +0000)
if the client tries to use Privoxy as FTP proxy.

jcc.c
project.h

diff --git a/jcc.c b/jcc.c
index aa6de6b..6184dc3 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.100 2006/09/03 19:42:59 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.101 2006/09/06 09:23:37 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -33,6 +33,11 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.100 2006/09/03 19:42:59 fabiankeil Exp $"
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.101  2006/09/06 09:23:37  fabiankeil
+ *    Make number of retries in case of forwarded-connect problems
+ *    a config file option (forwarded-connect-retries) and use 0 as
+ *    default.
+ *
  *    Revision 1.100  2006/09/03 19:42:59  fabiankeil
  *    Set random(3) seed.
  *
@@ -992,6 +997,18 @@ static void chat(struct client_state *csp)
       return;
    }
 
+   if (!strncmpic(http->cmd, "GET ftp://", 10))
+   {
+      strcpy(buf, FTP_RESPONSE);
+      write_socket(csp->cfd, buf, strlen(buf));
+
+      log_error(LOG_LEVEL_ERROR, "%s tried to use Privoxy as FTP proxy: %s",
+         csp->ip_addr_str, http->cmd);
+
+      free_http_request(http);
+      return;
+   }
+
    /* decide how to route the HTTP request */
 
    if ((fwd = forward_url(http, csp)) == NULL)
index bb7ee92..d7f888c 100644 (file)
--- a/project.h
+++ b/project.h
@@ -1,7 +1,7 @@
 #ifndef PROJECT_H_INCLUDED
 #define PROJECT_H_INCLUDED
 /** Version string. */
-#define PROJECT_H_VERSION "$Id: project.h,v 1.79 2006/09/06 09:23:37 fabiankeil Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.80 2006/09/06 10:43:32 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/project.h,v $
  *
  * Revisions   :
  *    $Log: project.h,v $
+ *    Revision 1.80  2006/09/06 10:43:32  fabiankeil
+ *    Added config option enable-remote-http-toggle
+ *    to specify if Privoxy should recognize special
+ *    headers (currently only X-Filter) to change its
+ *    behaviour. Disabled by default.
+ *
  *    Revision 1.79  2006/09/06 09:23:37  fabiankeil
  *    Make number of retries in case of forwarded-connect problems
  *    a config file option (forwarded-connect-retries) and use 0 as
@@ -1577,6 +1583,10 @@ static const char CHEADER[] =
 static const char CFORBIDDEN[] =
    "HTTP/1.0 403 Connection not allowable\r\nX-Hint: If you read this message interactively, then you know why this happens ,-)\r\n\r\n";
 
+static const char FTP_RESPONSE[] =
+   "HTTP/1.0 400 Invalid header received from browser\r\n\r\nPrivoxy doesn't support FTP. Please fix your setup.";
+
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif