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
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102404
13f79535-47bb-0310-9956-
ffa450edef68
[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]
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];
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);
}