Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d1bbb13be | ||
|
|
f864ff281f | ||
|
|
1dd459c9ec | ||
|
|
42849c7d66 | ||
|
|
9a61faa716 | ||
|
|
4dbc4a637b | ||
|
|
ee892c109b | ||
|
|
fd65072f1f | ||
|
|
f9d0fcd1a2 | ||
|
|
298784d80e |
No files matched your search
@@ -1,5 +1,15 @@
|
||||
2001-08-28 Robert James Kaes <rjkaes@flarenet.com>
|
||||
|
||||
* src/log.c (log_message): Finally got the log levels worked out
|
||||
properly. I've tested all the levels and they now produce the
|
||||
correct output.
|
||||
|
||||
2001-08-27 Robert James Kaes <rjkaes@flarenet.com>
|
||||
|
||||
* src/reqs.c (trim): Moved the trim functionality out of
|
||||
process_request() and added a test to make sure we don't back the
|
||||
pointer past the beginning of the string.
|
||||
|
||||
* src/log.c (log_message): Fixed a problem where the connect
|
||||
messages were not getting through if the log level was set to
|
||||
INFO.
|
||||
|
||||
@@ -26,6 +26,10 @@ new features will be worked into the next few releases.
|
||||
|
||||
Update
|
||||
------
|
||||
2001-08-28 - The log levels _now_ finally work correctly. I have
|
||||
tested all the levels in the configuration file and the logging
|
||||
function now outputs the correct information.
|
||||
|
||||
2001-08-27 - Fix one bug and two more crop up. The MIME type was
|
||||
incorrect in the httperr() function; this has been fixed.
|
||||
Jeffrey D. Wheelhouse included a patch to increase the stack size on
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
dnl $Id: configure.in,v 1.19 2001-08-27 17:47:25 rjkaes Exp $
|
||||
dnl $Id: configure.in,v 1.21 2001-08-28 15:52:53 rjkaes Exp $
|
||||
|
||||
dnl Devlopers, please strive to achieve this order:
|
||||
dnl
|
||||
@@ -19,7 +19,7 @@ AC_INIT()
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_DEFINE_UNQUOTED(TARGET_SYSTEM, "$target")
|
||||
|
||||
AM_INIT_AUTOMAKE(tinyproxy,1.4.1.4)
|
||||
AM_INIT_AUTOMAKE(tinyproxy,1.4.1.5)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl
|
||||
@@ -107,7 +107,7 @@ else
|
||||
CFLAGS="-D_REENTRANT $CFLAGS"
|
||||
else
|
||||
AC_CHECK_LIB(c_r, pthread_create)
|
||||
if test "$ac_cv_c_r_pthread_create" = "yes"; then
|
||||
if test "$ac_cv_lib_c_r_pthread_create" = "yes"; then
|
||||
CFLAGS="-pthread -D_REENTRANT $CFLAGS"
|
||||
else
|
||||
AC_MSG_ERROR(You must have a POSIX compliant threading library installed)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: log.c,v 1.11 2001-08-27 17:44:55 rjkaes Exp $
|
||||
/* $Id: log.c,v 1.12 2001-08-28 15:51:58 rjkaes Exp $
|
||||
*
|
||||
* Logs the various messages which tinyproxy produces to either a log file or
|
||||
* the syslog daemon. Not much to it...
|
||||
@@ -76,10 +76,16 @@ void log_message(short int level, char *fmt, ...)
|
||||
/*
|
||||
* Figure out if we should write the message or not.
|
||||
*/
|
||||
if (level == LOG_INFO && log_level == LOG_CONN)
|
||||
if (log_level == LOG_CONN) {
|
||||
if (level == LOG_INFO)
|
||||
return;
|
||||
else if (level > log_level && level != LOG_CONN && log_level != LOG_INFO)
|
||||
} else if (log_level == LOG_INFO) {
|
||||
if (level > LOG_INFO && level != LOG_CONN)
|
||||
return;
|
||||
} else if (level > log_level)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
if (config.syslog && level == LOG_CONN)
|
||||
|
||||
+26
-6
@@ -1,10 +1,10 @@
|
||||
/* $Id: reqs.c,v 1.16 2001-08-27 03:44:22 rjkaes Exp $
|
||||
/* $Id: reqs.c,v 1.17 2001-08-28 04:32:14 rjkaes Exp $
|
||||
*
|
||||
* This is where all the work in tinyproxy is actually done. Incoming
|
||||
* connections have a new thread created for them. The thread then
|
||||
* processes the headers from the client, the response from the server,
|
||||
* and then relays the bytes between the two.
|
||||
* If the UPSTEAM_PROXY is enabled, then tinyproxy will actually work
|
||||
* If TUNNEL_SUPPORT is enabled, then tinyproxy will actually work
|
||||
* as a simple buffering TCP tunnel. Very cool! (Robert actually uses
|
||||
* this feature for a buffering NNTP tunnel.)
|
||||
*
|
||||
@@ -81,6 +81,29 @@ static ssize_t safe_read(int fd, void *buffer, size_t count)
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove any new lines or carriage returns from the end of a string.
|
||||
*/
|
||||
static inline void trim(char *string, unsigned int len)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
assert(string != NULL);
|
||||
assert(len > 0);
|
||||
|
||||
ptr = string + len - 1;
|
||||
while (*ptr == '\r' || *ptr == '\n') {
|
||||
*ptr-- = '\0';
|
||||
|
||||
/*
|
||||
* Don't let the ptr back past the beginning of the
|
||||
* string.
|
||||
*/
|
||||
if (ptr < string)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a client HTTP request and then establish connection.
|
||||
*/
|
||||
@@ -89,7 +112,6 @@ static int process_method(struct conn_s *connptr)
|
||||
URI *uri = NULL;
|
||||
char inbuf[LINE_LENGTH];
|
||||
char *buffer = NULL, *request = NULL, *port = NULL;
|
||||
char *inbuf_ptr = NULL;
|
||||
|
||||
regex_t preg;
|
||||
regmatch_t pmatch[NMATCH];
|
||||
@@ -112,9 +134,7 @@ static int process_method(struct conn_s *connptr)
|
||||
/*
|
||||
* Strip the newline and character return from the string.
|
||||
*/
|
||||
inbuf_ptr = inbuf + len - 1;
|
||||
while (*inbuf_ptr == '\r' || *inbuf_ptr == '\n')
|
||||
*inbuf_ptr-- = '\0';
|
||||
trim(inbuf, len);
|
||||
|
||||
log_message(LOG_CONN, "Request: %s", inbuf);
|
||||
|
||||
|
||||
+8
-2
@@ -1,4 +1,4 @@
|
||||
/* $Id: thread.c,v 1.7 2001-08-27 17:45:50 rjkaes Exp $
|
||||
/* $Id: thread.c,v 1.8 2001-08-28 04:33:21 rjkaes Exp $
|
||||
*
|
||||
* Handles the creation/destruction of the various threads required for
|
||||
* processing incoming connections.
|
||||
@@ -23,6 +23,12 @@
|
||||
#include "sock.h"
|
||||
#include "thread.h"
|
||||
|
||||
/*
|
||||
* This is the stack frame size used by all the threads. We'll start by
|
||||
* setting it to 128 KB.
|
||||
*/
|
||||
#define THREAD_STACK_SIZE (1024 * 128)
|
||||
|
||||
static int listenfd;
|
||||
static socklen_t addrlen;
|
||||
|
||||
@@ -154,7 +160,7 @@ int thread_pool_create(void)
|
||||
* because the default on some OS's is too small.
|
||||
*/
|
||||
pthread_attr_init(&thread_attr);
|
||||
pthread_attr_setstacksize(&thread_attr, (1024 * 1024));
|
||||
pthread_attr_setstacksize(&thread_attr, THREAD_STACK_SIZE);
|
||||
|
||||
if (thread_config.maxclients == 0) {
|
||||
log_message(LOG_ERR, "You must set MaxClients to a value greater than 0");
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
/* $Id: utils.c,v 1.6 2001-08-27 17:46:50 rjkaes Exp $
|
||||
/* $Id: utils.c,v 1.7 2001-08-28 04:33:54 rjkaes Exp $
|
||||
*
|
||||
* Misc. routines which are used by the various functions to handle strings
|
||||
* and memory allocation and pretty much anything else we can think of. Also,
|
||||
@@ -79,8 +79,8 @@ int httperr(struct conn_s *connptr, int err, const char *msg)
|
||||
"<font size=\"+2\">Cache Error!</font><br>\r\n" \
|
||||
"An error of type %d occurred: %s\r\n" \
|
||||
"<hr>\r\n" \
|
||||
"<font size=\"-1\"><em>Generated by %s/%s</em></font>\r\n" \
|
||||
"</body></html>\r\n";
|
||||
"<font size=\"-1\"><em>Generated by %s (%s)</em></font>\r\n" \
|
||||
"</body></html>\r\n\r\n";
|
||||
|
||||
char *header_buffer;
|
||||
char *message_buffer;
|
||||
|
||||
Reference in new issue
Block a user