httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_negotiation.c
Date Mon, 25 Nov 2002 19:02:46 GMT
wrowe       2002/11/25 11:02:45

  Modified:    modules/mappers mod_negotiation.c
  Log:
    Set the appropriate mime response headers for negotated type-map
    Body: responses.
  
    wrowe's review;
      My earlier concern doesn't apply.  Type maps have always required the
      author to be explicit in all header fields to be negotiated; if the
      headers aren't given in the type map file the resulting redirect
      (for non-body maps) is broken anyways.  As to my other concern, the
      charset should only exist if the Content-Type was given.
  
  Submitted by: André Malo <nd@perlig.de>
  
  Revision  Changes    Path
  1.109     +28 -1     httpd-2.0/modules/mappers/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_negotiation.c,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- mod_negotiation.c	18 Nov 2002 14:13:53 -0000	1.108
  +++ mod_negotiation.c	25 Nov 2002 19:02:44 -0000	1.109
  @@ -2844,7 +2844,34 @@
            * ap_set_etag(r);
            */
           apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
  -        ap_set_content_length(r, best->bytes); 
  +        ap_set_content_length(r, best->bytes);
  +
  +        /* set MIME type and charset as negotiated */
  +        if (best->mime_type && *best->mime_type) {
  +            if (best->content_charset && *best->content_charset) {
  +                ap_set_content_type(r, apr_pstrcat(r->pool,
  +                                                   best->mime_type,
  +                                                   "; charset=",
  +                                                   best->content_charset,
  +                                                   NULL));
  +            }
  +            else {
  +                ap_set_content_type(r, apr_pstrdup(r->pool, best->mime_type));
  +            }
  +        }
  +
  +        /* set Content-language(s) as negotiated */
  +        if (best->content_languages && best->content_languages->nelts)
{
  +            r->content_languages = apr_array_copy(r->pool,
  +                                                  best->content_languages);
  +        }
  +
  +        /* set Content-Encoding as negotiated */
  +        if (best->content_encoding && *best->content_encoding) {
  +            r->content_encoding = apr_pstrdup(r->pool,
  +                                              best->content_encoding);
  +        }
  +
           if ((res = ap_meets_conditions(r)) != OK) {
               return res;
           }
  
  
  

Mime
View raw message