util.httpstream: Added support for an options callback, to allow passing per-message options to the parser.

Sat, 06 Nov 2010 01:54:58 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Sat, 06 Nov 2010 01:54:58 +0500
changeset 3566
75d287daad16
parent 3565
e2cc09e83a3e
child 3567
94828fb2dab8

util.httpstream: Added support for an options callback, to allow passing per-message options to the parser.

util/httpstream.lua file | annotate | diff | comparison | revisions
--- 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

mercurial