Software /
code /
prosody
File
net/httpserver_listener.lua @ 3041:7489ac1d5938
mod_bosh: Fix handling of rids by not dropping requests with repeated rids (assign them their sid instead), and always starting a session with first_rid-1.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 17 May 2010 11:46:54 +0100 |
parent | 2923:b7049746bd29 |
child | 2925:692b3c6c5bd2 |
child | 3046:92173d8a35d3 |
line wrap: on
line source
-- 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 connlisteners_register = require "net.connlisteners".register; local new_request = require "net.httpserver".new_request; local request_reader = require "net.httpserver".request_reader; local requests = {}; -- Open requests local httpserver = { default_port = 80, default_mode = "*a" }; function httpserver.listener(conn, data) local request = requests[conn]; if not request then request = new_request(conn); requests[conn] = request; -- If using HTTPS, request is secure if conn.ssl() then request.secure = true; end end if data then request_reader(request, data); end end function httpserver.disconnect(conn, err) local request = requests[conn]; if request and not request.destroyed then request.conn = nil; request_reader(request, nil); end requests[conn] = nil; end connlisteners_register("httpserver", httpserver);