Commit cb29b29
authored
fix: guard read_body in captcha verify state for HTTP/2 requests (#142)
ngx.req.read_body() raises a runtime error for HTTP/2 (and HTTP/3) requests
without a Content-Length header. The captcha verify-state handler in
csmod.Allow() called read_body unconditionally, causing nginx to return
HTTP 500 whenever a client with an active captcha decision reloaded the
challenge page over HTTP/2.
The guard mirrors the one already used in get_body(): if the protocol is
HTTP/2+ and Content-Length is missing, skip the body read and treat the
request as having no POST args. Genuine captcha form submissions are
POSTs from browsers that always include Content-Length, so the guard
does not interfere with the verification flow.
Closes #631 parent 6e57e28 commit cb29b29
1 file changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
761 | 761 | | |
762 | 762 | | |
763 | 763 | | |
764 | | - | |
765 | | - | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
766 | 776 | | |
767 | 777 | | |
768 | 778 | | |
| |||
0 commit comments