httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@locus.apache.org
Subject cvs commit: apache-1.3/src/main http_protocol.c
Date Tue, 10 Oct 2000 03:29:09 GMT
gstein      00/10/09 20:29:09

  Modified:    src/main http_protocol.c
  Log:
  Fix range processing: *any* illegal ranges should cause the Range header to
  be completely ignored.
  
  Submitted by: Joe Orton <joe@light.plus.com>
  Reviewed by: Greg Stein
  
  Revision  Changes    Path
  1.291     +19 -8     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.290
  retrieving revision 1.291
  diff -u -r1.290 -r1.291
  --- http_protocol.c	2000/10/07 16:11:50	1.290
  +++ http_protocol.c	2000/10/10 03:29:08	1.291
  @@ -235,13 +235,21 @@
           /* a multiple range */
           const char *r_range = ap_pstrdup(r->pool, range + 6);
           long tlength = 0;
  -
  -        r->byterange = 2;
  +	int ret;
  +	
           r->boundary = ap_psprintf(r->pool, "%lx%lx",
   				r->request_time, (long) getpid());
  -        while (internal_byterange(0, &tlength, r, &r_range, NULL, NULL));
  +        do {
  +	    /* Loop while we have another range spec to process */
  +	    ret = internal_byterange(0, &tlength, r, &r_range, NULL, NULL);
  +	} while (ret == 1);
  +	/* If an error occured processing one of the range specs, we
  +	 * must fail */
  +	if (ret < 0)
  +	    return 0;
           ap_table_setn(r->headers_out, "Content-Length",
   	    ap_psprintf(r->pool, "%ld", tlength));
  +        r->byterange = 2;
       }
   
       r->status = PARTIAL_CONTENT;
  @@ -262,8 +270,8 @@
    * If it is called with realreq=0, it will add to tlength the length
    * it *would* have used with realreq=1.
    *
  - * Either case will return 1 if it should be called again, and 0
  - * when done.
  + * Either case will return 1 if it should be called again, 0 when done,
  + * or -1 if an error occurs AND realreq=0.
    */
   static int internal_byterange(int realreq, long *tlength, request_rec *r,
                                 const char **r_range, long *offset, long *length)
  @@ -296,9 +304,12 @@
   #ifdef CHARSET_EBCDIC
           POP_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client);
   #endif /*CHARSET_EBCDIC*/
  -        /* Skip this one */
  -        return internal_byterange(realreq, tlength, r, r_range, offset,
  -                                  length);
  +	if (!realreq)
  +	    /* Return error on invalid syntax */
  +	    return -1;
  +	else
  +	    /* Should never get here */
  +	    return 0;
       }
   
       if (r->byterange > 1) {
  
  
  

Mime
View raw message