Break at 80 columns
This commit is contained in:
		
							parent
							
								
									a257703e59
								
							
						
					
					
						commit
						4c1ede779e
					
				@ -332,7 +332,8 @@ write_buffer (int fd, struct buffer_s * buffptr)
 | 
			
		||||
	case ENOBUFS:
 | 
			
		||||
	case ENOMEM:
 | 
			
		||||
	  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);
 | 
			
		||||
	  return 0;
 | 
			
		||||
	default:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								src/child.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/child.c
									
									
									
									
									
								
							@ -237,7 +237,8 @@ child_main (struct child_s *ptr)
 | 
			
		||||
	  if (ptr->connects == child_config.maxrequestsperchild)
 | 
			
		||||
	    {
 | 
			
		||||
	      log_message (LOG_NOTICE,
 | 
			
		||||
			   "Child has reached MaxRequestsPerChild (%u). Killing child.",
 | 
			
		||||
			   "Child has reached MaxRequestsPerChild (%u). "
 | 
			
		||||
			   "Killing child.",
 | 
			
		||||
			   ptr->connects);
 | 
			
		||||
	      break;
 | 
			
		||||
	    }
 | 
			
		||||
@ -251,7 +252,8 @@ child_main (struct child_s *ptr)
 | 
			
		||||
	   * off.
 | 
			
		||||
	   */
 | 
			
		||||
	  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);
 | 
			
		||||
	  SERVER_COUNT_UNLOCK ();
 | 
			
		||||
 | 
			
		||||
@ -310,13 +312,15 @@ child_pool_create (void)
 | 
			
		||||
  if (child_config.maxclients == 0)
 | 
			
		||||
    {
 | 
			
		||||
      log_message (LOG_ERR,
 | 
			
		||||
		   "child_pool_create: \"MaxClients\" must be greater than zero.");
 | 
			
		||||
		   "child_pool_create: \"MaxClients\" must be "
 | 
			
		||||
		   "greater than zero.");
 | 
			
		||||
      return -1;
 | 
			
		||||
    }
 | 
			
		||||
  if (child_config.startservers == 0)
 | 
			
		||||
    {
 | 
			
		||||
      log_message (LOG_ERR,
 | 
			
		||||
		   "child_pool_create: \"StartServers\" must be greater than zero.");
 | 
			
		||||
		   "child_pool_create: \"StartServers\" must be "
 | 
			
		||||
		   "greater than zero.");
 | 
			
		||||
      return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -345,7 +349,8 @@ child_pool_create (void)
 | 
			
		||||
  if (child_config.startservers > child_config.maxclients)
 | 
			
		||||
    {
 | 
			
		||||
      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.startservers = child_config.maxclients;
 | 
			
		||||
    }
 | 
			
		||||
@ -404,7 +409,8 @@ child_main_loop (void)
 | 
			
		||||
      if (*servers_waiting < child_config.minspareservers)
 | 
			
		||||
	{
 | 
			
		||||
	  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);
 | 
			
		||||
 | 
			
		||||
	  SERVER_COUNT_UNLOCK ();
 | 
			
		||||
 | 
			
		||||
@ -80,7 +80,9 @@ typedef int (*CONFFILE_HANDLER) (struct config_s *, const char *,
 | 
			
		||||
 * The handling function must return 0 if the directive was processed
 | 
			
		||||
 * 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
 | 
			
		||||
 | 
			
		||||
@ -194,7 +194,8 @@ send_http_error_message (struct conn_s *connptr)
 | 
			
		||||
  int ret;
 | 
			
		||||
  char *fallback_error =
 | 
			
		||||
    "<?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"
 | 
			
		||||
    "<head><title>%d %s</title></head>\n"
 | 
			
		||||
    "<body>\n"
 | 
			
		||||
 | 
			
		||||
@ -87,7 +87,7 @@
 | 
			
		||||
#  define LOG_DEBUG   7
 | 
			
		||||
#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:
 | 
			
		||||
@ -95,8 +95,10 @@
 | 
			
		||||
 *    DEBUG2("There was a big problem: %s in connptr %p", "hello", connptr);
 | 
			
		||||
 */
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
# define DEBUG1(x)       log_message(LOG_DEBUG, "[%s:%d] " x, __FILE__, __LINE__)
 | 
			
		||||
# define DEBUG2(x, y...) log_message(LOG_DEBUG, "[%s:%d] " x, __FILE__, __LINE__, ## y)
 | 
			
		||||
# define DEBUG1(x) \
 | 
			
		||||
  log_message(LOG_DEBUG, "[%s:%d] " x, __FILE__, __LINE__)
 | 
			
		||||
# define DEBUG2(x, y...) \
 | 
			
		||||
  log_message(LOG_DEBUG, "[%s:%d] " x, __FILE__, __LINE__, ## y)
 | 
			
		||||
#else
 | 
			
		||||
# define DEBUG1(x)       do { } while(0)
 | 
			
		||||
# define DEBUG2(x, y...) do { } while(0)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										50
									
								
								src/reqs.c
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								src/reqs.c
									
									
									
									
									
								
							@ -67,7 +67,9 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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
 | 
			
		||||
@ -143,7 +145,8 @@ retry:
 | 
			
		||||
  if (len <= 0)
 | 
			
		||||
    {
 | 
			
		||||
      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);
 | 
			
		||||
 | 
			
		||||
      return -1;
 | 
			
		||||
@ -1124,7 +1127,8 @@ process_client_headers (struct conn_s *connptr, hashmap_t hashofheaders)
 | 
			
		||||
      indicate_http_error (connptr, 503,
 | 
			
		||||
			   "Could not send data to remote server",
 | 
			
		||||
			   "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);
 | 
			
		||||
      goto PULL_CLIENT_DATA;
 | 
			
		||||
    }
 | 
			
		||||
@ -1150,7 +1154,9 @@ process_client_headers (struct conn_s *connptr, hashmap_t hashofheaders)
 | 
			
		||||
		  indicate_http_error (connptr, 503,
 | 
			
		||||
				       "Could not send data to remote server",
 | 
			
		||||
				       "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);
 | 
			
		||||
		  goto PULL_CLIENT_DATA;
 | 
			
		||||
		}
 | 
			
		||||
@ -1244,8 +1250,9 @@ retry:
 | 
			
		||||
      indicate_http_error (connptr, 503,
 | 
			
		||||
			   "Could not retrieve all the headers",
 | 
			
		||||
			   "detail",
 | 
			
		||||
			   PACKAGE
 | 
			
		||||
			   " was unable to retrieve and process headers from the remote web server.",
 | 
			
		||||
			   PACKAGE " "
 | 
			
		||||
			   "was unable to retrieve and process headers from "
 | 
			
		||||
			   "the remote web server.",
 | 
			
		||||
			   NULL);
 | 
			
		||||
      return -1;
 | 
			
		||||
    }
 | 
			
		||||
@ -1430,7 +1437,8 @@ relay_connection (struct conn_s *connptr)
 | 
			
		||||
      else if (ret < 0)
 | 
			
		||||
	{
 | 
			
		||||
	  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,
 | 
			
		||||
		       connptr->server_fd);
 | 
			
		||||
	  return;
 | 
			
		||||
@ -1532,13 +1540,15 @@ connect_to_upstream (struct conn_s *connptr, struct request_s *request)
 | 
			
		||||
      indicate_http_error (connptr, 404,
 | 
			
		||||
			   "Unable to connect to upstream proxy",
 | 
			
		||||
			   "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);
 | 
			
		||||
      return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  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);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
@ -1622,7 +1632,8 @@ handle_connection (int fd)
 | 
			
		||||
      update_stats (STAT_DENIED);
 | 
			
		||||
      indicate_http_error (connptr, 403, "Access denied",
 | 
			
		||||
			   "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);
 | 
			
		||||
      send_http_error_message (connptr);
 | 
			
		||||
      destroy_conn (connptr);
 | 
			
		||||
@ -1634,7 +1645,8 @@ handle_connection (int fd)
 | 
			
		||||
      update_stats (STAT_BADCONN);
 | 
			
		||||
      indicate_http_error (connptr, 408, "Timeout",
 | 
			
		||||
			   "detail",
 | 
			
		||||
			   "Server timeout waiting for the HTTP request from the client.",
 | 
			
		||||
			   "Server timeout waiting for the HTTP request "
 | 
			
		||||
			   "from the client.",
 | 
			
		||||
			   NULL);
 | 
			
		||||
      send_http_error_message (connptr);
 | 
			
		||||
      destroy_conn (connptr);
 | 
			
		||||
@ -1649,7 +1661,8 @@ handle_connection (int fd)
 | 
			
		||||
      update_stats (STAT_BADCONN);
 | 
			
		||||
      indicate_http_error (connptr, 503, "Internal error",
 | 
			
		||||
			   "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);
 | 
			
		||||
      send_http_error_message (connptr);
 | 
			
		||||
      destroy_conn (connptr);
 | 
			
		||||
@ -1698,14 +1711,15 @@ handle_connection (int fd)
 | 
			
		||||
	{
 | 
			
		||||
	  indicate_http_error (connptr, 500, "Unable to connect",
 | 
			
		||||
			       "detail",
 | 
			
		||||
			       PACKAGE
 | 
			
		||||
			       " was unable to connect to the remote web server.",
 | 
			
		||||
			       PACKAGE " "
 | 
			
		||||
			       "was unable to connect to the remote web server.",
 | 
			
		||||
			       "error", strerror (errno), NULL);
 | 
			
		||||
	  goto send_error;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      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);
 | 
			
		||||
 | 
			
		||||
      if (!connptr->connect_method)
 | 
			
		||||
@ -1757,7 +1771,8 @@ send_error:
 | 
			
		||||
      if (send_ssl_response (connptr) < 0)
 | 
			
		||||
	{
 | 
			
		||||
	  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);
 | 
			
		||||
	  destroy_conn (connptr);
 | 
			
		||||
	  return;
 | 
			
		||||
@ -1767,7 +1782,8 @@ send_error:
 | 
			
		||||
  relay_connection (connptr);
 | 
			
		||||
 | 
			
		||||
  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);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
 | 
			
		||||
@ -51,7 +51,8 @@ reversepath_add (const char *path, const char *url)
 | 
			
		||||
  if (path && *path != '/')
 | 
			
		||||
    {
 | 
			
		||||
      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);
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -65,7 +65,8 @@ showstats (struct conn_s *connptr)
 | 
			
		||||
{
 | 
			
		||||
  static char *msg =
 | 
			
		||||
    "<?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"
 | 
			
		||||
    "<head><title>%s version %s run-time statistics</title></head>\n"
 | 
			
		||||
    "<body>\n"
 | 
			
		||||
 | 
			
		||||
@ -293,12 +293,14 @@ main (int argc, char **argv)
 | 
			
		||||
  if (!config.user)
 | 
			
		||||
    {
 | 
			
		||||
      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)
 | 
			
		||||
    {
 | 
			
		||||
      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);
 | 
			
		||||
      config.idletimeout = MAX_IDLE_TIME;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -112,7 +112,8 @@ do_transparent_proxy (struct conn_s *connptr, hashmap_t hashofheaders,
 | 
			
		||||
		   connptr->client_fd);
 | 
			
		||||
      indicate_http_error (connptr, 400, "Bad Request",
 | 
			
		||||
			   "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);
 | 
			
		||||
      return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -144,7 +144,8 @@ create_file_safely (const char *filename, unsigned int truncate_file)
 | 
			
		||||
      if (fstatinfo.st_nlink > 1 || !S_ISREG (lstatinfo.st_mode))
 | 
			
		||||
	{
 | 
			
		||||
	  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));
 | 
			
		||||
	  close (fildes);
 | 
			
		||||
	  return -EMLINK;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user