projects
/
privoxy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a32e6d4
)
Remove the pointless buffer in client_protocol_is_unsupported().
author
Fabian Keil
<fk@fabiankeil.de>
Wed, 7 May 2008 18:05:53 +0000
(18:05 +0000)
committer
Fabian Keil
<fk@fabiankeil.de>
Wed, 7 May 2008 18:05:53 +0000
(18:05 +0000)
jcc.c
patch
|
blob
|
history
diff --git
a/jcc.c
b/jcc.c
index
0d6ef70
..
5a05d08
100644
(file)
--- a/
jcc.c
+++ b/
jcc.c
@@
-1,4
+1,4
@@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.17
2 2008/04/16 16:38:21
fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.17
3 2008/05/06 15:09:00
fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@
-33,6
+33,11
@@
const char jcc_rcs[] = "$Id: jcc.c,v 1.172 2008/04/16 16:38:21 fabiankeil Exp $"
*
* Revisions :
* $Log: jcc.c,v $
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.173 2008/05/06 15:09:00 fabiankeil
+ * Least-effort fix for bug #1821930 (reported by Lee):
+ * If the response doesn't look like HTTP,
+ * tell the client and log the problem.
+ *
* Revision 1.172 2008/04/16 16:38:21 fabiankeil
* Don't pass the whole csp structure to flush_socket()
* when it only needs a file descriptor and a buffer.
* Revision 1.172 2008/04/16 16:38:21 fabiankeil
* Don't pass the whole csp structure to flush_socket()
* when it only needs a file descriptor and a buffer.
@@
-1320,8
+1325,6
@@
static void sig_handler(int the_signal)
*********************************************************************/
static int client_protocol_is_unsupported(const struct client_state *csp, char *req)
{
*********************************************************************/
static int client_protocol_is_unsupported(const struct client_state *csp, char *req)
{
- char buf[BUFFER_SIZE];
-
/*
* If it's a FTP or gopher request, we don't support it.
*
/*
* If it's a FTP or gopher request, we don't support it.
*
@@
-1337,21
+1340,26
@@
static int client_protocol_is_unsupported(const struct client_state *csp, char *
*/
if (!strncmpic(req, "GET ftp://", 10) || !strncmpic(req, "GET gopher://", 13))
{
*/
if (!strncmpic(req, "GET ftp://", 10) || !strncmpic(req, "GET gopher://", 13))
{
+ const char *response = NULL;
+ const char *protocol = NULL;
+
if (!strncmpic(req, "GET ftp://", 10))
{
if (!strncmpic(req, "GET ftp://", 10))
{
- strlcpy(buf, FTP_RESPONSE, sizeof(buf));
- log_error(LOG_LEVEL_ERROR, "%s tried to use Privoxy as FTP proxy: %s",
- csp->ip_addr_str, req);
+ response = FTP_RESPONSE;
+ protocol = "FTP";
}
else
{
}
else
{
- strlcpy(buf, GOPHER_RESPONSE, sizeof(buf));
- log_error(LOG_LEVEL_ERROR, "%s tried to use Privoxy as gopher proxy: %s",
- csp->ip_addr_str, req);
+ response = GOPHER_RESPONSE;
+ protocol = "GOPHER";
}
}
- log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 400 0", csp->ip_addr_str, req);
+ log_error(LOG_LEVEL_ERROR,
+ "%s tried to use Privoxy as %s proxy: %s",
+ csp->ip_addr_str, protocol, req);
+ log_error(LOG_LEVEL_CLF,
+ "%s - - [%T] \"%s\" 400 0", csp->ip_addr_str, req);
freez(req);
freez(req);
- write_socket(csp->cfd,
buf, strlen(buf
));
+ write_socket(csp->cfd,
response, strlen(response
));
return TRUE;
}
return TRUE;
}