Skip to content

Commit ad8f3d1

Browse files
committed
Issue #18 URI path processing
Move all rejections to the last step.
1 parent c05f08b commit ad8f3d1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spec/src/main/asciidoc/servlet-spec-body.adoc

+4-3
Original file line numberDiff line numberDiff line change
@@ -1331,10 +1331,8 @@ Characters other than `/`, `;` and `%` that are encoded in `%nn` form are decode
13311331
Any sequence of more than one `"/"` character in the URI must be replaced with a single `"/"`.
13321332

13331333
==== Remove dot-segments+
1334-
* A path not starting with "/" must be rejected with a 400 response.
13351334
* Sequences of the form `"/./"` must be replaced with `"/"`.
13361335
* Sequences of the form `"/" + segment + "/../"` must be replaced with `"/"`.
1337-
* If there is no preceding segment for a `".."` segment then return a 400 response.
13381336

13391337
==== Removal of path parameters
13401338
A path segment containing the `";"` character is split at the first occurence of `";"`. The segment is replaced by the character sequence preceeding the `";"`. The characters following the `";"` are considered a path parameters and may be preserved by the container for later processing (eg `jsessionid`).
@@ -1346,11 +1344,14 @@ Any remaining `%nn` sequences in the path should be decoded. Some containers may
13461344
The decoded path is used to map the request to a context and resource within the context. This form of the URI path is used for all subsequent mapping (web applications, servlet, filters and security constraints).
13471345

13481346
==== Rejecting Suspicious Sequences
1349-
If suspicious sequences are discovered during the prior steps, the request must be rejected with a 400 bad request using the error handling of the matched context. By default the set of suspicious sequences includes:
1347+
If suspicious sequences are discovered during the prior steps, the request must be rejected with a 400 bad request. If a context is matched the the error handling of the context may be used to generate the response. By default the set of suspicious sequences includes:
13501348

1349+
* Any path not starting with the `"/"` character
1350+
* Any path starting with an initial segment of `".."`
13511351
* The encoded `"/"` character
13521352
* Any `"."` or `".."` segment that had a path parameter
13531353
* Any `"."` or `".."` segment with any encoded characters
1354+
* Any `".."` segment preceeded by an empty segment
13541355
* The `"\"` character encoded or not.
13551356
* Any control characters either encoded or not.
13561357

0 commit comments

Comments
 (0)