Changeset

3566:75d287daad16

util.httpstream: Added support for an options callback, to allow passing per-message options to the parser.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 06 Nov 2010 01:54:58 +0500
parents 3565:e2cc09e83a3e
children 3567:94828fb2dab8
files util/httpstream.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/util/httpstream.lua	Sat Nov 06 01:08:30 2010 +0500
+++ b/util/httpstream.lua	Sat Nov 06 01:54:58 2010 +0500
@@ -7,7 +7,7 @@
 
 module("httpstream")
 
-local function parser(success_cb, parser_type)
+local function parser(success_cb, parser_type, options_cb)
 	local data = coroutine.yield();
 	local function readline()
 		local pos = data:find("\r\n", nil, true);
@@ -93,9 +93,9 @@
 	else coroutine.yield("unknown-parser-type"); end
 end
 
-function new(success_cb, error_cb, parser_type)
+function new(success_cb, error_cb, parser_type, options_cb)
 	local co = coroutine.create(parser);
-	coroutine.resume(co, success_cb, parser_type)
+	coroutine.resume(co, success_cb, parser_type, options_cb)
 	return {
 		feed = function(self, data)
 			if not data then