Break at 80 columns

This commit is contained in:
Mukund Sivaraman 2008-12-08 12:26:08 +00:00
parent a257703e59
commit 4c1ede779e
11 changed files with 69 additions and 35 deletions

View File

@ -332,7 +332,8 @@ write_buffer (int fd, struct buffer_s * buffptr)
case ENOBUFS: case ENOBUFS:
case ENOMEM: case ENOMEM:
log_message (LOG_ERR, log_message (LOG_ERR,
"writebuff: write() error [NOBUFS/NOMEM] \"%s\" on file descriptor %d", "writebuff: write() error [NOBUFS/NOMEM] \"%s\" on "
"file descriptor %d",
strerror (errno), fd); strerror (errno), fd);
return 0; return 0;
default: default:

View File

@ -237,7 +237,8 @@ child_main (struct child_s *ptr)
if (ptr->connects == child_config.maxrequestsperchild) if (ptr->connects == child_config.maxrequestsperchild)
{ {
log_message (LOG_NOTICE, log_message (LOG_NOTICE,
"Child has reached MaxRequestsPerChild (%u). Killing child.", "Child has reached MaxRequestsPerChild (%u). "
"Killing child.",
ptr->connects); ptr->connects);
break; break;
} }
@ -251,7 +252,8 @@ child_main (struct child_s *ptr)
* off. * off.
*/ */
log_message (LOG_NOTICE, log_message (LOG_NOTICE,
"Waiting servers (%d) exceeds MaxSpareServers (%d). Killing child.", "Waiting servers (%d) exceeds MaxSpareServers (%d). "
"Killing child.",
*servers_waiting, child_config.maxspareservers); *servers_waiting, child_config.maxspareservers);
SERVER_COUNT_UNLOCK (); SERVER_COUNT_UNLOCK ();
@ -310,13 +312,15 @@ child_pool_create (void)
if (child_config.maxclients == 0) if (child_config.maxclients == 0)
{ {
log_message (LOG_ERR, log_message (LOG_ERR,
"child_pool_create: \"MaxClients\" must be greater than zero."); "child_pool_create: \"MaxClients\" must be "
"greater than zero.");
return -1; return -1;
} }
if (child_config.startservers == 0) if (child_config.startservers == 0)
{ {
log_message (LOG_ERR, log_message (LOG_ERR,
"child_pool_create: \"StartServers\" must be greater than zero."); "child_pool_create: \"StartServers\" must be "
"greater than zero.");
return -1; return -1;
} }
@ -345,7 +349,8 @@ child_pool_create (void)
if (child_config.startservers > child_config.maxclients) if (child_config.startservers > child_config.maxclients)
{ {
log_message (LOG_WARNING, log_message (LOG_WARNING,
"Can not start more than \"MaxClients\" servers. Starting %u servers instead.", "Can not start more than \"MaxClients\" servers. "
"Starting %u servers instead.",
child_config.maxclients); child_config.maxclients);
child_config.startservers = child_config.maxclients; child_config.startservers = child_config.maxclients;
} }
@ -404,7 +409,8 @@ child_main_loop (void)
if (*servers_waiting < child_config.minspareservers) if (*servers_waiting < child_config.minspareservers)
{ {
log_message (LOG_NOTICE, log_message (LOG_NOTICE,
"Waiting servers (%d) is less than MinSpareServers (%d). Creating new child.", "Waiting servers (%d) is less than MinSpareServers (%d). "
"Creating new child.",
*servers_waiting, child_config.minspareservers); *servers_waiting, child_config.minspareservers);
SERVER_COUNT_UNLOCK (); SERVER_COUNT_UNLOCK ();

View File

@ -80,7 +80,9 @@ typedef int (*CONFFILE_HANDLER) (struct config_s *, const char *,
* The handling function must return 0 if the directive was processed * The handling function must return 0 if the directive was processed
* properly. Any errors are reported by returning a non-zero value. * properly. Any errors are reported by returning a non-zero value.
*/ */
#define HANDLE_FUNC(func) int func(struct config_s* conf, const char* line, regmatch_t match[]) #define HANDLE_FUNC(func) \
int func(struct config_s* conf, const char* line, \
regmatch_t match[])
/* /*
* List all the handling functions. These are defined later, but they need * List all the handling functions. These are defined later, but they need

View File

@ -194,7 +194,8 @@ send_http_error_message (struct conn_s *connptr)
int ret; int ret;
char *fallback_error = char *fallback_error =
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
"\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
"<html>\n" "<html>\n"
"<head><title>%d %s</title></head>\n" "<head><title>%d %s</title></head>\n"
"<body>\n" "<body>\n"

View File

@ -87,7 +87,7 @@
# define LOG_DEBUG 7 # define LOG_DEBUG 7
#endif #endif
#define LOG_CONN 8 /* extra to log connections without the INFO stuff */ #define LOG_CONN 8 /* extra to log connections without the INFO stuff */
/* /*
* Use this for debugging. The format is specific: * Use this for debugging. The format is specific:
@ -95,8 +95,10 @@
* DEBUG2("There was a big problem: %s in connptr %p", "hello", connptr); * DEBUG2("There was a big problem: %s in connptr %p", "hello", connptr);
*/ */
#ifndef NDEBUG #ifndef NDEBUG
# define DEBUG1(x) log_message(LOG_DEBUG, "[%s:%d] " x, __FILE__, __LINE__) # define DEBUG1(x) \
# define DEBUG2(x, y...) log_message(LOG_DEBUG, "[%s:%d] " x, __FILE__, __LINE__, ## y) log_message(LOG_DEBUG, "[%s:%d] " x, __FILE__, __LINE__)
# define DEBUG2(x, y...) \
log_message(LOG_DEBUG, "[%s:%d] " x, __FILE__, __LINE__, ## y)
#else #else
# define DEBUG1(x) do { } while(0) # define DEBUG1(x) do { } while(0)
# define DEBUG2(x, y...) do { } while(0) # define DEBUG2(x, y...) do { } while(0)

View File

@ -67,7 +67,9 @@
/* /*
* Codify the test for the carriage return and new line characters. * Codify the test for the carriage return and new line characters.
*/ */
#define CHECK_CRLF(header, len) ((len == 1 && header[0] == '\n') || (len == 2 && header[0] == '\r' && header[1] == '\n')) #define CHECK_CRLF(header, len) \
((len == 1 && header[0] == '\n') || \
(len == 2 && header[0] == '\r' && header[1] == '\n'))
/* /*
* This is a global variable which stores which ports are allowed by * This is a global variable which stores which ports are allowed by
@ -143,7 +145,8 @@ retry:
if (len <= 0) if (len <= 0)
{ {
log_message (LOG_ERR, log_message (LOG_ERR,
"read_request_line: Client (file descriptor: %d) closed socket before read.", "read_request_line: Client (file descriptor: %d) "
"closed socket before read.",
connptr->client_fd); connptr->client_fd);
return -1; return -1;
@ -1124,7 +1127,8 @@ process_client_headers (struct conn_s *connptr, hashmap_t hashofheaders)
indicate_http_error (connptr, 503, indicate_http_error (connptr, 503,
"Could not send data to remote server", "Could not send data to remote server",
"detail", "detail",
"A network error occurred while trying to write data to the remote web server.", "A network error occurred while "
"trying to write data to the remote web server.",
NULL); NULL);
goto PULL_CLIENT_DATA; goto PULL_CLIENT_DATA;
} }
@ -1150,7 +1154,9 @@ process_client_headers (struct conn_s *connptr, hashmap_t hashofheaders)
indicate_http_error (connptr, 503, indicate_http_error (connptr, 503,
"Could not send data to remote server", "Could not send data to remote server",
"detail", "detail",
"A network error occurred while trying to write data to the remote web server.", "A network error occurred while "
"trying to write data to the "
"remote web server.",
NULL); NULL);
goto PULL_CLIENT_DATA; goto PULL_CLIENT_DATA;
} }
@ -1244,8 +1250,9 @@ retry:
indicate_http_error (connptr, 503, indicate_http_error (connptr, 503,
"Could not retrieve all the headers", "Could not retrieve all the headers",
"detail", "detail",
PACKAGE PACKAGE " "
" was unable to retrieve and process headers from the remote web server.", "was unable to retrieve and process headers from "
"the remote web server.",
NULL); NULL);
return -1; return -1;
} }
@ -1430,7 +1437,8 @@ relay_connection (struct conn_s *connptr)
else if (ret < 0) else if (ret < 0)
{ {
log_message (LOG_ERR, log_message (LOG_ERR,
"relay_connection: select() error \"%s\". Closing connection (client_fd:%d, server_fd:%d)", "relay_connection: select() error \"%s\". "
"Closing connection (client_fd:%d, server_fd:%d)",
strerror (errno), connptr->client_fd, strerror (errno), connptr->client_fd,
connptr->server_fd); connptr->server_fd);
return; return;
@ -1532,13 +1540,15 @@ connect_to_upstream (struct conn_s *connptr, struct request_s *request)
indicate_http_error (connptr, 404, indicate_http_error (connptr, 404,
"Unable to connect to upstream proxy", "Unable to connect to upstream proxy",
"detail", "detail",
"A network error occurred while trying to connect to the upstream web proxy.", "A network error occurred while trying to "
"connect to the upstream web proxy.",
NULL); NULL);
return -1; return -1;
} }
log_message (LOG_CONN, log_message (LOG_CONN,
"Established connection to upstream proxy \"%s\" using file descriptor %d.", "Established connection to upstream proxy \"%s\" "
"using file descriptor %d.",
cur_upstream->host, connptr->server_fd); cur_upstream->host, connptr->server_fd);
/* /*
@ -1622,7 +1632,8 @@ handle_connection (int fd)
update_stats (STAT_DENIED); update_stats (STAT_DENIED);
indicate_http_error (connptr, 403, "Access denied", indicate_http_error (connptr, 403, "Access denied",
"detail", "detail",
"The administrator of this proxy has not configured it to service requests from your host.", "The administrator of this proxy has not configured "
"it to service requests from your host.",
NULL); NULL);
send_http_error_message (connptr); send_http_error_message (connptr);
destroy_conn (connptr); destroy_conn (connptr);
@ -1634,7 +1645,8 @@ handle_connection (int fd)
update_stats (STAT_BADCONN); update_stats (STAT_BADCONN);
indicate_http_error (connptr, 408, "Timeout", indicate_http_error (connptr, 408, "Timeout",
"detail", "detail",
"Server timeout waiting for the HTTP request from the client.", "Server timeout waiting for the HTTP request "
"from the client.",
NULL); NULL);
send_http_error_message (connptr); send_http_error_message (connptr);
destroy_conn (connptr); destroy_conn (connptr);
@ -1649,7 +1661,8 @@ handle_connection (int fd)
update_stats (STAT_BADCONN); update_stats (STAT_BADCONN);
indicate_http_error (connptr, 503, "Internal error", indicate_http_error (connptr, 503, "Internal error",
"detail", "detail",
"An internal server error occurred while processing your request. Please contact the administrator.", "An internal server error occurred while processing "
"your request. Please contact the administrator.",
NULL); NULL);
send_http_error_message (connptr); send_http_error_message (connptr);
destroy_conn (connptr); destroy_conn (connptr);
@ -1698,14 +1711,15 @@ handle_connection (int fd)
{ {
indicate_http_error (connptr, 500, "Unable to connect", indicate_http_error (connptr, 500, "Unable to connect",
"detail", "detail",
PACKAGE PACKAGE " "
" was unable to connect to the remote web server.", "was unable to connect to the remote web server.",
"error", strerror (errno), NULL); "error", strerror (errno), NULL);
goto send_error; goto send_error;
} }
log_message (LOG_CONN, log_message (LOG_CONN,
"Established connection to host \"%s\" using file descriptor %d.", "Established connection to host \"%s\" using "
"file descriptor %d.",
request->host, connptr->server_fd); request->host, connptr->server_fd);
if (!connptr->connect_method) if (!connptr->connect_method)
@ -1757,7 +1771,8 @@ send_error:
if (send_ssl_response (connptr) < 0) if (send_ssl_response (connptr) < 0)
{ {
log_message (LOG_ERR, log_message (LOG_ERR,
"handle_connection: Could not send SSL greeting to client."); "handle_connection: Could not send SSL greeting "
"to client.");
update_stats (STAT_BADCONN); update_stats (STAT_BADCONN);
destroy_conn (connptr); destroy_conn (connptr);
return; return;
@ -1767,7 +1782,8 @@ send_error:
relay_connection (connptr); relay_connection (connptr);
log_message (LOG_INFO, log_message (LOG_INFO,
"Closed connection between local client (fd:%d) and remote client (fd:%d)", "Closed connection between local client (fd:%d) "
"and remote client (fd:%d)",
connptr->client_fd, connptr->server_fd); connptr->client_fd, connptr->server_fd);
/* /*

View File

@ -51,7 +51,8 @@ reversepath_add (const char *path, const char *url)
if (path && *path != '/') if (path && *path != '/')
{ {
log_message (LOG_WARNING, log_message (LOG_WARNING,
"Skipping reverse proxy rule: path '%s' doesn't start with a /", "Skipping reverse proxy rule: path '%s' "
"doesn't start with a /",
path); path);
return; return;
} }

View File

@ -65,7 +65,8 @@ showstats (struct conn_s *connptr)
{ {
static char *msg = static char *msg =
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
"\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
"<html>\n" "<html>\n"
"<head><title>%s version %s run-time statistics</title></head>\n" "<head><title>%s version %s run-time statistics</title></head>\n"
"<body>\n" "<body>\n"

View File

@ -293,12 +293,14 @@ main (int argc, char **argv)
if (!config.user) if (!config.user)
{ {
log_message (LOG_WARNING, log_message (LOG_WARNING,
"You SHOULD set a UserName in the configuration file. Using current user instead."); "You SHOULD set a UserName in the configuration file. "
"Using current user instead.");
} }
if (config.idletimeout == 0) if (config.idletimeout == 0)
{ {
log_message (LOG_WARNING, log_message (LOG_WARNING,
"Invalid idle time setting. Only values greater than zero allowed; therefore setting idle timeout to %u seconds.", "Invalid idle time setting. Only values greater than zero "
"allowed; therefore setting idle timeout to %u seconds.",
MAX_IDLE_TIME); MAX_IDLE_TIME);
config.idletimeout = MAX_IDLE_TIME; config.idletimeout = MAX_IDLE_TIME;
} }

View File

@ -112,7 +112,8 @@ do_transparent_proxy (struct conn_s *connptr, hashmap_t hashofheaders,
connptr->client_fd); connptr->client_fd);
indicate_http_error (connptr, 400, "Bad Request", indicate_http_error (connptr, 400, "Bad Request",
"detail", "detail",
"You tried to connect to the machine the proxy is running on", "You tried to connect to the machine "
"the proxy is running on",
"url", url, NULL); "url", url, NULL);
return 0; return 0;
} }

View File

@ -144,7 +144,8 @@ create_file_safely (const char *filename, unsigned int truncate_file)
if (fstatinfo.st_nlink > 1 || !S_ISREG (lstatinfo.st_mode)) if (fstatinfo.st_nlink > 1 || !S_ISREG (lstatinfo.st_mode))
{ {
fprintf (stderr, fprintf (stderr,
"%s: The file %s has too many links, or is not a regular file: %s\n", "%s: The file %s has too many links, "
"or is not a regular file: %s\n",
PACKAGE, filename, strerror (errno)); PACKAGE, filename, strerror (errno));
close (fildes); close (fildes);
return -EMLINK; return -EMLINK;