| 115 | } |
| 116 | |
| 117 | void |
| 118 | testParse() |
| 119 | { |
| 120 | doMatrix<false>( |
| 121 | "HTTP/1.0 200 OK\r\n" |
| 122 | "Server: test\r\n" |
| 123 | "\r\n" |
| 124 | "Hello, world!", |
| 125 | [&](parser_type<false> const& p) |
| 126 | { |
| 127 | auto const& m = p.get(); |
| 128 | BEAST_EXPECT(! p.chunked()); |
| 129 | BEAST_EXPECT(p.need_eof()); |
| 130 | BEAST_EXPECT(p.content_length() == boost::none); |
| 131 | BEAST_EXPECT(m.version() == 10); |
| 132 | BEAST_EXPECT(m.result() == status::ok); |
| 133 | BEAST_EXPECT(m.reason() == "OK"); |
| 134 | BEAST_EXPECT(m["Server"] == "test"); |
| 135 | BEAST_EXPECT(m.body() == "Hello, world!"); |
| 136 | } |
| 137 | ); |
| 138 | doMatrix<false>( |
| 139 | "HTTP/1.1 200 OK\r\n" |
| 140 | "Server: test\r\n" |
| 141 | "Transfer-Encoding: chunked\r\n" |
| 142 | "Trailer: Content-Digest, X-Forwarded-For\r\n" |
| 143 | "\r\n" |
| 144 | "5\r\n" |
| 145 | "*****\r\n" |
| 146 | "2;a;b=1;c=\"2\"\r\n" |
| 147 | "--\r\n" |
| 148 | "0;d;e=3;f=\"4\"\r\n" |
| 149 | "Content-Digest: 123\r\n" |
| 150 | "Signature: xyz\r\n" |
| 151 | "X-Forwarded-For: 203.0.113.195\r\n" |
| 152 | "\r\n", |
| 153 | [&](parser_type<false> const& p) |
| 154 | { |
| 155 | auto const& m = p.get(); |
| 156 | BEAST_EXPECT(! p.need_eof()); |
| 157 | BEAST_EXPECT(p.chunked()); |
| 158 | BEAST_EXPECT(p.content_length() == boost::none); |
| 159 | BEAST_EXPECT(m.version() == 11); |
| 160 | BEAST_EXPECT(m.result() == status::ok); |
| 161 | BEAST_EXPECT(m.reason() == "OK"); |
| 162 | BEAST_EXPECT(m["Server"] == "test"); |
| 163 | BEAST_EXPECT(m["Transfer-Encoding"] == "chunked"); |
| 164 | BEAST_EXPECT(m["Content-Digest"] == "123"); |
| 165 | BEAST_EXPECT(! m.contains("Signature")); |
| 166 | BEAST_EXPECT(! m.contains("X-Forwarded-For")); |
| 167 | BEAST_EXPECT(m.body() == "*****--"); |
| 168 | } |
| 169 | ); |
| 170 | doMatrix<false>( |
| 171 | "HTTP/1.0 200 OK\r\n" |
| 172 | "Server: test\r\n" |
| 173 | "Content-Length: 5\r\n" |
| 174 | "\r\n" |
nothing calls this directly
no test coverage detected