Fwd: [Rook] Rhttpd hangs when POST data is empty (#6)

40 views
Skip to first unread message

Jeffrey Horner

unread,
May 6, 2013, 3:57:44 PM5/6/13
to rr...@googlegroups.com
Simon's not on the mailing list so here's his response to me.


---------- Forwarded message ----------
From: Simon Urbanek <simon....@r-project.org>
Date: Mon, May 6, 2013 at 12:20 PM
Subject: Re: [Rook] Rhttpd hangs when POST data is empty (#6)
To: Jeffrey Horner <jeffrey...@gmail.com>
Cc: jeffreyhorner/Rook
<reply+i-11377476-8c4e81f3f99a326...@reply.github.com>


On May 6, 2013, at 11:40 AM, Jeffrey Horner wrote:

> Simon is there a way to get the first line of HTTP protocol information to the R user?
>

Not currently. Note that the internal httpd was intended solely for
the help system so it's not designed to be general-purpose server. It
doesn't handle anything beyond HEAD/GET/POST anyway. To be honest, I'd
much rather have Rook use the HTTP server in Rserve instead which
could be more easily extended (since R doesn't rely on it internally),
supports HTTPS and doesn't suffer from the limitations in the built-in
one (serial processing, mashing into the event loop etc.). But we
could talk about what is needed.

I don't follow the original discussion, but if what Jeroen refers to
is a bug in the Rhttpd please let me know and I'll have a look.

Cheers,
Simon


>
> On Mon, May 6, 2013 at 1:41 AM, Jeroen <notifi...@github.com> wrote:
> I am going to guess this is related to the following line in Rhttpd.R:
>
> assign('REQUEST_METHOD',ifelse(is.null(postBody),'GET','POST'),env)
>
> This is due to a design flaw in the R build-in http server in R. For some reason they decided to not include the http method in the handler signature. See this paper for more details.
>
> The workaround chooses between GET or POST based on the presence of a request body. However this method is far from flawless of course. A body can be present for POST as well as PUT, but is optional. When no body is present, any method could have been used.
>
> —
> Reply to this email directly or view it on GitHub.
>
>

Jeroen Ooms

unread,
May 6, 2013, 4:07:08 PM5/6/13
to rr...@googlegroups.com
On Mon, May 6, 2013 at 12:57 PM, Jeffrey Horner
<jeffrey...@gmail.com> wrote:
> Simon's not on the mailing list so here's his response to me.

Oh snap I just emailed him as well. Unfortunate communication from my
side, sorry.

> Not currently. Note that the internal httpd was intended solely for the help system so it's not designed to be general-purpose server. It doesn't handle anything beyond HEAD/GET/POST anyway.
I don't understand what he means by handle. The method is just a
string? The user defines what to do with it?


> To be honest, I'd much rather have Rook use the HTTP server in Rserve instead which could be more easily extended (since R doesn't rely on it internally), supports HTTPS and doesn't suffer from the limitations in the built-in one (serial processing, mashing into the event loop etc.).

Rserve has a httpd? Where? And why doesn't it implement Rook yet? :-)
I think httpuv is another alternative, but it would be great to be
able to use the DynamicHelp as well. It seems like a trivial
implementation to pass on the method string to the handler.

Jeffrey Horner

unread,
May 6, 2013, 4:36:11 PM5/6/13
to rr...@googlegroups.com
On Mon, May 6, 2013 at 3:07 PM, Jeroen Ooms <jeroe...@gmail.com> wrote:
> On Mon, May 6, 2013 at 12:57 PM, Jeffrey Horner
> <jeffrey...@gmail.com> wrote:
>> Simon's not on the mailing list so here's his response to me.
>
> Oh snap I just emailed him as well. Unfortunate communication from my
> side, sorry.
>
>> Not currently. Note that the internal httpd was intended solely for the help system so it's not designed to be general-purpose server. It doesn't handle anything beyond HEAD/GET/POST anyway.
> I don't understand what he means by handle. The method is just a
> string? The user defines what to do with it?

All he's saying is that the internal httpd server (Rhttpd) was never
intended for user applications. Rhttpd.R, which comes with Rook,
exposes everything about the requests that it can to the user.

>
>
>> To be honest, I'd much rather have Rook use the HTTP server in Rserve instead which could be more easily extended (since R doesn't rely on it internally), supports HTTPS and doesn't suffer from the limitations in the built-in one (serial processing, mashing into the event loop etc.).
>
> Rserve has a httpd? Where? And why doesn't it implement Rook yet? :-)

Yeah, I didn't know that. I'm sure if there were enough demand, Rserve
could support Rook applications.

> I think httpuv is another alternative, but it would be great to be
> able to use the DynamicHelp as well. It seems like a trivial
> implementation to pass on the method string to the handler.

Agreed, but you're still talking about making a change to the tools
package which is not trivial.

>
> --
> You received this message because you are subscribed to the Google Groups "rRook" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rrook+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Jeffrey Horner

unread,
May 10, 2013, 11:19:03 AM5/10/13
to rr...@googlegroups.com
Well now, there you go!

---------- Forwarded message ----------
From: Simon Urbanek <notifi...@github.com>
Date: Fri, May 10, 2013 at 10:13 AM
Subject: Re: [Rook] Rhttpd hangs when POST data is empty (#6)
To: jeffreyhorner/Rook <Ro...@noreply.github.com>
Cc: jeffreyhorner <jeffrey...@gmail.com>


That's actually irrelevant here - the problem was that Rhttpd would choke on POST requests with no content length. This is now fixed in R-patched and R-devel.

As for your other question - Rhttpd will now pass the method in Request-Method: header to custom handlers. But beware, it means the handle is now responsible for handling unimplemented methods!


Reply to this email directly or view it on GitHub.


Jeroen Ooms

unread,
May 10, 2013, 1:00:50 PM5/10/13
to rr...@googlegroups.com
Cool, sounds great. I'll try to see if I can build an r-patched one of these days to test it.


Reply all
Reply to author
Forward
0 new messages