240827.1 · feat: Added support for RTSP and ICE response and the on_protocol_complete callback. (#477)
Finish
Those tests check the return codes and the behavior of llhttp_finish() C API.
It should be safe to finish after GET request
GET / HTTP/1.1
off=0 message begin
off=0 len=3 span[method]="GET"
off=3 method complete
off=4 len=1 span[url]="/"
off=6 url complete
off=6 len=4 span[protocol]="HTTP"
off=10 protocol complete
off=11 len=3 span[version]="1.1"
off=14 version complete
off=18 headers complete method=1 v=1/1 flags=0 content_length=0
off=18 message complete
off=NULL finish=0
It should be unsafe to finish after incomplete PUT request
PUT / HTTP/1.1
Content-Length: 100
off=0 message begin
off=0 len=3 span[method]="PUT"
off=3 method complete
off=4 len=1 span[url]="/"
off=6 url complete
off=6 len=4 span[protocol]="HTTP"
off=10 protocol complete
off=11 len=3 span[version]="1.1"
off=14 version complete
off=16 len=14 span[header_field]="Content-Length"
off=31 header_field complete
off=32 len=3 span[header_value]="100"
off=NULL finish=2
It should be unsafe to finish inside of the header
PUT / HTTP/1.1
Content-Lengoff=0 message begin
off=0 len=3 span[method]="PUT"
off=3 method complete
off=4 len=1 span[url]="/"
off=6 url complete
off=6 len=4 span[protocol]="HTTP"
off=10 protocol complete
off=11 len=3 span[version]="1.1"
off=14 version complete
off=16 len=12 span[header_field]="Content-Leng"
off=NULL finish=2