Removed the compare_header() function since it's been replaced by a call
the anonymous_search(). Added a few more log_message() calls to better explain error conditions. Fixed up a problem with X-Tinyproxy sending logic.
This commit is contained in:
parent
0c5bd57698
commit
eef4559783
22
src/reqs.c
22
src/reqs.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: reqs.c,v 1.53 2002-04-07 21:35:59 rjkaes Exp $
|
/* $Id: reqs.c,v 1.54 2002-04-09 20:06:24 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
|
||||||
@ -461,17 +461,6 @@ add_xtinyproxy_header(struct conn_s *connptr)
|
|||||||
}
|
}
|
||||||
#endif /* XTINYPROXY */
|
#endif /* XTINYPROXY */
|
||||||
|
|
||||||
/*
|
|
||||||
* Check to see if the header is allowed or not depending on the anonymous
|
|
||||||
* headers which are to be allowed. If the header is found in the
|
|
||||||
* anonymous list return 0, otherwise return -1.
|
|
||||||
*/
|
|
||||||
static inline int
|
|
||||||
compare_header(char *header)
|
|
||||||
{
|
|
||||||
return anonymous_search(header);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Take a complete header line and break it apart (into a key and the data.)
|
* Take a complete header line and break it apart (into a key and the data.)
|
||||||
* Now insert this information into the hashmap for the connection so it
|
* Now insert this information into the hashmap for the connection so it
|
||||||
@ -603,10 +592,11 @@ process_client_headers(struct conn_s *connptr)
|
|||||||
* Get all the headers from the client in a big hash.
|
* Get all the headers from the client in a big hash.
|
||||||
*/
|
*/
|
||||||
if (get_all_headers(connptr->client_fd, hashofheaders) < 0) {
|
if (get_all_headers(connptr->client_fd, hashofheaders) < 0) {
|
||||||
|
log_message(LOG_WARNING, "Could not retrieve all the headers from the client");
|
||||||
|
|
||||||
hashmap_delete(hashofheaders);
|
hashmap_delete(hashofheaders);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't send headers if there's already an error, or if this was
|
* Don't send headers if there's already an error, or if this was
|
||||||
@ -614,6 +604,7 @@ process_client_headers(struct conn_s *connptr)
|
|||||||
*/
|
*/
|
||||||
if (connptr->server_fd == -1
|
if (connptr->server_fd == -1
|
||||||
|| (connptr->connect_method && !UPSTREAM_CONFIGURED())) {
|
|| (connptr->connect_method && !UPSTREAM_CONFIGURED())) {
|
||||||
|
log_message(LOG_INFO, "Not sending client headers to remote machine");
|
||||||
hashmap_delete(hashofheaders);
|
hashmap_delete(hashofheaders);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -685,7 +676,7 @@ process_client_headers(struct conn_s *connptr)
|
|||||||
|
|
||||||
hashmap_search(hashofheaders, data, (void **)&header);
|
hashmap_search(hashofheaders, data, (void **)&header);
|
||||||
|
|
||||||
if (!is_anonymous_enabled() || compare_header(data) == 0) {
|
if (!is_anonymous_enabled() || anonymous_search(data) == 0) {
|
||||||
write_message(connptr->server_fd,
|
write_message(connptr->server_fd,
|
||||||
"%s: %s\r\n",
|
"%s: %s\r\n",
|
||||||
data, header);
|
data, header);
|
||||||
@ -697,7 +688,8 @@ process_client_headers(struct conn_s *connptr)
|
|||||||
hashmap_delete(hashofheaders);
|
hashmap_delete(hashofheaders);
|
||||||
|
|
||||||
#if defined(XTINYPROXY_ENABLE)
|
#if defined(XTINYPROXY_ENABLE)
|
||||||
add_xtinyproxy_header(connptr);
|
if (config.my_domain)
|
||||||
|
add_xtinyproxy_header(connptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Write the final "blank" line to signify the end of the headers */
|
/* Write the final "blank" line to signify the end of the headers */
|
||||||
|
Loading…
Reference in New Issue
Block a user