projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
In case of SOCKS5 failures, dump the socks response
[privoxy.git]
/
gateway.c
diff --git
a/gateway.c
b/gateway.c
index
aaee503
..
f28823b
100644
(file)
--- a/
gateway.c
+++ b/
gateway.c
@@
-1,4
+1,4
@@
-const char gateway_rcs[] = "$Id: gateway.c,v 1.
75 2011/07/30 15:05:49
fabiankeil Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.
80 2011/10/23 11:20:51
fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.c,v $
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.c,v $
@@
-338,16
+338,12
@@
void forget_connection(jb_socket sfd)
sfd, reusable_connection[slot].host,
reusable_connection[slot].port, slot);
mark_connection_closed(&reusable_connection[slot]);
sfd, reusable_connection[slot].host,
reusable_connection[slot].port, slot);
mark_connection_closed(&reusable_connection[slot]);
- privoxy_mutex_unlock(&connection_reuse_mutex);
-
- return;
+ break;
}
}
}
}
- log_error(LOG_LEVEL_CONNECT,
- "Socket %d already forgotten or never remembered.", sfd);
-
privoxy_mutex_unlock(&connection_reuse_mutex);
privoxy_mutex_unlock(&connection_reuse_mutex);
+
}
#endif /* def FEATURE_CONNECTION_SHARING */
}
#endif /* def FEATURE_CONNECTION_SHARING */
@@
-659,7
+655,7
@@
jb_socket forwarded_connect(const struct forward_spec * fwd,
default:
/* Should never get here */
log_error(LOG_LEVEL_FATAL,
default:
/* Should never get here */
log_error(LOG_LEVEL_FATAL,
- "
SOCKS4 impossible internal error - bad SOCKS type."
);
+ "
Internal error in forwarded_connect(). Bad proxy type: %d", fwd->type
);
}
if (JB_INVALID_SOCKET != sfd)
}
if (JB_INVALID_SOCKET != sfd)
@@
-947,7
+943,7
@@
static jb_socket socks5_connect(const struct forward_spec *fwd,
{
int err = 0;
char cbuf[300];
{
int err = 0;
char cbuf[300];
- char sbuf[
3
0];
+ char sbuf[
1
0];
size_t client_pos = 0;
int server_size = 0;
size_t hostlen = 0;
size_t client_pos = 0;
int server_size = 0;
size_t hostlen = 0;
@@
-1085,7
+1081,7
@@
static jb_socket socks5_connect(const struct forward_spec *fwd,
if (write_socket(sfd, cbuf, client_pos))
{
if (write_socket(sfd, cbuf, client_pos))
{
- errstr = "SOCKS5 negotiation
read
failed";
+ errstr = "SOCKS5 negotiation
write
failed";
csp->error_message = strdup(errstr);
log_error(LOG_LEVEL_CONNECT, "%s", errstr);
close_socket(sfd);
csp->error_message = strdup(errstr);
log_error(LOG_LEVEL_CONNECT, "%s", errstr);
close_socket(sfd);
@@
-1094,18
+1090,11
@@
static jb_socket socks5_connect(const struct forward_spec *fwd,
}
server_size = read_socket(sfd, sbuf, sizeof(sbuf));
}
server_size = read_socket(sfd, sbuf, sizeof(sbuf));
- if (server_size
< 3
)
+ if (server_size
!= sizeof(sbuf)
)
{
errstr = "SOCKS5 negotiation read failed";
err = 1;
}
{
errstr = "SOCKS5 negotiation read failed";
err = 1;
}
- else if (server_size > 20)
- {
- /* This is somewhat unexpected but doesn't really matter. */
- log_error(LOG_LEVEL_CONNECT, "socks5_connect: read %d bytes "
- "from socks server. Would have accepted up to %d.",
- server_size, sizeof(sbuf));
- }
if (!err)
{
if (!err)
{
@@
-1129,7
+1118,7
@@
static jb_socket socks5_connect(const struct forward_spec *fwd,
assert(errstr != NULL);
csp->error_message = strdup(errstr);
assert(errstr != NULL);
csp->error_message = strdup(errstr);
- log_error(LOG_LEVEL_CONNECT, "socks5_connect: %s
", errstr
);
+ log_error(LOG_LEVEL_CONNECT, "socks5_connect: %s
: %N", errstr, server_size, sbuf
);
close_socket(sfd);
errno = EINVAL;
close_socket(sfd);
errno = EINVAL;