httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
Date Sun, 25 Jan 2004 15:40:08 GMT
nd          2004/01/25 07:40:08

  Modified:    .        CHANGES
               modules/mappers mod_rewrite.c
  Log:
  EOLs sent by external rewritemaps are now consumed
  as whole. That way, on systems with more than one EOL character
  rewritemap programs no longer need to switch stdout to binary
  mode.
  
  PR: 25635
  
  Revision  Changes    Path
  1.1376    +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1375
  retrieving revision 1.1376
  diff -u -u -r1.1375 -r1.1376
  --- CHANGES	24 Jan 2004 21:21:49 -0000	1.1375
  +++ CHANGES	25 Jan 2004 15:40:07 -0000	1.1376
  @@ -2,6 +2,11 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) mod_rewrite: EOLs sent by external rewritemaps are now consumed
  +     as whole. That way, on systems with more than one EOL character
  +     rewritemap programs no longer need to switch stdout to binary
  +     mode. PR 25635.  [André Malo]
  +
     *) mod_rewrite: Introduce the ability to force a content handler via
        the [handler=...] flag.  [André Malo]
   
  
  
  
  1.247     +18 -2     httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.246
  retrieving revision 1.247
  diff -u -u -r1.246 -r1.247
  --- mod_rewrite.c	24 Jan 2004 21:21:49 -0000	1.246
  +++ mod_rewrite.c	25 Jan 2004 15:40:08 -0000	1.247
  @@ -1348,6 +1348,8 @@
       apr_size_t i;
       apr_size_t nbytes;
       apr_status_t rv;
  +    const char *eol = APR_EOL_STR;
  +    int eolc = 0;
   
   #ifndef NO_WRITEV
       struct iovec iova[2];
  @@ -1400,11 +1402,25 @@
       nbytes = 1;
       apr_file_read(fpout, &c, &nbytes);
       while (nbytes == 1 && (i < REWRITE_MAX_PRG_MAP_LINE)) {
  -        if (c == '\n') {
  +        if (c == eol[eolc]) {
  +            if (!eol[++eolc]) {
  +                /* remove eol from the buffer */
  +                i -= --eolc;
  +                break;
  +            }
  +        }
  +
  +        /* only partial (invalid) eol sequence -> reset the counter */
  +        else if (eolc) {
  +            eolc = 0;
  +        }
  +
  +        /* catch binary mode, e.g. on Win32 */
  +        else if (c == '\n') { 
               break;
           }
  -        buf[i++] = c;
   
  +        buf[i++] = c;
           apr_file_read(fpout, &c, &nbytes);
       }
   
  
  
  

Mime
View raw message