Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:perl:CPAN-P
perl-Plack-Middleware-FixIEXDomainRequestBug
perl-Plack-Middleware-FixIEXDomainRequestBug.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-Plack-Middleware-FixIEXDomainRequestBug.spec of Package perl-Plack-Middleware-FixIEXDomainRequestBug
# # spec file for package perl-Plack-Middleware-FixIEXDomainRequestBug # # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: perl-Plack-Middleware-FixIEXDomainRequestBug Version: 0.001 Release: 0 %define cpan_name Plack-Middleware-FixIEXDomainRequestBug Summary: Fix IE8/IE9 XDomainRequest Missing Content Type License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Plack-Middleware-FixIEXDomainRequestBug/ Source0: http://www.cpan.org/authors/id/J/JJ/JJNAPIORK/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(HTTP::Message::PSGI) BuildRequires: perl(HTTP::Request) BuildRequires: perl(HTTP::Response) BuildRequires: perl(Plack::Middleware) BuildRequires: perl(Test::Most) Requires: perl(Plack::Middleware) %{perl_requires} %description Here's a good explanation of the issue we are attempting to solve: the http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restr ictions-limitations-and-workarounds.aspx manpage Basically Internet Explorer 8 and 9 have a proprietary approach to allow cross domain AJAX safely. However in the attempt to lock down the interface as much as possible Microsoft introduced what is widely considered a major bug, which vastly decreases the value of the feature. What happens is that any type of attempt to use the XDomainRequest activeX control sets the request content type to nothing or text/plain (the docs say text/plain is the only type allowed, but web search and the experience we have seen is that the content type is empty). As a result, when a framework like the Catalyst manpage trys to parse the POST body, it can't figure out what to do, so it punts, typically busting this code. Since it is common with web applications to use a Javascript framework to paper over browser differences, this means that an application doing cross domain access might easily work with Firefox but totally bust with IE 8 or 9 (at the time of this writing these browsers are still the most popular for people using Windows on the desktop, and typically represent 20%+ total web traffic) This distribution attempts to solve this problem at the middleware level. What it does is check to see if the user agent identifies itself as Internet Explorer 8 or 9, AND the method is POST (only GET and POST http methods are allowed with XDomainRequest anyway) AND content-type is nothing or text/plain, THEN we do of the following: We create the following custom key $env->{'plack.middleware.fixiexdomainrequestbug.overrode_content_type'} = 1 You can test if this value is true to detect if we changed the 'content-type', should you wish to know (might be useful for debugging). Then we change $env->{'CONTENT_TYPE'} in one of the following ways If you've specified a 'force_content_type' configuration, we always use that, and change the http content type to match. Otherwise, if you've set a 'guess_with' configuration we assume that is an anonymous sub and invoke that with $env. That coderef is expected to return a string which is a valid 'content-type'. Commonly you may wish to set a custom search query parameter as a fallback mechanism for setting the 'Content_Type', or set the expected content-type based on the requested path ( as seen in the the /SYNOPSIS manpage example. use Plack::Builder; builder { enable 'FixIEXDomainRequestBug', guess_with => sub { my $env = shift; my $req = Plack::Request->new($env); ## Assume a request url like "http://myapp.com/path?format=application/json" return $req->query_parameters->get('format') }; $app; }; %prep %setup -q -n %{cpan_name}-%{version} %build %{__perl} Makefile.PL INSTALLDIRS=vendor %{__make} %{?_smp_mflags} %check %{__make} test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %defattr(-,root,root,755) %doc Changes LICENSE README README.mkdn %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor