Software /
code /
prosody
Diff
net/http.lua @ 714:ab3c47f4fe1d
net.http: Fix for callbacks being triggered multiple times for the same request
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 14 Jan 2009 03:06:26 +0000 |
parent | 678:1859edec2237 |
child | 719:b1eb112478b8 |
line wrap: on
line diff
--- a/net/http.lua Tue Jan 13 23:16:39 2009 +0500 +++ b/net/http.lua Wed Jan 14 03:06:26 2009 +0000 @@ -37,9 +37,11 @@ request.callback("connection-closed", 0, request); end destroy_request(request); + request.body = nil; + request.state = "completed"; return; end - if request.state == "body" then + if request.state == "body" and request.state ~= "completed" then print("Reading body...") if not request.body then request.body = {}; request.havebodylength, request.bodylength = 0, tonumber(request.responseheaders["content-length"]); end if startpos then