Mercurial > prosody-hg
comparison spec/net_http_parser_spec.lua @ 12882:9ed628635dc6 0.12
net.http.parser: Improve handling of responses without content-length
This ensures that we support responses without a content-length header, and
allow streaming them through the streaming handler interface. An example of
such a response would be Server-Sent Events streams.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 09 Feb 2023 22:57:32 +0000 |
| parents | cb5555443852 |
| children | 94a99330ce87 |
comparison
equal
deleted
inserted
replaced
| 12881:91baddaeea84 | 12882:9ed628635dc6 |
|---|---|
| 85 0 | 85 0 |
| 86 | 86 |
| 87 | 87 |
| 88 ]], | 88 ]], |
| 89 { | 89 { |
| 90 body = "Hello", count = 2; | 90 body = "Hello", count = 3; |
| 91 } | 91 } |
| 92 ); | 92 ); |
| 93 end); | 93 end); |
| 94 | 94 |
| 95 it("should handle a stream of responses", function () | 95 it("should handle a stream of responses", function () |
| 114 0 | 114 0 |
| 115 | 115 |
| 116 | 116 |
| 117 ]], | 117 ]], |
| 118 { | 118 { |
| 119 body = "Hello", count = 3; | 119 body = "Hello", count = 4; |
| 120 } | 120 } |
| 121 ); | 121 ); |
| 122 end); | 122 end); |
| 123 end); | 123 end); |
| 124 | 124 |
| 127 | 127 |
| 128 -- Just a sanity check... text editors and things may mess with line endings, etc. | 128 -- Just a sanity check... text editors and things may mess with line endings, etc. |
| 129 assert.equal("25930f021785ae14053a322c2dbc1897c3769720", sha1(data, true), "test data malformed"); | 129 assert.equal("25930f021785ae14053a322c2dbc1897c3769720", sha1(data, true), "test data malformed"); |
| 130 | 130 |
| 131 test_stream(data, { | 131 test_stream(data, { |
| 132 body = string.rep("~", 11085), count = 2; | 132 body = string.rep("~", 11085), count = 3; |
| 133 }); | 133 }); |
| 134 end); | 134 end); |
| 135 end); | 135 end); |
