+ /*
+ * If it's a FTP or gopher request, we don't support it.
+ *
+ * These checks are better than nothing, but they might
+ * not work in all configurations and some clients might
+ * have problems digesting the answer.
+ *
+ * They should, however, never cause more problems than
+ * Privoxy's old behaviour (returning the misleading HTML error message:
+ * "Could not resolve http://(ftp|gopher)://example.org").
+ */
+ if (!strncmpic(req, "GET ftp://", 10) || !strncmpic(req, "GET gopher://", 13))
+ {
+ if (!strncmpic(req, "GET ftp://", 10))
+ {
+ strcpy(buf, FTP_RESPONSE);
+ log_error(LOG_LEVEL_ERROR, "%s tried to use Privoxy as FTP proxy: %s",
+ csp->ip_addr_str, req);
+ }
+ else
+ {
+ strcpy(buf, GOPHER_RESPONSE);
+ log_error(LOG_LEVEL_ERROR, "%s tried to use Privoxy as gopher proxy: %s",
+ csp->ip_addr_str, req);
+ }
+ log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 400 0", csp->ip_addr_str, req);
+ freez(req);
+ write_socket(csp->cfd, buf, strlen(buf));
+ free_http_request(http);
+ return;
+ }
+