Mailing List Archive

Modifying HTTP Headers
Is there a way to modify the HTTP header content from within Apache::ASP.
We are sending a file via a cgi script right now using modified headers. We
would like to do this under ASP since we don't have all the session data
available via the cgi script.

We do something like this:
print $q->header(
-content_type => $file->MIME_Type,
-content_length => $file->Size,
-content_transfer_encoding =>
$file->MIME_Type =~ m/^text/ ? 'base64' : 'binary',
-content_disposition =>
qq[inline; filename="].$file->File_Name .qq["],
);

Aaron Johnson


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Modifying HTTP Headers [ In reply to ]
Aaron Johnson wrote:
>
> Is there a way to modify the HTTP header content from within Apache::ASP.
> We are sending a file via a cgi script right now using modified headers. We
> would like to do this under ASP since we don't have all the session data
> available via the cgi script.
>
> We do something like this:
> print $q->header(
> -content_type => $file->MIME_Type,
> -content_length => $file->Size,
> -content_transfer_encoding =>
> $file->MIME_Type =~ m/^text/ ? 'base64' : 'binary',
> -content_disposition =>
> qq[inline; filename="].$file->File_Name .qq["],
> );

Well, you can try using your CGI object, I once tried to make
things fairly compatible with CGI.pm. Just wrap <% %> around
your CGI code and go!

But the real ASP method lies in the $Response object:

http://www.apache-asp.org/objects.html

content-type with:
$Response->{ContentType} = "text/html"

the rest with:
$Response->AddHeader($name, $value)

but you will have to know the real header names like
Content-Disposition, Content-Length, etc.

Also, content length will be calculated for you if
buffering is on, $Response->{Buffer} = 1, and no flush
is called prior to the end of the script.

--Josh

_________________________________________________________________
Joshua Chamas Chamas Enterprises Inc.
NodeWorks >> free web link monitoring Huntington Beach, CA USA
http://www.nodeworks.com 1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org