rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Lighttpd's FastCGI Environment
@ 2009-08-28 14:37 bones
  2009-08-28 20:43 ` Yehuda Katz
  2009-08-28 22:22 ` Magnus Holm
  0 siblings, 2 replies; 9+ messages in thread
From: bones @ 2009-08-28 14:37 UTC (permalink / raw)
  To: Rack Development


I am porting my application from ruby fcgi to rack which is in
production using the Lighttpd webserver.

I noticed that lighttpd doesn't send PATH_INFO or QUERY_STRING so I
used to patch it by reconstructing it from REQUEST_URI. Now with Rack
I have exactly the same situation. Rack::Request.GET is empty. This
fix on the environment makes it working:

class RackApp

  def fix_env(ec)
       if (ec['PATH_INFO'].to_s.empty?) then
          pi =  ec['REQUEST_URI']
          pi = pi[0..(pi.index('?')-1)] if pi.include?('?')
          ec['PATH_INFO'] = pi
       end

       if (ec['QUERY_STRING'].to_s.empty?) then
          ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ?
              ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] :
              ""
       end
       ec
  end

 def call(env)
    Rack::Request.new(fix_env(env))
   # [...]
  end
end


As far as I know Lighttpd and Rails (which used Rack?!) is a popular
combination - so I am quiet surprised that I don't find anything
related on the web. Especially - shouldn't that be implemented into
Rack's CGI/FastCGI Handler?

Cheers,
Martin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lighttpd's FastCGI Environment
  2009-08-28 14:37 Lighttpd's FastCGI Environment bones
@ 2009-08-28 20:43 ` Yehuda Katz
  2009-08-28 22:22 ` Magnus Holm
  1 sibling, 0 replies; 9+ messages in thread
From: Yehuda Katz @ 2009-08-28 20:43 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]

These sounds like bugs in the Rack LightHTTP adapter. It looks like
LightHTTP is supposed to work: http://rack.rubyforge.org/doc/
-- Yehuda

On Fri, Aug 28, 2009 at 9:37 AM, bones <boesemar@googlemail.com> wrote:

>
> I am porting my application from ruby fcgi to rack which is in
> production using the Lighttpd webserver.
>
> I noticed that lighttpd doesn't send PATH_INFO or QUERY_STRING so I
> used to patch it by reconstructing it from REQUEST_URI. Now with Rack
> I have exactly the same situation. Rack::Request.GET is empty. This
> fix on the environment makes it working:
>
> class RackApp
>
>  def fix_env(ec)
>       if (ec['PATH_INFO'].to_s.empty?) then
>          pi =  ec['REQUEST_URI']
>          pi = pi[0..(pi.index('?')-1)] if pi.include?('?')
>          ec['PATH_INFO'] = pi
>       end
>
>       if (ec['QUERY_STRING'].to_s.empty?) then
>          ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ?
>              ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] :
>              ""
>       end
>       ec
>  end
>
>  def call(env)
>    Rack::Request.new(fix_env(env))
>   # [...]
>  end
> end
>
>
> As far as I know Lighttpd and Rails (which used Rack?!) is a popular
> combination - so I am quiet surprised that I don't find anything
> related on the web. Especially - shouldn't that be implemented into
> Rack's CGI/FastCGI Handler?
>
> Cheers,
> Martin
>



-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

