Cleaned up the code in handle_connection() and added a NULL pointer test
in the free request function.
This commit is contained in:
parent
ad743c1e41
commit
358b2781af
@ -1,5 +1,10 @@
|
|||||||
2001-10-22 Robert James Kaes <rjkaes@flarenet.com>
|
2001-10-22 Robert James Kaes <rjkaes@flarenet.com>
|
||||||
|
|
||||||
|
* src/reqs.c (free_request_struct): Added a test to return if the
|
||||||
|
pointer is NULL.
|
||||||
|
(handle_connection): Cleaned up the code to better handle the
|
||||||
|
cause where the request is NULL.
|
||||||
|
|
||||||
* src/sock.c (getpeer_string):
|
* src/sock.c (getpeer_string):
|
||||||
* src/sock.c (getpeer_ip): When the DNS lookup fails, we need to
|
* src/sock.c (getpeer_ip): When the DNS lookup fails, we need to
|
||||||
initialized the user's buffer to an empty string; otherwise, the
|
initialized the user's buffer to an empty string; otherwise, the
|
||||||
|
13
src/reqs.c
13
src/reqs.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: reqs.c,v 1.30 2001-10-19 18:03:49 rjkaes Exp $
|
/* $Id: reqs.c,v 1.31 2001-10-22 16:08:29 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* This is where all the work in tinyproxy is actually done. Incoming
|
* This is where all the work in tinyproxy is actually done. Incoming
|
||||||
* connections have a new thread created for them. The thread then
|
* connections have a new thread created for them. The thread then
|
||||||
@ -111,6 +111,9 @@ struct request_s {
|
|||||||
|
|
||||||
static void free_request_struct(struct request_s *request)
|
static void free_request_struct(struct request_s *request)
|
||||||
{
|
{
|
||||||
|
if (!request)
|
||||||
|
return;
|
||||||
|
|
||||||
safefree(request->method);
|
safefree(request->method);
|
||||||
safefree(request->protocol);
|
safefree(request->protocol);
|
||||||
|
|
||||||
@ -836,13 +839,14 @@ internal_proxy:
|
|||||||
safefree(request_line);
|
safefree(request_line);
|
||||||
|
|
||||||
if (!request) {
|
if (!request) {
|
||||||
update_stats(STAT_BADCONN);
|
|
||||||
|
|
||||||
if (!connptr->send_message) {
|
if (!connptr->send_message) {
|
||||||
|
update_stats(STAT_BADCONN);
|
||||||
destroy_conn(connptr);
|
destroy_conn(connptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
goto send_error;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef UPSTREAM_SUPPORT
|
#ifdef UPSTREAM_SUPPORT
|
||||||
if (config.upstream_name && config.upstream_port != -1) {
|
if (config.upstream_name && config.upstream_port != -1) {
|
||||||
if (connect_to_upstream(connptr, request) < 0)
|
if (connect_to_upstream(connptr, request) < 0)
|
||||||
@ -862,7 +866,6 @@ internal_proxy:
|
|||||||
#ifdef UPSTREAM_SUPPORT
|
#ifdef UPSTREAM_SUPPORT
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
send_error:
|
send_error:
|
||||||
free_request_struct(request);
|
free_request_struct(request);
|
||||||
|
Loading…
Reference in New Issue
Block a user