httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: httpd-2.0/modules/proxy proxy_http.c
Date Thu, 09 Sep 2004 16:22:23 GMT
mturk       2004/09/09 09:22:23

  Modified:    modules/proxy proxy_http.c
  Log:
  If any of steps return status != OK close the connection
  and call the proxy_http_cleanup.
  
  Revision  Changes    Path
  1.197     +33 -37    httpd-2.0/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v
  retrieving revision 1.196
  retrieving revision 1.197
  diff -u -r1.196 -r1.197
  --- proxy_http.c	1 Sep 2004 17:21:53 -0000	1.196
  +++ proxy_http.c	9 Sep 2004 16:22:23 -0000	1.197
  @@ -1205,14 +1205,10 @@
       }
       /* create space for state information */
       if (!backend) {
  -        status = ap_proxy_acquire_connection(proxy_function, &backend, worker, r->server);
  -        if (status != OK) {
  -            if (backend) {
  -                backend->close_on_recycle = 1;
  -                ap_proxy_release_connection(proxy_function, backend, r->server);
  -            }
  -            return status;
  -        }
  +        if ((status = ap_proxy_acquire_connection(proxy_function, &backend,
  +                                                  worker, r->server)) != OK)
  +            goto cleanup;
  +
           if (!r->main) {
               ap_set_module_config(c->conn_config, &proxy_http_module, backend);
           }
  @@ -1222,50 +1218,50 @@
       backend->close_on_recycle = 1;
   
       /* Step One: Determine Who To Connect To */
  -    status = ap_proxy_determine_connection(p, r, conf, worker, backend, c->pool,
  -                                           uri, &url, proxyname, proxyport,
  -                                           server_portstr,
  -                                           sizeof(server_portstr));
  -
  -    if ( status != OK ) {
  -        return status;
  -    }
  +    if ((status = ap_proxy_determine_connection(p, r, conf, worker, backend,
  +                                                c->pool, uri, &url, proxyname,
  +                                                proxyport, server_portstr,
  +                                                sizeof(server_portstr))) != OK)
  +        goto cleanup;
   
       /* Step Two: Make the Connection */
       if (ap_proxy_connect_backend(proxy_function, backend, worker, r->server)) {
  -        return HTTP_SERVICE_UNAVAILABLE;
  +        if (r->proxyreq == PROXYREQ_PROXY)
  +            status = HTTP_NOT_FOUND;
  +        else
  +            status = HTTP_SERVICE_UNAVAILABLE;
  +        goto cleanup;
       }
   
       /* Step Three: Create conn_rec */
       if (!backend->connection) {
  -        status = ap_proxy_connection_create(proxy_function, backend, c, r->server);
  -        if (status != OK)
  -            return status;
  +        if ((status = ap_proxy_connection_create(proxy_function, backend,
  +                                                 c, r->server)) != OK)
  +            goto cleanup;
       }
      
       /* Step Four: Send the Request */
  -    status = ap_proxy_http_request(p, r, backend, backend->connection, conf, uri, url,
  -                                   server_portstr);
  -    if ( status != OK ) {
  -        return status;
  -    }
  +    if ((status = ap_proxy_http_request(p, r, backend, backend->connection,
  +                                        conf, uri, url, server_portstr)) != OK)
  +        goto cleanup;
   
       /* Step Five: Receive the Response */
  -    status = ap_proxy_http_process_response(p, r, backend, backend->connection, conf,
  -                                            server_portstr);
  -    if (status != OK) {
  -        /* clean up even if there is an error */
  -        ap_proxy_http_cleanup(proxy_function, r, backend);
  -        return status;
  -    }
  +    if ((status = ap_proxy_http_process_response(p, r, backend,
  +                                                 backend->connection,
  +                                                 conf, server_portstr)) != OK)
  +        goto cleanup;
   
       /* Step Six: Clean Up */
  -    status = ap_proxy_http_cleanup(proxy_function, r, backend);
  -    if ( status != OK ) {
  -        return status;
  -    }
   
  -    return OK;
  +cleanup:
  +    if (backend) {
  +        if (status != OK) {
  +            backend->close = 1;
  +            backend->close_on_recycle = 1;
  +        }
  +        ap_proxy_http_cleanup(proxy_function, r, backend);
  +    }
  +    return status;
   }
   
   static void ap_proxy_http_register_hook(apr_pool_t *p)
  
  
  

Mime
View raw message