GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Plack::Middleware::NoMultipleSlashes(3) User Contributed Perl Documentation Plack::Middleware::NoMultipleSlashes(3)

Plack::Middleware::NoMultipleSlashes - Remove multiple slashes in your paths automatically

version 0.001

Pure Plack:

    # in your app.psgi
    use Plack::Builder;

    my $app = sub { ... };

    builder {
        enable 'NoMultipleSlashes';
        $app;
    };

Or in your Dancer app:

    # in config.yml
    plack_middlewares:
        - [ NoMultipleSlashes ]

In short: this removes all multiple slashes from your PATH_INFO. Read on, if you care why.

Multiple slashes in requests are a common problem, which many share. Apparently, the RFC states that you should be able to expect different results from http://server/ and http://server// (notice the second slash), so if the frameworks wish to maintain RFC compatibility, they cannot remove those extra slashes for you.

While you can handle this issue in a reverse proxy, in a rewrite module or in your code, I find it more comfortable to have Plack take care of it in the thin layer called Middlewares.

By enabling this middleware, all multiple slashes in your requests will automatically be cut. //hello///world becomes /hello/world. Simple as that.

This Plack middleware was written originally after the issue was raised in the Dancer (<http://perldancer.org>) community.

If you're using Dancer, this is the prefered way to handle this issue.

  Sawyer X <xsawyerx@cpan.org>

This software is copyright (c) 2011 by Sawyer X.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2011-02-20 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.