You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Roy Fielding <fi...@hyperreal.com> on 1997/03/20 19:40:19 UTC

cvs commit: apache/src/modules/proxy mod_proxy.h proxy_cache.c proxy_ftp.c proxy_http.c proxy_util.c

fielding    97/03/20 10:40:18

  Modified:    src       CHANGES
               src/modules/proxy  mod_proxy.h proxy_cache.c proxy_ftp.c
                        proxy_http.c  proxy_util.c
  Log:
  In the proxy, if the cache filesystem was full, garbage_coll() was
  never called, and thus the filesystem would remain full indefinitely.
  We now also remove incomplete cache files left if the origin server
  didn't send a Content-Length header and either the client has aborted
  transfer or bwrite() to client has failed.
  
  Submitted by: Petr Lampa
  Reviewed by: Chuck Murcko, Roy Fielding
  
  Revision  Changes    Path
  1.207     +6 -0      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.206
  retrieving revision 1.207
  diff -C3 -r1.206 -r1.207
  *** CHANGES	1997/03/20 18:03:33	1.206
  --- CHANGES	1997/03/20 18:40:11	1.207
  ***************
  *** 1,5 ****
  --- 1,11 ----
    Changes with Apache 1.2b8
    
  +   *) In the proxy, if the cache filesystem was full, garbage_coll() was
  +      never called, and thus the filesystem would remain full indefinitely.
  +      We now also remove incomplete cache files left if the origin server
  +      didn't send a Content-Length header and either the client has aborted
  +      transfer or bwrite() to client has failed. [Petr Lampa]
  + 
      *) Fixed the handling of module and script-added header fields.
         Improved the interface for sending header fields and reduced
         the duplication of code between sending okay responses and errors.
  
  
  
  1.9       +1 -0      apache/src/modules/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/mod_proxy.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -C3 -r1.8 -r1.9
  *** mod_proxy.h	1997/03/02 05:05:22	1.8
  --- mod_proxy.h	1997/03/20 18:40:14	1.9
  ***************
  *** 228,233 ****
  --- 228,234 ----
        struct cache_req **cr);
    int proxy_cache_update(struct cache_req *c, array_header *resp_hdrs,
        const char *protocol, int nocache);
  + void proxy_garbage_coll(request_rec *r);
    
    /* proxy_connect.c */
    
  
  
  
  1.10      +6 -2      apache/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -C3 -r1.9 -r1.10
  *** proxy_cache.c	1997/01/20 04:28:32	1.9
  --- proxy_cache.c	1997/03/20 18:40:15	1.10
  ***************
  *** 88,94 ****
    static int sub_garbage_coll(request_rec *r,array_header *files,
    			    const char *cachedir,const char *cachesubdir);
    
  ! static void garbage_coll(request_rec *r)
        {
        const char *cachedir;
        void *sconf = r->server->module_config;
  --- 88,94 ----
    static int sub_garbage_coll(request_rec *r,array_header *files,
    			    const char *cachedir,const char *cachesubdir);
    
  ! void proxy_garbage_coll(request_rec *r)
        {
        const char *cachedir;
        void *sconf = r->server->module_config;
  ***************
  *** 835,840 ****
  --- 835,845 ----
    	    return;
    	}
        } else
  +     if (c->req->connection->aborted) {
  + 	    pclosef(c->req->pool, c->fp->fd);  /* no need to flush */
  + 	    unlink(c->tempfile);
  + 	    return;
  +     } else 
        {
    /* update content-length of file */
    	char buff[9];
  ***************
  *** 909,914 ****
    	    "proxy: error deleting temp file",s);
    #endif
    
  -     garbage_coll(c->req);
    }
    
  --- 914,918 ----
  
  
  
  1.12      +2 -0      apache/src/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -C3 -r1.11 -r1.12
  *** proxy_ftp.c	1997/02/24 05:37:54	1.11
  --- proxy_ftp.c	1997/03/20 18:40:15	1.12
  ***************
  *** 878,883 ****
  --- 878,885 ----
        pclosef(pool, dsock);
        pclosef(pool, sock);
    
  +     proxy_garbage_coll(r);
  + 
        return OK;
    }
    
  
  
  
  1.15      +1 -0      apache/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -C3 -r1.14 -r1.15
  *** proxy_http.c	1997/02/20 05:16:25	1.14
  --- proxy_http.c	1997/03/20 18:40:15	1.15
  ***************
  *** 395,400 ****
  --- 395,401 ----
    
        pclosef(pool, sock);
    
  +     proxy_garbage_coll(r);
        return OK;
    }
    
  
  
  
  1.8       +8 -2      apache/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -C3 -r1.7 -r1.8
  *** proxy_util.c	1997/01/20 04:28:34	1.7
  --- proxy_util.c	1997/03/20 18:40:16	1.8
  ***************
  *** 408,415 ****
    	
            while(n && !r->connection->aborted) {
                w = bwrite(con->client, &buf[o], n);
  ! 	    if (w <= 0)
  ! 		break;
    	    reset_timeout(r); /* reset timeout after successfule write */
                n-=w;
                o+=w;
  --- 408,421 ----
    	
            while(n && !r->connection->aborted) {
                w = bwrite(con->client, &buf[o], n);
  !             if (w <= 0) {
  !                 if (f2 != NULL) {
  !                     pclosef(c->req->pool, c->fp->fd);
  !                     c->fp = NULL; 
  !                     unlink(c->tempfile);
  !                 }
  !                 break;
  !             }
    	    reset_timeout(r); /* reset timeout after successfule write */
                n-=w;
                o+=w;