From: Fabian Keil Date: Wed, 6 Sep 2006 13:03:04 +0000 (+0000) Subject: Respond with 400 and a short text message X-Git-Tag: v_3_0_5~84 X-Git-Url: http://www.privoxy.org/gitweb/%40user-manual%40%40actions-help-prefix%40SERVER-HEADER-FILTER?a=commitdiff_plain;h=e5d6cae5ad9f6da66a5579afa46e7aa04457a054;p=privoxy.git Respond with 400 and a short text message if the client tries to use Privoxy as FTP proxy. --- diff --git a/jcc.c b/jcc.c index aa6de6b6..6184dc33 100644 --- 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) diff --git a/project.h b/project.h index bb7ee921..d7f888cb 100644 --- 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 $ @@ -37,6 +37,12 @@ * * 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