Does the parser need to see an EOF to find the end of the message? */
| 2124 | |
| 2125 | /* Does the parser need to see an EOF to find the end of the message? */ |
| 2126 | int |
| 2127 | http_message_needs_eof (const http_parser *parser) |
| 2128 | { |
| 2129 | if (parser->type == HTTP_REQUEST) { |
| 2130 | return 0; |
| 2131 | } |
| 2132 | |
| 2133 | /* See RFC 2616 section 4.4 */ |
| 2134 | if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */ |
| 2135 | parser->status_code == 204 || /* No Content */ |
| 2136 | parser->status_code == 304 || /* Not Modified */ |
| 2137 | parser->flags & F_SKIPBODY) { /* response to a HEAD request */ |
| 2138 | return 0; |
| 2139 | } |
| 2140 | |
| 2141 | /* RFC 7230 3.3.3, see `s_headers_almost_done` */ |
| 2142 | if ((parser->uses_transfer_encoding == 1) && |
| 2143 | (parser->flags & F_CHUNKED) == 0) { |
| 2144 | return 1; |
| 2145 | } |
| 2146 | |
| 2147 | if ((parser->flags & F_CHUNKED) || parser->content_length != ULLONG_MAX) { |
| 2148 | return 0; |
| 2149 | } |
| 2150 | |
| 2151 | return 1; |
| 2152 | } |
| 2153 | |
| 2154 | |
| 2155 | int |
no outgoing calls
no test coverage detected