[-- Attachment #2: Type: text/html, Size: 2029 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lighttpd's FastCGI Environment
  2009-08-28 14:37 Lighttpd's FastCGI Environment bones
  2009-08-28 20:43 ` Yehuda Katz
@ 2009-08-28 22:22 ` Magnus Holm
  2009-08-29  8:17   ` Martin Boese
  1 sibling, 1 reply; 9+ messages in thread
From: Magnus Holm @ 2009-08-28 22:22 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

There is another know issue with Lighttpd:
http://github.com/rack/rack/blob/master/KNOWN-ISSUES
Maybe they're related?

//Magnus Holm


On Fri, Aug 28, 2009 at 16:37, bones <boesemar@googlemail.com> wrote:

>
> I am porting my application from ruby fcgi to rack which is in
> production using the Lighttpd webserver.
>
> I noticed that lighttpd doesn't send PATH_INFO or QUERY_STRING so I
> used to patch it by reconstructing it from REQUEST_URI. Now with Rack
> I have exactly the same situation. Rack::Request.GET is empty. This
> fix on the environment makes it working:
>
> class RackApp
>
>  def fix_env(ec)
>       if (ec['PATH_INFO'].to_s.empty?) then
>          pi =  ec['REQUEST_URI']
>          pi = pi[0..(pi.index('?')-1)] if pi.include?('?')
>          ec['PATH_INFO'] = pi
>       end
>
>       if (ec['QUERY_STRING'].to_s.empty?) then
>          ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ?
>              ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] :
>              ""
>       end
>       ec
>  end
>
>  def call(env)
>    Rack::Request.new(fix_env(env))
>   # [...]
>  end
> end
>
>
> As far as I know Lighttpd and Rails (which used Rack?!) is a popular
> combination - so I am quiet surprised that I don't find anything
> related on the web. Especially - shouldn't that be implemented into
> Rack's CGI/FastCGI Handler?
>
> Cheers,
> Martin
>

[-- Attachment #2: Type: text/html, Size: 2037 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lighttpd's FastCGI Environment
  2009-08-28 22:22 ` Magnus Holm
@ 2009-08-29  8:17   ` Martin Boese
  2009-08-29 14:06     ` Yehuda Katz
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Boese @ 2009-08-29  8:17 UTC (permalink / raw)
  To: rack-devel


On Fri, Aug 28, 2009 at 11:22 PM, Magnus Holm <judofyr@gmail.com> wrote:
>
> There is another know issue with Lighttpd: http://github.com/rack/rack/blob/master/KNOWN-ISSUES
>
> Maybe they're related?
>
> //Magnus Holm

Thanks, yes that sounds related.

I was hoping that Rack will give me a standard set of environments no
matter in which technologie the applicaion is deployed at the end.
But I guess that should be fixed in Lighttpd's cgi implementation instead...

Martin


>
>
> On Fri, Aug 28, 2009 at 16:37, bones <boesemar@googlemail.com> wrote:
>>
>>
>> I am porting my application from ruby fcgi to rack which is in
>> production using the Lighttpd webserver.
>>
>> I noticed that lighttpd doesn't send PATH_INFO or QUERY_STRING so I
>> used to patch it by reconstructing it from REQUEST_URI. Now with Rack
>> I have exactly the same situation. Rack::Request.GET is empty. This
>> fix on the environment makes it working:
>>
>> class RackApp
>>
>>  def fix_env(ec)
>>       if (ec['PATH_INFO'].to_s.empty?) then
>>          pi =  ec['REQUEST_URI']
>>          pi = pi[0..(pi.index('?')-1)] if pi.include?('?')
>>          ec['PATH_INFO'] = pi
>>       end
>>
>>       if (ec['QUERY_STRING'].to_s.empty?) then
>>          ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ?
>>              ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] :
>>              ""
>>       end
>>       ec
>>  end
>>
>>  def call(env)
>>    Rack::Request.new(fix_env(env))
>>   # [...]
>>  end
>> end
>>
>>
>> As far as I know Lighttpd and Rails (which used Rack?!) is a popular
>> combination - so I am quiet surprised that I don't find anything
>> related on the web. Especially - shouldn't that be implemented into
>> Rack's CGI/FastCGI Handler?
>>
>> Cheers,
>> Martin
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lighttpd's FastCGI Environment
  2009-08-29  8:17   ` Martin Boese
@ 2009-08-29 14:06     ` Yehuda Katz
  2009-08-29 17:59       ` Magnus Holm
  2009-08-30  8:45       ` Martin Boese
  0 siblings, 2 replies; 9+ messages in thread
