Compare commits

..
1 Commits
Author SHA1 Message Date
cvs2svn b8a4f72b7a This commit was manufactured by cvs2svn to create tag
'rel_1_5_1pre1'.
2002-05-27 15:19:35 +00:00
6 changed files with 22 additions and 115 deletions

No files matched your search

-43
View File
@@ -1,48 +1,5 @@
2002-05-29 Robert James Kaes <rjkaes@flarenet.com>
* src/heap.c (malloc_shared_memory):
Removed the MMAP_ANON and open("/dev/zero") since they are not
portable across a while enough spectrum of machines. Right now
tinyproxy is using a "classic" temporary file method of sharing
memory. This will likely be improved in the future.
* src/child.c, src/stats.c:
Changed the tests on the return value from malloc_shared_memory()
to make tinyproxy more portable, since we can't be certain that
"if (!ret_value)" would actually detect a mmap() error.
* src/reqs.c (add_header_to_connection):
Removed the "double_cgi" boolean, since tinyproxy now ignores all
the headers after a "double CGI" situation has occurred.
(get_all_headers): Instead of dropping duplicate headers when the
"double CGI" situation occurs, tinyproxy will now drop _all_ the
headers from the "inner" HTTP response.
* src/stats.c (init_stats):
Fixed a spelling mistake where the number of bytes being allocated
was incorrect.
2002-05-28 Robert James Kaes <rjkaes@flarenet.com>
* src/reqs.c (add_header_to_connection):
Added a boolean to indicate that a "Double CGI" situation is in
affect. This is needed to solve a problem with some sites (like
cgi.ebay.com) where they are sending two HTTP response lines (and
associated headers) with a response.
(get_all_headers): Detect if a "Double CGI" situation has occurred.
* src/reqs.c (get_all_headers):
Added code to ignore a "response" line in a header. This was
pointed out as being a problem with eBay (cgi.ebay.com)
(process_server_headers): Added code to make skip blank lines
before a response line.
2002-05-27 Robert James Kaes <rjkaes@flarenet.com> 2002-05-27 Robert James Kaes <rjkaes@flarenet.com>
* doc/Makefile.am:
Fixed up a problem where the tinyproxy manual page was not getting
included with the distribution.
* src/reqs.c (process_request): * src/reqs.c (process_request):
Changed the filtering code around to handle both domains and URLs. Changed the filtering code around to handle both domains and URLs.
+2 -2
View File
@@ -1,4 +1,4 @@
dnl $Id: configure.ac,v 2.35 2002-05-29 20:55:47 rjkaes Exp $ dnl $Id: configure.ac,v 2.33 2002-05-27 00:49:06 rjkaes Exp $
dnl Devlopers, please strive to achieve this order: dnl Devlopers, please strive to achieve this order:
dnl dnl
@@ -14,7 +14,7 @@ dnl 8. System services
dnl dnl
dnl Read the Autoconf manual for details. dnl Read the Autoconf manual for details.
AC_INIT([tinyproxy], [1.5.1pre3], [rjkaes@users.sourceforge.net]) AC_INIT([tinyproxy], [1.5.1pre1], [rjkaes@users.sourceforge.net])
AC_CONFIG_SRCDIR([src/tinyproxy.c]) AC_CONFIG_SRCDIR([src/tinyproxy.c])
AC_PREREQ(2.52) AC_PREREQ(2.52)
+3 -3
View File
@@ -1,4 +1,4 @@
/* $Id: child.c,v 1.2 2002-05-29 20:49:55 rjkaes Exp $ /* $Id: child.c,v 1.1 2002-05-26 18:45:26 rjkaes Exp $
* *
* Handles the creation/destruction of the various children required for * Handles the creation/destruction of the various children required for
* processing incoming connections. * processing incoming connections.
@@ -269,14 +269,14 @@ child_pool_create(void)
} }
child_ptr = calloc_shared_memory(child_config.maxclients, child_ptr = calloc_shared_memory(child_config.maxclients,
sizeof(struct child_s)); sizeof(struct child_s));
if (!child_ptr) { if (!child_ptr) {
log_message(LOG_ERR, "Could not allocate memory for children."); log_message(LOG_ERR, "Could not allocate memory for children.");
return -1; return -1;
} }
servers_waiting = malloc_shared_memory(sizeof(int)); servers_waiting = malloc_shared_memory(sizeof(int));
if (servers_waiting == MAP_FAILED) { if (!servers_waiting) {
log_message(LOG_ERR, "Could not allocate memory for child counting."); log_message(LOG_ERR, "Could not allocate memory for child counting.");
return -1; return -1;
} }
+11 -23
View File
@@ -1,4 +1,4 @@
/* $Id: heap.c,v 1.3 2002-05-29 20:51:35 rjkaes Exp $ /* $Id: heap.c,v 1.2 2002-05-26 18:56:06 rjkaes Exp $
* *
* Debugging versions of various heap related functions are combined * Debugging versions of various heap related functions are combined
* here. The debugging versions include assertions and also print * here. The debugging versions include assertions and also print
@@ -21,7 +21,6 @@
#include "tinyproxy.h" #include "tinyproxy.h"
#include "heap.h" #include "heap.h"
#include "text.h"
void * void *
debugging_calloc(size_t nmemb, size_t size, const char *file, debugging_calloc(size_t nmemb, size_t size, const char *file,
@@ -93,35 +92,24 @@ debugging_strdup(const char* s, const char* file, unsigned long line)
} }
/* /*
* Allocate a block of memory in the "shared" memory region. * Allocate a block of memory in the "shared" memory region
*
* FIXME: This uses the most basic (and slowest) means of creating a
* shared memory location. It requires the use of a temporary file. We might
* want to look into something like MM (Shared Memory Library) for a better
* solution.
*/ */
void* void*
malloc_shared_memory(size_t size) malloc_shared_memory(size_t size)
{ {
int fd; int fd;
void* ptr; void* ptr;
char buffer[128];
static char* shared_file = "/tmp/tinyproxy.shared";
assert(size > 0); assert(size > 0);
assert(shared_file != NULL);
strlcpy(buffer, shared_file, sizeof(buffer) - 8); #ifdef MAP_ANON
strlcat(buffer, ".XXXXXX", sizeof(buffer)); ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
#else
fd = open("/dev/zero", O_RDWR, 0);
if ((fd = mkstemp(buffer)) == -1) ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
return (void *)MAP_FAILED; close(fd);
unlink(buffer); #endif
if (ftruncate(fd, size) == -1)
return (void *)MAP_FAILED;
ptr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
return ptr; return ptr;
} }
@@ -142,8 +130,8 @@ calloc_shared_memory(size_t nmemb, size_t size)
length = nmemb * size; length = nmemb * size;
ptr = malloc_shared_memory(length); ptr = malloc_shared_memory(length);
if (ptr == MAP_FAILED) if (!ptr)
return ptr; return NULL;
memset(ptr, 0, length); memset(ptr, 0, length);
+3 -41
View File
@@ -1,4 +1,4 @@
/* $Id: reqs.c,v 1.80 2002-05-29 18:11:57 rjkaes Exp $ /* $Id: reqs.c,v 1.77 2002-05-27 02:00:22 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 child created for them. The child then * connections have a new child created for them. The child then
@@ -559,10 +559,6 @@ get_all_headers(int fd, hashmap_t hashofheaders)
{ {
char *header; char *header;
ssize_t len; ssize_t len;
bool_t double_cgi = FALSE;
assert(fd >= 0);
assert(hashofheaders != NULL);
for (;;) { for (;;) {
if ((len = readline(fd, &header)) <= 0) { if ((len = readline(fd, &header)) <= 0) {
@@ -579,26 +575,7 @@ get_all_headers(int fd, hashmap_t hashofheaders)
return 0; return 0;
} }
/* if (add_header_to_connection(hashofheaders, header, len) < 0) {
* BUG FIX: The following code detects a "Double CGI"
* situation so that we can handle the nonconforming system.
* This problem was found when accessing cgi.ebay.com, and it
* turns out to be a wider spread problem as well.
*
* If "Double CGI" is in effect, duplicate headers are
* ignored.
*
* FIXME: Might need to change this to a more robust check.
*/
if (strncasecmp(header, "HTTP/", 5) == 0) {
double_cgi = TRUE;
safefree(header);
continue;
}
if (!double_cgi
&& add_header_to_connection(hashofheaders, header, len) < 0) {
safefree(header); safefree(header);
return -1; return -1;
} }
@@ -880,24 +857,9 @@ process_server_headers(struct conn_s *connptr)
/* FIXME: Remember to handle a "simple_req" type */ /* FIXME: Remember to handle a "simple_req" type */
/* Get the response line from the remote server. */ /* Get the response line from the remote server. */
retry: if ((len = readline(connptr->server_fd, &response_line)) <= 0)
len = readline(connptr->server_fd, &response_line);
if (len <= 0)
return -1; return -1;
/*
* Strip the new line and character return from the string.
*/
if (chomp(response_line, len) == len) {
/*
* If the number of characters removed is the same as the
* length then it was a blank line. Free the buffer and
* try again (since we're looking for a request line.)
*/
safefree(response_line);
goto retry;
}
hashofheaders = hashmap_create(HEADER_BUCKETS); hashofheaders = hashmap_create(HEADER_BUCKETS);
if (!hashofheaders) { if (!hashofheaders) {
safefree(response_line); safefree(response_line);
+3 -3
View File
@@ -1,4 +1,4 @@
/* $Id: stats.c,v 1.12 2002-05-29 20:49:55 rjkaes Exp $ /* $Id: stats.c,v 1.10 2002-05-26 18:53:14 rjkaes Exp $
* *
* This module handles the statistics for tinyproxy. There are only two * This module handles the statistics for tinyproxy. There are only two
* public API functions. The reason for the functions, rather than just a * public API functions. The reason for the functions, rather than just a
@@ -44,8 +44,8 @@ static struct stat_s *stats;
void void
init_stats(void) init_stats(void)
{ {
stats = malloc_shared_memory(sizeof(struct stat_s)); stats = malloc_shared_memory(sizeof(struct stat));
if (stats == MAP_FAILED) if (!stats)
return; return;
memset(stats, 0, sizeof(struct stat)); memset(stats, 0, sizeof(struct stat));