httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bray <Tim.B...@Sun.COM>
Subject Re: svn commit: r691418 [2/2] - in /httpd/httpd/trunk: ./ docs/manual/mod/ modules/filters/
Date Tue, 09 Sep 2008 21:40:30 GMT
On Sep 9, 2008, at 1:38 PM, Ruediger Pluem wrote:

> IMHO the following patch should fix the mod_mbox error by correctly
> encoding these chars:
>
> Index: module-2.0/mod_mbox_cte.c
> ===================================================================
> --- module-2.0/mod_mbox_cte.c   (Revision 693585)
> +++ module-2.0/mod_mbox_cte.c   (Arbeitskopie)
> @@ -91,6 +91,9 @@
>         else if (s[i] == '&') {
>             j += 4;
>         }
> +        else if (((unsigned char) s[i]) < 32) {
> +            j += 5;
> +        }
>     }
>
>     /* If there is nothing to escape, just copy the body to the new
> @@ -118,6 +121,10 @@
>                 memcpy(&x[j], "&amp;", 5);
>                 j += 4;
>             }
> +            else if (((unsigned char) s[i]) < 32) {
> +                apr_snprintf(&x[j], 6, "&#%02i;", s[i]);
> +                j += 4;
> +            }
>             else {
>                 x[j] = s[i];
>             }

Um, this won't make the XML problems go away, because some of those  
"control chars" < 32 are simply illegal in an XML document, see http://www.w3.org/TR/REC-xml/#NT-Char

  - this code could produce, for example, &#05; which is just not  
allowed.

I don't know what the constraints are, but it does seem odd to put  
"characters" like ASCII  ENQ or SO, which have no shared semantics by  
anything,  in something you might send over the Internet.  -Tim


Mime
View raw message