From: Yehuda Katz @ 2009-08-29 14:06 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 2122 bytes --]

That is definitely the intention. This should be fixed in the rack lighty
adapter.
-- Yehuda

On Sat, Aug 29, 2009 at 3:17 AM, Martin Boese <boesemar@googlemail.com>wrote:

>
> On Fri, Aug 28, 2009 at 11:22 PM, Magnus Holm <judofyr@gmail.com> wrote:
> >
> > There is another know issue with Lighttpd:
> http://github.com/rack/rack/blob/master/KNOWN-ISSUES
> >
> > Maybe they're related?
> >
> > //Magnus Holm
>
> Thanks, yes that sounds related.
>
> I was hoping that Rack will give me a standard set of environments no
> matter in which technologie the applicaion is deployed at the end.
> But I guess that should be fixed in Lighttpd's cgi implementation
> instead...
>
> Martin
>
>
> >
> >
> > On Fri, Aug 28, 2009 at 16:37, bones <boesemar@googlemail.com> wrote:
> >>
> >>
> >> I am porting my application from ruby fcgi to rack which is in
> >> production using the Lighttpd webserver.
> >>
> >> I noticed that lighttpd doesn't send PATH_INFO or QUERY_STRING so I
> >> used to patch it by reconstructing it from REQUEST_URI. Now with Rack
> >> I have exactly the same situation. Rack::Request.GET is empty. This
> >> fix on the environment makes it working:
> >>
> >> class RackApp
> >>
> >>  def fix_env(ec)
> >>       if (ec['PATH_INFO'].to_s.empty?) then
> >>          pi =  ec['REQUEST_URI']
> >>          pi = pi[0..(pi.index('?')-1)] if pi.include?('?')
> >>          ec['PATH_INFO'] = pi
> >>       end
> >>
> >>       if (ec['QUERY_STRING'].to_s.empty?) then
> >>          ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ?
> >>              ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] :
> >>              ""
> >>       end
> >>       ec
> >>  end
> >>
> >>  def call(env)
> >>    Rack::Request.new(fix_env(env))
> >>   # [...]
> >>  end
> >> end
> >>
> >>
> >> As far as I know Lighttpd and Rails (which used Rack?!) is a popular
> >> combination - so I am quiet surprised that I don't find anything
> >> related on the web. Especially - shouldn't that be implemented into
> >> Rack's CGI/FastCGI Handler?
> >>
> >> Cheers,
> >> Martin
> >
> >
>



-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

