Re: [Catalyst] Chained, slashes, and escaping

2007-03-06 Thread Matt Lawrence

Jim Spath wrote:
I'm implementing tagging under Catalyst and want to be as 
unrestrictive as possible on the tag text.  As such, I allow slashes 
in the tag text.


To view information on a given tag, you hit the following path:

/tag/URI_ESCAPED_TAG

Which uses the following action in the Tag controller:

sub view : PathPart('tag') Chained('/') Args {
  my ($self, $c, $tag) = @_;


How about:

my ($self, $c, @tag_parts) = @_;
my $tag = join('/', @tag_parts);

Matt



___
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, slashes, and escaping

2007-03-06 Thread Carl Johnstone

When I access the following URI:

/tag/sl%2Fashes

$tag gets set to sl instead of sl/ashes.


Apparently back in the early days of the web, a URL like that caused 
problems


I ran into this a couple of weeks ago. As far as I could the development 
myapp_server actually deals with everything correctly.


In Apache:

You can now allow encoded slashes in Apache  2.0.46 with:

 AllowEncodedSlashes On


If you're using mod_perl though, when Catalyst fetches the URI from apache 
it requests the parsed vesion so for your example would get back 
/tag/sl/ashes


You can customise Catalyst::Engine::Apache to use unparsed_uri and split off 
the query string - which seems to work OK for my simple case, but I didn't 
test any further.


See:

http://lists.scsys.co.uk/pipermail/catalyst-dev/2007-February/000578.html

Carl





___
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, slashes, and escaping

2007-03-06 Thread Jim Spath
Hi Matt, I had considered that.  I just wanted to check with the list 
before I went that route.


Thanks!
- Jim

Matt Lawrence wrote:

Jim Spath wrote:
I'm implementing tagging under Catalyst and want to be as 
unrestrictive as possible on the tag text.  As such, I allow slashes 
in the tag text.


To view information on a given tag, you hit the following path:

/tag/URI_ESCAPED_TAG

Which uses the following action in the Tag controller:

sub view : PathPart('tag') Chained('/') Args {
  my ($self, $c, $tag) = @_;


How about:

my ($self, $c, @tag_parts) = @_;
my $tag = join('/', @tag_parts);

Matt



--
Jim Spath
Lead Developer
Pangea Media
Em: [EMAIL PROTECTED]
Ph: 617.314.6687
Fx: 617.390.7824
IM: panJimS (AIM)

___
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, slashes, and escaping

2007-03-06 Thread Jim Spath

Unfortunately I'm using lighttpd.

Carl Johnstone wrote:

When I access the following URI:

/tag/sl%2Fashes

$tag gets set to sl instead of sl/ashes.


Apparently back in the early days of the web, a URL like that caused 
problems


I ran into this a couple of weeks ago. As far as I could the development 
myapp_server actually deals with everything correctly.


In Apache:

You can now allow encoded slashes in Apache  2.0.46 with:

 AllowEncodedSlashes On


If you're using mod_perl though, when Catalyst fetches the URI from 
apache it requests the parsed vesion so for your example would get back 
/tag/sl/ashes


You can customise Catalyst::Engine::Apache to use unparsed_uri and split 
off the query string - which seems to work OK for my simple case, but I 
didn't test any further.


See:

http://lists.scsys.co.uk/pipermail/catalyst-dev/2007-February/000578.html

Carl


___
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] Chained, slashes, and escaping

2007-03-05 Thread Jim Spath
I'm implementing tagging under Catalyst and want to be as unrestrictive 
as possible on the tag text.  As such, I allow slashes in the tag text.


To view information on a given tag, you hit the following path:

/tag/URI_ESCAPED_TAG

Which uses the following action in the Tag controller:

sub view : PathPart('tag') Chained('/') Args {
  my ($self, $c, $tag) = @_;

To test and make sure the escaping is working properly I created the 
following tag:


sl/ashes

When I access the following URI:

/tag/sl%2Fashes

$tag gets set to sl instead of sl/ashes.

Chained appears to be using the unescaped path when it looks for the 
separator instead of the actual path.


Is this a bug or a feature?  How can I work around it?

- Jim

___
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, slashes, and escaping

2007-03-05 Thread Chris

On 3/6/07, Jim Spath [EMAIL PROTECTED] wrote:

I'm implementing tagging under Catalyst and want to be as unrestrictive
as possible on the tag text.  As such, I allow slashes in the tag text.

To view information on a given tag, you hit the following path:

/tag/URI_ESCAPED_TAG

Which uses the following action in the Tag controller:

sub view : PathPart('tag') Chained('/') Args {
   my ($self, $c, $tag) = @_;

To test and make sure the escaping is working properly I created the
following tag:

sl/ashes

When I access the following URI:

/tag/sl%2Fashes

$tag gets set to sl instead of sl/ashes.

Chained appears to be using the unescaped path when it looks for the
separator instead of the actual path.

Is this a bug or a feature?  How can I work around it?

- Jim



I cheated and replace '/' with '_' when outputting links when
confronted with a similar issue, then s/_/\//og in the handler. Don't
know if that will work for you?

- Chris

___
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, slashes, and escaping

2007-03-05 Thread Jonathan Rockway
On Monday 05 March 2007 14:33, Jim Spath wrote:
 When I access the following URI:

 /tag/sl%2Fashes

 $tag gets set to sl instead of sl/ashes.

Apparently back in the early days of the web, a URL like that caused problems 
with poorly written CGI scripts that blindly opened the PATH_INFO variable.  
Instead of fixing the scripts, the apache / NCSA HTTPD authors decided to 
break the URL spec for the rest of forever.

http://mail-archives.apache.org/mod_mbox/httpd-dev/199612.mbox/[EMAIL PROTECTED]

11 years later, the web is still broken (for backwards compatibility, of 
course).

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup;

___
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/