Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
I have had this problem since 5.33 I think. just wrote it off as a configuration problem and PEBKAC:) andreas On 29. aug. 2006, at 03.02, Daisuke Maki wrote: I just got bit by this last night with lighttpd + FastCGI and was wondering, too. My quick and dirty fix for lighttpd was $path = $base_path . ($ENV{PATH_INFO} || $ENV{SCRIPT_NAME} || ''); in Catalyst::Engine::CGI. However, after some sleep and reading other solutions, it does seem that subclassing the App or a base controller class would be better. is this a problem with FastCGI + Catalyst 5.7+? I was vaguely thinking that this is a problem with lighttpd + FastCGI, but OP's report suggests that it doesn't work on Apache either, so... --d Mark Blythe wrote: Hey Jason, I think you're having the same problem I had back in June. I was amazed that nobody else seemed to have been having this issue. I guess it just took a few months. :-) Anyway, here's the solution message I posted, which has been working fine for me since then. Take a look and see if it will work for you: http://lists.rawmode.org/pipermail/catalyst/2006-June/008361.html I have this in my app as a Catalyst plugin. Mark On 8/28/06, Jason Kohles [EMAIL PROTECTED] wrote: I've been struggling for a while now to get an app working under FastCGI, mostly under Apache, although I did briefly experiment with lighttpd, it gave me the same results. In a nutshell, the problem is this, I setup an application using this configuration (which I found in the documentation): FastCgiExternalServer /tmp/test -socket /tmp/test.socket VirtualHost *:80 ServerName test.domain.com ServerAdmin [EMAIL PROTECTED] DocumentRoot /var/www/html Alias / /tmp/test/ /VirtualHost When running a Catalyst app with this configuration, what happens is that any URL that is one level off the root, and ends with a / ends up at the main controllers index method. You can demonstrate this with a very basic modification of a generic application, just use 'catalyst.pl Test' to create a test app, then put these two methods in Controller::Root: sub default : Private { my ( $self, $c ) = @_; $c-response-body( This is default ); } sub index : Private { my ( $self, $c ) = @_; $c-response-body( This is index ); } Loading this application as http://test.domain.com/ should return 'This is index', while any other url on the server should say 'This is default'. What happens however, is that if you request a URL such as http://test.domain.com/foo/, you also get 'This is index'. The reason for this is that Catalyst::Engine::FastCGI inherits from Catalyst::Engine::CGI. Catalyst::Engine::CGI::prepare_path() has this code: $base_path = $ENV{SCRIPT_NAME} || '/'; When using the CGI interface, this works fine, and most of the time this seems to work fine for FastCGI as well, except when you use URL such as http://test.domain.com/foo/, what happens is that Apache (or mod_fastcgi) sets up these environment variables as: SCRIPT_NAME = '/foo' PATH_INFO = '/' Rather than the values you would expect them to have, which should be: SCRIPT_NAME = '/' PATH_INFO = '/foo' This seems to be a fairly common problem (there are bugs that mention similar behaviour in the bug tracking queues for lighttpd, rt, trac, zope, and several others), although I haven't been able to find a solution anywhere. I'm trying to use fastcgi with the external server so that I can have different apps using different perl installs for deployment purposes, which is a lot trickier with mod_perl, although if I can't get this working, I may have to bite the bullet and see about doing something ugly with mod_perl to make it happen. -- Jason Kohles [EMAIL PROTECTED] - http://www.jasonkohles.com/ A witty saying proves nothing. -- Voltaire ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/ catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/ catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/ catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Force server to send data to browser....
I'm running a test script from a browser and I need it to provide feedback as it's running but right now if I run it through catalyst it wont send text until the process is done. Is there a way to send stuff as it's running, like forcing the server to send info every so often? ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Chained actions question
On 8/29/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: sub base :Chained('/') PathPart('') CaptureArgs(0) { sub drpt : Chained('base') PathPart('dailystatusrpt') CaptureArgs(0) { sub view_drpt :Chained('drpt') PathPart('view') Args(0) {} sub drpt_year : Chained('base') PathPart('dailystatusrpt') CaptureArgs(1) { sub year_view :Chained('drpt_year') PathPart('view') Args(0) {} sub drpt_month : Chained('base') PathPart('dailystatusrpt') CaptureArgs(2) { sub view_month :Chained('drpt_month') PathPart('view') Args(0) {} sub drpt_day : Chained('base') PathPart('dailystatusrpt') CaptureArgs(3) { sub day_view :Chained('drpt_day') PathPart('view') Args(0) { sub create_drpt :Chained('drpt_day') PathPart('create') Args(0) { sub issue : Chained('drpt_day') PathPart CaptureArgs(0) {} sub create_issue : Chained('issue') PathPart('add') Args(0) { I've never really used chained actions (except when experimenting with it) because all the code I could come up with looked like this - which are extremely confusing action definitions IMO. I think chained actions would work a lot better if there was a way to chain things in a more abstract way. So that, in this example, you could have a single 'view' action which would handle all the cases and the preceeding action would just populate the resultset accordingly or something to that effect (of course, your reports may actually be completely different, but in my own use cases it does make a lot of sense). However, the current way is also useful in some usage cases, so I think Catalyst should probably have two ways of chaining stuff. Of course, there might be better was to achieve the same functionality that I'm not aware of. For now, I need to forward things around and do it a little backwards (e.g. /dailystatusrpt/view/2005/10/08). It's kind of counter intuitive, but it works. -Nilson Santos F. Jr. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Force server to send data to browser....
* Jonathan Rockway [EMAIL PROTECTED] [2006-08-30 03:20]: If you think about it, this is necessary because you can change headers or the body at any time in the request cycle... and you can't unsend data. So what’s `finalize_headers` do? Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Chained actions question
On 8/29/06, Nilson Santos Figueiredo Junior [EMAIL PROTECTED] wrote: On 8/29/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: sub base :Chained('/') PathPart('') CaptureArgs(0) { sub drpt : Chained('base') PathPart('dailystatusrpt') CaptureArgs(0) { sub view_drpt :Chained('drpt') PathPart('view') Args(0) {} sub drpt_year : Chained('base') PathPart('dailystatusrpt') CaptureArgs(1) { sub year_view :Chained('drpt_year') PathPart('view') Args(0) {} sub drpt_month : Chained('base') PathPart('dailystatusrpt') CaptureArgs(2) { sub view_month :Chained('drpt_month') PathPart('view') Args(0) {} sub drpt_day : Chained('base') PathPart('dailystatusrpt') CaptureArgs(3) { sub day_view :Chained('drpt_day') PathPart('view') Args(0) { sub create_drpt :Chained('drpt_day') PathPart('create') Args(0) { sub issue : Chained('drpt_day') PathPart CaptureArgs(0) {} sub create_issue : Chained('issue') PathPart('add')Args(0) {I've never really used chained actions (except when experimenting withit) because all the code I could come up with looked like this - which are extremely confusing action definitions IMO.I think chained actions would work a lot better if there was a way tochain things in a more abstract way. So that, in this example, youcould have a single 'view' action which would handle all the cases and the preceeding action would just populate the resultset accordingly orsomething to that effect (of course, your reports may actually becompletely different, but in my own use cases it does make a lot ofsense). However, the current way is also useful in some usage cases, so I think Catalyst should probably have two ways of chaining stuff.Of course, there might be better was to achieve the same functionalitythat I'm not aware of. For now, I need to forward things around and do it a little backwards (e.g. /dailystatusrpt/view/2005/10/08). It'skind of counter intuitive, but it works.I was doing something like that, and using regexes, but then I had to have everything in one action so I decided to explore the chained stuff. Matt's clues really helped my by providing an non-trivail example to build from. What I like about the chain I ended up with is the table-key-command patern to the REST parameters. ===OK, so maybe report is a minor misnomer. This bit of my app is the Daily Production Status Report which is put together by the oncall engineer each morning. Currently its a spreadsheet, but the boss wants it webbed. So I have view actions to display it, and add/update actions. So my base path is /dailystatusrpt followed by the date in /MM/DD form, which Identifies a specific day's report. I accept , /MM, and even no date. In that case, I produce a calendar view (Thanks Advent Calendar!!!) which shows a view of this month in year , month MM in year , and this month respectively. The calendars have links to ./view where a report already exists, and ./add where one doesn't. /add creeates the report header record, which includes the presenter's name, but mostly exists to provide a foreign key to tie a list of issues together. /view shows the list of issues for the report. If the user has the proper roles, they will see the issue entry form, and edit links next to each issue. The form submits to /dailystatus/rpt//MM/DD/issue/add to save a new issue, and /dailystatusrpt//MM/DD/issue/{issue_id}/update respectively, and the edit linkcalls /dailystatusrpt//MM/DD/issue/{issue_id}/edit to fill the issue data into the form.So after all that, I found that I has a couple of empty actions which were used to absorb PathParts, which correspond to the table , The actions that capture some args and look up that record, and then a command action that figures out what to do with the record, and which template to end up in. I like it. Len.-- [EMAIL PROTECTED]In this specific case, there are a few things that might make this less convoluted, and I did have a couple of moments of how do I express that? but I think this is a nice powerful addition to our action arsenal. If I had one wish to add to the wish list, it would be the ability to capture a variable number of args. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value BUG?
Wrong Content-Length value BUG? There is no problem in the test server. I do not think that it is in the bug of CGI version. Is it wrong? ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
On 30/08/06, Jason Kohles [EMAIL PROTECTED] wrote: On 8/29/06, Matt S Trout [EMAIL PROTECTED] wrote: Andreas Marienborg wrote: I have had this problem since 5.33 I think. just wrote it off as a configuration problem and PEBKAC:) If somebody could write this up for Engine::FastCGI in the form of a patch I'm sure it could ship in 5.7002I started to, but the workaround involves changing some environmentvariables in ways that (for Apache at least) require knowledge of the Apache configuration that FastCGI doesn't make available to the... snip ...OK, how about a *documentation* patch outlining the issue and possible workarounds then please? ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Is this right (Chained actions)
Hi, I'm giving my first shot at using this chained action thing and I'm not sure if I have this right. If I have a catalyst controller like so: package myapp::templates [...] sub pages :Path Args(0) { [...] } sub page :Chained('/') PathPart('templates') CaptureArgs(1) { [...] } sub view :Chained('page') PathPart('view') Args(0) { [...] } sub edit :Chained('page') PathPart('edit') Args(0) { [...] } For the pages action it matches /templates/pages and for the two chained actions it matches /templates/*/view and /templates/*/edit. I'm confused about having to specify PathPart('templates') in the page action. If I leave this empty (PathPart()) It matches /page/*/(view|edit) which is different what I might think is would do based on my understanding of the Path attribute, which matches to the action based on the controller namespace if you leave it blank, as I did in the pages action. So, am I doing this right? To be honest my intution suggestions that Path and PathPart are very similar and should have similar defaults and the fact that that don't seem to tells me I am not understanding the best way to use this feature. Please let me know what you all think! --john ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
If somebody could write this up for Engine::FastCGI in the form of a patch I'm sure it could ship in 5.7002 If anybody is interested, I've attached the tiny plugin I wrote to solve this issue for Lighttpd. I've been using this for local development for several months. I agree, it'd be best to patch the engine if it can be done in a way that works for all webservers. I don't yet have the free time to test with Apache as well. package Catalyst::Plugin::Lighttpd; # $Id$ BEGIN { our $VERSION = (split(' ', q$Revision$))[1]; } use strict; sub handle_request { my ($class, %args) = @_; if (exists $args{env}) { # lighttpd seems to report these backward $args{env}{PATH_INFO} ||= delete $args{env}{SCRIPT_NAME}; } $class-NEXT::handle_request(%args); } 1; =head1 NAME Catalyst::Plugin::Lighttpd - Fix Lighttpd path info =head1 SYNOPSIS use Catalyst qw(Lighttpd); =head1 DESCRIPTION Lighttpd seems to report PATH_INFO and SCRIPT_NAME differently than Apache and most other web servers. This causes Catalyst to always route URLs with trailing slashes to the application's default action. This plugin will fix that. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Force server to send data to browser....
Is there a way to send stuff as it's running, like forcing the server to send info every so often? Good question, not sure how you'd do it with Catalyst. I've done this before to show output from a lengthy batch program, using CGI.pm, sending the header then the start of the output followed by a flushed space char every minute to stop the browser timing out. Like a tail -f on a log file. Regards, Peter ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/