You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/03/03 07:09:42 UTC

Re: cvs commit: modperl-2.0 Changes

I hope this code will work correctly on win32 and other non-unix platforms. I 
have no clue why Apache folks have mixed CR (defined in httpd.h) and '\n' in 
their code, but I guess if it's there, it's safe to use it.

basically it does:

   my($headers, $body) = split $buffer, /\n\r?\n/;

>   +    /* ap_scan_script_header_err_strs won't handle correctly binary
>   +     * data following the headers, e.g. when the terminating /\n\r?\n/
>   +     * is followed by \0\0 which is a part of the response
>   +     * body. Therefore we need to separate the headers from the body
>   +     * and not rely on ap_scan_script_header_err_strs to do that for
>   +     * us.
>   +     */
>   +    tmp = buffer;
>   +    newln = 0;
>   +    tlen = *len;
>   +    while (tlen--) {
>   +        /* that strange mix of CR and \n (and not LF) copied from
>   +         * util_script.c:ap_scan_script_header_err_core
>   +         */
>   +        if (*tmp != CR && *tmp != '\n') {
>   +            newln = 0;
>   +        }
>   +        if (*tmp == '\n') {
>   +            newln++;
>   +        }
>   +        tmp++;
>   +        if (newln == 2) {
>   +            break;
>   +        }
>   +    }

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org