https://bz.apache.org/bugzilla/show_bug.cgi?id=69098

--- Comment #1 from abernal <[email protected]> ---
Investigated this. Confirmed lookup_map_program()
(modules/mappers/mod_rewrite.c) does return "" (non-NULL, empty) instead of
NULL when the prg: process has already exited: the first apr_file_read() gets 0
bytes before any newline is seen, and the function falls through to buf[0]='\0'
instead of the NULL path used for an explicit "NULL" response.

However, I traced the only place that return value is consumed, do_expand()'s
"${map:key}" substitution:
  if (key && *key) { ... append substitution ... }
A NULL and an empty-string "" result are treated identically there (both make
the if-condition false, contributing nothing to the expansion), so patching
lookup_map_program() to return NULL instead of "" does not actually change what
gets substituted.

I built a real server (mod_rewrite + a small prg: script that answers 2 lookups
then exits) to check what actually happens once the process is dead, using two
different rule shapes:
  RewriteRule "^/x$" "${foo:lookup}"
  RewriteRule "^/x/(.*)$" "${foo:$1}" [PT]
In both cases I got a 301-to-root or a 200 (serving the docroot's index),
depending on the rule flags -- never a 400, and nothing unusual in the error
log either way.

I could not reproduce the literal reported symptom (400 Bad Request, nothing
logged). Could you share the actual full config (the second line in the report
looks garbled -- "RewriteMap /x ..." is presumably meant to be a RewriteRule)
and the httpd version/OS you saw this on? That would help pin down whether this
is version-specific.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to