Software /
code /
prosody
Changeset
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 |
parents | 713:2afd6d9e21cd |
children | 715:beec1eb7d9c6 |
files | net/http.lua |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
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