diff options
Diffstat (limited to 'src/http.lua')
| -rw-r--r-- | src/http.lua | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/http.lua b/src/http.lua index 6cdc90a..3e2c789 100644 --- a/src/http.lua +++ b/src/http.lua | |||
| @@ -360,7 +360,7 @@ local trequest, tredirect | |||
| 360 | headers = reqt.headers, | 360 | headers = reqt.headers, |
| 361 | proxy = reqt.proxy, | 361 | proxy = reqt.proxy, |
| 362 | maxredirects = reqt.maxredirects, | 362 | maxredirects = reqt.maxredirects, |
| 363 | response_headers = reqt.response_headers, | 363 | headers_callback = reqt.headers_callback, |
| 364 | nredirects = (reqt.nredirects or 0) + 1, | 364 | nredirects = (reqt.nredirects or 0) + 1, |
| 365 | create = reqt.create | 365 | create = reqt.create |
| 366 | } | 366 | } |
| @@ -405,12 +405,8 @@ end | |||
| 405 | end | 405 | end |
| 406 | -- here we are finally done | 406 | -- here we are finally done |
| 407 | -- provide an opportunity to abort or replace the sink based on the response headers | 407 | -- provide an opportunity to abort or replace the sink based on the response headers |
| 408 | if nreqt.response_headers then | 408 | if nreqt.headers_callback then |
| 409 | local abort, sink = nreqt.response_headers(code, headers, status) | 409 | local _, sink = h.try(nreqt.headers_callback(code, headers, status, h.c)) |
| 410 | if abort then | ||
| 411 | h:close() | ||
| 412 | return 1, code, headers, status | ||
| 413 | end | ||
| 414 | if sink then | 410 | if sink then |
| 415 | nreqt.sink = sink | 411 | nreqt.sink = sink |
| 416 | end | 412 | end |
