From a5aa14f9f35c9698db90a73bed94964eebec3d7d Mon Sep 17 00:00:00 2001 From: Sunpoet Po-Chuan Hsieh Date: Sat, 29 Mar 2014 08:43:21 +0000 Subject: [PATCH] - Add p5-Plack-Middleware-MethodOverride 0.10 Writing RESTful apps is a good thing, but if you're also trying to support web browsers, you're probably going to need some hackish workarounds. This module provides one such workaround for your Plack applications. Specifically, you can also use a header named X-HTTP-Method-Override (as used by Google for its APIs) override the POST request method. Or you can add a parameter named x-tunneled-method to your form action's query. Either way, the overriding works only via POST requests, not GET. If either of these attributes are available in a POST request, the REQUEST_METHOD key of the Plack environment hash will be replaced with its value. This allows your apps to override any HTTP method over POST. If your application needs to know that such overriding has taken place, the original method is stored under the plack.original_request_method key in the Plack environment hash. The list of methods you can specify are: GET, POST, HEAD, PUT, DELETE, OPTIONS, TRACE and CONNECT. WWW: http://search.cpan.org/dist/Plack-Middleware-MethodOverride/ --- www/Makefile | 1 + .../Makefile | 25 +++++++++++++++++++ .../distinfo | 2 ++ .../pkg-descr | 20 +++++++++++++++ .../pkg-plist | 4 +++ 5 files changed, 52 insertions(+) create mode 100644 www/p5-Plack-Middleware-MethodOverride/Makefile create mode 100644 www/p5-Plack-Middleware-MethodOverride/distinfo create mode 100644 www/p5-Plack-Middleware-MethodOverride/pkg-descr create mode 100644 www/p5-Plack-Middleware-MethodOverride/pkg-plist diff --git a/www/Makefile b/www/Makefile index e1a1e651fab3..5cee4d21ee87 100644 --- a/www/Makefile +++ b/www/Makefile @@ -1139,6 +1139,7 @@ SUBDIR += p5-Plack-Middleware-InteractiveDebugger SUBDIR += p5-Plack-Middleware-JSConcat SUBDIR += p5-Plack-Middleware-MemoryUsage + SUBDIR += p5-Plack-Middleware-MethodOverride SUBDIR += p5-Plack-Middleware-Precompressed SUBDIR += p5-Plack-Middleware-Reproxy SUBDIR += p5-Plack-Middleware-ReverseProxy diff --git a/www/p5-Plack-Middleware-MethodOverride/Makefile b/www/p5-Plack-Middleware-MethodOverride/Makefile new file mode 100644 index 000000000000..94d3e5fa0d8a --- /dev/null +++ b/www/p5-Plack-Middleware-MethodOverride/Makefile @@ -0,0 +1,25 @@ +# Created by: Sunpoet Po-Chuan Hsieh +# $FreeBSD$ + +PORTNAME= Plack-Middleware-MethodOverride +PORTVERSION= 0.10 +CATEGORIES= www perl5 +MASTER_SITES= CPAN +PKGNAMEPREFIX= p5- + +MAINTAINER= sunpoet@FreeBSD.org +COMMENT= Override REST methods to Plack apps via POST + +LICENSE= ART10 GPLv1 +LICENSE_COMB= dual + +BUILD_DEPENDS= p5-Plack>=0.9929:${PORTSDIR}/www/p5-Plack \ + p5-URI>=0:${PORTSDIR}/net/p5-URI +RUN_DEPENDS:= ${BUILD_DEPENDS} +TEST_DEPENDS= p5-Test-Pod>=1.41:${PORTSDIR}/devel/p5-Test-Pod \ + p5-Test-Pod-Coverage>=1.06:${PORTSDIR}/devel/p5-Test-Pod-Coverage + +USE_PERL5= modbuild +USES= perl5 + +.include diff --git a/www/p5-Plack-Middleware-MethodOverride/distinfo b/www/p5-Plack-Middleware-MethodOverride/distinfo new file mode 100644 index 000000000000..2876421729f5 --- /dev/null +++ b/www/p5-Plack-Middleware-MethodOverride/distinfo @@ -0,0 +1,2 @@ +SHA256 (Plack-Middleware-MethodOverride-0.10.tar.gz) = f8d6a33b56d69dddd5db289f855e100d86ff39099abe31ef40e2672d0dc5568d +SIZE (Plack-Middleware-MethodOverride-0.10.tar.gz) = 4943 diff --git a/www/p5-Plack-Middleware-MethodOverride/pkg-descr b/www/p5-Plack-Middleware-MethodOverride/pkg-descr new file mode 100644 index 000000000000..799d48af2f0a --- /dev/null +++ b/www/p5-Plack-Middleware-MethodOverride/pkg-descr @@ -0,0 +1,20 @@ +Writing RESTful apps is a good thing, but if you're also trying to support web +browsers, you're probably going to need some hackish workarounds. This module +provides one such workaround for your Plack applications. + +Specifically, you can also use a header named X-HTTP-Method-Override (as used by +Google for its APIs) override the POST request method. Or you can add a +parameter named x-tunneled-method to your form action's query. Either way, the +overriding works only via POST requests, not GET. + +If either of these attributes are available in a POST request, the +REQUEST_METHOD key of the Plack environment hash will be replaced with its +value. This allows your apps to override any HTTP method over POST. If your +application needs to know that such overriding has taken place, the original +method is stored under the plack.original_request_method key in the Plack +environment hash. + +The list of methods you can specify are: GET, POST, HEAD, PUT, DELETE, OPTIONS, +TRACE and CONNECT. + +WWW: http://search.cpan.org/dist/Plack-Middleware-MethodOverride/ diff --git a/www/p5-Plack-Middleware-MethodOverride/pkg-plist b/www/p5-Plack-Middleware-MethodOverride/pkg-plist new file mode 100644 index 000000000000..85601aaf6a82 --- /dev/null +++ b/www/p5-Plack-Middleware-MethodOverride/pkg-plist @@ -0,0 +1,4 @@ +%%SITE_PERL%%/Plack/Middleware/MethodOverride.pm +%%PERL5_MAN3%%/Plack::Middleware::MethodOverride.3.gz +@dirrmtry %%SITE_PERL%%/Plack/Middleware +@dirrmtry %%SITE_PERL%%/Plack