You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@gbiv.com> on 2006/01/06 01:39:16 UTC
Re: svn commit: r366174 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c
On Jan 5, 2006, at 4:49 AM, maxime@apache.org wrote:
> + In order to handle empty boundaries, we'll look for the
> + boundary plus the \n. */
> +
> + boundary_line = apr_pstrcat(p, "--", mail->boundary, "\n", NULL);
>
> /* The start boundary */
> - bound = ap_strstr(mail->body, mail->boundary);
> + bound = ap_strstr(mail->body, boundary_line);
That seems a bit risky -- MIME parts are supposed to have CRLF for
line terminators, but that code will only search for LF on Unix.
Would it make more sense to use a regex?
....Roy
Re: svn commit: r366174 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c
Posted by Maxime Petazzoni <ma...@bulix.org>.
* William A. Rowe, Jr. <wr...@rowe-clan.net> [2006-01-07 02:50:23]:
> Why not
>
> + boundary_line = apr_pstrcat(p, "--", mail->boundary, "\r\n", NULL);
>
> which should be far faster than a regex evaluation?
Actually this problem has already been cut off by r366386 because yes,
a regexp is not a fast solution. We don't need to look for the EOL
character, either it's \r\n or \n.
- Sam
--
Maxime Petazzoni (http://www.bulix.org)
-- gone crazy, back soon. leave message.
Re: svn commit: r366174 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Roy T. Fielding wrote:
> On Jan 5, 2006, at 4:49 AM, maxime@apache.org wrote:
>
>> + In order to handle empty boundaries, we'll look for the
>> + boundary plus the \n. */
>> +
>> + boundary_line = apr_pstrcat(p, "--", mail->boundary, "\n", NULL);
>>
>> /* The start boundary */
>> - bound = ap_strstr(mail->body, mail->boundary);
>> + bound = ap_strstr(mail->body, boundary_line);
>
> That seems a bit risky -- MIME parts are supposed to have CRLF for
> line terminators, but that code will only search for LF on Unix.
>
> Would it make more sense to use a regex?
Why not
+ boundary_line = apr_pstrcat(p, "--", mail->boundary, "\r\n", NULL);
which should be far faster than a regex evaluation?
Re: svn commit: r366174 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c
Posted by Maxime Petazzoni <ma...@bulix.org>.
Hi,
* Roy T. Fielding <fi...@gbiv.com> [2006-01-05 16:39:16]:
> >+ boundary_line = apr_pstrcat(p, "--", mail->boundary, "\n", NULL);
> >
> > /* The start boundary */
> >- bound = ap_strstr(mail->body, mail->boundary);
> >+ bound = ap_strstr(mail->body, boundary_line);
>
> That seems a bit risky -- MIME parts are supposed to have CRLF for
> line terminators, but that code will only search for LF on Unix.
>
> Would it make more sense to use a regex?
Actually, we could just not search for the \n, the -- prefix is enough
to make the empty boundary problem go away.
Thanks for poiting this out, I did not take care of it while reading the
RFC.
- Sam
--
Maxime Petazzoni (http://www.bulix.org)
-- gone crazy, back soon. leave message.