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