[-- Attachment #2: Type: text/html, Size: 3248 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lighttpd's FastCGI Environment
  2009-08-29 14:06     ` Yehuda Katz
@ 2009-08-29 17:59       ` Magnus Holm
  2009-08-30  8:45       ` Martin Boese
  1 sibling, 0 replies; 9+ messages in thread
From: Magnus Holm @ 2009-08-29 17:59 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 2327 bytes --]

Which rack lighty adapter?

//Magnus Holm


On Sat, Aug 29, 2009 at 16:06, Yehuda Katz <wycats@gmail.com> wrote:

> That is definitely the intention. This should be fixed in the rack lighty
> adapter.
> -- Yehuda
>
>
> On Sat, Aug 29, 2009 at 3:17 AM, Martin Boese <boesemar@googlemail.com>wrote:
>
>>
>> On Fri, Aug 28, 2009 at 11:22 PM, Magnus Holm <judofyr@gmail.com> wrote:
>> >
>> > There is another know issue with Lighttpd:
>> http://github.com/rack/rack/blob/master/KNOWN-ISSUES
>> >
>> > Maybe they're related?
>> >
>> > //Magnus Holm
>>
>> Thanks, yes that sounds related.
>>
>> I was hoping that Rack will give me a standard set of environments no
>> matter in which technologie the applicaion is deployed at the end.
>> But I guess that should be fixed in Lighttpd's cgi implementation
>> instead...
>>
>> Martin
>>
>>
>> >
>> >
>> > On Fri, Aug 28, 2009 at 16:37, bones <boesemar@googlemail.com> wrote:
>> >>
>> >>
>> >> I am porting my application from ruby fcgi to rack which is in
>> >> production using the Lighttpd webserver.
>> >>
>> >> I noticed that lighttpd doesn't send PATH_INFO or QUERY_STRING so I
>> >> used to patch it by reconstructing it from REQUEST_URI. Now with Rack
>> >> I have exactly the same situation. Rack::Request.GET is empty. This
>> >> fix on the environment makes it working:
>> >>
>> >> class RackApp
>> >>
>> >>  def fix_env(ec)
>> >>       if (ec['PATH_INFO'].to_s.empty?) then
>> >>          pi =  ec['REQUEST_URI']
>> >>          pi = pi[0..(pi.index('?')-1)] if pi.include?('?')
>> >>          ec['PATH_INFO'] = pi
>> >>       end
>> >>
>> >>       if (ec['QUERY_STRING'].to_s.empty?) then
>> >>          ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ?
>> >>              ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] :
>> >>              ""
>> >>       end
>> >>       ec
>> >>  end
>> >>
>> >>  def call(env)
>> >>    Rack::Request.new(fix_env(env))
>> >>   # [...]
>> >>  end
>> >> end
>> >>
>> >>
>> >> As far as I know Lighttpd and Rails (which used Rack?!) is a popular
>> >> combination - so I am quiet surprised that I don't find anything
>> >> related on the web. Especially - shouldn't that be implemented into
>> >> Rack's CGI/FastCGI Handler?
>> >>
>> >> Cheers,
>> >> Martin
>> >
>> >
>>
>
>
>
> --
> Yehuda Katz
> Developer | Engine Yard
> (ph) 718.877.1325
>

[-- Attachment #2: Type: text/html, Size: 3799 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lighttpd's FastCGI Environment
  2009-08-29 14:06     ` Yehuda Katz
  2009-08-29 17:59       ` Magnus Holm
@ 2009-08-30  8:45       ` Martin Boese
  2009-08-30 18:27         ` Magnus Holm
  1 sibling, 1 reply; 9+ messages in thread
From: Martin Boese @ 2009-08-30  8:45 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 2732 bytes --]

You mean the Rack FastCGI Handler...

if that's the case, this fix works for me:

rack-1.0.0/lib/rack/handler/fastcgi.rb

48c48,55
<         env["QUERY_STRING"] ||= ""
---
>         if env["PATH_INFO"].to_s.empty? then
>            env["PATH_INFO"] = env["REQUEST_URI"].split('?')[0]
>         end
>
>         if env['QUERY_STRING'].to_s.empty? then
>            env['QUERY_STRING'] = env['REQUEST_URI'].scan(/.+?\?(.*)/).to_s
>         end
>




On Sat, Aug 29, 2009 at 3:06 PM, Yehuda Katz <wycats@gmail.com> wrote:

> That is definitely the intention. This should be fixed in the rack lighty
> adapter.
> -- Yehuda
>
>
> On Sat, Aug 29, 2009 at 3:17 AM, Martin Boese <boesemar@googlemail.com>wrote:
>
>>
>> On Fri, Aug 28, 2009 at 11:22 PM, Magnus Holm <judofyr@gmail.com> wrote:
>> >
>> > There is another know issue with Lighttpd:
>> http://github.com/rack/rack/blob/master/KNOWN-ISSUES
>> >
>> > Maybe they're related?
>> >
>> > //Magnus Holm
>>
>> Thanks, yes that sounds related.
>>
>> I was hoping that Rack will give me a standard set of environments no
>> matter in which technologie the applicaion is deployed at the end.
>> But I guess that should be fixed in Lighttpd's cgi implementation
>> instead...
>>
>> Martin
>>
>>
>> >
>> >
>> > On Fri, Aug 28, 2009 at 16:37, bones <boesemar@googlemail.com> wrote:
>> >>
>> >>
>> >> I am porting my application from ruby fcgi to rack which is in
>> >> production using the Lighttpd webserver.
>> >>
>> >> I noticed that lighttpd doesn't send PATH_INFO or QUERY_STRING so I
>> >> used to patch it by reconstructing it from REQUEST_URI. Now with Rack
>> >> I have exactly the same situation. Rack::Request.GET is empty. This
>> >> fix on the environment makes it working:
>> >>
>> >> class RackApp
>> >>
>> >>  def fix_env(ec)
>> >>       if (ec['PATH_INFO'].to_s.empty?) then
>> >>          pi =  ec['REQUEST_URI']
>> >>          pi = pi[0..(pi.index('?')-1)] if pi.include?('?')
>> >>          ec['PATH_INFO'] = pi
>> >>       end
>> >>
>> >>       if (ec['QUERY_STRING'].to_s.empty?) then
>> >>          ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ?
>> >>              ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] :
>> >>              ""
>> >>       end
>> >>       ec
>> >>  end
>> >>
>> >>  def call(env)
>> >>    Rack::Request.new(fix_env(env))
>> >>   # [...]
>> >>  end
>> >> end
>> >>
>> >>
>> >> As far as I know Lighttpd and Rails (which used Rack?!) is a popular
>> >> combination - so I am quiet surprised that I don't find anything
>> >> related on the web. Especially - shouldn't that be implemented into
>> >> Rack's CGI/FastCGI Handler?
>> >>
>> >> Cheers,
>> >> Martin
>> >
>> >
>>
>
>
>
> --
> Yehuda Katz
> Developer | Engine Yard
> (ph) 718.877.1325
>

[-- Attachment #2: Type: text/html, Size: 4358 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lighttpd's FastCGI Environment
  2009-08-30  8:45       ` Martin Boese
@ 2009-08-30 18:27         ` Magnus Holm
  2009-08-30 18:51           ` Yehuda Katz
  0 siblings, 1 reply; 9+ messages in thread
From: Magnus Holm @ 2009-08-30 18:27 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 3089 bytes --]

