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:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to