416fedb9b9d3b33afbc49e7dab0450e2fc158d8d
[mdref/mdref-http] / http / Message / Parser.md
1 # class http\Message\Parser
2
3 The parser which is underlying http\Message.
4
5 > ***NOTE:****
6 > This class was added in v2.2.0.
7
8 ## Constants:
9
10 ### Parser flags:
11
12 * CLEANUP
13 Finish up parser at end of (incomplete) input.
14 * DUMB_BODIES
15 Soak up the rest of input if no entity length is deducible.
16 * EMPTY_REDIRECTS
17 Redirect messages do not contain any body despite of indication of such.
18 * GREEDY
19 Continue parsing while input is available.
20
21 ### Parser states:
22
23 * STATE_FAILURE
24 Parse failure.
25 * STATE_START
26 Expecting HTTP info (request/response line) or headers.
27 * STATE_HEADER
28 Parsing headers.
29 * STATE_HEADER_DONE
30 Completed parsing headers.
31 * STATE_BODY
32 Parsing the body.
33 * STATE_BODY_DUMB
34 Soaking up all input as body.
35 * STATE_BODY_LENGTH
36 Reading body as indicated by `Content-Lenght` or `Content-Range`.
37 * STATE_BODY_CHUNKED
38 Parsing `chunked` encoded body.
39 * STATE_BODY_DONE
40 Finished parsing the body.
41 * STATE_DONE
42 Finished parsing the message.
43
44 > ***NOTE:***
45 > Most of this states won't be returned to the user, because the parser immediately jumps to the next expected state.