You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Adam Prime x443 <ap...@brunico.com> on 2005/03/11 23:21:09 UTC

[mp2] returning only headers on a GET request

This is sort of a weird situation, so here's a bit of background.

We have a machine that hosts quicktimes offsite.  That machine runs a mod_perl handler that attempts to keep the quicktimes from being deeplinked.  One of the other things it does it handle requests from the user-agent "contype" by only sending headers, instead of attempting to send the full file back.  contype is this weird plugin holdover that uses GET, but doesn't actually examine the file that's returned, just the headers, you can find out more about it on google if you care.

Anyway, in mp1 this was handled just find and dandy by using send_http_header.  But that's gone in mp2.  I would set $r->content-type, but i don't want to make the assumption that the file is a quicktime.

Any ideas?

adam

Re: [mp2] returning only headers on a GET request

Posted by Stas Bekman <st...@stason.org>.
Adam Prime x443 wrote:
> This is sort of a weird situation, so here's a bit of background.
> 
> We have a machine that hosts quicktimes offsite.  That machine runs a mod_perl handler that attempts to keep the quicktimes from being deeplinked.  One of the other things it does it handle requests from the user-agent "contype" by only sending headers, instead of attempting to send the full file back.  contype is this weird plugin holdover that uses GET, but doesn't actually examine the file that's returned, just the headers, you can find out more about it on google if you care.
> 
> Anyway, in mp1 this was handled just find and dandy by using send_http_header.  But that's gone in mp2.  I would set $r->content-type, but i don't want to make the assumption that the file is a quicktime.

$r->content_type() is the same as $r->send_http_header(), it just doesn't 
force the flush of headers. The headers are sent as soon as some data is 
sent. If you want to emulate $r->send_http_header(), do:

   $r->content_type($type);
   $r->rflush;

If you want to convert GET requests to HEADs, Apache will discard the body 
for you automatically. All you need is a simple filter, See 
MyApache::InputFilterGET2HEAD:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_Input_Filters



-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com