diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-01-14 03:06:26 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-01-14 03:06:26 +0000 |
commit | 06ffda18818e1d0f0e2c41eb59468586f6da9dec (patch) | |
tree | 05773c475ac447232d86c94505359b12f936faf8 /net | |
parent | 15cbc4d03ede8002ee850ec84784411534adda9d (diff) | |
download | prosody-06ffda18818e1d0f0e2c41eb59468586f6da9dec.tar.gz prosody-06ffda18818e1d0f0e2c41eb59468586f6da9dec.zip |
net.http: Fix for callbacks being triggered multiple times for the same request
Diffstat (limited to 'net')
-rw-r--r-- | net/http.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/http.lua b/net/http.lua index 2ff88269..da5b3c84 100644 --- a/net/http.lua +++ b/net/http.lua @@ -37,9 +37,11 @@ local function request_reader(request, data, startpos) 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 |