Changeset

89:1752a9097e6b

verse.bosh: Update to use net.http instead of verse.plugins.http
author Matthew Wild <mwild1@gmail.com>
date Fri, 06 Aug 2010 17:07:56 +0100
parents 88:e204ef45bdd6
children 90:aa0b78053cec
files bosh.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bosh.lua	Fri Aug 06 16:31:30 2010 +0100
+++ b/bosh.lua	Fri Aug 06 17:07:56 2010 +0100
@@ -1,6 +1,8 @@
 
 local init_xmlhandlers = require "core.xmlhandlers";
 local st = require "util.stanza";
+require "net.httpclient_listener"; -- Required for net.http to work
+local http = require "net.http";
 
 local stream_mt = setmetatable({}, { __index = verse.stream_mt });
 stream_mt.__index = stream_mt;
@@ -25,7 +27,6 @@
 		return stream:_handle_response(response, code, request);
 	end
 	local conn = verse.new(logger, stream);
-	conn:add_plugin("http");
 	return setmetatable(conn, stream_mt);
 end
 
@@ -50,7 +51,7 @@
 			payload:add_child(stanza);
 			buffer[i] = nil;
 		end
-		local request = self.http.request(self.bosh_url, { body = tostring(payload) }, self.bosh_response_handler);
+		local request = http.request(self.bosh_url, { body = tostring(payload) }, self.bosh_response_handler);
 		table.insert(self.bosh_waiting_requests, request);
 	else
 		self:debug("Decided not to flush.");
@@ -71,7 +72,7 @@
 	body.attr.to = self.host;
 	body.attr.secure = 'true';
 	
-	self.http.request(self.bosh_url, { body = tostring(body) }, function (response)
+	http.request(self.bosh_url, { body = tostring(body) }, function (response)
 		-- Handle session creation response
 		local payload = self:_parse_response(response)
 		if not payload then