Compare commits

..
1 Commits
Author SHA1 Message Date
cvs2svn b3af1f2abc This commit was manufactured by cvs2svn to create tag
'release_1_6_0pre1'.
2003-04-01 16:50:42 +00:00
6 changed files with 21 additions and 159 deletions

No files matched your search

-87
View File
@@ -1,90 +1,3 @@
2003-04-16 Robert James Kaes <rjkaes@flarenet.com>
* src/reqs.c (build_url):
Rebuild the URL from the component pieces. This function
is used by the transparent proxy code. [Anatole Shaw]
(process_request): Fixed up the transparent proxy code so that
filtering can be done on the whole URL. [Anatole Shaw]
(pull_client_data): Added a bug fix for Internet Explorer (IE).
IE will leave an extra CR and LF after the data in an HTTP POST.
The new code will eat the extra bytes if they're present. Thanks
to Yannick Koehler for finding the bug and offering an explanation
as to why it was happening.
Changed all calls of connptr->remote_content_length to
connptr->content_length.server
* src/conns.c, src/conns.h:
Removed the remote_content_length field in the "conn" structure
and replaced it with a smaller structure containing both the
remote/server and the local/client content-length fields if
they're present in the HTTP response headers.
2003-04-01 Robert James Kaes <rjkaes@flarenet.com>
* configure.ac:
Reorganized some of the code, and remove some function tests for
which results were never used, and removed duplicate header tests.
* src/htmlerror.c (add_error_variable):
Test whether connptr->error_variable is NULL, and if so call
safemalloc(). This is needed since saferealloc() will assert() if
the first argument is a NULL pointer.
2003-03-26 Robert James Kaes <rjkaes@flarenet.com>
* src/reqs.c (establish_http_connection):
Always include the port number for the requested server. This
fixes a problem when the server is not listening on the default
port, 80. [Fix suggested by duncan@sapio.co.uk]
2003-03-17 Robert James Kaes <rjkaes@flarenet.com>
* doc/Makefile.am:
Create the doc/report.sh script from the new template file.
* doc/report.sh, doc/report.sh.tmpl:
Moved the doc/report.sh script to doc/report.sh.tmpl file. The
script is then updated by the make procedure to reflect the
correct location of the tinyproxy executable.
2003-03-14 Robert James Kaes <rjkaes@flarenet.com>
* src/htmlerror.c:
Made get_html_file() and lookup_variable() static functions since
they are only used with this file.
* src/utils.c (send_http_message):
Changed the function to use the new http_message API.
2003-03-13 Robert James Kaes <rjkaes@flarenet.com>
* src/grammar.y, src/scanner.l:
Allow the URL for the statistic page to be controlled from the
configuration file, rather than being hard-coded in the program.
[John M Wright]
* doc/tinyproxy.conf:
Include example information for the new "file" directives
(ErrorFile, DefaultErrorFile, StatFile.) [Steven Young]
* src/utils.c, src/utils.h:
Moved the send_http_error_message() and indicate_http_error()
functions into the htmlerror.c file, and recoded them to use the
new variable substitution system. [Steven Young]
* src/common.h:
Fixed up the include order for the <sys/time.h> and <time.h>
headers.
* src/http_message.c, src/http_message.h:
An API to handle HTTP messages as concrete entities.
* src/text.c, src/text.h (chomp):
Fixed up the code to prevent negative array access. Added
code to make sure the supplied arguments are valid.
2003-03-09 Steven Young <sdyoung@well.com>
* src/htmlerror.[ch]: Code to allow the use of substituted
+2 -2
View File
@@ -1,4 +1,4 @@
dnl $Id: configure.ac,v 2.53 2003-04-16 18:12:45 rjkaes Exp $
dnl $Id: configure.ac,v 2.52 2003-04-01 16:50:41 rjkaes Exp $
dnl Devlopers, please strive to achieve this order:
dnl
@@ -14,7 +14,7 @@ dnl 8. System services
dnl
dnl Read the Autoconf manual for details.
AC_INIT([tinyproxy], [1.6.0pre2], [rjkaes@users.sourceforge.net])
AC_INIT([tinyproxy], [1.6.0pre1], [rjkaes@users.sourceforge.net])
AC_CONFIG_SRCDIR([src/tinyproxy.c])
AC_PREREQ(2.52)
+2 -9
View File
@@ -1,4 +1,4 @@
/* $Id: child.c,v 1.10 2003-04-16 18:04:58 rjkaes Exp $
/* $Id: child.c,v 1.8 2003-03-13 19:30:19 rjkaes Exp $
*
* Handles the creation/destruction of the various children required for
* processing incoming connections.
@@ -180,17 +180,10 @@ child_main(struct child_s* ptr)
connfd = accept(listenfd, cliaddr, &clilen);
#ifndef NDEBUG
/*
* Enable the TINYPROXY_DEBUG environment variable if you
* want to use the GDB debugger.
*/
if (getenv("TINYPROXY_DEBUG")) {
/* Pause for 10 seconds to allow us to connect debugger */
fprintf(stderr,
"Process has accepted connection: %u\n", ptr->tid);
fprintf(stderr, "Process has accepted connection: %u\n", ptr->tid);
sleep(10);
fprintf(stderr, "Continuing process: %u\n", ptr->tid);
}
#endif
/*
+2 -3
View File
@@ -1,4 +1,4 @@
/* $Id: conns.c,v 1.15 2003-04-16 16:37:59 rjkaes Exp $
/* $Id: conns.c,v 1.14 2003-03-13 21:27:29 rjkaes Exp $
*
* Create and free the connection structure. One day there could be
* other connection related tasks put here, but for now the header
@@ -69,8 +69,7 @@ initialize_conn(int client_fd, const char* ipaddr, const char* string_addr)
connptr->protocol.major = connptr->protocol.minor = 0;
/* There is _no_ content length initially */
connptr->content_length.server = connptr->content_length.client = -1;
connptr->remote_content_length = -1;
connptr->client_ip_addr = safestrdup(ipaddr);
connptr->client_string_addr = safestrdup(string_addr);
+2 -5
View File
@@ -1,4 +1,4 @@
/* $Id: conns.h,v 1.13 2003-04-16 16:37:58 rjkaes Exp $
/* $Id: conns.h,v 1.12 2003-03-13 21:27:29 rjkaes Exp $
*
* See 'conns.c' for a detailed description.
*
@@ -53,10 +53,7 @@ struct conn_s {
char *error_string;
/* A Content-Length value from the remote server */
struct {
long int server;
long int client;
} content_length;
long remote_content_length;
/*
* Store the client's IP and hostname information
+13 -53
View File
@@ -1,4 +1,4 @@
/* $Id: reqs.c,v 1.96 2003-04-16 18:11:58 rjkaes Exp $
/* $Id: reqs.c,v 1.95 2003-03-26 16:47:30 rjkaes Exp $
*
* This is where all the work in tinyproxy is actually done. Incoming
* connections have a new child created for them. The child then
@@ -275,27 +275,6 @@ extract_ssl_url(const char *url, struct request_s *request)
return 0;
}
/*
* Build a URL from parts.
*/
static int
build_url(char **url, const char *host, int port, const char *path)
{
int len;
assert(url != NULL);
assert(host != NULL);
assert(port > 0 && port < 32768);
assert(path != NULL);
len = strlen(host) + strlen(path) + 14;
*url = safemalloc(len);
if (*url == NULL)
return -1;
return snprintf(*url, len, "http://%s:%d%s", host, port, path);
}
/*
* Create a connection for HTTP connections.
*/
@@ -379,7 +358,6 @@ process_request(struct conn_s *connptr, hashmap_t hashofheaders)
return NULL;
}
/*
* FIXME: We need to add code for the simple HTTP/0.9 style GET
* request.
@@ -478,11 +456,9 @@ process_request(struct conn_s *connptr, hashmap_t hashofheaders)
request->port = ntohs(dest_addr.sin_port);
request->path = safemalloc(strlen(url) + 1);
strcpy(request->path, url);
safefree(url);
build_url(&url, request->host, request->port, request->path);
log_message(LOG_INFO,
"process_request: trans IP %s %s for %d",
request->method, url, connptr->client_fd);
"process_request: trans IP %s http://%s:%d%s for %d",
request->method, request->host, request->port, request->path, connptr->client_fd);
} else {
request->host = safemalloc(length+1);
if (sscanf(data, "%[^:]:%hu", request->host, &request->port) != 2) {
@@ -491,11 +467,9 @@ process_request(struct conn_s *connptr, hashmap_t hashofheaders)
}
request->path = safemalloc(strlen(url) + 1);
strcpy(request->path, url);
safefree(url);
build_url(&url, request->host, request->port, request->path);
log_message(LOG_INFO,
"process_request: trans Host %s %s for %d",
request->method, url, connptr->client_fd);
"process_request: trans Host %s http://%s:%d%s for %d",
request->method, request->host, request->port, request->path, connptr->client_fd);
}
if (config.ipAddr &&
strcmp(request->host, config.ipAddr) == 0) {
@@ -593,7 +567,7 @@ process_request(struct conn_s *connptr, hashmap_t hashofheaders)
* - rjkaes
*/
static int
pull_client_data(struct conn_s *connptr, long int length)
pull_client_data(struct conn_s *connptr, unsigned long int length)
{
char *buffer;
ssize_t len;
@@ -616,21 +590,6 @@ pull_client_data(struct conn_s *connptr, long int length)
length -= len;
} while (length > 0);
/*
* BUG FIX: Internet Explorer will leave two bytes (carriage
* return and line feed) at the end of a POST message. These
* need to be eaten for tinyproxy to work correctly.
*/
socket_nonblocking(connptr->client_fd);
len = recv(connptr->client_fd, buffer, 2, MSG_PEEK);
socket_blocking(connptr->client_fd);
if (len < 0 && errno != EAGAIN)
goto ERROR_EXIT;
if (len == 2 && CHECK_CRLF(buffer, len))
read(connptr->client_fd, buffer, 2);
safefree(buffer);
return 0;
@@ -881,6 +840,7 @@ process_client_headers(struct conn_s *connptr, hashmap_t hashofheaders)
};
int i;
hashmap_iter iter;
long content_length = -1;
int ret = 0;
char *data, *header;
@@ -900,7 +860,7 @@ process_client_headers(struct conn_s *connptr, hashmap_t hashofheaders)
* See if there is a "Content-Length" header. If so, again we need
* to do a bit of processing.
*/
connptr->content_length.client = get_content_length(hashofheaders);
content_length = get_content_length(hashofheaders);
/*
* See if there is a "Connection" header. If so, we need to do a bit
@@ -968,9 +928,9 @@ process_client_headers(struct conn_s *connptr, hashmap_t hashofheaders)
* Spin here pulling the data from the client.
*/
PULL_CLIENT_DATA:
if (connptr->content_length.client > 0)
if (content_length > 0)
return pull_client_data(connptr,
connptr->content_length.client);
(unsigned long int) content_length);
else
return ret;
}
@@ -1050,7 +1010,7 @@ process_server_headers(struct conn_s *connptr)
* If there is a "Content-Length" header, retrieve the information
* from it for later use.
*/
connptr->content_length.server = get_content_length(hashofheaders);
connptr->remote_content_length = get_content_length(hashofheaders);
/*
* See if there is a connection header. If so, we need to to a bit of
@@ -1176,8 +1136,8 @@ relay_connection(struct conn_s *connptr)
if (bytes_received < 0)
break;
connptr->content_length.server -= bytes_received;
if (connptr->content_length.server == 0)
connptr->remote_content_length -= bytes_received;
if (connptr->remote_content_length == 0)
break;
}
if (FD_ISSET(connptr->client_fd, &rset)