Fixed segfault with incorrect location nesting.

A configuration with a named location inside a zero-length prefix
or regex location used to trigger a segmentation fault, as
ngx_http_core_location() failed to properly detect if a nested location
was created.  Example configuration to reproduce the problem:

    location "" {
        location @foo {}
    }

Fix is to not rely on a parent location name length, but rather check
command type we are currently parsing.

Identical fix is also applied to ngx_http_rewrite_if(), which used to
incorrectly assume the "if" directive is on server{} level in such
locations.

Reported by Markus Linnala.
Found with afl-fuzz.
2 files changed
tree: 34bc04caeccbc47691252f39347b238bb85e3070
  1. auto/
  2. conf/
  3. contrib/
  4. docs/
  5. misc/
  6. src/
  7. .hgtags