librelist archives

« back to archive

Mongrel2-Lua Question For Josh

Mongrel2-Lua Question For Josh

From:
Zed A. Shaw
Date:
2010-12-08 @ 18:40
Hey Josh,

I saw you pop onto IRC and tell me not to pcall the recv_json.  I just
did an upgrade of Tir on hype.la, and I'm gettting a lot of requests
that seem to return nil.  Any idea why mongrel2-lua will give me a nil
on recv_json or any recv?

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] Mongrel2-Lua Question For Josh

From:
joshua simmons
Date:
2010-12-08 @ 18:54
The second return value should still give a normal error message, in the
case of recv_json it could be invalid json, or just a parsing bug. Could
also be a bug in my netstring parsing, or even just invalid data. Really
need to check the message though.
On Dec 9, 2010 5:40 AM, "Zed A. Shaw" <zedshaw@zedshaw.com> wrote:
> Hey Josh,
>
> I saw you pop onto IRC and tell me not to pcall the recv_json. I just
> did an upgrade of Tir on hype.la, and I'm gettting a lot of requests
> that seem to return nil. Any idea why mongrel2-lua will give me a nil
> on recv_json or any recv?
>
> --
> Zed A. Shaw
> http://zedshaw.com/

Re: [mongrel2] Mongrel2-Lua Question For Josh

From:
Zed A. Shaw
Date:
2010-12-08 @ 19:58
On Thu, Dec 09, 2010 at 05:54:57AM +1100, joshua simmons wrote:
> The second return value should still give a normal error message, in the
> case of recv_json it could be invalid json, or just a parsing bug. Could
> also be a bug in my netstring parsing, or even just invalid data. Really
> need to check the message though.

I figured it out, I should just be calling recv not recv_json.  I
thought you were checking the request.headers.METHOD == 'JSON', but now
that I think about it you do that in the request.parse so recv_json
should be for forcing json.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] Mongrel2-Lua Question For Josh

From:
joshua simmons
Date:
2010-12-08 @ 22:35
It makes me wonder if it wouldn't be more intuitive to only have recv and
then have a req:parse_json or something. Hidden work like that irks me
somewhat.
On Dec 9, 2010 6:58 AM, "Zed A. Shaw" <zedshaw@zedshaw.com> wrote:
> On Thu, Dec 09, 2010 at 05:54:57AM +1100, joshua simmons wrote:
>> The second return value should still give a normal error message, in the
>> case of recv_json it could be invalid json, or just a parsing bug. Could
>> also be a bug in my netstring parsing, or even just invalid data. Really
>> need to check the message though.
>
> I figured it out, I should just be calling recv not recv_json. I
> thought you were checking the request.headers.METHOD == 'JSON', but now
> that I think about it you do that in the request.parse so recv_json
> should be for forcing json.
>
> --
> Zed A. Shaw
> http://zedshaw.com/