IMO, Rack::Handler::FastCGI should strictly follow the FastCGI spec. If the
FastCGI doesn't mention it, we shouldn't take care of it.

//Magnus Holm


On Sun, Aug 30, 2009 at 10:45, Martin Boese <boesemar@googlemail.com> wrote:

> You mean the Rack FastCGI Handler...
>
> if that's the case, this fix works for me:
>
> rack-1.0.0/lib/rack/handler/fastcgi.rb
>
> 48c48,55
> <         env["QUERY_STRING"] ||= ""
> ---
> >         if env["PATH_INFO"].to_s.empty? then
> >            env["PATH_INFO"] = env["REQUEST_URI"].split('?')[0]
> >         end
> >
> >         if env['QUERY_STRING'].to_s.empty? then
> >            env['QUERY_STRING'] =
> env['REQUEST_URI'].scan(/.+?\?(.*)/).to_s
> >         end
>
> >
>
>
>
>
> On Sat, Aug 29, 2009 at 3:06 PM, Yehuda Katz <wycats@gmail.com> wrote:
>
>> That is definitely the intention. This should be fixed in the rack lighty
>> adapter.
>> -- Yehuda
>>
>>
>> On Sat, Aug 29, 2009 at 3:17 AM, Martin Boese <boesemar@googlemail.com>wrote:
>>
>>>
>>> On Fri, Aug 28, 2009 at 11:22 PM, Magnus Holm <judofyr@gmail.com> wrote:
>>> >
>>> > There is another know issue with Lighttpd:
>>> http://github.com/rack/rack/blob/master/KNOWN-ISSUES
>>> >
>>> > Maybe they're related?
>>> >
>>> > //Magnus Holm
>>>
>>> Thanks, yes that sounds related.
>>>
>>> I was hoping that Rack will give me a standard set of environments no
>>> matter in which technologie the applicaion is deployed at the end.
>>> But I guess that should be fixed in Lighttpd's cgi implementation
>>> instead...
>>>
>>> Martin
>>>
>>>
>>> >
>>> >
>>> > On Fri, Aug 28, 2009 at 16:37, bones <boesemar@googlemail.com> wrote:
>>> >>
>>> >>
>>> >> I am porting my application from ruby fcgi to rack which is in
>>> >> production using the Lighttpd webserver.
>>> >>
>>> >> I noticed that lighttpd doesn't send PATH_INFO or QUERY_STRING so I
>>> >> used to patch it by reconstructing it from REQUEST_URI. Now with Rack
>>> >> I have exactly the same situation. Rack::Request.GET is empty. This
>>> >> fix on the environment makes it working:
>>> >>
>>> >> class RackApp
>>> >>
>>> >>  def fix_env(ec)
>>> >>       if (ec['PATH_INFO'].to_s.empty?) then
>>> >>          pi =  ec['REQUEST_URI']
>>> >>          pi = pi[0..(pi.index('?')-1)] if pi.include?('?')
>>> >>          ec['PATH_INFO'] = pi
>>> >>       end
>>> >>
>>> >>       if (ec['QUERY_STRING'].to_s.empty?) then
>>> >>          ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ?
>>> >>              ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] :
>>> >>              ""
>>> >>       end
>>> >>       ec
>>> >>  end
>>> >>
>>> >>  def call(env)
>>> >>    Rack::Request.new(fix_env(env))
>>> >>   # [...]
>>> >>  end
>>> >> end
>>> >>
>>> >>
>>> >> As far as I know Lighttpd and Rails (which used Rack?!) is a popular
>>> >> combination - so I am quiet surprised that I don't find anything
>>> >> related on the web. Especially - shouldn't that be implemented into
>>> >> Rack's CGI/FastCGI Handler?
>>> >>
>>> >> Cheers,
>>> >> Martin
>>> >
>>> >
>>>
>>
>>
>>
>> --
>> Yehuda Katz
>> Developer | Engine Yard
>> (ph) 718.877.1325
>>
>
>

