Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I do not have the Flash app that creates the PDF in the request body, but I verified it against the output of a static resource with the same response headers. <code>Content-Disposition</code> is the crucial one. This was tested in Konqueror with the Okular KPart and works, I fully expect other browsers/plug-in combinations to also work.</p> <pre><code>#!/usr/bin/perl -T # ↑↑↑↑↑ # on Windows you can just write … #!perl -T # … instead, using the Unix shebang however does no harm use strict; use warnings FATAL =&gt; 'all'; use CGI qw(); use IO::File qw(); # delete @ENV{qw(BASH_ENV CDPATH ENV IFS PATH)}; # ↑↑↑↑↑ # Cleaning path is required for taint-checked programs # that want to run other programs. It does not affect anything here, # so I commented it out. my $c = CGI-&gt;new; # untaint data coming from outside my ($name) = defined $c-&gt;url_param('name') ? $c-&gt;url_param('name') =~ /\A ([a-zA-Z_-]{1,40}\.pdf) \z/msx : (); my ($method) = defined $c-&gt;url_param('method') ? $c-&gt;url_param('method') =~ /\A (attachment|inline) \z/msx : (); die 'invalid parameters' unless $name or $method; # FIXME: untaint blindly because I don't know how to validate PDF my ($pdf) = $c-&gt;param('POSTDATA') =~ /(.*)/msx; STDOUT-&gt;binmode(':raw'); STDOUT-&gt;print($c-&gt;header( -Content_Type =&gt; 'application/pdf', -Content_Length =&gt; length($pdf), -Content_Disposition =&gt; qq($method; filename="$name"), )); STDOUT-&gt;print($pdf); </code></pre> <p>Be aware that you are <a href="https://stackoverflow.com/questions/7920076/how-can-i-get-both-the-get-and-post-request-params-on-a-post-request">mixing GET and POST parameters</a>. Learn how to write secure CGI programs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload