httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@hyperreal.org
Subject cvs commit: apache-1.3/src/modules/proxy mod_proxy.c mod_proxy.h proxy_cache.c proxy_connect.c proxy_ftp.c proxy_http.c proxy_util.c
Date Wed, 27 May 1998 22:56:08 GMT
martin      98/05/27 15:56:07

  Modified:    src      CHANGES
               src/include compat.h
               src/main http_protocol.c http_request.c
               src/modules/proxy mod_proxy.c mod_proxy.h proxy_cache.c
                        proxy_connect.c proxy_ftp.c proxy_http.c
                        proxy_util.c
  Log:
  Make ErrorDocuments work for proxy error messages.
  Define "error-notes" as a  communication channel modules->core
  
  PR: 494, 1259
  Reviewed by:	Dean Gaudet, Marc Slemco, Chuck Murcko
  
  Revision  Changes    Path
  1.866     +12 -0     apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.865
  retrieving revision 1.866
  diff -u -u -r1.865 -r1.866
  --- CHANGES	1998/05/27 15:29:28	1.865
  +++ CHANGES	1998/05/27 22:55:50	1.866
  @@ -1,5 +1,17 @@
   Changes with Apache 1.3b8
   
  +  *) Proxy Fix: The proxy special failure routine ap_proxyerror()
  +     was updated to use the normal apache error processing, thereby allowing
  +     proxy errors to be treated by ErrorDocument's as well. For this
  +     purpose, a new module-to-core communication variable "error-notes"
  +     was introduced; the proxy (and possibly other modules) communicates
  +     its error text using this variable. Its content is copied to a new
  +     cgi-env-var REDIRECT_ERROR_NOTES for use by ErrorDocuments.
  +     The old proxy special error routine ap_proxy_log_uerror()
  +     was replaced by regular ap_log_error() calls, many messages were made
  +     more informative. 
  +     [Martin Kraemer] PR#494, 1259
  +
     *) [SECURITY] A possible buffer overflow in the ftp proxy was fixed.
        [Martin Kraemer]
   
  
  
  
  1.9       +0 -1      apache-1.3/src/include/compat.h
  
  Index: compat.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/compat.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -u -r1.8 -r1.9
  --- compat.h	1998/05/27 14:01:30	1.8
  +++ compat.h	1998/05/27 22:55:59	1.9
  @@ -284,7 +284,6 @@
   #define proxy_is_ipaddr                ap_proxy_is_ipaddr
   #define proxy_is_word                  ap_proxy_is_word
   #define proxy_liststr                  ap_proxy_liststr
  -#define proxy_log_uerror               ap_proxy_log_uerror
   #define proxy_read_headers             ap_proxy_read_headers
   #define proxy_sec2hex                  ap_proxy_sec2hex
   #define proxy_send_fb                  ap_proxy_send_fb
  
  
  
  1.217     +165 -144  apache-1.3/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
  retrieving revision 1.216
  retrieving revision 1.217
  diff -u -u -r1.216 -r1.217
  --- http_protocol.c	1998/05/27 14:01:33	1.216
  +++ http_protocol.c	1998/05/27 22:55:59	1.217
  @@ -1950,25 +1950,25 @@
       if (status == HTTP_NOT_MODIFIED) {
           if (!is_empty_table(r->err_headers_out))
               r->headers_out = ap_overlay_tables(r->pool, r->err_headers_out,
  -                                            r->headers_out);
  +                                               r->headers_out);
           ap_hard_timeout("send 304", r);
   
           ap_basic_http_header(r);
           ap_set_keepalive(r);
   
  -        ap_table_do((int (*)(void *, const char *, const char *))ap_send_header_field,
  -                 (void *) r, r->headers_out,
  -                 "Connection",
  -                 "Keep-Alive",
  -                 "ETag",
  -                 "Content-Location",
  -                 "Expires",
  -                 "Cache-Control",
  -                 "Vary",
  -                 "Warning",
  -                 "WWW-Authenticate",
  -                 "Proxy-Authenticate",
  -                 NULL);
  +        ap_table_do((int (*)(void *, const char *, const char *)) ap_send_header_field,
  +                    (void *) r, r->headers_out,
  +                    "Connection",
  +                    "Keep-Alive",
  +                    "ETag",
  +                    "Content-Location",
  +                    "Expires",
  +                    "Cache-Control",
  +                    "Vary",
  +                    "Warning",
  +                    "WWW-Authenticate",
  +                    "Proxy-Authenticate",
  +                    NULL);
   
           terminate_header(r->connection->client);
   
  @@ -2044,144 +2044,165 @@
       }
       {
           char *title = status_lines[idx];
  +        char *h1;
  +        char *error_notes;
  +
  +        /* Accept a status_line set by a module, but only if it begins
  +         * with the 3 digit status code
  +         */
  +        if (r->status_line != NULL
  +            && strlen(r->status_line) > 4       /* long enough */
  +            && isdigit(r->status_line[0])
  +            && isdigit(r->status_line[1])
  +            && isdigit(r->status_line[2])
  +            && isspace(r->status_line[3])
  +            && isalnum(r->status_line[4])) {
  +            title = r->status_line;
  +        }
  +
           /* folks decided they didn't want the error code in the H1 text */
  +        h1 = &title[4];
   
  -        char *h1 = 4 + status_lines[idx];
  +        ap_bvputs(fd,
  +                  "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
  +                  "<HTML><HEAD>\n<TITLE>", title,
  +                  "</TITLE>\n</HEAD><BODY>\n<H1>", h1, "</H1>\n",
  +                  NULL);
   
  -        ap_bvputs(fd, "<HTML><HEAD>\n<TITLE>", title,
  -               "</TITLE>\n</HEAD><BODY>\n<H1>", h1, "</H1>\n",
  -               NULL);
  -
  -        switch (status) {
  -        case REDIRECT:
  -        case MOVED:
  -            ap_bvputs(fd, "The document has moved <A HREF=\"",
  -                   ap_escape_html(r->pool, location), "\">here</A>.<P>\n", NULL);
  -            break;
  -        case HTTP_SEE_OTHER:
  -            ap_bvputs(fd, "The answer to your request is located <A HREF=\"",
  -                   ap_escape_html(r->pool, location), "\">here</A>.<P>\n", NULL);
  -            break;
  -        case HTTP_USE_PROXY:
  -            ap_bvputs(fd, "This resource is only accessible through the proxy\n",
  -                   ap_escape_html(r->pool, location), "<BR>\nYou will need to ",
  -                   "configure your client to use that proxy.<P>\n", NULL);
  -            break;
  -        case HTTP_PROXY_AUTHENTICATION_REQUIRED:
  -        case AUTH_REQUIRED:
  -            ap_bputs("This server could not verify that you\n", fd);
  -            ap_bputs("are authorized to access the document you\n", fd);
  -            ap_bputs("requested.  Either you supplied the wrong\n", fd);
  -            ap_bputs("credentials (e.g., bad password), or your\n", fd);
  -            ap_bputs("browser doesn't understand how to supply\n", fd);
  -            ap_bputs("the credentials required.<P>\n", fd);
  -            break;
  -        case BAD_REQUEST:
  -            ap_bputs("Your browser sent a request that\n", fd);
  -            ap_bputs("this server could not understand.<P>\n", fd);
  -            break;
  -        case HTTP_FORBIDDEN:
  -            ap_bvputs(fd, "You don't have permission to access ",
  -                   ap_escape_html(r->pool, r->uri), "\non this server.<P>\n",
  -                   NULL);
  -            break;
  -        case NOT_FOUND:
  -            ap_bvputs(fd, "The requested URL ", ap_escape_html(r->pool, r->uri),
  -                   " was not found on this server.<P>\n", NULL);
  -            break;
  -        case METHOD_NOT_ALLOWED:
  -            ap_bvputs(fd, "The requested method ", r->method, " is not allowed "
  -                   "for the URL ", ap_escape_html(r->pool, r->uri),
  -                   ".<P>\n", NULL);
  -            break;
  -        case NOT_ACCEPTABLE:
  -            ap_bvputs(fd,
  -                   "An appropriate representation of the requested resource ",
  -                   ap_escape_html(r->pool, r->uri),
  -                   " could not be found on this server.<P>\n", NULL);
  -            /* fall through */
  -        case MULTIPLE_CHOICES:
  -            {
  -                char *list;
  -                if ((list = ap_table_get(r->notes, "variant-list")))
  -                    ap_bputs(list, fd);
  -            }
  -            break;
  -        case LENGTH_REQUIRED:
  -            ap_bvputs(fd, "A request of the requested method ", r->method,
  -                   " requires a valid Content-length.<P>\n", NULL);
  -            break;
  -        case PRECONDITION_FAILED:
  -            ap_bvputs(fd, "The precondition on the request for the URL ",
  -                   ap_escape_html(r->pool, r->uri), " evaluated to false.<P>\n",
  -                   NULL);
  -            break;
  -        case NOT_IMPLEMENTED:
  -            ap_bvputs(fd, ap_escape_html(r->pool, r->method), " to ",
  -                   ap_escape_html(r->pool, r->uri), " not supported.<P>\n", NULL);
  -            break;
  -        case BAD_GATEWAY:
  -            ap_bputs("The proxy server received an invalid\015\012", fd);
  -            ap_bputs("response from an upstream server.<P>\015\012", fd);
  -            break;
  -        case VARIANT_ALSO_VARIES:
  -            ap_bvputs(fd, "A variant for the requested entity  ",
  -                   ap_escape_html(r->pool, r->uri), " is itself a ",
  -                   "transparently negotiable resource.<P>\n", NULL);
  -            break;
  -        case HTTP_REQUEST_TIME_OUT:
  -            ap_bputs("I'm tired of waiting for your request.\n", fd);
  -            break;
  -        case HTTP_GONE:
  -            ap_bvputs(fd, "The requested resource<BR>",
  -                   ap_escape_html(r->pool, r->uri),
  -                   "<BR>\nis no longer available on this server ",
  -                   "and there is no forwarding address.\n",
  -                   "Please remove all references to this resource.\n", NULL);
  -            break;
  -        case HTTP_REQUEST_ENTITY_TOO_LARGE:
  -            ap_bvputs(fd, "The requested resource<BR>",
  -                   ap_escape_html(r->pool, r->uri), "<BR>\n",
  -                   "does not allow request data with ", r->method,
  -                   " requests, or the amount of data provided in\n",
  -                   "the request exceeds the capacity limit.\n", NULL);
  -            break;
  -        case HTTP_REQUEST_URI_TOO_LARGE:
  -            ap_bputs("The requested URL's length exceeds the capacity\n", fd);
  -            ap_bputs("limit for this server.\n", fd);
  -            break;
  -        case HTTP_UNSUPPORTED_MEDIA_TYPE:
  -            ap_bputs("The supplied request data is not in a format\n", fd);
  -            ap_bputs("acceptable for processing by this resource.\n", fd);
  -            break;
  -        case HTTP_SERVICE_UNAVAILABLE:
  -            ap_bputs("The server is temporarily unable to service your\n", fd);
  -            ap_bputs("request due to maintenance downtime or capacity\n", fd);
  -            ap_bputs("problems. Please try again later.\n", fd);
  -            break;
  -        case HTTP_GATEWAY_TIME_OUT:
  -            ap_bputs("The proxy server did not receive a timely response\n", fd);
  -            ap_bputs("from the upstream server.<P>\n", fd);
  -            break;
  -        default:                /* HTTP_INTERNAL_SERVER_ERROR */
  -            ap_bputs("The server encountered an internal error or\n", fd);
  -            ap_bputs("misconfiguration and was unable to complete\n", fd);
  -            ap_bputs("your request.<P>\n", fd);
  -            ap_bputs("Please contact the server administrator,\n ", fd);
  -            ap_bputs(ap_escape_html(r->pool, r->server->server_admin), fd);
  -            ap_bputs(" and inform them of the time the error occurred,\n", fd);
  -            ap_bputs("and anything you might have done that may have\n", fd);
  -            ap_bputs("caused the error.<P>\n", fd);
  -            break;
  +        if ((error_notes = ap_table_get(r->notes, "error-notes"))) {
  +            ap_bputs(error_notes, fd);
           }
  +        else
  +            switch (status) {
  +            case REDIRECT:
  +            case MOVED:
  +                ap_bvputs(fd, "The document has moved <A HREF=\"",
  +                          ap_escape_html(r->pool, location), "\">here</A>.<P>\n", NULL);
  +                break;
  +            case HTTP_SEE_OTHER:
  +                ap_bvputs(fd, "The answer to your request is located <A HREF=\"",
  +                          ap_escape_html(r->pool, location), "\">here</A>.<P>\n", NULL);
  +                break;
  +            case HTTP_USE_PROXY:
  +                ap_bvputs(fd, "This resource is only accessible through the proxy\n",
  +                ap_escape_html(r->pool, location), "<BR>\nYou will need to ",
  +                     "configure your client to use that proxy.<P>\n", NULL);
  +                break;
  +            case HTTP_PROXY_AUTHENTICATION_REQUIRED:
  +            case AUTH_REQUIRED:
  +                ap_bputs("This server could not verify that you\n", fd);
  +                ap_bputs("are authorized to access the document you\n", fd);
  +                ap_bputs("requested.  Either you supplied the wrong\n", fd);
  +                ap_bputs("credentials (e.g., bad password), or your\n", fd);
  +                ap_bputs("browser doesn't understand how to supply\n", fd);
  +                ap_bputs("the credentials required.<P>\n", fd);
  +                break;
  +            case BAD_REQUEST:
  +                ap_bputs("Your browser sent a request that\n", fd);
  +                ap_bputs("this server could not understand.<P>\n", fd);
  +                break;
  +            case HTTP_FORBIDDEN:
  +                ap_bvputs(fd, "You don't have permission to access ",
  +                  ap_escape_html(r->pool, r->uri), "\non this server.<P>\n",
  +                          NULL);
  +                break;
  +            case NOT_FOUND:
  +                ap_bvputs(fd, "The requested URL ", ap_escape_html(r->pool, r->uri),
  +                          " was not found on this server.<P>\n", NULL);
  +                break;
  +            case METHOD_NOT_ALLOWED:
  +                ap_bvputs(fd, "The requested method ", r->method, " is not allowed "
  +                          "for the URL ", ap_escape_html(r->pool, r->uri),
  +                          ".<P>\n", NULL);
  +                break;
  +            case NOT_ACCEPTABLE:
  +                ap_bvputs(fd,
  +                 "An appropriate representation of the requested resource ",
  +                          ap_escape_html(r->pool, r->uri),
  +                          " could not be found on this server.<P>\n", NULL);
  +                /* fall through */
  +            case MULTIPLE_CHOICES:
  +                {
  +                    char *list;
  +                    if ((list = ap_table_get(r->notes, "variant-list")))
  +                        ap_bputs(list, fd);
  +                }
  +                break;
  +            case LENGTH_REQUIRED:
  +                ap_bvputs(fd, "A request of the requested method ", r->method,
  +                          " requires a valid Content-length.<P>\n", NULL);
  +                break;
  +            case PRECONDITION_FAILED:
  +                ap_bvputs(fd, "The precondition on the request for the URL ",
  +                ap_escape_html(r->pool, r->uri), " evaluated to false.<P>\n",
  +                          NULL);
  +                break;
  +            case NOT_IMPLEMENTED:
  +                ap_bvputs(fd, ap_escape_html(r->pool, r->method), " to ",
  +                          ap_escape_html(r->pool, r->uri), " not supported.<P>\n", NULL);
  +                break;
  +            case BAD_GATEWAY:
  +                ap_bputs("The proxy server received an invalid\015\012", fd);
  +                ap_bputs("response from an upstream server.<P>\015\012", fd);
  +                break;
  +            case VARIANT_ALSO_VARIES:
  +                ap_bvputs(fd, "A variant for the requested entity  ",
  +                          ap_escape_html(r->pool, r->uri), " is itself a ",
  +                          "transparently negotiable resource.<P>\n", NULL);
  +                break;
  +            case HTTP_REQUEST_TIME_OUT:
  +                ap_bputs("I'm tired of waiting for your request.\n", fd);
  +                break;
  +            case HTTP_GONE:
  +                ap_bvputs(fd, "The requested resource<BR>",
  +                          ap_escape_html(r->pool, r->uri),
  +                          "<BR>\nis no longer available on this server ",
  +                          "and there is no forwarding address.\n",
  +                  "Please remove all references to this resource.\n", NULL);
  +                break;
  +            case HTTP_REQUEST_ENTITY_TOO_LARGE:
  +                ap_bvputs(fd, "The requested resource<BR>",
  +                          ap_escape_html(r->pool, r->uri), "<BR>\n",
  +                          "does not allow request data with ", r->method,
  +                          " requests, or the amount of data provided in\n",
  +                          "the request exceeds the capacity limit.\n", NULL);
  +                break;
  +            case HTTP_REQUEST_URI_TOO_LARGE:
  +                ap_bputs("The requested URL's length exceeds the capacity\n", fd);
  +                ap_bputs("limit for this server.\n", fd);
  +                break;
  +            case HTTP_UNSUPPORTED_MEDIA_TYPE:
  +                ap_bputs("The supplied request data is not in a format\n", fd);
  +                ap_bputs("acceptable for processing by this resource.\n", fd);
  +                break;
  +            case HTTP_SERVICE_UNAVAILABLE:
  +                ap_bputs("The server is temporarily unable to service your\n", fd);
  +                ap_bputs("request due to maintenance downtime or capacity\n", fd);
  +                ap_bputs("problems. Please try again later.\n", fd);
  +                break;
  +            case HTTP_GATEWAY_TIME_OUT:
  +                ap_bputs("The proxy server did not receive a timely response\n", fd);
  +                ap_bputs("from the upstream server.<P>\n", fd);
  +                break;
  +            default:            /* HTTP_INTERNAL_SERVER_ERROR */
  +                ap_bputs("The server encountered an internal error or\n", fd);
  +                ap_bputs("misconfiguration and was unable to complete\n", fd);
  +                ap_bputs("your request.<P>\n", fd);
  +                ap_bputs("Please contact the server administrator,\n ", fd);
  +                ap_bputs(ap_escape_html(r->pool, r->server->server_admin), fd);
  +                ap_bputs(" and inform them of the time the error occurred,\n", fd);
  +                ap_bputs("and anything you might have done that may have\n", fd);
  +                ap_bputs("caused the error.<P>\n", fd);
  +                break;
  +            }
   
           if (recursive_error) {
               ap_bvputs(fd, "<P>Additionally, a ",
  -                   status_lines[ap_index_of_response(recursive_error)],
  -                   "\nerror was encountered while trying to use an "
  -                   "ErrorDocument to handle the request.\n", NULL);
  +                      status_lines[ap_index_of_response(recursive_error)],
  +                      "\nerror was encountered while trying to use an "
  +                      "ErrorDocument to handle the request.\n", NULL);
           }
  -	ap_bputs(ap_psignature("<HR>\n", r), fd);
  +        ap_bputs(ap_psignature("<HR>\n", r), fd);
           ap_bputs("</BODY></HTML>\n", fd);
       }
       ap_kill_timeout(r);
  
  
  
  1.122     +10 -0     apache-1.3/src/main/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_request.c,v
  retrieving revision 1.121
  retrieving revision 1.122
  diff -u -u -r1.121 -r1.122
  --- http_request.c	1998/05/02 23:25:46	1.121
  +++ http_request.c	1998/05/27 22:56:00	1.122
  @@ -943,6 +943,7 @@
               ap_table_setn(r->headers_out, "Location", custom_response);
           }
           else if (custom_response[0] == '/') {
  +            char *error_notes;
               r->no_local_copy = 1;       /* Do NOT send USE_LOCAL_COPY for
                                            * error documents! */
               /*
  @@ -950,6 +951,15 @@
                * method was.
                */
               ap_table_setn(r->subprocess_env, "REQUEST_METHOD", r->method);
  +
  +	    /*
  +	     * Provide a special method for modules to communicate
  +	     * more informative (than the plain canned) messages to us.
  +	     * Propagate them to ErrorDocuments via the ERROR_NOTES variable:
  +	     */
  +            if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) {
  +		ap_table_setn(r->subprocess_env, "ERROR_NOTES", error_notes);
  +	    }
               r->method = ap_pstrdup(r->pool, "GET");
               r->method_number = M_GET;
               ap_internal_redirect(custom_response, r);
  
  
  
  1.53      +15 -16    apache-1.3/src/modules/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -u -r1.52 -r1.53
  --- mod_proxy.c	1998/05/27 14:01:37	1.52
  +++ mod_proxy.c	1998/05/27 22:56:02	1.53
  @@ -266,7 +266,7 @@
   				  UNP_REVEALPASSWORD);
   
       ap_table_set(r->headers_out, "Location", nuri);
  -    ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r->server,
  +    ap_log_error(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, r->server,
   		"Domain missing: %s sent to %s%s%s", r->uri,
   		ap_unparse_uri_components(r->pool, &r->parsed_uri,
   		      UNP_OMITUSERINFO),
  @@ -328,11 +328,9 @@
   	    direct_connect = list[ii].matcher(&list[ii], r);
   	}
   #if DEBUGGING
  -	{
  -	    char msg[256];
  -	    sprintf(msg, (direct_connect) ? "NoProxy for %s" : "UseProxy for %s", r->uri);
  -	    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, msg);
  -	}
  +	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server,
  +		     (direct_connect) ? "NoProxy for %s" : "UseProxy for %s",
  +		     r->uri);
   #endif
       }
   
  @@ -422,11 +420,11 @@
   
       p = strchr(r, ':');
       if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0')
  -	return "Bad syntax for a remote proxy server";
  +	return "ProxyRemote: Bad syntax for a remote proxy server";
       q = strchr(p + 3, ':');
       if (q != NULL) {
   	if (sscanf(q + 1, "%u", &port) != 1 || port > 65535)
  -	    return "Bad syntax for a remote proxy server (bad port number)";
  +	    return "ProxyRemote: Bad syntax for a remote proxy server (bad port number)";
   	*q = '\0';
       }
       else
  @@ -504,6 +502,7 @@
   	new->name = arg;
   	/* Don't do name lookups on things that aren't dotted */
   	if (strchr(arg, '.') != NULL && ap_proxy_host2addr(new->name, &hp) == NULL)
  +	    /*@@@FIXME: This copies only the first of (possibly many) IP addrs */
   	    memcpy(&new->addr, hp.h_addr, sizeof(struct in_addr));
   	else
   	    new->addr.s_addr = 0;
  @@ -571,7 +570,7 @@
       ap_get_module_config(parms->server->module_config, &proxy_module);
   
       if (arg[0] != '.')
  -	return "Domain name must start with a dot.";
  +	return "ProxyDomain: domain name must start with a dot.";
   
       psf->domain = arg;
       return NULL;
  @@ -596,7 +595,7 @@
       int val;
   
       if (sscanf(arg, "%d", &val) != 1)
  -	return "Value must be an integer";
  +	return "CacheSize value must be an integer (kBytes)";
       psf->cache.space = val;
       return NULL;
   }
  @@ -620,7 +619,7 @@
       double val;
   
       if (sscanf(arg, "%lg", &val) != 1)
  -	return "Value must be a float";
  +	return "CacheLastModifiedFactor value must be a float";
       psf->cache.lmfactor = val;
   
       return NULL;
  @@ -634,7 +633,7 @@
       double val;
   
       if (sscanf(arg, "%lg", &val) != 1)
  -	return "Value must be a float";
  +	return "CacheMaxExpire value must be a float";
       psf->cache.maxexpire = (int) (val * (double) SEC_ONE_HR);
       return NULL;
   }
  @@ -647,7 +646,7 @@
       double val;
   
       if (sscanf(arg, "%lg", &val) != 1)
  -	return "Value must be a float";
  +	return "CacheDefaultExpire value must be a float";
       psf->cache.defaultexpire = (int) (val * (double) SEC_ONE_HR);
       return NULL;
   }
  @@ -660,7 +659,7 @@
       double val;
   
       if (sscanf(arg, "%lg", &val) != 1)
  -	return "Value must be a float";
  +	return "CacheGcInterval value must be a float";
       psf->cache.gcinterval = (int) (val * (double) SEC_ONE_HR);
       return NULL;
   }
  @@ -674,7 +673,7 @@
   
       val = atoi(arg);
       if (val < 1)
  -	return "Value must be an integer greater than 0";
  +	return "CacheDirLevels value must be an integer greater than 0";
       if (val * psf->cache.dirlength > CACHEFILE_LEN)
   	return "CacheDirLevels*CacheDirLength value must not be higher than 20";
       psf->cache.dirlevels = val;
  @@ -690,7 +689,7 @@
   
       val = atoi(arg);
       if (val < 1)
  -	return "Value must be an integer greater than 0";
  +	return "CacheDirLength value must be an integer greater than 0";
       if (val * psf->cache.dirlevels > CACHEFILE_LEN)
   	return "CacheDirLevels*CacheDirLength value must not be higher than 20";
       psf->cache.dirlength = val;
  
  
  
  1.34      +0 -2      apache-1.3/src/modules/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.h,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -u -r1.33 -r1.34
  --- mod_proxy.h	1998/04/11 12:00:39	1.33
  +++ mod_proxy.h	1998/05/27 22:56:04	1.34
  @@ -285,8 +285,6 @@
   void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength);
   int ap_proxy_hex2sec(const char *x);
   void ap_proxy_sec2hex(int t, char *y);
  -void ap_proxy_log_uerror(const char *routine, const char *file, const char *err,
  -		      server_rec *s);
   BUFF *ap_proxy_cache_error(struct cache_req *r);
   int ap_proxyerror(request_rec *r, const char *message);
   const char *ap_proxy_host2addr(const char *host, struct hostent *reqhp);
  
  
  
  1.40      +71 -48    apache-1.3/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -u -r1.39 -r1.40
  --- proxy_cache.c	1998/05/15 09:01:38	1.39
  +++ proxy_cache.c	1998/05/27 22:56:04	1.40
  @@ -166,13 +166,15 @@
       strcat(filename, "/.time");
       if (stat(filename, &buf) == -1) {	/* does not exist */
   	if (errno != ENOENT) {
  -	    ap_proxy_log_uerror("stat", filename, NULL, r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy: stat(%s)", filename);
   	    ap_unblock_alarms();
   	    return;
   	}
   	if ((timefd = creat(filename, 0666)) == -1) {
   	    if (errno != EEXIST)
  -		ap_proxy_log_uerror("creat", filename, NULL, r->server);
  +		ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			     "proxy: creat(%s)", filename);
   	    else
   		lastcheck = abs(garbage_now);	/* someone else got in there */
   	    ap_unblock_alarms();
  @@ -187,7 +189,8 @@
   	    return;
   	}
   	if (utime(filename, NULL) == -1)
  -	    ap_proxy_log_uerror("utimes", filename, NULL, r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy: utimes(%s)", filename);
       }
       files = ap_make_array(r->pool, 100, sizeof(struct gc_ent *));
       curblocks = 0;
  @@ -212,7 +215,8 @@
   #else
   	if (unlink(filename) == -1) {
   	    if (errno != ENOENT)
  -		ap_proxy_log_uerror("unlink", filename, NULL, r->server);
  +		ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			     "proxy gc: unlink(%s)", filename);
   	}
   	else
   #endif
  @@ -250,7 +254,8 @@
       Explain1("GC Examining directory %s", cachedir);
       dir = opendir(cachedir);
       if (dir == NULL) {
  -	ap_proxy_log_uerror("opendir", cachedir, NULL, r->server);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +		     "proxy gc: opendir(%s)", cachedir);
   	return 0;
       }
   
  @@ -264,11 +269,14 @@
   /* then stat it to see how old it is; delete temporary files > 1 day old */
   	    if (stat(filename, &buf) == -1) {
   		if (errno != ENOENT)
  -		    ap_proxy_log_uerror("stat", filename, NULL, r->server);
  +		    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +				 "proxy gc: stat(%s)", filename);
   	    }
   	    else if (garbage_now != -1 && buf.st_atime < garbage_now - SEC_ONE_DAY &&
   		     buf.st_mtime < garbage_now - SEC_ONE_DAY) {
   		Explain1("GC unlink %s", filename);
  +		ap_log_error(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, r->server,
  +			     "proxy gc: deleting orphaned cache file %s", filename);
   #if TESTING
   		fprintf(stderr, "Would unlink %s\n", filename);
   #else
  @@ -307,12 +315,13 @@
   	fd = open(filename, O_RDONLY | O_BINARY);
   	if (fd == -1) {
   	    if (errno != ENOENT)
  -		ap_proxy_log_uerror("open", filename, NULL,
  -				 r->server);
  +		ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			     "proxy gc: open(%s)", filename);
   	    continue;
   	}
   	if (fstat(fd, &buf) == -1) {
  -	    ap_proxy_log_uerror("fstat", filename, NULL, r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy gc: fstat(%s)", filename);
   	    close(fd);
   	    continue;
   	}
  @@ -339,12 +348,12 @@
   #endif
   
   	i = read(fd, line, 26);
  +	close(fd);
   	if (i == -1) {
  -	    ap_proxy_log_uerror("read", filename, NULL, r->server);
  -	    close(fd);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy gc: read(%s)", filename);
   	    continue;
   	}
  -	close(fd);
   	line[i] = '\0';
   	garbage_expire = ap_proxy_hex2sec(line + 18);
   	if (!ap_checkmask(line, "&&&&&&&& &&&&&&&& &&&&&&&&") ||
  @@ -352,7 +361,8 @@
   	    /* bad file */
   	    if (garbage_now != -1 && buf.st_atime > garbage_now + SEC_ONE_DAY &&
   		buf.st_mtime > garbage_now + SEC_ONE_DAY) {
  -		ap_log_error_old("proxy: deleting bad cache file", r->server);
  +		ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, r->server,
  +			     "proxy: deleting bad cache file with future date: %s", filename);
   #if TESTING
   		fprintf(stderr, "Would unlink bad file %s\n", filename);
   #else
  @@ -532,8 +542,9 @@
   	    ap_bpushfd(cachefp, cfd, cfd);
   	}
   	else if (errno != ENOENT)
  -	    ap_proxy_log_uerror("open", c->filename,
  -			     "proxy: error opening cache file", r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy: error opening cache file %s",
  +			 c->filename);
   #ifdef EXPLAIN
   	else
   	    Explain1("File %s not found", c->filename);
  @@ -543,10 +554,12 @@
       if (cachefp != NULL) {
   	i = rdcache(r->pool, cachefp, c);
   	if (i == -1)
  -	    ap_proxy_log_uerror("read", c->filename,
  -			     "proxy: error reading cache file", r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy: error reading cache file %s", 
  +			 c->filename);
   	else if (i == 0)
  -	    ap_log_error_old("proxy: bad cache file", r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r->server,
  +			 "proxy: bad (short?) cache file: %s", c->filename);
   	if (i != 1) {
   	    ap_pclosef(r->pool, cachefp->fd);
   	    cachefp = NULL;
  @@ -796,11 +809,13 @@
   	    if (lmod != c->lmod || expc != c->expire || date != c->date) {
   		off_t curpos = lseek(c->fp->fd, 0, SEEK_SET);
   		if (curpos == -1)
  -		    ap_proxy_log_uerror("lseek", c->filename,
  -			   "proxy: error seeking on cache file", r->server);
  +		    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +				 "proxy: error seeking on cache file %s",
  +				 c->filename);
   		else if (write(c->fp->fd, buff, 35) == -1)
  -		    ap_proxy_log_uerror("write", c->filename,
  -			     "proxy: error updating cache file", r->server);
  +		    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +				 "proxy: error updating cache file %s",
  +				 c->filename);
   	    }
   	    ap_pclosef(r->pool, c->fp->fd);
   	    Explain0("Remote document not modified, use local copy");
  @@ -827,11 +842,13 @@
   		off_t curpos = lseek(c->fp->fd, 0, SEEK_SET);
   
   		if (curpos == -1)
  -		    ap_proxy_log_uerror("lseek", c->filename,
  -			   "proxy: error seeking on cache file", r->server);
  +		    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +				 "proxy: error seeking on cache file %s",
  +				 c->filename);
   		else if (write(c->fp->fd, buff, 35) == -1)
  -		    ap_proxy_log_uerror("write", c->filename,
  -			     "proxy: error updating cache file", r->server);
  +		    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +				 "proxy: error updating cache file %s",
  +				 c->filename);
   	    }
   	    ap_pclosef(r->pool, c->fp->fd);
   	    return OK;
  @@ -862,8 +879,9 @@
   
       i = open(c->tempfile, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0622);
       if (i == -1) {
  -	ap_proxy_log_uerror("open", c->tempfile,
  -			 "proxy: error creating cache file", r->server);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +		     "proxy: error creating cache file %s",
  +		     c->tempfile);
   	return DECLINED;
       }
       ap_note_cleanups_for_fd(r->pool, i);
  @@ -871,8 +889,8 @@
       ap_bpushfd(c->fp, -1, i);
   
       if (ap_bvputs(c->fp, buff, "X-URL: ", c->url, "\n", NULL) == -1) {
  -	ap_proxy_log_uerror("write", c->tempfile,
  -			 "proxy: error writing cache file", r->server);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +		     "proxy: error writing cache file(%s)", c->tempfile);
   	ap_pclosef(r->pool, c->fp->fd);
   	unlink(c->tempfile);
   	c->fp = NULL;
  @@ -913,31 +931,33 @@
   	ap_proxy_sec2hex(c->len, buff);
   	curpos = lseek(c->fp->fd, 36, SEEK_SET);
   	if (curpos == -1)
  -	    ap_proxy_log_uerror("lseek", c->tempfile,
  -			     "proxy: error seeking on cache file", s);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +			 "proxy: error seeking on cache file %s", c->tempfile);
   	else if (write(c->fp->fd, buff, 8) == -1)
  -	    ap_proxy_log_uerror("write", c->tempfile,
  -			     "proxy: error updating cache file", s);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +			 "proxy: error updating cache file %s", c->tempfile);
       }
   
       if (ap_bflush(c->fp) == -1) {
  -	ap_proxy_log_uerror("write", c->tempfile,
  -			 "proxy: error writing to cache file", s);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +		     "proxy: error writing to cache file %s",
  +		     c->tempfile);
   	ap_pclosef(c->req->pool, c->fp->fd);
   	unlink(c->tempfile);
   	return;
       }
   
       if (ap_pclosef(c->req->pool, c->fp->fd) == -1) {
  -	ap_proxy_log_uerror("close", c->tempfile,
  -			 "proxy: error closing cache file", s);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +		     "proxy: error closing cache file %s", c->tempfile);
   	unlink(c->tempfile);
   	return;
       }
   
       if (unlink(c->filename) == -1 && errno != ENOENT) {
  -	ap_proxy_log_uerror("unlink", c->filename,
  -			 "proxy: error deleting old cache file", s);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +		     "proxy: error deleting old cache file %s",
  +		     c->tempfile);
       }
       else {
   	char *p;
  @@ -954,27 +974,30 @@
   #else
   	    if (mkdir(c->filename, S_IREAD | S_IWRITE | S_IEXEC) < 0 && errno != EEXIST)
   #endif /* WIN32 */
  -		ap_proxy_log_uerror("mkdir", c->filename,
  -				 "proxy: error creating cache directory", s);
  +		ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +			     "proxy: error creating cache directory %s",
  +			     c->filename);
   	    *p = '/';
   	    ++p;
   	}
   #if defined(__EMX__) || defined(WIN32)
   	/* Under OS/2 use rename. */
   	if (rename(c->tempfile, c->filename) == -1)
  -	    ap_proxy_log_uerror("rename", c->filename,
  -			     "proxy: error renaming cache file", s);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +			 "proxy: error renaming cache file %s to %s",
  +			 c->tempfile, c->filename);
       }
   #else
   
   	if (link(c->tempfile, c->filename) == -1)
  -	    ap_proxy_log_uerror("link", c->filename,
  -			     "proxy: error linking cache file", s);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +			 "proxy: error linking cache file %s to %s",
  +			 c->tempfile, c->filename);
       }
   
       if (unlink(c->tempfile) == -1)
  -	ap_proxy_log_uerror("unlink", c->tempfile,
  -			 "proxy: error deleting temp file", s);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +		     "proxy: error deleting temp file %s", c->tempfile);
   #endif
   
   }
  
  
  
  1.28      +3 -1      apache-1.3/src/modules/proxy/proxy_connect.c
  
  Index: proxy_connect.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_connect.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -u -r1.27 -r1.28
  --- proxy_connect.c	1998/04/11 12:00:40	1.27
  +++ proxy_connect.c	1998/05/27 22:56:04	1.28
  @@ -188,7 +188,9 @@
       }
       if (i == -1) {
   	ap_pclosesocket(r->pool, sock);
  -	return ap_proxyerror(r, "Could not connect to remote machine");
  +	return ap_proxyerror(r, ap_pstrcat(r->pool,
  +					"Could not connect to remote machine:<br>",
  +					strerror(errno), NULL));
       }
   
       /* If we are connecting through a remote proxy, we need to pass
  
  
  
  1.60      +29 -25    apache-1.3/src/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -u -r1.59 -r1.60
  --- proxy_ftp.c	1998/05/27 15:29:30	1.59
  +++ proxy_ftp.c	1998/05/27 22:56:05	1.60
  @@ -59,6 +59,7 @@
   
   #include "mod_proxy.h"
   #include "http_main.h"
  +#include "http_log.h"
   
   DEF_Explain
   
  @@ -569,8 +570,8 @@
   
       sock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP);
       if (sock == -1) {
  -	ap_proxy_log_uerror("socket", NULL, "proxy: error creating socket",
  -			 r->server);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +		     "proxy: error creating socket");
   	return SERVER_ERROR;
       }
   
  @@ -578,17 +579,16 @@
   	if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
   		       (const char *) &conf->recv_buffer_size, sizeof(int))
   	    == -1) {
  -	    ap_proxy_log_uerror("setsockopt", "(SO_RCVBUF)",
  -			     "Failed to set ProxyReceiveBufferSize, using default",
  -			     r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default");
   	}
       }
   
       if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &one,
   		   sizeof(one)) == -1) {
   #ifndef _OSD_POSIX /* BS2000 has this option "always on" */
  -	ap_proxy_log_uerror("setsockopt", NULL,
  -			 "proxy: error setting reuseaddr option", r->server);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +		     "proxy: error setting reuseaddr option: setsockopt(SO_REUSEADDR)");
   	ap_pclosesocket(p, sock);
   	return SERVER_ERROR;
   #endif /*_OSD_POSIX*/
  @@ -618,7 +618,9 @@
   #endif
       if (i == -1) {
   	ap_pclosesocket(p, sock);
  -	return ap_proxyerror(r, "Could not connect to remote machine");
  +	return ap_proxyerror(r, /*HTTP_BAD_GATEWAY*/ ap_pstrcat(r->pool,
  +				"Could not connect to remote machine: ",
  +				strerror(errno), NULL));
       }
   
       f = ap_bcreate(p, B_RDWR | B_SOCKET);
  @@ -769,8 +771,8 @@
   /* try to set up PASV data connection first */
       dsock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP);
       if (dsock == -1) {
  -	ap_proxy_log_uerror("socket", NULL, "proxy: error creating PASV socket",
  -			 r->server);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +		     "proxy: error creating PASV socket");
   	ap_bclose(f);
   	ap_kill_timeout(r);
   	return SERVER_ERROR;
  @@ -779,8 +781,8 @@
       if (conf->recv_buffer_size) {
   	if (setsockopt(dsock, SOL_SOCKET, SO_RCVBUF,
   	       (const char *) &conf->recv_buffer_size, sizeof(int)) == -1) {
  -	    ap_proxy_log_uerror("setsockopt", "(SO_RCVBUF)",
  -		  "Failed to set ProxyReceiveBufferSize, using default", r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default");
   	}
       }
   
  @@ -791,8 +793,8 @@
       i = ap_bgets(pasv, sizeof(pasv), f);
   
       if (i == -1) {
  -	ap_proxy_log_uerror("command", NULL, "PASV: control connection is toast",
  -			 r->server);
  +	ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r->server,
  +		     "PASV: control connection is toast");
   	ap_pclosesocket(p, dsock);
   	ap_bclose(f);
   	ap_kill_timeout(r);
  @@ -831,7 +833,9 @@
   
   	    if (i == -1) {
   		ap_kill_timeout(r);
  -		return ap_proxyerror(r, "Could not connect to remote machine");
  +		return ap_proxyerror(r, /*HTTP_BAD_GATEWAY*/ ap_pstrcat(r->pool,
  +				"Could not connect to remote machine: ",
  +				strerror(errno), NULL));
   	    }
   	    else {
   		pasvmode = 1;
  @@ -844,8 +848,8 @@
       if (!pasvmode) {		/* set up data connection */
   	clen = sizeof(struct sockaddr_in);
   	if (getsockname(sock, (struct sockaddr *) &server, &clen) < 0) {
  -	    ap_proxy_log_uerror("getsockname", NULL,
  -			  "proxy: error getting socket address", r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy: error getting socket address");
   	    ap_bclose(f);
   	    ap_kill_timeout(r);
   	    return SERVER_ERROR;
  @@ -853,8 +857,8 @@
   
   	dsock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP);
   	if (dsock == -1) {
  -	    ap_proxy_log_uerror("socket", NULL, "proxy: error creating socket",
  -			     r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy: error creating socket");
   	    ap_bclose(f);
   	    ap_kill_timeout(r);
   	    return SERVER_ERROR;
  @@ -863,8 +867,8 @@
   	if (setsockopt(dsock, SOL_SOCKET, SO_REUSEADDR, (void *) &one,
   		       sizeof(one)) == -1) {
   #ifndef _OSD_POSIX /* BS2000 has this option "always on" */
  -	    ap_proxy_log_uerror("setsockopt", NULL,
  -			"proxy: error setting reuseaddr option", r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy: error setting reuseaddr option");
   	    ap_pclosesocket(p, dsock);
   	    ap_bclose(f);
   	    ap_kill_timeout(r);
  @@ -877,8 +881,8 @@
   	    char buff[22];
   
   	    ap_snprintf(buff, sizeof(buff), "%s:%d", inet_ntoa(server.sin_addr), server.sin_port);
  -	    ap_proxy_log_uerror("bind", buff,
  -		      "proxy: error binding to ftp data socket", r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy: error binding to ftp data socket %s", buff);
   	    ap_bclose(f);
   	    ap_pclosesocket(p, dsock);
   	    return SERVER_ERROR;
  @@ -1035,8 +1039,8 @@
   	    csd = accept(dsock, (struct sockaddr *) &server, &clen);
   	while (csd == -1 && errno == EINTR);
   	if (csd == -1) {
  -	    ap_proxy_log_uerror("accept", NULL,
  -		      "proxy: failed to accept data connection", r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "proxy: failed to accept data connection");
   	    ap_pclosesocket(p, dsock);
   	    ap_bclose(f);
   	    ap_kill_timeout(r);
  
  
  
  1.47      +5 -4      apache-1.3/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -u -r1.46 -r1.47
  --- proxy_http.c	1998/04/11 12:00:40	1.46
  +++ proxy_http.c	1998/05/27 22:56:05	1.47
  @@ -256,9 +256,8 @@
   	if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
   		       (const char *) &conf->recv_buffer_size, sizeof(int))
   	    == -1) {
  -	    ap_proxy_log_uerror("setsockopt", "(SO_RCVBUF)",
  -			     "Failed to set ReceiveBufferSize, using default",
  -			     r->server);
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +			 "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default");
   	}
       }
   
  @@ -288,7 +287,9 @@
   	if (proxyhost != NULL)
   	    return DECLINED;	/* try again another way */
   	else
  -	    return ap_proxyerror(r, "Could not connect to remote machine");
  +	    return ap_proxyerror(r, /*HTTP_BAD_GATEWAY*/ ap_pstrcat(r->pool,
  +				"Could not connect to remote machine: ",
  +				strerror(errno), NULL));
       }
   
       clear_connection(r->headers_in);	/* Strip connection-based headers */
  
  
  
  1.61      +14 -50    apache-1.3/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -u -r1.60 -r1.61
  --- proxy_util.c	1998/05/05 02:57:34	1.60
  +++ proxy_util.c	1998/05/27 22:56:05	1.61
  @@ -766,36 +766,11 @@
       y[8] = '\0';
   }
   
  -void ap_proxy_log_uerror(const char *routine, const char *file, const char *err,
  -		      server_rec *s)
  -{
  -    char *p, *q;
  -
  -    q = ap_get_time();
  -    p = strerror(errno);
  -
  -    if (err != NULL) {
  -	fprintf(s->error_log, "[%s] %s\n", q, err);
  -	if (file != NULL)
  -	    fprintf(s->error_log, "- %s: %s: %s\n", routine, file, p);
  -	else
  -	    fprintf(s->error_log, "- %s: %s\n", routine, p);
  -    }
  -    else {
  -	if (file != NULL)
  -	    fprintf(s->error_log, "[%s] %s: %s: %s\n", q, routine, file, p);
  -	else
  -	    fprintf(s->error_log, "[%s] %s: %s\n", q, routine, p);
  -    }
  -
  -    fflush(s->error_log);
  -}
  -
   BUFF *
        ap_proxy_cache_error(struct cache_req *c)
   {
  -    ap_proxy_log_uerror("write", c->tempfile, "proxy: error writing to cache file",
  -		     c->req->server);
  +    ap_log_error(APLOG_MARK, APLOG_ERR, c->req->server,
  +		 "proxy: error writing to cache file %s", c->tempfile);
       ap_pclosef(c->req->pool, c->fp->fd);
       c->fp = NULL;
       unlink(c->tempfile);
  @@ -804,24 +779,14 @@
   
   int ap_proxyerror(request_rec *r, const char *message)
   {
  -    r->status = SERVER_ERROR;
  +    ap_table_setn(r->notes, "error-notes",
  +		  ap_pstrcat(r->pool, 
  +			     "The proxy server could not handle the request "
  +			     "<EM><A HREF=\"", r->uri, "\">",
  +			     r->method, "&nbsp;", r->uri, "</A></EM>.<P>\n"
  +			     "Reason: <STRONG>", message, "</STRONG>", NULL));
       r->status_line = "500 Proxy Error";
  -    r->content_type = "text/html";
  -
  -    ap_send_http_header(r);
  -    ap_soft_timeout("proxy error", r);
  -
  -    ap_rvputs(r, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
  -	   "<html><head><title>Proxy Error</title><head>\n<body>"
  -	   "<h1>Proxy Error</h1>\n"
  -	   "The proxy server could not handle this request.\n<p>\n"
  -	   "Reason: <b>", message, "</b>\n",
  -	   ap_psignature("<HR>\n", r),
  -	   "</body><html>\n",
  -	   NULL);
  -
  -    ap_kill_timeout(r);
  -    return OK;
  +    return HTTP_INTERNAL_SERVER_ERROR;
   }
   
   /*
  @@ -882,7 +847,8 @@
       err = ap_proxy_canon_netloc(r->pool, &url, &user, &password, &host, &port);
   
       if (err != NULL)
  -	ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r->server, err);
  +	ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r->server,
  +		     "%s", err);
   
       r->hostname = host;
   
  @@ -1216,11 +1182,9 @@
   #endif /* WIN32 */
       } while (i == -1 && errno == EINTR);
       if (i == -1) {
  -	char details[128];
  -
  -	ap_snprintf(details, sizeof(details), "%s port %d",
  -		    inet_ntoa(addr->sin_addr), ntohs(addr->sin_port));
  -	ap_proxy_log_uerror("connect", details, NULL, r->server);
  +	ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +		     "proxy connect to %s port %d failed",
  +		     inet_ntoa(addr->sin_addr), ntohs(addr->sin_port));
       }
       ap_kill_timeout(r);
   
  
  
  

Mime
View raw message