02:00:49  * DarkGodquit (Quit: Leaving)
04:37:15  * SkyRocknRolljoined
07:25:35  * ^vquit (Ping timeout: 264 seconds)
07:31:53  * ^vjoined
07:48:37  * inexquit (Quit: oh)
08:11:47  * ^vquit (Ping timeout: 264 seconds)
08:15:23  * ^vjoined
08:23:02  * inexjoined
08:24:02  * DarkGodjoined
08:38:27  * rendarjoined
08:45:23  * ^vquit (Ping timeout: 255 seconds)
08:45:53  * ^vjoined
09:08:36  * rendarquit (Ping timeout: 240 seconds)
09:09:54  * ^vquit (Ping timeout: 252 seconds)
09:10:27  * ^vjoined
09:36:59  * ^vquit (Ping timeout: 264 seconds)
09:37:32  * ^vjoined
09:39:16  * rendarjoined
09:43:03  * ^vquit (Ping timeout: 276 seconds)
09:44:34  * ^vjoined
09:51:47  * ^vquit (Ping timeout: 240 seconds)
10:01:47  * ^vjoined
10:09:30  * ^vquit (Ping timeout: 255 seconds)
10:10:33  * ^vjoined
10:15:42  * ^vquit (Ping timeout: 258 seconds)
10:16:34  * ^vjoined
10:44:49  * ^vquit (Ping timeout: 240 seconds)
10:47:18  * ^vjoined
10:57:09  * ^vquit (Ping timeout: 252 seconds)
11:00:50  * ^vjoined
11:15:09  * ^vquit (Ping timeout: 240 seconds)
11:22:19  * ^vjoined
11:43:49  * ^vquit (Ping timeout: 240 seconds)
11:58:08  * ^vjoined
12:26:17  * ^vquit (Ping timeout: 255 seconds)
12:46:40  * SkyRocknRollquit (Quit: Ex-Chat)
15:58:04  * ^vjoined
16:13:09  * ^vquit (Ping timeout: 240 seconds)
16:13:26  * whethereverjoined
16:18:34  * ^vjoined
16:58:31  * whetherever72joined
16:58:57  * whethereverquit (Read error: Connection reset by peer)
17:19:17  * DarkGodquit (Remote host closed the connection)
18:54:06  * DarkGodjoined
19:46:06  * Ulydevjoined
21:02:15  * Ulydevquit (Quit: Leaving...)
21:09:18  * rendarquit (Ping timeout: 252 seconds)
21:14:19  <Soni>creationix, you should tweak coro-wrapper decoder
21:14:31  <Soni>if newindex == #buffer then buffer = nil or something
21:15:29  <Soni>(or I can explicitly return data, nil myself >.< but I wanted to use "return chunk:match("^(.-)\r\n()", index)")
21:39:22  * rendarjoined
21:39:22  * rendarquit (Changing host)
21:39:22  * rendarjoined
21:43:45  * rendarquit (Client Quit)
21:47:14  <Soni>creationix, also, you should consider passing the writer function as an extra argument to the encoder
21:47:24  <Soni>it'd be slightly more efficient
21:47:55  <Soni>(it can be done backwards-compatibly)
21:49:33  <Soni>creationix, `return o .. '\r\n'` vs `write(o) write('\r\n')`
21:49:48  <Soni>where o is an string
21:50:14  <Soni>(it's called o because it can be any object, but the string case does "return o .. '\r\n'")
21:51:16  <creationix>Soni if I automatically convert empty string to nil then it breaks http keepalive in the http-codec
21:51:22  <creationix>there are some tricky edge cases in there
21:51:34  <creationix>http itself isn't as clean cut as I would like
21:51:40  <Soni>creationix, huh?
21:52:23  <creationix>"if newindex == #buffer then buffer = nil or something" will break http-codec and I can't figure out a way to make it work
21:52:28  <creationix>I tried that for a few hours the other day
21:53:13  <Soni>if doing that breaks http-codec, you're doing something wrong... because it makes no sense.
21:53:59  <Soni>creationix, are you calling the decode function with nils or something?
21:54:12  <creationix>I certain cases I think I might be
21:54:13  <Soni>(vs empty string)
21:54:37  <creationix>but it is up to the decoder to control that
21:54:45  <Soni>(if you get empty string from read(), you should pass empty string. if you get nil from read(), then you should pass nil...)
21:54:59  <Soni>(assuming the buffer is empty in both cases)
22:02:23  <NiteHawk>creationix: i've just created a PR for the dns stuff i was tinkering with - https://github.com/luvit/luvit/pull/945
22:03:08  <Soni>creationix, anyway what about the encoder thing?
22:04:44  <Soni>creationix, also, why's `want` a thing?
22:09:24  <creationix>NiteHawk thanks
22:09:46  <creationix>Soni want was also needed to make http-codec work
22:10:02  <creationix>if you want to propose any changes, please test them out with http-codec and ensure that it still works
22:10:37  <Soni>creationix, can read() return nil when the socket's not closed? (altho wait that doesn't sound like it'd affect it, unless you're closing the socket on the first nil...)
22:10:45  <Soni>uh
22:10:50  <Soni>this code confuses me
22:10:50  <creationix>no, read blocks while the socket is live
22:11:12  <creationix>if you try to read at the wrong time, it will deadlock the stream
22:11:35  <creationix>the want flag ensures that we only ever try to read when there is no data left to read and the decoder has had a chance to do everything it needs
22:11:48  <Soni>oh
22:11:51  <Soni>and uh
22:12:04  <Soni>why's being able to parse empty buffers a thing?
22:12:09  <Soni>won't that just loop forever?
22:12:38  <creationix>it's up to the decoder
22:12:46  <creationix>it will loop forever if your decoder is buggy
22:12:50  <Soni>assuming well-behaved decoders that don't take external input
22:13:12  <creationix>but in the case of http-codec it allows emitting the empty string body required for http requests that don't have a body
22:13:18  <Soni>creationix, it'll run with an empty chunk once
22:13:30  <Soni>which probably won't do anything
22:13:32  <creationix>the http-codec protocol emits one message for head, then chunks for body, then empty string to signify end of body
22:13:45  <Soni>and if you return a new index it'll keep looping
22:14:05  <creationix>so if it's decoding a request with no body, it needs coro-wrapper to call back into it after it emits the body
22:14:10  <creationix>even though there is no more data to parse
22:14:47  <Soni>I'll try it in a bit
22:14:50  <creationix>notice here that it returns a new index unconditionally https://github.com/luvit/lit/blob/master/deps/http-codec.lua#L229
22:15:12  <creationix>if you don't want coro-wrapper to call back into you and expect more data first, then you should return nil for the second arg
22:15:37  <creationix>basically returning anything, nil means "get more data before coming back to me"
22:15:39  <Soni>well, it *shouldn't* make a difference
22:15:54  <creationix>but returning an index means, "I've consumed up to here, call me again with the rest"
22:16:05  <creationix>it's pretty simple and required for the protocol that http-codec implements
22:16:19  <creationix>(protocol meaning the outgoing events, not the incoming http data)
22:17:03  <Soni>ok
22:17:04  <Soni>anyway
22:17:14  <Soni><Soni> creationix, anyway what about the encoder thing?
22:19:31  <creationix>what about encoder? That's pretty straightforward
22:19:56  <Soni>creationix, oh I see what you're doing
22:20:04  <Soni>you wanted a way to insert arbitrary chunks
22:31:23  <creationix>http directly is tricky and has tons of edge cases. The protocol that http-codec emits is easy to work with. 1 header event, 0 or more body chunks, 1 empty string.
22:31:40  <creationix>it doesn't matter if it's a GET request, a HEAD response, an upgrade or anything
22:32:18  <creationix>the body can be implied empty, explicitly empty, chunk encoded, length delimited, etc and it all comes out uniformly 1 head, 0-n chunks and 1 empty string
22:32:56  <creationix>(also it normalized the body chunks. Chunked encoding gets removed from chunks)
22:33:24  <Soni>alright, I see your use-case
22:33:47  <Soni>it's a bit weird imo :P
22:40:32  <creationix>http is weird, can't do much about that
22:40:36  <creationix>just trying to make it easier to use
22:42:14  <Soni>I meant the thing with the decoder
22:50:51  <NiteHawk>that was a fast merge! :D thanks
22:58:32  <Soni>shitty IRC client ftw https://vgy.me/Zf8XFN
23:30:19  <rphillips>Soni: nice!
23:37:15  <daurnimator>creationix: hope you might be able to use lua-http somehow
23:38:28  <Soni>and yes, I called the IRC client "bot.lua" .-.