"REQUEST_PATH"? vs "PATH_INFO"?

1,119 views
Skip to first unread message

Jeffrey 'jf' Lim

unread,
May 10, 2010, 11:46:40 PM5/10/10
to rack-...@googlegroups.com
hi, I just came across an app that uses 'REQUEST_PATH' instead of
'PATH_INFO'. Ordinarily (I guess if u dont use webrick?), I guess this
might not be a problem, but it seems like webrick always sets the
REQUEST_PATH as '/', whereas PATH_INFO varies, according to your
request. So I'm wondering - is it the fault of this app that it is
trying to rely on using REQUEST_PATH to determine the PATH? or is it
webrick's fault, and that somehow using we've all moved on, and using
REQUEST_PATH is ok, or even the recommended way? (The rack spec
http://rack.rubyforge.org/doc/SPEC.html only mentions PATH_INFO, btw,
so...)

I'm running rack 1.1.0, with webrick 1.3.1 from ruby 1.8.7. I'm
running a sinatra app, with 'rackup'.

thanks,
-jf

--
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."
--Richard Stallman

"It's so hard to write a graphics driver that open-sourcing it would not help."
-- Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org/node/7228

Yehuda Katz

unread,
May 11, 2010, 4:23:22 AM5/11/10
to rack-devel
REQUEST_PATH is a legacy variable that is completely undefined in Rack. Applications should use the Rack information, which should always be enough for any required purposes.

Yehuda Katz
Architect | Engine Yard
(ph) 718.877.1325

Jeffrey 'jf' Lim

unread,
May 11, 2010, 10:49:32 AM5/11/10
to rack-...@googlegroups.com
On Tue, May 11, 2010 at 4:23 PM, Yehuda Katz <wyc...@gmail.com> wrote:
> REQUEST_PATH is a legacy variable that is completely undefined in Rack.
> Applications should use the Rack information, which

great! I needed to hear that :) Looked through the cgi specs (rfc3875)
- and even that didnt define, or mention REQUEST_PATH...


> should always be enough
> for any required purposes.

u know, deja vu! reminds me of something somebody else said. 640k...
:P (but of course, *that* guy didnt have a basis for saying anything,
and was just simply pulling stuff out of his ass...)

Eric Wong

unread,
May 12, 2010, 7:04:13 PM5/12/10
to rack-...@googlegroups.com
Yehuda Katz <wyc...@gmail.com> wrote:
> REQUEST_PATH is a legacy variable that is completely undefined in Rack.

And yet `git grep REQUEST_PATH` reveals it some of the server handlers
and also the specs for handlers.

I wonder how many applications would break if it were removed
entirely...

I definitely wouldn't write code that depends on it, though.

--
Eric Wong

Yehuda Katz

unread,
May 12, 2010, 8:47:40 PM5/12/10
to rack-devel
Yep. The WEBRick handler is full of stuff completely unneeded by the Rack spec. I recently read through it for another purpose and I was shocked, because I expected it to be a pretty good reference implementation for Rack handlers (since WEBRick already implements CGI'ish variables pretty well).

Yehuda Katz
Architect | Engine Yard
(ph) 718.877.1325


Reply all
Reply to author
Forward
0 new messages