You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tom Murphy <tm...@netchemistry.com> on 2002/12/16 18:20:05 UTC

Access to ap_send_fd_length in 1.0

I have a client for whom I manage documents, some of which are in pdf
format.  The documents are not in the web tree, and are served based on
custom access etc., and some are encrypted on the files system.  I am
successfully do all this, and ultimately use send_fd to send the file(s).
The client has noticed that through the managed process, the time to view
the pdf is longer than viewing the same file through the default handler.  

I have discovered that this is most likely due to the fact that Apache is
byteserving the file, allowing the first page to be viewed even though the
complete file has not been downloaded.  The complete time to download
between the default handler and my handler are quite close, but the document
comes up for partial view much quicker with the default handler.

I have been able to use Apache::File to modify my handler to recognize when
a byteserving request has come in ( using ap_set_byterange), and access the
ap_each_byterange call to decode the header.  However, it does not seem like
the ap_send_fd_length is mod_perl accessible.  Is there any issue with
adding access to this API function?  Also, will I have a problem setting the
PARTIAL_CONTENT response?

With the clients encrypted documents, I have the documents in memory only.
I would like to use the send_fb/send_fb_length call in a similar fashion.

I haven't done any XS/guts type programming, so I'm hoping this will be a
relatively simple task.

Thanks for any pointers,

Tom Murphy


Re: [mp2] Having to reload apache when perl modules change

Posted by Josh Chamas <jo...@chamas.com>.
Geoffrey Young wrote:
> 
> 
> Richard Curtis wrote:
> 
>> Hi again group.
>>    A quick question (but this might not be the right place).
>> If this is the wrong place to ask, please point me in the direction of 
>> the
>> right place.
> 
> 
> you're in the right place, don't worry :)
> 
>>
>> I have a web app written using mod_perl2 and apache::ASP.
>> When I change the code in a perl module, I have to restart apache to make
>> the changes appear to all children.
>> Is there a way of avoiding this - maybe with an apache directive - so 
>> that
>> all modules are re-read by all children without a restart ?
> 

Also note the native Apache::ASP configs StatINC and StatINCMatch
work too.  These can be good as they handle reloading ASP
compiled packages smoothly without undefining ASP related symbols.

Note that these settings should only be used in development
and for reloading code in production a full stop/start should
be done.

Regards,

Josh
________________________________________________________________
Josh Chamas, Founder                   phone:925-552-0128
Chamas Enterprises Inc.                http://www.chamas.com
NodeWorks Link Checking                http://www.nodeworks.com


Re: [mp2] Having to reload apache when perl modules change

Posted by Josh Chamas <jo...@chamas.com>.
Geoffrey Young wrote:
> 
> 
> Richard Curtis wrote:
> 
>> Hi again group.
>>    A quick question (but this might not be the right place).
>> If this is the wrong place to ask, please point me in the direction of 
>> the
>> right place.
> 
> 
> you're in the right place, don't worry :)
> 
>>
>> I have a web app written using mod_perl2 and apache::ASP.
>> When I change the code in a perl module, I have to restart apache to make
>> the changes appear to all children.
>> Is there a way of avoiding this - maybe with an apache directive - so 
>> that
>> all modules are re-read by all children without a restart ?
> 

Also note the native Apache::ASP configs StatINC and StatINCMatch
work too.  These can be good as they handle reloading ASP
compiled packages smoothly without undefining ASP related symbols.

Note that these settings should only be used in development
and for reloading code in production a full stop/start should
be done.

Regards,

Josh
________________________________________________________________
Josh Chamas, Founder                   phone:925-552-0128
Chamas Enterprises Inc.                http://www.chamas.com
NodeWorks Link Checking                http://www.nodeworks.com


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


Re: [mp2] Having to reload apache when perl modules change

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Richard Curtis wrote:
> Hi again group.
>    A quick question (but this might not be the right place).
> If this is the wrong place to ask, please point me in the direction of the
> right place.

you're in the right place, don't worry :)

> 
> I have a web app written using mod_perl2 and apache::ASP.
> When I change the code in a perl module, I have to restart apache to make
> the changes appear to all children.
> Is there a way of avoiding this - maybe with an apache directive - so that
> all modules are re-read by all children without a restart ?

Apache::Reload ships standard with mod_perl 2.0 and is pretty much the same as with 1.0. 
See that manpage or docs/api/mod_perl-2.0/Apache/Reload.pod for more details.

HTH

--Geoff


[mp2] Having to reload apache when perl modules change

Posted by Richard Curtis <ri...@crosswired.co.uk>.
Hi again group.
   A quick question (but this might not be the right place).
If this is the wrong place to ask, please point me in the direction of the
right place.

I have a web app written using mod_perl2 and apache::ASP.
When I change the code in a perl module, I have to restart apache to make
the changes appear to all children.
Is there a way of avoiding this - maybe with an apache directive - so that
all modules are re-read by all children without a restart ?

Thanks
Richard


Re: Access to ap_send_fd_length in 1.0

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Tom Murphy wrote:
> I have a client for whom I manage documents, some of which are in pdf
> format.  The documents are not in the web tree, and are served based on
> custom access etc., and some are encrypted on the files system.  I am
> successfully do all this, and ultimately use send_fd to send the file(s).
> The client has noticed that through the managed process, the time to view
> the pdf is longer than viewing the same file through the default handler.  
> 
> I have discovered that this is most likely due to the fact that Apache is
> byteserving the file, allowing the first page to be viewed even though the
> complete file has not been downloaded.  The complete time to download
> between the default handler and my handler are quite close, but the document
> comes up for partial view much quicker with the default handler.
> 
> I have been able to use Apache::File to modify my handler to recognize when
> a byteserving request has come in ( using ap_set_byterange), and access the
> ap_each_byterange call to decode the header.  However, it does not seem like
> the ap_send_fd_length is mod_perl accessible.  

$r->send_fd($fh, $length);

see recipe 6.3 in the mod_perl developer's cookbook, but that's about all there is to the 
call.  recipe 6.7 explains byteserving in general, but it seems you've already seen the 
appropriate methods in Apache::File.

> Is there any issue with
> adding access to this API function? 

no :)

> Also, will I have a problem setting the
> PARTIAL_CONTENT response?

you shouldn't if you use the proper series of API calls - order is important.  see 
http://www.modperlcookbook.org/code/ch06/Cookbook/SendAnyDoc.pm for an example.

> 
> With the clients encrypted documents, I have the documents in memory only.
> I would like to use the send_fb/send_fb_length call in a similar fashion.
> 
> I haven't done any XS/guts type programming, so I'm hoping this will be a
> relatively simple task.

it's relatively simple to create a subclass Apache that adds whatever ap_ method you want 
to $r.  there are a few examples in the cookbook, or you can see some materials in the 
presentation I just gave at ApacheCon

http://www.modperlcookbook.org/~geoff/slides/ApacheCon/oo-mod_perl-printable.ppt.gz

most of the examples can be found someplace under

http://www.modperlcookbook.org/~geoff/modules/

HTH

--Geoff