[-- Attachment #2: Type: text/html, Size: 5033 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lighttpd's FastCGI Environment
  2009-08-30 18:27         ` Magnus Holm
@ 2009-08-30 18:51           ` Yehuda Katz
  0 siblings, 0 replies; 9+ messages in thread
From: Yehuda Katz @ 2009-08-30 18:51 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 3425 bytes --]

Then we need a lighty adapter that inherits from the FCGI one.
-- Yehuda

On Sun, Aug 30, 2009 at 1:27 PM, Magnus Holm <judofyr@gmail.com> wrote:

> IMO, Rack::Handler::FastCGI should strictly follow the FastCGI spec. If the
> FastCGI doesn't mention it, we shouldn't take care of it.
>
> //Magnus Holm
>
>
>
> On Sun, Aug 30, 2009 at 10:45, Martin Boese <boesemar@googlemail.com>wrote:
>
>> You mean the Rack FastCGI Handler...
>>
>> if that's the case, this fix works for me:
>>
>> rack-1.0.0/lib/rack/handler/fastcgi.rb
>>
>> 48c48,55
>> <         env["QUERY_STRING"] ||= ""
>> ---
>> >         if env["PATH_INFO"].to_s.empty? then
>> >            env["PATH_INFO"] = env["REQUEST_URI"].split('?')[0]
>> >         end
>> >
>> >         if env['QUERY_STRING'].to_s.empty? then
>> >            env['QUERY_STRING'] =
>> env['REQUEST_URI'].scan(/.+?\?(.*)/).to_s
>> >         end
>>
>> >
>>
>>
>>
>>
>> On Sat, Aug 29, 2009 at 3:06 PM, Yehuda Katz <wycats@gmail.com> wrote:
>>
>>> That is definitely the intention. This should be fixed in the rack lighty
>>> adapter.
>>> -- Yehuda
>>>
>>>
>>> On Sat, Aug 29, 2009 at 3:17 AM, Martin Boese <boesemar@googlemail.com>wrote:
>>>
>>>>
>>>> On Fri, Aug 28, 2009 at 11:22 PM, Magnus Holm <judofyr@gmail.com>
>>>> wrote:
>>>> >
>>>> > There is another know issue with Lighttpd:
>>>> http://github.com/rack/rack/blob/master/KNOWN-ISSUES
>>>> >
>>>> > Maybe they're related?
>>>> >
>>>> > //Magnus Holm
>>>>
>>>> Thanks, yes that sounds related.
>>>>
>>>> I was hoping that Rack will give me a standard set of environments no
>>>> matter in which technologie the applicaion is deployed at the end.
>>>> But I guess that should be fixed in Lighttpd's cgi implementation
>>>> instead...
>>>>
>>>> Martin
>>>>
>>>>
>>>> >
>>>> >
>>>> > On Fri, Aug 28, 2009 at 16:37, bones <boesemar@googlemail.com> wrote:
>>>> >>
>>>> >>
>>>> >> I am porting my application from ruby fcgi to rack which is in
>>>> >> production using the Lighttpd webserver.
>>>> >>
>>>> >> I noticed that lighttpd doesn't send PATH_INFO or QUERY_STRING so I
>>>> >> used to patch it by reconstructing it from REQUEST_URI. Now with Rack
>>>> >> I have exactly the same situation. Rack::Request.GET is empty. This
>>>> >> fix on the environment makes it working:
>>>> >>
>>>> >> class RackApp
>>>> >>
>>>> >>  def fix_env(ec)
>>>> >>       if (ec['PATH_INFO'].to_s.empty?) then
>>>> >>          pi =  ec['REQUEST_URI']
>>>> >>          pi = pi[0..(pi.index('?')-1)] if pi.include?('?')
>>>> >>          ec['PATH_INFO'] = pi
>>>> >>       end
>>>> >>
>>>> >>       if (ec['QUERY_STRING'].to_s.empty?) then
>>>> >>          ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ?
>>>> >>              ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] :
>>>> >>              ""
>>>> >>       end
>>>> >>       ec
>>>> >>  end
>>>> >>
>>>> >>  def call(env)
>>>> >>    Rack::Request.new(fix_env(env))
>>>> >>   # [...]
>>>> >>  end
>>>> >> end
>>>> >>
>>>> >>
>>>> >> As far as I know Lighttpd and Rails (which used Rack?!) is a popular
>>>> >> combination - so I am quiet surprised that I don't find anything
>>>> >> related on the web. Especially - shouldn't that be implemented into
>>>> >> Rack's CGI/FastCGI Handler?
>>>> >>
>>>> >> Cheers,
>>>> >> Martin
>>>> >
>>>> >
>>>>
>>>
>>>
>>>
>>> --
>>> Yehuda Katz
>>> Developer | Engine Yard
>>> (ph) 718.877.1325
>>>
>>
>>
>


-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

[-- Attachment #2: Type: text/html, Size: 5506 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-08-30 19:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-28 14:37 Lighttpd's FastCGI Environment bones
2009-08-28 20:43 ` Yehuda Katz
2009-08-28 22:22 ` Magnus Holm
2009-08-29  8:17   ` Martin Boese
2009-08-29 14:06     ` Yehuda Katz
2009-08-29 17:59       ` Magnus Holm
2009-08-30  8:45       ` Martin Boese
2009-08-30 18:27         ` Magnus Holm
2009-08-30 18:51           ` Yehuda Katz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).