httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_protocol.c
Date Mon, 13 Nov 2000 20:23:43 GMT
rbb         00/11/13 12:23:43

  Modified:    src      CHANGES
               src/main http_protocol.c
  Log:
  Get send the content-type header sent correctly for both regular requests
  and byteranges.
  Submitted by:   Ryan Bloom and Will Rowe
  
  Revision  Changes    Path
  1.322     +3 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.321
  retrieving revision 1.322
  diff -u -r1.321 -r1.322
  --- CHANGES	2000/11/13 14:39:18	1.321
  +++ CHANGES	2000/11/13 20:23:40	1.322
  @@ -1,4 +1,7 @@
   Changes with Apache 2.0a8
  +  *) We are sending the content-type correctly now.
  +     [Ryan Bloom and Will Rowe]
  +
     *) APR on FreeBSD: Fix a bug in apr_sendfile() which caused us to report
        a bogus bytes-sent value when the only thing being sent was trailers
        and writev() returned an error (or EAGAIN).  [Jeff Trawick]
  
  
  
  1.241     +24 -15    apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.240
  retrieving revision 1.241
  diff -u -r1.240 -r1.241
  --- http_protocol.c	2000/11/10 18:04:44	1.240
  +++ http_protocol.c	2000/11/13 20:23:41	1.241
  @@ -186,6 +186,21 @@
       int num_ranges;
   } byterange_ctx;
   
  +/*
  + * Here we try to be compatible with clients that want multipart/x-byteranges
  + * instead of multipart/byteranges (also see above), as per HTTP/1.1. We
  + * look for the Request-Range header (e.g. Netscape 2 and 3) as an indication
  + * that the browser supports an older protocol. We also check User-Agent
  + * for Microsoft Internet Explorer 3, which needs this as well.
  + */
  +static int use_range_x(request_rec *r)
  +{
  +    const char *ua;
  +    return (apr_table_get(r->headers_in, "Request-Range") ||
  +            ((ua = apr_table_get(r->headers_in, "User-Agent"))
  +             && ap_strstr_c(ua, "MSIE 3")));
  +}
  +
   #define BYTERANGE_FMT "%" APR_OFF_T_FMT "-%" APR_OFF_T_FMT "/%" APR_OFF_T_FMT
   
   AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(
  @@ -213,6 +228,12 @@
           ctx = f->ctx = apr_pcalloc(r->pool, sizeof(*ctx));
           ctx->num_ranges = num_ranges;
   
  +        if (num_ranges > 1) {
  +            r->content_type = 
  +                 apr_pstrcat(r->pool, "multipart", use_range_x(r) ? "/x-" : "/",
  +                          "byteranges; boundary=", r->boundary, NULL);
  +        }
  +
           /* create a brigade in case we never call ap_save_brigade() */
           ctx->bb = ap_brigade_create(r->pool);
       }
  @@ -2135,21 +2156,6 @@
       return OK;
   }
   
  -/*
  - * Here we try to be compatible with clients that want multipart/x-byteranges
  - * instead of multipart/byteranges (also see above), as per HTTP/1.1. We
  - * look for the Request-Range header (e.g. Netscape 2 and 3) as an indication
  - * that the browser supports an older protocol. We also check User-Agent
  - * for Microsoft Internet Explorer 3, which needs this as well.
  - */
  -static int use_range_x(request_rec *r)
  -{
  -    const char *ua;
  -    return (apr_table_get(r->headers_in, "Request-Range") ||
  -            ((ua = apr_table_get(r->headers_in, "User-Agent"))
  -             && ap_strstr_c(ua, "MSIE 3")));
  -}
  -
   /* This routine is called by apr_table_do and merges all instances of
    * the passed field values into a single array that will be further
    * processed by some later routine.  Originally intended to help split
  @@ -2456,6 +2462,9 @@
            * bucket brigade code  */
   /*      ap_add_output_filter("COALESCE", NULL, r, r->connection); */
       }
  +
  +    apr_table_setn(r->headers_out, "Content-Type", make_content_type(r,
  +        r->content_type));
   
       if (r->content_encoding) {
           apr_table_setn(r->headers_out, "Content-Encoding",
  
  
  

Mime
View raw message