Apache Module: Sharing information between requests

This is a discussion on Apache Module: Sharing information between requests within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hello, My module needs to share information between different requests. As a simple example, let's say that it wants ...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-23-2004
Michael Ransburg
 
Posts: n/a
Default Apache Module: Sharing information between requests

Hello,

My module needs to share information between different requests. As a
simple example, let's say that it wants to store the remote_ip of
every request it gets and and output the whole list of IPs as a
response to every request it gets (Just an example, this is not what I
want to do ;-)). So I need some "global memory" where I can store
these values. What would be the appropriate mechanism for that? I
realize that I could [ab?]use the module_config using
ap_set_module_config() for this, but I'm not sure if there is not a
more appropriate way to do it?

Many thanks,
Michael
  #2 (permalink)  
Old 12-28-2004
Nick Kew
 
Posts: n/a
Default Re: Apache Module: Sharing information between requests

In article <7562d656.0412230318.621ff58c@posting.google.com >,
mike@unfolded.com (Michael Ransburg) writes:
> Hello,
>
> My module needs to share information between different requests. As a
> simple example, let's say that it wants to store the remote_ip of
> every request it gets and and output the whole list of IPs as a
> response to every request it gets (Just an example, this is not what I
> want to do ;-)).


Bad example. The implication is that you probably need educating
on the meaning of remote IP addressess on the web. Distracting.

> So I need some "global memory" where I can store
> these values. What would be the appropriate mechanism for that? I


That depends. A general solution needs to work cross-MPM.
You could use apr_shm, but dbm would probably be easier and at least
as good.

> realize that I could [ab?]use the module_config using
> ap_set_module_config() for this, but I'm not sure if there is not a
> more appropriate way to do it?


That is an appropriate way if you're happy for your pool to be kept
per-process, particularly if - as seems likely - only one virtual host
cares about this. You will of course need to use the appropriate module
config and prevent race conditions updating it.

--
Nick Kew
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:52 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0