X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=net%2Fhttpclient_listener.lua;h=dfa250623af523d18c4950608c42cfe043afd78f;hb=e2615fb00f14ddcb436afd00c7729e1135667d42;hp=a648743fb348dfff30f08173e6c8a072028125e8;hpb=a2783f91e5c215f106ffab944aeef978717d8c9b;p=prosody.git diff --git a/net/httpclient_listener.lua b/net/httpclient_listener.lua index a648743f..dfa25062 100644 --- a/net/httpclient_listener.lua +++ b/net/httpclient_listener.lua @@ -1,3 +1,11 @@ +-- Prosody IM +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 Waqas Hussain +-- +-- This project is MIT/X11 licensed. Please see the +-- COPYING file in the source package for more information. +-- + local log = require "util.logger".init("httpclient_listener"); local connlisteners_register = require "net.connlisteners".register; @@ -7,7 +15,7 @@ local buffers = {}; -- Buffers of partial lines local httpclient = { default_port = 80, default_mode = "*a" }; -function httpclient.listener(conn, data) +function httpclient.onincoming(conn, data) local request = requests[conn]; if not request then @@ -20,9 +28,9 @@ function httpclient.listener(conn, data) end end -function httpclient.disconnect(conn, err) +function httpclient.ondisconnect(conn, err) local request = requests[conn]; - if request then + if request and err ~= "closed" then request:reader(nil); end requests[conn] = nil;