<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>modules-dev@httpd.apache.org Archives</title>
<link rel="self" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/?format=atom"/>
<link href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/"/>
<id>http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/</id>
<updated>2009-12-08T12:26:59Z</updated>
<entry>
<title>Re: Bandwith limit/per user from mysql</title>
<author><name>Sorin Manolache &lt;sorinm@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c20170a030912080019k14bf4229r48067a2369521980@mail.gmail.com%3e"/>
<id>urn:uuid:%3c20170a030912080019k14bf4229r48067a2369521980@mail-gmail-com%3e</id>
<updated>2009-12-08T08:19:32Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
On Tue, Dec 8, 2009 at 05:11, partysoft &lt;partysoft@gmail.com&gt; wrote:
&gt;
&gt; I am looking for a solution to limit the bandwith for the users of a site
&gt; that have access to some mp3 / subscription. I don't want to serve files
&gt; through PHP, but directly with some apache module..
&gt; do i have to count every bit? or how this should be handled. I have all the
&gt; info on a mysql DB.
&gt; Thank you so much for your replies.

This kind of functionality,  in my opinion, is better implemented at
transport level and not at application level.

I've done something similar, but more primitive, i.e. the cumulated
bandwidth of all connections to port 80 was capped, using traffic
shaping in the linux kernel.

The network packets are classified with iptables and then each class
can be given a different queueing policy with tc. Check
http://lartc.org/howto/, chapter 9. I didn't do it per user, but I
suppose one can easily do it per client IP address. I admit that maybe
this approach is not suitable when you identify users with some data
token at application level.

S


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Linking in libraries to Apache Module</title>
<author><name>Ray Morris &lt;support@bettercgi.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c1260246667.28106.16@raydesk1.bettercgi.com%3e"/>
<id>urn:uuid:%3c1260246667-28106-16@raydesk1-bettercgi-com%3e</id>
<updated>2009-12-08T04:31:07Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
&gt; So, for what it's worth, it ends up that it will work with either
&gt; the direct linking as I was trying or with LoadFile

    It will work FOR NOW, on that ONE SERVER, if you directly
link a library.  Loadfile will work now, and in the future,
and on other servers, rather than causing incorrect results
or crashes in the future.
--
Ray Morris
support@bettercgi.com

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php


On 12/07/2009 09:59:41 PM, Devin Ceartas wrote:
&gt; So, for what it's worth, it ends up that it will work with either the  
&gt; direct linking as I was trying or with LoadFile
&gt; 
&gt; The problem had to do with my downloading SQLite and compiling - when  
&gt; I deleted all those resulting files and installed the OpenBSD package  
&gt; for SQLite, it worked fine. So there must be some platform-specific  
&gt; compile tweaks needed for that library.
&gt; 
&gt; -- devin
&gt; 
&gt; 
&gt; On Dec 7, 2009, at 9:24 PM, Nick Kew wrote:
&gt; 
&gt;&gt; 
&gt;&gt; On 7 Dec 2009, at 23:44, Devin Ceartas wrote:
&gt;&gt; 
&gt;&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin mod_hello.c
&gt;&gt;&gt; /* Works Fine, prints "hello world" */
&gt;&gt;&gt; 
&gt;&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin -lsqlite3 mod_hello.c
&gt;&gt;&gt; /* compiles but dies on apache load */
&gt;&gt;&gt; The platform is OpenBSD 4.6 with the platform's version of Apache  
&gt;&gt;&gt; 1.3 and SQLite 3.6.20 downloaded from the SQLite site and compiled  
&gt;&gt;&gt; from source
&gt;&gt; 
&gt;&gt; Don't link libsqlite.
&gt;&gt; 
&gt;&gt; apr_dbd may already be loading libsqlite.  If for instance you've
&gt;&gt; got more than one libsqlite installed and the two load different
&gt;&gt; versions, segfault is the expected outcome.
&gt;&gt; 
&gt;&gt; If apache DBD API doesn't meet your needs, you can invoke
&gt;&gt; sqlite directly, but use LoadFile so sysops can load libsqlite if
&gt;&gt; and only if it's not already loaded.
&gt;&gt; 
&gt;&gt; --Nick Kew
&gt; 


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Bandwith limit/per user from mysql</title>
<author><name>Ray Morris &lt;support@bettercgi.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c1260246520.28106.15@raydesk1.bettercgi.com%3e"/>
<id>urn:uuid:%3c1260246520-28106-15@raydesk1-bettercgi-com%3e</id>
<updated>2009-12-08T04:28:40Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
&gt; do i have to count every bit?

   You have to count every bucket, and do it carefully
because there are some pitfalls you run into when you
implement it in the real world.  Be aware that the major
browsers have recently changed so they will by default
use many connections.  Download agents which behave
strangely are also not uncommon and need to be handled
gracefully.  These things I learned implementing our
commercial module for this purpose.
--
Ray Morris
support@bettercgi.com

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php


On 12/07/2009 10:11:42 PM, partysoft wrote:
&gt; 
&gt; I am looking for a solution to limit the bandwith for the users of a  
&gt; site
&gt; that have access to some mp3 / subscription. I don't want to serve  
&gt; files
&gt; through PHP, but directly with some apache module..
&gt; do i have to count every bit? or how this should be handled. I have  
&gt; all the
&gt; info on a mysql DB.
&gt; Thank you so much for your replies.
&gt; --
&gt; View this message in context:  
&gt; http://old.nabble.com/Bandwith-limit-per-user-from-mysql-tp26688437p26688437.html
&gt; Sent from the Apache HTTP Server - Module Writers mailing list  
&gt; archive at Nabble.com.
&gt; 
&gt; 



</pre>
</div>
</content>
</entry>
<entry>
<title>Bandwith limit/per user from mysql</title>
<author><name>partysoft &lt;partysoft@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c26688437.post@talk.nabble.com%3e"/>
<id>urn:uuid:%3c26688437-post@talk-nabble-com%3e</id>
<updated>2009-12-08T04:11:42Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

I am looking for a solution to limit the bandwith for the users of a site
that have access to some mp3 / subscription. I don't want to serve files
through PHP, but directly with some apache module..
do i have to count every bit? or how this should be handled. I have all the
info on a mysql DB.
Thank you so much for your replies.
-- 
View this message in context: http://old.nabble.com/Bandwith-limit-per-user-from-mysql-tp26688437p26688437.html
Sent from the Apache HTTP Server - Module Writers mailing list archive at Nabble.com.



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Linking in libraries to Apache Module</title>
<author><name>Devin Ceartas &lt;devin@nacredata.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3cC8195152-2736-42FE-B2A6-99192E08FDD9@nacredata.com%3e"/>
<id>urn:uuid:%3cC8195152-2736-42FE-B2A6-99192E08FDD9@nacredata-com%3e</id>
<updated>2009-12-08T03:59:41Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
So, for what it's worth, it ends up that it will work with either the  
direct linking as I was trying or with LoadFile

The problem had to do with my downloading SQLite and compiling - when  
I deleted all those resulting files and installed the OpenBSD package  
for SQLite, it worked fine. So there must be some platform-specific  
compile tweaks needed for that library.

-- devin


On Dec 7, 2009, at 9:24 PM, Nick Kew wrote:

&gt;
&gt; On 7 Dec 2009, at 23:44, Devin Ceartas wrote:
&gt;
&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin mod_hello.c
&gt;&gt; /* Works Fine, prints "hello world" */
&gt;&gt;
&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin -lsqlite3 mod_hello.c
&gt;&gt; /* compiles but dies on apache load */
&gt;&gt; The platform is OpenBSD 4.6 with the platform's version of Apache  
&gt;&gt; 1.3 and SQLite 3.6.20 downloaded from the SQLite site and compiled  
&gt;&gt; from source
&gt;
&gt; Don't link libsqlite.
&gt;
&gt; apr_dbd may already be loading libsqlite.  If for instance you've
&gt; got more than one libsqlite installed and the two load different
&gt; versions, segfault is the expected outcome.
&gt;
&gt; If apache DBD API doesn't meet your needs, you can invoke
&gt; sqlite directly, but use LoadFile so sysops can load libsqlite if
&gt; and only if it's not already loaded.
&gt;
&gt; -- 
&gt; Nick Kew



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Linking in libraries to Apache Module</title>
<author><name>Devin Ceartas &lt;devin@nacredata.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3cC64F3759-A480-49AF-A305-2007ABB74316@nacredata.com%3e"/>
<id>urn:uuid:%3cC64F3759-A480-49AF-A305-2007ABB74316@nacredata-com%3e</id>
<updated>2009-12-08T02:52:40Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
OK, these ideas sound useful, thanks. I'll look into DBD and LoadFile.  
Thanks for your time.

On Dec 7, 2009, at 9:24 PM, Nick Kew &lt;niq@apache.org&gt; wrote:

&gt;
&gt; On 7 Dec 2009, at 23:44, Devin Ceartas wrote:
&gt;
&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin mod_hello.c
&gt;&gt; /* Works Fine, prints "hello world" */
&gt;&gt;
&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin -lsqlite3 mod_hello.c
&gt;&gt; /* compiles but dies on apache load */
&gt;&gt; The platform is OpenBSD 4.6 with the platform's version of Apache  
&gt;&gt; 1.3 and SQLite 3.6.20 downloaded from the SQLite site and compiled  
&gt;&gt; from source
&gt;
&gt; Don't link libsqlite.
&gt;
&gt; apr_dbd may already be loading libsqlite.  If for instance you've
&gt; got more than one libsqlite installed and the two load different
&gt; versions, segfault is the expected outcome.
&gt;
&gt; If apache DBD API doesn't meet your needs, you can invoke
&gt; sqlite directly, but use LoadFile so sysops can load libsqlite if
&gt; and only if it's not already loaded.
&gt;
&gt; -- 
&gt; Nick Kew


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Linking in libraries to Apache Module</title>
<author><name>Nick Kew &lt;niq@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3cAE93E9D6-DE02-44BA-864A-2C75E5DFEA1D@apache.org%3e"/>
<id>urn:uuid:%3cAE93E9D6-DE02-44BA-864A-2C75E5DFEA1D@apache-org%3e</id>
<updated>2009-12-08T02:24:55Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

On 7 Dec 2009, at 23:44, Devin Ceartas wrote:

&gt; apxs -cia -L/usr/local/lib -I/home/devin mod_hello.c
&gt; /* Works Fine, prints "hello world" */
&gt; 
&gt; apxs -cia -L/usr/local/lib -I/home/devin -lsqlite3 mod_hello.c
&gt; /* compiles but dies on apache load */
&gt; The platform is OpenBSD 4.6 with the platform's version of Apache 1.3 and SQLite 3.6.20
downloaded from the SQLite site and compiled from source

Don't link libsqlite.

apr_dbd may already be loading libsqlite.  If for instance you've
got more than one libsqlite installed and the two load different
versions, segfault is the expected outcome.

If apache DBD API doesn't meet your needs, you can invoke
sqlite directly, but use LoadFile so sysops can load libsqlite if
and only if it's not already loaded.

-- 
Nick Kew


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Linking in libraries to Apache Module</title>
<author><name>Devin Ceartas &lt;devin@nacredata.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c8339DD83-E62A-4844-94C4-A30C31BB523B@nacredata.com%3e"/>
<id>urn:uuid:%3c8339DD83-E62A-4844-94C4-A30C31BB523B@nacredata-com%3e</id>
<updated>2009-12-08T01:40:26Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I don't know enough to understand the output yet, but to me it seems  
to indicate that the library is not missing:

# ldd /usr/lib/apache/modules/mod_hello2.so
/usr/lib/apache/modules/mod_hello2.so:
         Start    End      Type Open Ref GrpRef Name
         09384000 29388000 dlib 1    0   0      /usr/lib/apache/ 
modules/mod_hello2.so
         09fe8000 29ff5000 rlib 0    1   0      /usr/local/lib/ 
libsqlite3.so.8.6
         05d02000 25d0b000 rlib 0    1   0      /usr/lib/libpthread.so. 
11.1

Thanks!
-devin

On Dec 7, 2009, at 8:00 PM, Dennis J. wrote:

&gt; Have you tried "ldd &lt;path-to-compiled-module&gt;"? That could also give  
&gt; you a hint if anything is fishy with the library paths/dependencies.
&gt;
&gt; Regards,
&gt;  Dennis
&gt;
&gt; On 12/08/2009 01:07 AM, Devin Ceartas wrote:
&gt;&gt; hm. -rpath doesn't seem to be an accepted flag in the apxs included  
&gt;&gt; with
&gt;&gt; the latest OpenBSD
&gt;&gt; -- devin
&gt;&gt;
&gt;&gt; On Dec 7, 2009, at 6:56 PM, Joe Lewis wrote:
&gt;&gt;
&gt;&gt;&gt; Devin Ceartas wrote:
&gt;&gt;&gt;&gt; The logic of my SQLite code works if I compile it as a stand-alone
&gt;&gt;&gt;&gt; executable.
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt; My mod_hello.c compiles and loads/works fine without the SQLite  
&gt;&gt;&gt;&gt; code
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt; Combining the two, the module compiles and is installed, but the
&gt;&gt;&gt;&gt; apache process dies immediately (core dump) every time it is  
&gt;&gt;&gt;&gt; loaded.
&gt;&gt;&gt;&gt; Stripping out all the SQLite code and simply linking against SQLite
&gt;&gt;&gt;&gt; causes this problem. In other words, with the same code:
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin mod_hello.c
&gt;&gt;&gt;&gt; /* Works Fine, prints "hello world" */
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin -lsqlite3 mod_hello.c
&gt;&gt;&gt;&gt; /* compiles but dies on apache load */
&gt;&gt;&gt;&gt; The platform is OpenBSD 4.6 with the platform's version of Apache  
&gt;&gt;&gt;&gt; 1.3
&gt;&gt;&gt;&gt; and SQLite 3.6.20 downloaded from the SQLite site and compiled from
&gt;&gt;&gt;&gt; source
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt; Since I'm just getting started with C apache modules, I assume I'm
&gt;&gt;&gt;&gt; missing something basic.
&gt;&gt;&gt;
&gt;&gt;&gt; If using a Linux-based system, I'd suggest ensuring that  
&gt;&gt;&gt; ld.so.conf is
&gt;&gt;&gt; setup to point to the directory or that the compile has the runtime
&gt;&gt;&gt; path for the sqlite library. For example, I have added "-rpath
&gt;&gt;&gt; /usr/local/lib -rpath /usr/local/lib/mysql" to my -L parameters for
&gt;&gt;&gt; apxs to load mySQL external modules dynamically in the past.
&gt;&gt;&gt;
&gt;&gt;&gt; Linux-based systems also have an "strace" command that may be used  
&gt;&gt;&gt; to
&gt;&gt;&gt; figure out what libraries are missing.
&gt;&gt;&gt;
&gt;&gt;&gt; --
&gt;&gt;&gt; Joe Lewis
&gt;&gt;&gt; Chief Nerd SILVERHAWK &lt;http://www.silverhawk.net/&gt; (801) 660-1900
&gt;&gt;&gt;
&gt;&gt;&gt; ------------------------------------------------------------------------
&gt;&gt;&gt; /Rights that do not flow directly from duty well performed are not
&gt;&gt;&gt; worth having.
&gt;&gt;&gt; --Mohandas K. Gandhi/
&gt;&gt;
&gt;



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Linking in libraries to Apache Module</title>
<author><name>Eric Covener &lt;covener@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c1404e5910912071710j456effaara0527b47cff5f7f6@mail.gmail.com%3e"/>
<id>urn:uuid:%3c1404e5910912071710j456effaara0527b47cff5f7f6@mail-gmail-com%3e</id>
<updated>2009-12-08T01:10:13Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
On Mon, Dec 7, 2009 at 7:07 PM, Devin Ceartas &lt;devin@nacredata.com&gt; wrote:
&gt; hm. -rpath doesn't seem to be an accepted flag in the apxs included with the
&gt; latest OpenBSD

apxs will pass linker or compiler args down to the respective program
with -Wl, or -Wc, ; it doesn't do anything with them directly.

-- 
Eric Covener
covener@gmail.com


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Linking in libraries to Apache Module</title>
<author><name>&quot;Dennis J.&quot; &lt;dennisml@conversis.de&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c4B1DA548.8030703@conversis.de%3e"/>
<id>urn:uuid:%3c4B1DA548-8030703@conversis-de%3e</id>
<updated>2009-12-08T01:00:56Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Have you tried "ldd &lt;path-to-compiled-module&gt;"? That could also give you a 
hint if anything is fishy with the library paths/dependencies.

Regards,
   Dennis

On 12/08/2009 01:07 AM, Devin Ceartas wrote:
&gt; hm. -rpath doesn't seem to be an accepted flag in the apxs included with
&gt; the latest OpenBSD
&gt; -- devin
&gt;
&gt; On Dec 7, 2009, at 6:56 PM, Joe Lewis wrote:
&gt;
&gt;&gt; Devin Ceartas wrote:
&gt;&gt;&gt; The logic of my SQLite code works if I compile it as a stand-alone
&gt;&gt;&gt; executable.
&gt;&gt;&gt;
&gt;&gt;&gt; My mod_hello.c compiles and loads/works fine without the SQLite code
&gt;&gt;&gt;
&gt;&gt;&gt; Combining the two, the module compiles and is installed, but the
&gt;&gt;&gt; apache process dies immediately (core dump) every time it is loaded.
&gt;&gt;&gt; Stripping out all the SQLite code and simply linking against SQLite
&gt;&gt;&gt; causes this problem. In other words, with the same code:
&gt;&gt;&gt;
&gt;&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin mod_hello.c
&gt;&gt;&gt; /* Works Fine, prints "hello world" */
&gt;&gt;&gt;
&gt;&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin -lsqlite3 mod_hello.c
&gt;&gt;&gt; /* compiles but dies on apache load */
&gt;&gt;&gt; The platform is OpenBSD 4.6 with the platform's version of Apache 1.3
&gt;&gt;&gt; and SQLite 3.6.20 downloaded from the SQLite site and compiled from
&gt;&gt;&gt; source
&gt;&gt;&gt;
&gt;&gt;&gt; Since I'm just getting started with C apache modules, I assume I'm
&gt;&gt;&gt; missing something basic.
&gt;&gt;
&gt;&gt; If using a Linux-based system, I'd suggest ensuring that ld.so.conf is
&gt;&gt; setup to point to the directory or that the compile has the runtime
&gt;&gt; path for the sqlite library. For example, I have added "-rpath
&gt;&gt; /usr/local/lib -rpath /usr/local/lib/mysql" to my -L parameters for
&gt;&gt; apxs to load mySQL external modules dynamically in the past.
&gt;&gt;
&gt;&gt; Linux-based systems also have an "strace" command that may be used to
&gt;&gt; figure out what libraries are missing.
&gt;&gt;
&gt;&gt; --
&gt;&gt; Joe Lewis
&gt;&gt; Chief Nerd SILVERHAWK &lt;http://www.silverhawk.net/&gt; (801) 660-1900
&gt;&gt;
&gt;&gt; ------------------------------------------------------------------------
&gt;&gt; /Rights that do not flow directly from duty well performed are not
&gt;&gt; worth having.
&gt;&gt; --Mohandas K. Gandhi/
&gt;



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Linking in libraries to Apache Module</title>
<author><name>Devin Ceartas &lt;devin@nacredata.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3cF3697E79-AE37-4D0F-B2B6-5B2D1A1EA41A@nacredata.com%3e"/>
<id>urn:uuid:%3cF3697E79-AE37-4D0F-B2B6-5B2D1A1EA41A@nacredata-com%3e</id>
<updated>2009-12-08T00:07:54Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
hm. -rpath doesn't seem to be an accepted flag in the apxs included  
with the latest OpenBSD
-- devin

On Dec 7, 2009, at 6:56 PM, Joe Lewis wrote:

&gt; Devin Ceartas wrote:
&gt;&gt; The logic of my SQLite code works if I compile it as a stand-alone  
&gt;&gt; executable.
&gt;&gt;
&gt;&gt; My mod_hello.c compiles and loads/works fine without the SQLite code
&gt;&gt;
&gt;&gt; Combining the two, the module compiles and is installed, but the  
&gt;&gt; apache process dies immediately (core dump) every time it is  
&gt;&gt; loaded. Stripping out all the SQLite code and simply linking  
&gt;&gt; against SQLite causes this problem. In other words, with the same  
&gt;&gt; code:
&gt;&gt;
&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin mod_hello.c
&gt;&gt; /* Works Fine, prints "hello world" */
&gt;&gt;
&gt;&gt; apxs -cia -L/usr/local/lib -I/home/devin -lsqlite3 mod_hello.c
&gt;&gt; /* compiles but dies on apache load */
&gt;&gt; The platform is OpenBSD 4.6 with the platform's version of Apache  
&gt;&gt; 1.3 and SQLite 3.6.20 downloaded from the SQLite site and compiled  
&gt;&gt; from source
&gt;&gt;
&gt;&gt; Since I'm just getting started with C apache modules, I assume I'm  
&gt;&gt; missing something basic.
&gt;
&gt; If using a Linux-based system, I'd suggest ensuring that ld.so.conf  
&gt; is setup to point to the directory or that the compile has the  
&gt; runtime path for the sqlite library.  For example, I have added  "- 
&gt; rpath /usr/local/lib -rpath /usr/local/lib/mysql" to my -L  
&gt; parameters for apxs to load mySQL external modules dynamically in  
&gt; the past.
&gt;
&gt; Linux-based systems also have an "strace" command that may be used  
&gt; to figure out what libraries are missing.
&gt;
&gt; -- 
&gt; Joe Lewis
&gt; Chief Nerd 	SILVERHAWK &lt;http://www.silverhawk.net/&gt; 	(801) 660-1900
&gt;
&gt; ------------------------------------------------------------------------
&gt; /Rights that do not flow directly from duty well performed are not  
&gt; worth having.
&gt;   --Mohandas K. Gandhi/



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Linking in libraries to Apache Module</title>
<author><name>Joe Lewis &lt;joe@joe-lewis.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c4B1D9625.2040204@joe-lewis.com%3e"/>
<id>urn:uuid:%3c4B1D9625-2040204@joe-lewis-com%3e</id>
<updated>2009-12-07T23:56:21Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Devin Ceartas wrote:
&gt; The logic of my SQLite code works if I compile it as a stand-alone 
&gt; executable.
&gt;
&gt; My mod_hello.c compiles and loads/works fine without the SQLite code
&gt;
&gt; Combining the two, the module compiles and is installed, but the 
&gt; apache process dies immediately (core dump) every time it is loaded. 
&gt; Stripping out all the SQLite code and simply linking against SQLite 
&gt; causes this problem. In other words, with the same code:
&gt;
&gt; apxs -cia -L/usr/local/lib -I/home/devin mod_hello.c
&gt; /* Works Fine, prints "hello world" */
&gt;
&gt; apxs -cia -L/usr/local/lib -I/home/devin -lsqlite3 mod_hello.c
&gt; /* compiles but dies on apache load */
&gt; The platform is OpenBSD 4.6 with the platform's version of Apache 1.3 
&gt; and SQLite 3.6.20 downloaded from the SQLite site and compiled from 
&gt; source
&gt;
&gt; Since I'm just getting started with C apache modules, I assume I'm 
&gt; missing something basic.

If using a Linux-based system, I'd suggest ensuring that ld.so.conf is 
setup to point to the directory or that the compile has the runtime path 
for the sqlite library.  For example, I have added  "-rpath 
/usr/local/lib -rpath /usr/local/lib/mysql" to my -L parameters for apxs 
to load mySQL external modules dynamically in the past.

Linux-based systems also have an "strace" command that may be used to 
figure out what libraries are missing.

-- 
Joe Lewis
Chief Nerd 	SILVERHAWK &lt;http://www.silverhawk.net/&gt; 	(801) 660-1900

------------------------------------------------------------------------
/Rights that do not flow directly from duty well performed are not worth 
having.
    --Mohandas K. Gandhi/


</pre>
</div>
</content>
</entry>
<entry>
<title>Linking in libraries to Apache Module</title>
<author><name>Devin Ceartas &lt;devin@nacredata.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3cF3747BA2-B58D-4774-B26A-094DA9134A49@nacredata.com%3e"/>
<id>urn:uuid:%3cF3747BA2-B58D-4774-B26A-094DA9134A49@nacredata-com%3e</id>
<updated>2009-12-07T23:44:45Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Playing around with this a bit, but not getting too far...

The logic of my SQLite code works if I compile it as a stand-alone  
executable.

My mod_hello.c compiles and loads/works fine without the SQLite code

Combining the two, the module compiles and is installed, but the  
apache process dies immediately (core dump) every time it is loaded.  
Stripping out all the SQLite code and simply linking against SQLite  
causes this problem. In other words, with the same code:

apxs -cia -L/usr/local/lib -I/home/devin mod_hello.c
/* Works Fine, prints "hello world" */

apxs -cia -L/usr/local/lib -I/home/devin -lsqlite3 mod_hello.c
/* compiles but dies on apache load */
The platform is OpenBSD 4.6 with the platform's version of Apache 1.3  
and SQLite 3.6.20 downloaded from the SQLite site and compiled from  
source

Since I'm just getting started with C apache modules, I assume I'm  
missing something basic. 

</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Reading post parameters from apache request</title>
<author><name>pranil dasika &lt;pranil.dasika@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c404e5e360912010343o74008920r6a6c1444076772c@mail.gmail.com%3e"/>
<id>urn:uuid:%3c404e5e360912010343o74008920r6a6c1444076772c@mail-gmail-com%3e</id>
<updated>2009-12-01T11:43:34Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
On Mon, Nov 30, 2009 at 8:49 AM, Yoichi Kawasaki &lt;yokawasa@gmail.com&gt; wrote:

&gt; 2009/11/21 Sorin Manolache &lt;sorinm@gmail.com&gt;:
&gt; &gt; On Fri, Nov 20, 2009 at 22:01, pranil dasika &lt;pranil.dasika@gmail.com&gt;
&gt; wrote:
&gt; &gt;&gt; Hi,
&gt; &gt;&gt;
&gt; &gt;&gt; I am trying to write a custom module where I need to read post
&gt; parameters
&gt; &gt;&gt; from the request. I guess apreq library is relevant to this but could
&gt; not
&gt; &gt;&gt; find any substantial examples or documents.
&gt; &gt;&gt; Is there any other way to read the params other than apreq. Any
&gt; pseudocode/
&gt; &gt;&gt; examples will be appreciated.
&gt; &gt;&gt;
&gt; &gt;&gt; Thanks,
&gt; &gt;&gt; Pranil
&gt; &gt;&gt;
&gt; &gt;
&gt; &gt; Here you have an example. It is not optimal, you could, for example,
&gt; &gt; take the brigade creation out of the loop and clean the brigade at the
&gt; &gt; end of each iteration, after you extracted the data.
&gt; &gt;
&gt; &gt; apr_bucket_brigade *bb;
&gt; &gt; do {
&gt; &gt;   bb = apr_brigade_create(req-&gt;pool, req-&gt;connection-&gt;bucket_alloc);
&gt; &gt;   if (0 == bb)
&gt; &gt;        // error
&gt; &gt;   if (APR_SUCCESS != ap_get_brigade(req-&gt;input_filters, bb,
&gt; &gt; AP_MODE_READBYTES, APR_BLOCK_READ, 9216))
&gt; &gt;        // error
&gt; &gt;   extract data from bb;
&gt; &gt; } while (EOS not yet encountered in bb);
&gt; &gt;
&gt; &gt;
&gt; &gt; S
&gt; &gt;
&gt;
&gt;
&gt; Hi
&gt;
&gt; I  have an another example. I read post parameters in the source code
&gt; below:
&gt;
&gt; http://github.com/yokawasa/mod_akismet/blob/master/mod_akismet.c#L647
&gt; line: 647 - 705
&gt;
&gt; hope this helps you.
&gt;
&gt; Yoichi
&gt;
&gt; --
&gt; Yoichi Kawasaki &lt;yokawasa@gmail.com&gt;
&gt;



Sorin, Yoichi,

Thanks for your responses. The below code worked for me using apreq.

const apr_table_t* args;
apreq_handle_t* h = apreq_handle_apache2(r);
apreq_body(h, &amp;args);
const char *params = apreq_params_as_string(r-&gt;pool, args, NULL,
APREQ_JOIN_QUOTE);


-Pranil


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Segfault doing SQL select</title>
<author><name>Micah Yoder &lt;micah@yoderdev.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c4B14E9CB.4070605@yoderdev.com%3e"/>
<id>urn:uuid:%3c4B14E9CB-4070605@yoderdev-com%3e</id>
<updated>2009-12-01T10:02:51Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Sorin Manolache wrote:
&gt;&gt; void sql_template(ap_dbd_t *con, request_rec *r, apr_hash_t *formdata) {
&gt;&gt;  apr_dbd_results_t *res;
&gt;&gt;     
&gt;
&gt;
&gt; Set res to NULL before passing it.
&gt;
&gt;   
&gt;&gt;  apr_dbd_row_t *row;
&gt;&gt;     
&gt;
&gt;
&gt; Set row to NULL before passing it.
&gt;
&gt;   
that was it. Thanks so much!

Guess I thought that the functions would have ignored and overridden any 
nonsensical values. Oh well.

And thank you too Jerome, I'm sure I will be studying that code.



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Segfault doing SQL select</title>
<author><name>Sorin Manolache &lt;sorinm@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c20170a030912010123t750297abq29a5b31d21a40c10@mail.gmail.com%3e"/>
<id>urn:uuid:%3c20170a030912010123t750297abq29a5b31d21a40c10@mail-gmail-com%3e</id>
<updated>2009-12-01T09:23:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
On Tue, Dec 1, 2009 at 09:26, Micah Yoder &lt;micah@yoderdev.com&gt; wrote:
&gt; Hello,
&gt;
&gt; I'm new to this. Just read most of Nick Kew's book and am trying to write a
&gt; module that is a thin-as-possible layer between an AJAX type rich client web
&gt; app and an SQL database. I then hope to build a small CMS on top of that.
&gt;
&gt; Currently I'm running into a road block with a segfault every time I run the
&gt; query. I'm using Postgres 8.4 from the Ubuntu repos and a custom-compiled
&gt; Apache 2.2.14 with the Worker MPM.  Here is the relevant code:
&gt;
&gt; void sql_template(ap_dbd_t *con, request_rec *r, apr_hash_t *formdata) {
&gt;  apr_dbd_results_t *res;


Set res to NULL before passing it.

&gt;  apr_dbd_row_t *row;


Set row to NULL before passing it.

&gt;  int rv;
&gt;
&gt;  rv = apr_dbd_select(con-&gt;driver, r-&gt;pool, con-&gt;handle, &amp;res, "select *
from
&gt; topics;", 0);
&gt;  if (!rv)
&gt;   ap_rputs("Failed to run query.\n", r);
&gt;  while (apr_dbd_get_row(con-&gt;driver, r-&gt;pool, res, &amp;row, 0) != -1) {
&gt;   ap_rputs("*** Row data *** ", r);
&gt;   ap_rputs(apr_dbd_get_entry(con-&gt;driver, row, 0), r);
&gt;   ap_rputs(" ... ", r);
&gt;   ap_rputs(apr_dbd_get_entry(con-&gt;driver, row, 1), r);
&gt;  }
&gt; }
&gt;
&gt; This is being called from the main handler function.
&gt;
&gt;  apr_hash_t *formdata;
&gt;  ap_dbd_t *con;
&gt;
&gt; [...]
&gt;
&gt;  if (r-&gt;method_number == M_GET)
&gt;   formdata = parse_form_from_string(r, r-&gt;args);
&gt;
&gt; [...]
&gt;
&gt;  con = ap_dbd_acquire(r);
&gt;  if (!con) return HTTP_INTERNAL_SERVER_ERROR;
&gt;
&gt;  sql_template(con, r, formdata);
&gt;
&gt; Kind of ugly but I'm just trying to get the concepts to work.
&gt;
&gt; I've run it through GDB and sometimes the segfault is on apr_dbd_select line
&gt; and sometimes it is on the apr_dbd_get_row line. The arguments passed into
&gt; my sql_template function seem to be valid.
&gt;
&gt; Am I doing anything obviously wrong? Or can someone point to a simple
&gt; handler module that does a SELECT? (mod_auth_dbd appears to use a different
&gt; method and introduces other complexities.)
&gt;
&gt; Thanks,
&gt; Micah
&gt;
&gt;
&gt;



-- 
A: Because it reverses the logical flow of conversation.
Q: Why is top-posting frowned upon?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Segfault doing SQL select</title>
<author><name>Jerome Renard &lt;jerome.renard@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c17550da70912010045w465a6adeie965b7fb8e1bc727@mail.gmail.com%3e"/>
<id>urn:uuid:%3c17550da70912010045w465a6adeie965b7fb8e1bc727@mail-gmail-com%3e</id>
<updated>2009-12-01T08:45:42Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hello,

On Tue, Dec 1, 2009 at 9:26 AM, Micah Yoder &lt;micah@yoderdev.com&gt; wrote:
[...]
&gt; Am I doing anything obviously wrong? Or can someone point to a simple
&gt; handler module that does a SELECT? (mod_auth_dbd appears to use a different
&gt; method and introduces other complexities.)

Maybe the piece of code available here will help you :
- http://code.google.com/p/modurlalias/source/browse/src/mod_url_alias.c#454

Best Regards

--
JÃ©rÃ´me :)


</pre>
</div>
</content>
</entry>
<entry>
<title>Segfault doing SQL select</title>
<author><name>Micah Yoder &lt;micah@yoderdev.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200912.mbox/%3c4B14D32B.2000808@yoderdev.com%3e"/>
<id>urn:uuid:%3c4B14D32B-2000808@yoderdev-com%3e</id>
<updated>2009-12-01T08:26:19Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hello,

I'm new to this. Just read most of Nick Kew's book and am trying to 
write a module that is a thin-as-possible layer between an AJAX type 
rich client web app and an SQL database. I then hope to build a small 
CMS on top of that.

Currently I'm running into a road block with a segfault every time I run 
the query. I'm using Postgres 8.4 from the Ubuntu repos and a 
custom-compiled Apache 2.2.14 with the Worker MPM.  Here is the relevant 
code:

void sql_template(ap_dbd_t *con, request_rec *r, apr_hash_t *formdata) {
  apr_dbd_results_t *res;
  apr_dbd_row_t *row;
  int rv;
 
  rv = apr_dbd_select(con-&gt;driver, r-&gt;pool, con-&gt;handle, &amp;res, "select * 
from topics;", 0);
  if (!rv)
    ap_rputs("Failed to run query.\n", r);
  while (apr_dbd_get_row(con-&gt;driver, r-&gt;pool, res, &amp;row, 0) != -1) {
    ap_rputs("*** Row data *** ", r);
    ap_rputs(apr_dbd_get_entry(con-&gt;driver, row, 0), r);
    ap_rputs(" ... ", r);
    ap_rputs(apr_dbd_get_entry(con-&gt;driver, row, 1), r);
  }
}

This is being called from the main handler function.

  apr_hash_t *formdata;
  ap_dbd_t *con;

[...]

  if (r-&gt;method_number == M_GET)
    formdata = parse_form_from_string(r, r-&gt;args);

[...]

  con = ap_dbd_acquire(r);
  if (!con) return HTTP_INTERNAL_SERVER_ERROR;
 
  sql_template(con, r, formdata);

Kind of ugly but I'm just trying to get the concepts to work.

I've run it through GDB and sometimes the segfault is on apr_dbd_select 
line and sometimes it is on the apr_dbd_get_row line. The arguments 
passed into my sql_template function seem to be valid.

Am I doing anything obviously wrong? Or can someone point to a simple 
handler module that does a SELECT? (mod_auth_dbd appears to use a 
different method and introduces other complexities.)

Thanks,
Micah




</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Reading post parameters from apache request</title>
<author><name>Yoichi Kawasaki &lt;yokawasa@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c2d2004750911291919t77f9a696q81094bbc01fae78e@mail.gmail.com%3e"/>
<id>urn:uuid:%3c2d2004750911291919t77f9a696q81094bbc01fae78e@mail-gmail-com%3e</id>
<updated>2009-11-30T03:19:12Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
2009/11/21 Sorin Manolache &lt;sorinm@gmail.com&gt;:
&gt; On Fri, Nov 20, 2009 at 22:01, pranil dasika &lt;pranil.dasika@gmail.com&gt; wrote:
&gt;&gt; Hi,
&gt;&gt;
&gt;&gt; I am trying to write a custom module where I need to read post parameters
&gt;&gt; from the request. I guess apreq library is relevant to this but could not
&gt;&gt; find any substantial examples or documents.
&gt;&gt; Is there any other way to read the params other than apreq. Any pseudocode/
&gt;&gt; examples will be appreciated.
&gt;&gt;
&gt;&gt; Thanks,
&gt;&gt; Pranil
&gt;&gt;
&gt;
&gt; Here you have an example. It is not optimal, you could, for example,
&gt; take the brigade creation out of the loop and clean the brigade at the
&gt; end of each iteration, after you extracted the data.
&gt;
&gt; apr_bucket_brigade *bb;
&gt; do {
&gt;   bb = apr_brigade_create(req-&gt;pool, req-&gt;connection-&gt;bucket_alloc);
&gt;   if (0 == bb)
&gt;        // error
&gt;   if (APR_SUCCESS != ap_get_brigade(req-&gt;input_filters, bb,
&gt; AP_MODE_READBYTES, APR_BLOCK_READ, 9216))
&gt;        // error
&gt;   extract data from bb;
&gt; } while (EOS not yet encountered in bb);
&gt;
&gt;
&gt; S
&gt;


Hi

I  have an another example. I read post parameters in the source code below:

http://github.com/yokawasa/mod_akismet/blob/master/mod_akismet.c#L647
line: 647 - 705

hope this helps you.

Yoichi

-- 
Yoichi Kawasaki &lt;yokawasa@gmail.com&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Reading post parameters from apache request</title>
<author><name>Sorin Manolache &lt;sorinm@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c20170a030911201359p69bcd433j356ed72d7d252926@mail.gmail.com%3e"/>
<id>urn:uuid:%3c20170a030911201359p69bcd433j356ed72d7d252926@mail-gmail-com%3e</id>
<updated>2009-11-20T21:59:46Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
On Fri, Nov 20, 2009 at 22:01, pranil dasika &lt;pranil.dasika@gmail.com&gt; wrote:
&gt; Hi,
&gt;
&gt; I am trying to write a custom module where I need to read post parameters
&gt; from the request. I guess apreq library is relevant to this but could not
&gt; find any substantial examples or documents.
&gt; Is there any other way to read the params other than apreq. Any pseudocode/
&gt; examples will be appreciated.
&gt;
&gt; Thanks,
&gt; Pranil
&gt;

Here you have an example. It is not optimal, you could, for example,
take the brigade creation out of the loop and clean the brigade at the
end of each iteration, after you extracted the data.

apr_bucket_brigade *bb;
do {
   bb = apr_brigade_create(req-&gt;pool, req-&gt;connection-&gt;bucket_alloc);
   if (0 == bb)
        // error
   if (APR_SUCCESS != ap_get_brigade(req-&gt;input_filters, bb,
AP_MODE_READBYTES, APR_BLOCK_READ, 9216))
        // error
   extract data from bb;
} while (EOS not yet encountered in bb);


S


</pre>
</div>
</content>
</entry>
<entry>
<title>Reading post parameters from apache request</title>
<author><name>pranil dasika &lt;pranil.dasika@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c404e5e360911201301p2e5b7d75qf47a909e550f52b2@mail.gmail.com%3e"/>
<id>urn:uuid:%3c404e5e360911201301p2e5b7d75qf47a909e550f52b2@mail-gmail-com%3e</id>
<updated>2009-11-20T21:01:45Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi,

I am trying to write a custom module where I need to read post parameters
from the request. I guess apreq library is relevant to this but could not
find any substantial examples or documents.
Is there any other way to read the params other than apreq. Any pseudocode/
examples will be appreciated.

Thanks,
Pranil


</pre>
</div>
</content>
</entry>
<entry>
<title>APyXS : generating apache module skeletons</title>
<author><name>Jerome Renard &lt;jerome.renard@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c17550da70911180014o218e09a9v3b77e1f9ae10075a@mail.gmail.com%3e"/>
<id>urn:uuid:%3c17550da70911180014o218e09a9v3b77e1f9ae10075a@mail-gmail-com%3e</id>
<updated>2009-11-18T08:14:54Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi list,

a few weeks ago, I started to write an Apache module skeleton
generator in Python : APyXS.

The original idea was that when one create a new module, it is always
the same process :
1. defining configuration directives
2. defining hooks
etc.

I thought it could be useful if we could have the process automatic,
only by writing a trivial configuration file.

That's the point of aPyXS, it is possible to define configuration
directives and hooks in a very simple XML file
and then the module skeleton is generated.

I started to write the code for it in my spare time, but I will have
less and less time for this project in the next few months.
This is why I am looking for contributors.

So if there is anyone interested in contributing, feel free to contact
me and join the project so I grant you commit access.

The project page is available on Google code here :
- http://code.google.com/p/apyxs/

The code is available here :
- http://code.google.com/p/apyxs/source/browse/

And example configuration files are here :
- http://code.google.com/p/apyxs/source/browse/#hg/examples

And you can clone it by running the following command (mercurial required) :
- hg clone https://apyxs.googlecode.com/hg/ apyxs

As you will see the code is really trivial (I know it can be much
better), so are the configuration files.

Have a nice day

:)

--
JÃ©rÃ´me


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: I'm stuck with an OS X module problem and -mmacosx-version-min=10.5</title>
<author><name>Patrick McManus &lt;mcmanus@ducksong.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c1258469156.8667.222.camel@tng%3e"/>
<id>urn:uuid:%3c1258469156-8667-222-camel@tng%3e</id>
<updated>2009-11-17T14:45:56Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
William, thanks for the response.

A clearer way of asking my question: "How do I (can I?) build a single
binary module that runs on both OS X 10.5 and 10.6 with the standard
apache package found on those systems - they are 2.2.11 and 2.2.13
respectively". 

Creating such a full executable (unrelated to apache) is easy,
-mmacosx-version-min=10.5 does the trick but that is giving me problems
with a module.

On Mon, 2009-11-16 at 22:18 -0600, William A. Rowe Jr. wrote:
&gt; You mixed up httpd by detecting 10.6, doesn't matter what you told the
&gt; compiler to do after configure.  Try
&gt; 
&gt; CC="gcc -mmacosx-version-min=10.5" ./configure
&gt; 
&gt; or something like that.

This advice applies to the building of the Apache Server itself, not my
module - right? I want to work with the standard apache packages
included in Leopard and Snow Leopard, not build and distribute them
myself.









</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Recommended way to use autotools</title>
<author><name>Jerome Renard &lt;jerome.renard@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c17550da70911162325i3e9e995q1372e0817081562f@mail.gmail.com%3e"/>
<id>urn:uuid:%3c17550da70911162325i3e9e995q1372e0817081562f@mail-gmail-com%3e</id>
<updated>2009-11-17T07:25:07Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi Dave,

On Mon, Nov 16, 2009 at 11:42 PM, Dave Ingram &lt;dave@dmi.me.uk&gt; wrote:
&gt; Hi all,
&gt;
&gt; I've been wondering if there is a recommended way of using autotools when
&gt; writing an Apache module? I've seen a tutorial
&gt; &lt;http://threebit.net/tutorials/apache2_modules/tut1/tutorial1.html&gt; on this,
&gt; but it was last updated in 2005, so I'm not sure if there are any better
&gt; ways or things to do. I've also looked at a couple
&gt; &lt;http://code.google.com/p/mod-authn-otp/&gt; of projects
&gt; &lt;http://code.google.com/p/modskeleton/&gt;, and they seem to do things
&gt; differently. I also found a couple of previous
&gt; &lt;http://marc.info/?l=apache-modules&amp;m=109754513810791&amp;w=2&gt; questions
&gt; &lt;http://marc.info/?l=apache-modules&amp;m=97517123707363&amp;w=2&gt; on this subject,
&gt; but they're very old and don't answer my question.
&gt;
&gt; I essentially want to allow the module to be compiled against one or two
&gt; different libraries, depending on availability and user choice.

Will the following files help you :
- http://code.google.com/p/modmemcachedinclude/source/browse/m4

Have a nice day :)


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: I'm stuck with an OS X module problem and -mmacosx-version-min=10.5</title>
<author><name>&quot;William A. Rowe Jr.&quot; &lt;wrowe@rowe-clan.net&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c4B0223FA.9010004@rowe-clan.net%3e"/>
<id>urn:uuid:%3c4B0223FA-9010004@rowe-clan-net%3e</id>
<updated>2009-11-17T04:18:02Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Patrick McManus wrote:
&gt; 
&gt; Of course, the SL binary will not run on 10.5 - I get linker errors when
&gt; apache loads it. That's expected (ok, I forgot it, but its normal) - and
&gt; then I rebuilt the module with -mmacosx-version-min=10.5.
&gt; 
&gt; The linker errors resolved themselves. Hurrah.
&gt; 
&gt; However now the module is broken for me. The handler will run and
&gt; the right content-body will flow out, but content-type is consistently
&gt; text/plain even though ap_set_content_type(r, "text/html") has been
&gt; called.

You mixed up httpd by detecting 10.6, doesn't matter what you told the
compiler to do after configure.  Try

CC="gcc -mmacosx-version-min=10.5" ./configure

or something like that.


</pre>
</div>
</content>
</entry>
<entry>
<title>Recommended way to use autotools</title>
<author><name>Dave Ingram &lt;dave@dmi.me.uk&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c4B01D549.7060001@dmi.me.uk%3e"/>
<id>urn:uuid:%3c4B01D549-7060001@dmi-me-uk%3e</id>
<updated>2009-11-16T22:42:17Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi all,

I've been wondering if there is a recommended way of using autotools 
when writing an Apache module? I've seen a tutorial 
&lt;http://threebit.net/tutorials/apache2_modules/tut1/tutorial1.html&gt; on 
this, but it was last updated in 2005, so I'm not sure if there are any 
better ways or things to do. I've also looked at a couple 
&lt;http://code.google.com/p/mod-authn-otp/&gt; of projects 
&lt;http://code.google.com/p/modskeleton/&gt;, and they seem to do things 
differently. I also found a couple of previous 
&lt;http://marc.info/?l=apache-modules&amp;m=109754513810791&amp;w=2&gt; questions 
&lt;http://marc.info/?l=apache-modules&amp;m=97517123707363&amp;w=2&gt; on this 
subject, but they're very old and don't answer my question.

I essentially want to allow the module to be compiled against one or two 
different libraries, depending on availability and user choice.

Non-essential background details:
----8&lt;-----------------------------------------------------------------
I'm building a module that accesses a database at configuration parse 
time, but I can't use APR DBD for a few reasons. Firstly, I need 
features from apr-util 1.3 which is not in many major distributions. 
Secondly, apr-util and mod_php can conflict by linking against 
libmysqlclient_r and libmysqlclient, respectively. Both libraries export 
the same symbols, which then causes all sorts of hell (generally 
manifesting as bizarre segfaults). I've also had issues with the 
distro-packaged versions of apr-util being compiled without database 
support (or DSO support, making it impossible to load the DB drivers). 
Then again, this could be due to me missing something. My DB 
driver-loading code was inspired from mod_dbd, so I'm fairly sure it's 
making the right calls.

Basically, I want the user/package maintainer to be able to force 
selection of libmysqlclient/libmysqlclient_r as appropriate (as some 
distributions have fixed this issue), although it would be even better 
to autodetect this via "configure" rules. I then also plan to add 
support for other databases, such as Postgres.

Of course, if anyone has any better suggestions on how to do this that 
don't involve me writing my own reduced-functionality DB abstraction 
layer, I would love to hear them.
----&gt;8-----------------------------------------------------------------


Thanks,


Dave


</pre>
</div>
</content>
</entry>
<entry>
<title>I'm stuck with an OS X module problem and -mmacosx-version-min=10.5</title>
<author><name>Patrick McManus &lt;mcmanus@ducksong.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c1258399430.8667.162.camel@tng%3e"/>
<id>urn:uuid:%3c1258399430-8667-162-camel@tng%3e</id>
<updated>2009-11-16T19:23:50Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi All,

Here's my problem - I have an apache module that has been happily
running on Mac Leopard for quite a while. I installed snow leopard recently.
If I build it on the SL host, it works fine there too.

Of course, the SL binary will not run on 10.5 - I get linker errors when
apache loads it. That's expected (ok, I forgot it, but its normal) - and
then I rebuilt the module with -mmacosx-version-min=10.5.

The linker errors resolved themselves. Hurrah.

However now the module is broken for me. The handler will run and
the right content-body will flow out, but content-type is consistently
text/plain even though ap_set_content_type(r, "text/html") has been
called.

If I remove the version-min-flag the correct content-type comes out (but
of course the binary is not portable anymore).

I tracked it down further to some interactions with filters and the
brigade code.

I have a simple example below which sets up a brigade directly out of
the handler, but it doesn't even do anything with it. (the real code
inserts it as a filter and deals with data streamed in - this change is
made to create a minimal example - the symptoms are identical). If this
brigade could is called and version-min is set - then content-type is
not honored. If EITHER the brigade calls or the version-min is omitted,
then content-type works fine. You'll see nothing is even done with the
brigade, and the HTTP request is a GET anyhow.


#include &lt;unistd.h&gt;
#include &lt;sys/types.h&gt;

#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_protocol.h"
#include "http_request.h"
#include "http_connection.h"
#include "http_log.h"

#include "apr_strings.h"
#include "apr_lib.h"            /* for apr_isspace */
#include "apr_base64.h"         /* for apr_base64_decode et al */
#include "apr_file_io.h"


#define MGI_TYPE   "application/mgi"
#define MGI_SCRIPT "mgi-script"


static int mgi_handler(request_rec *r)
{
  if (r-&gt;handler == NULL)
    return DECLINED;
  
  if (strcmp(r-&gt;handler, MGI_TYPE) &amp;&amp; strcmp(r-&gt;handler, MGI_SCRIPT))
    return DECLINED;

  {
      apr_status_t rv;
      apr_bucket_brigade *bb;
      
      bb = apr_brigade_create(r-&gt;pool, r-&gt;connection-&gt;bucket_alloc);
      rv = ap_get_brigade(r-&gt;input_filters, bb, AP_MODE_READBYTES,
                          APR_BLOCK_READ, HUGE_STRING_LEN);
  }
  
    ap_set_content_type (r,"text/fake");
    ap_rwrite ("foobit", 6, r);
    
    return OK;
}

static void mgi_register_hooks(apr_pool_t *p)
{
    ap_hook_handler (mgi_handler, NULL, NULL, APR_HOOK_MIDDLE);
    return;
}

module AP_MODULE_DECLARE_DATA mgi_module =
{
    STANDARD20_MODULE_STUFF,
    NULL,    /* per-directory config creator */
    NULL,     /* dir config merger */
    NULL,
    NULL,  /* server config merger */
    NULL, // todo mgi_cmds,                 /* command table */
    mgi_register_hooks,       /* set up other request processing hooks
*/
};

Compiled like so (on 10.6  xcode 3.2.1 (and 3.2.0 - same result) using
the apache 2.2.13 distributed on SL)

gcc -Wall -Wno-multichar -fPIC -g -arch x86_64 -arch i386 -arch ppc -mmacosx-version-min=10.5
-I /usr/include/apr-1.0/ -I /usr/include/apr-1/ -I `/usr/sbin/apxs -q INCLUDEDIR` -DAPACHE_MODULE
-c -o mod_mgi.o mod_mgi.c
gcc -Wall -Wno-multichar -fPIC -g -arch x86_64 -arch i386 -arch ppc -mmacosx-version-min=10.5
-I /usr/include/apr-1.0/ -I /usr/include/apr-1/ -I `/usr/sbin/apxs -q INCLUDEDIR` -DAPACHE_MODULE
-fPIC -shared -flat_namespace -undefined warning -o mod_mgi.so mod_mgi.o


Like I said, either removing that brigade code that doesn't do anything or
removing the compiler flag gets the content-type text/fake that you
would expect.. but this example has been boiled down, the real module of
course needs a useful input filter and its really strange to expect
different output results based on that flag anyhow.

Is there potentially a problem because core apache isn't compiled with
that flag? And if that's the case, how could a 3rd party construct a
module that can run on either revision of the OS? Do I need multiple
binaries that are sorted out by the installer? Yech, hope that isn't the
case.

Thanks again for any help you can muster. I appreciate it.

-Patrick







</pre>
</div>
</content>
</entry>
<entry>
<title>Re: May have found the culprit was Re: ap_sub_req_lookup_uri(r-&gt;uri,	r, NULL)-&gt;content_type always returns 'text/plain'?</title>
<author><name>Bob Ionescu &lt;bobsiegen@googlemail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c553da56d0911161037iad57455w93f47156e732b321@mail.gmail.com%3e"/>
<id>urn:uuid:%3c553da56d0911161037iad57455w93f47156e732b321@mail-gmail-com%3e</id>
<updated>2009-11-16T18:37:07Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
2009/11/16  &lt;ohaya@cox.net&gt;:
&gt; Content-Type:
&gt; - local ==&gt; text/html
&gt; - Via WebLogic Plugin ==&gt; text/html; charset=UTF-8
&gt;
&gt; Could either of these (or both) differences be messing the mod_limitipconn module up,
preventing it from getting the Content-Type properly?

Are you saying that "Via WebLogic Plugin ==&gt; text/html; charset=UTF-8"
is being set before the content handler (proxy) runs or after?

The subrequest *lookup* won't invoke the content handler. You'll have
to call ap_run_sub_req() with the generated request_record (rr) of
your lookup to invoke the content handler.

Bob


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: [OT] ajusting apache timeout</title>
<author><name>Sam Carleton &lt;scarleton@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c8d38ca0a0911160631l23b4d238jad62f94291d09b6a@mail.gmail.com%3e"/>
<id>urn:uuid:%3c8d38ca0a0911160631l23b4d238jad62f94291d09b6a@mail-gmail-com%3e</id>
<updated>2009-11-16T14:31:36Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Eric,

I was stepping through the Axis2/C code on Apache.  I found the issue...

I was programmatically setting up the binding on the client and had missed
the fact that after I set the SendTimeout to 10 minutes, about 15 lines
farther down I set it again to 25 seconds.

Sam

On Sun, Nov 15, 2009 at 8:08 PM, Eric Covener &lt;covener@gmail.com&gt; wrote:

&gt; On Sun, Nov 15, 2009 at 3:44 PM, Sam Carleton
&gt; &lt;scarleton@miltonstreet.com&gt; wrote:
&gt; &gt; I am working on a Axis2/C module that is hosted by Apache 2.2.  The
&gt; client
&gt; &gt; is .Net 3.5.  I have set the SendTimeout on the .Net binding to 10
&gt; minutes
&gt; &gt; but things are still timing out in about 30 seconds.
&gt;
&gt; During what?
&gt;
&gt; --
&gt; Eric Covener
&gt; covener@gmail.com
&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: [OT] ajusting apache timeout</title>
<author><name>Eric Covener &lt;covener@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c1404e5910911151708j47a142c4v2af491ace612b913@mail.gmail.com%3e"/>
<id>urn:uuid:%3c1404e5910911151708j47a142c4v2af491ace612b913@mail-gmail-com%3e</id>
<updated>2009-11-16T01:08:48Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
On Sun, Nov 15, 2009 at 3:44 PM, Sam Carleton
&lt;scarleton@miltonstreet.com&gt; wrote:
&gt; I am working on a Axis2/C module that is hosted by Apache 2.2.  The client
&gt; is .Net 3.5.  I have set the SendTimeout on the .Net binding to 10 minutes
&gt; but things are still timing out in about 30 seconds.

During what?

-- 
Eric Covener
covener@gmail.com


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Preventing the use of chunked TF encoding while content-filtering</title>
<author><name>Christoph =?ISO-8859-1?Q?Gr=F6ver?= &lt;grover@sitepark.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c20091115231539.254c88a8@aeshna.sitepark.local%3e"/>
<id>urn:uuid:%3c20091115231539-254c88a8@aeshna-sitepark-local%3e</id>
<updated>2009-11-15T22:15:39Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

Hello Anthony,

&gt; I had a mod_buffer module written for me by Konstantin Chuguev
&gt; (konstantin@chuguev.com) which collects chunks and buffers them for
&gt; transfer in one shot. You should contact him and see whether he'll
&gt; give/license it to you.

Thank you for your answer.

Does this mean that collecting the chunks and transfering them in one
shot will solve my problem?

Do you know for sure that by this I will be able to circumvent the use
of chunked transfer encoding?

I will program it myself, but I wanted to be sure that this will help
before I start implementing it.

Bye

-- 
Christoph Gröver, grover@sitepark.com
Sitepark GmbH, Gesellschaft für Informationsmanagement, AG Münster, HRB
5017 Rothenburg 14-16, D-48143 Münster, Telefon (0251) 48265-50
Geschäftsführer: Dipl.-Phys. Martin Kurze, Dipl.-Des. Thorsten Liebold


</pre>
</div>
</content>
</entry>
<entry>
<title>[OT] ajusting apache timeout</title>
<author><name>Sam Carleton &lt;scarleton@miltonstreet.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c8d38ca0a0911151244q3c2de580l37376e8a062ce76@mail.gmail.com%3e"/>
<id>urn:uuid:%3c8d38ca0a0911151244q3c2de580l37376e8a062ce76@mail-gmail-com%3e</id>
<updated>2009-11-15T20:44:26Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
I am working on a Axis2/C module that is hosted by Apache 2.2.  The client
is .Net 3.5.  I have set the SendTimeout on the .Net binding to 10 minutes
but things are still timing out in about 30 seconds.  I am wondering if
anyone in this forum has run into timeout problems that where fixed by
modifiying Apache's configuration.

Sam


</pre>
</div>
</content>
</entry>
<entry>
<title>May have found the culprit was Re: ap_sub_req_lookup_uri(r-&gt;uri,  r, NULL)-&gt;content_type always returns 'text/plain'?</title>
<author><name>&lt;ohaya@cox.net&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c20091115152049.WOQHH.748851.imail@eastrmwml39%3e"/>
<id>urn:uuid:%3c20091115152049-WOQHH-748851-imail@eastrmwml39%3e</id>
<updated>2009-11-15T20:20:49Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Hi,

With further testing, I think that I've identified that mod_limitipconn is not able to get
the Content-Type/content_type when the URL is being proxied to a WebLogic server via a plugin/module
that comes with WebLogic (the "WebLogic Plugin for Apache").

[NOTE: mod_limitipconn still DOES get the correct content_type for other URLs that are NOT
being proxied by the WebLogic Plugin.]

I've tried changing the LoadModule order, so that mod_limitipconn is both before and after
the WebLogic plugin/module in httpd.conf, and the order doesn't seem to matter.

I guess that this might take this thread slightly off-topic, except that I still don't understand
why mod_limitipconn can't get the content_type, especially since the LoadModule order doesn't
seem to affect things :(...

Jim


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Static vs. Shared module precedence was Re: ap_sub_req_lookup_uri(r-&gt;uri,  r, NULL)-&gt;content_type always returns 'text/plain'?</title>
<author><name>&lt;ohaya@cox.net&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c20091115112031.5BQDA.971161.imail@eastrmwml49%3e"/>
<id>urn:uuid:%3c20091115112031-5BQDA-971161-imail@eastrmwml49%3e</id>
<updated>2009-11-15T16:20:31Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

---- Eric Covener &lt;covener@gmail.com&gt; wrote: 
&gt; &gt; Is the problem that the original Apache was on a 64-bit system?
&gt; &gt;
&gt; &gt; Could the Apache API on the 64-bit system be behaving differently than on a 32-bit
system?
&gt; 
&gt; Seems unlikely. I also checked and mod_limitipconn and mod_mime don't
&gt; even operate in the same hook.
&gt; 
&gt; Perhaps see the comments in mid_dir's usage of ap_sub_req_lookup_uri()?
&gt; 
&gt; -- 
&gt; Eric Covener
&gt; covener@gmail.com


Eric,

I'm not clear what you meant by:

"Perhaps see the comments in mid_dir's usage of ap_sub_req_lookup_uri()?".

Did you mean "mod_dir"?

Jim


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Static vs. Shared module precedence was Re: ap_sub_req_lookup_uri(r-&gt;uri,	r, NULL)-&gt;content_type always returns 'text/plain'?</title>
<author><name>Eric Covener &lt;covener@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c1404e5910911150510p6be3616fia376e0e4ae1b8c57@mail.gmail.com%3e"/>
<id>urn:uuid:%3c1404e5910911150510p6be3616fia376e0e4ae1b8c57@mail-gmail-com%3e</id>
<updated>2009-11-15T13:10:04Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
&gt; Is the problem that the original Apache was on a 64-bit system?
&gt;
&gt; Could the Apache API on the 64-bit system be behaving differently than on a 32-bit system?

Seems unlikely. I also checked and mod_limitipconn and mod_mime don't
even operate in the same hook.

Perhaps see the comments in mid_dir's usage of ap_sub_req_lookup_uri()?

-- 
Eric Covener
covener@gmail.com


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: Static vs. Shared module precedence was Re: ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type always returns 'text/plain'?</title>
<author><name>&lt;ohaya@cox.net&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c20091114235438.5QGRT.971829.imail@eastrmwml32%3e"/>
<id>urn:uuid:%3c20091114235438-5QGRT-971829-imail@eastrmwml32%3e</id>
<updated>2009-11-15T04:54:38Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

---- ohaya@cox.net wrote: 
&gt; 
&gt; ---- ohaya@cox.net wrote: 
&gt; &gt; 
&gt; &gt; ---- ohaya@cox.net wrote: 
&gt; &gt; &gt; Hi,
&gt; &gt; &gt; 
&gt; &gt; &gt; I'm not sure if this is the appropriate list, or if I should post on the regular
httpd list...
&gt; &gt; &gt; 
&gt; &gt; &gt; I've been trying to work with an Apache module, mod_limitipconn:
&gt; &gt; &gt; 
&gt; &gt; &gt; http://dominia.org/djao/limitipconn2.html
&gt; &gt; &gt; 
&gt; &gt; &gt; This is with Apache 2.2.8/2.2.11.
&gt; &gt; &gt; 
&gt; &gt; &gt; Our use case is slightly different that the original one for this module. 
The original code is designed to limit the number of connections from any given IP address,
whereas in my case, we want to limit the total number of connections to the entire Apache
server instance.
&gt; &gt; &gt; 
&gt; &gt; &gt; To do that, I commented out one line (an 'if'), as shown below:
&gt; &gt; &gt; 
&gt; &gt; &gt;     /* Count up the number of connections we are handling right now from
&gt; &gt; &gt;      * this IP address */
&gt; &gt; &gt;     /* This is modified to not do strcmp(address, ws_record-&gt;client check,
in order
&gt; &gt; &gt;        to count ALL connections to this server. */
&gt; &gt; &gt;     for (i = 0; i &lt; server_limit; ++i) {
&gt; &gt; &gt;       for (j = 0; j &lt; thread_limit; ++j) {
&gt; &gt; &gt;         ws_record = ap_get_scoreboard_worker(i, j);
&gt; &gt; &gt;         switch (ws_record-&gt;status) {
&gt; &gt; &gt;             case SERVER_BUSY_READ:
&gt; &gt; &gt;             case SERVER_BUSY_WRITE:
&gt; &gt; &gt;             case SERVER_BUSY_KEEPALIVE:
&gt; &gt; &gt;             case SERVER_BUSY_LOG:
&gt; &gt; &gt;             case SERVER_BUSY_DNS:
&gt; &gt; &gt;             case SERVER_CLOSING:
&gt; &gt; &gt;             case SERVER_GRACEFUL:
&gt; &gt; &gt; /*
&gt; &gt; &gt;                 if (strcmp(address, ws_record-&gt;client) == 0)
&gt; &gt; &gt; */
&gt; &gt; &gt;                     ip_count++;
&gt; &gt; &gt;                 break;
&gt; &gt; &gt;             default:
&gt; &gt; &gt;                 break;
&gt; &gt; &gt;         }
&gt; &gt; &gt;       }
&gt; &gt; &gt;     }
&gt; &gt; &gt; 
&gt; &gt; &gt; and, after I rebuilt the module, it seems to work ok.
&gt; &gt; &gt; 
&gt; &gt; &gt; Now, I'm trying to get the module's directive "NoIPLimit" to work.  
&gt; &gt; &gt; 
&gt; &gt; &gt; According to the README, plus reading the code, the way that this is suppose
to work is that if you specify a MIME type string (substring, actually), the module won't
"count" requests that have any of the MIME types in the directive.
&gt; &gt; &gt; 
&gt; &gt; &gt; I have the Apache LogLevel set to debug, and it looks like the "content_type"
that the module is retrieving from ALL requests is "text/plain", and I have confirmed that
the actual MIME types are not "text/plain" (I see things like "image/gif", "text/css", etc.),
so the "NoIPLimit" directive doesn't work.
&gt; &gt; &gt; 
&gt; &gt; &gt; From reading the code, I think that the "content_type" is set in this snippet:
&gt; &gt; &gt; 
&gt; &gt; &gt;     /* Only check the MIME-type if we have MIME-type stuff in our config.
&gt; &gt; &gt;        The extra subreq can be quite expensive. */
&gt; &gt; &gt;     if(cfg-&gt;no_limit-&gt;nelts &gt; 0 || cfg-&gt;excl_limit-&gt;nelts &gt;
0) {
&gt; &gt; &gt;         /* Look up the Content-type of this request. We need a subrequest
&gt; &gt; &gt;          * here since this module might be called before the URI has been
&gt; &gt; &gt;          * translated into a MIME type. */
&gt; &gt; &gt;         content_type = ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type;
&gt; &gt; &gt; 
&gt; &gt; &gt;         /* If there's no Content-type, use the default. */
&gt; &gt; &gt;         if (!content_type) {
&gt; &gt; &gt;             content_type = ap_default_type(r);
&gt; &gt; &gt;         }
&gt; &gt; &gt; 
&gt; &gt; &gt;         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
&gt; &gt; &gt;                 "mod_limitipconn: uri: %s  Content-Type: %s",
&gt; &gt; &gt;                 r-&gt;uri, content_type);
&gt; &gt; &gt; 
&gt; &gt; &gt;         /* Cycle through the exempt list; if our content_type is exempt,
&gt; &gt; &gt;          * return OK */
&gt; &gt; &gt;         for (i = 0; i &lt; cfg-&gt;no_limit-&gt;nelts; i++) {
&gt; &gt; &gt;             if ((ap_strcasecmp_match(content_type, nolim[i]) == 0)
&gt; &gt; &gt;                 || (strncmp(nolim[i], content_type, strlen(nolim[i])) == 0))
&gt; &gt; &gt;             {
&gt; &gt; &gt;                 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
&gt; &gt; &gt;                              "mod_limitipconn: OK: %s exempt", content_type);
&gt; &gt; &gt;                 return DECLINED;
&gt; &gt; &gt;             }
&gt; &gt; &gt;         }
&gt; &gt; &gt; 
&gt; &gt; &gt; and, in particular:
&gt; &gt; &gt; 
&gt; &gt; &gt;         content_type = ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type;
&gt; &gt; &gt; 
&gt; &gt; &gt;         /* If there's no Content-type, use the default. */
&gt; &gt; &gt;         if (!content_type) {
&gt; &gt; &gt;             content_type = ap_default_type(r);
&gt; &gt; &gt;         }
&gt; &gt; &gt; 
&gt; &gt; &gt; I'm not that familiar with Apache module development, but reading the docs,
it *seems* like the above *should* work.
&gt; &gt; &gt; 
&gt; &gt; &gt; I'm assuming you all on this list *are* familiar with module development, so
I was wondering if you might be able to tell me what, if anything, is wrong with that code
(i.e., why is "content_type" not being set with the actual content type?
&gt; &gt; &gt; 
&gt; &gt; &gt; Thanks in advance!!
&gt; &gt; &gt; 
&gt; &gt; &gt; Jim
&gt; &gt; 
&gt; &gt; Hi,
&gt; &gt; 
&gt; &gt; BTW, here's an example of the Apache debug output for mod_limitipconn that illustrates
what I'm seeing:
&gt; &gt; 
&gt; &gt; [Sun Nov 15 02:21:09 2009] [debug] mod_limitipconn.c(143): [client 192.168.xx.yy]
mod_limitipconn: uri: /anewwsclient/css/body.css  Content-Type: text/plain, referer: http://foo.host.com/anewwsclient
&gt; &gt; 
&gt; &gt; As you can see, the URI is for a .css, but the Content-Type comes back as "text/plain,
referer: http://foo.host.com/anewwsclient", then, since the mod_limitipconn code checks for
the MIME types in the NoIPLimit directive, (e.g., image/* text/css/*), it fails to detect
this as a MIME type that it should ignore.
&gt; &gt; 
&gt; &gt; Shouldn't the Content-Type be something like "text/css, referer: http://foo.host.com/anewwsclient"?
&gt; &gt; 
&gt; &gt; Jim
&gt; &gt; 
&gt; 
&gt; 
&gt; Hi,
&gt; 
&gt; I just noticed that when I run "apachectl -M", I get:
&gt; 
&gt; bash-3.00# ./apachectl -M
&gt; Loaded Modules:
&gt;  core_module (static)
&gt;  authn_file_module (static)
&gt;  authn_default_module (static)
&gt;  authz_host_module (static)
&gt;  authz_groupfile_module (static)
&gt;  authz_user_module (static)
&gt;  authz_default_module (static)
&gt;  auth_basic_module (static)
&gt;  include_module (static)
&gt;  filter_module (static)
&gt;  log_config_module (static)
&gt;  env_module (static)
&gt;  setenvif_module (static)
&gt;  ssl_module (static)
&gt;  mpm_prefork_module (static)
&gt;  http_module (static)
&gt;  mime_module (static)
&gt;  status_module (static)
&gt;  autoindex_module (static)
&gt;  asis_module (static)
&gt;  cgi_module (static)
&gt;  negotiation_module (static)
&gt;  dir_module (static)
&gt;  actions_module (static)
&gt;  userdir_module (static)
&gt;  alias_module (static)
&gt;  so_module (static)
&gt;  limitipconn_module (shared)
&gt; Syntax OK
&gt; 
&gt; Notice that the static modules apparently are listed before the shared module.  I'm assuming
that this list is in module, order, so it seems like the limitipconn module is "first".
&gt; 
&gt; I'm wondering if *this* might be my problem, i.e., since the mod_limitipconn is first,
and the mod_mime (which maps the suffix to mime type) is "after" the mod_limitipconn, if that
might be why mod_limitipconn is apparently not able to determine the correct MIME type?
&gt; 
&gt; Jim
&gt; 

Hi,

To try to test the "precedence" theory, I built a new Apache 2.2.14, with all shared module.
 I then built a new copy of mod_limitipconn.so.

Now, here's the weird thing :(...

When I run this new Apache with the new mod_limitipconn.so, and check in the error_log file,
it is now SHOWING the PROPER Content-Type!!

Here's the 'apachectl -M'  and '-V' from this new build:

[root@fed9 htdocs]# ../bin/apachectl -M
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 authn_file_module (shared)
 authn_dbm_module (shared)
 authn_anon_module (shared)
 authn_dbd_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_groupfile_module (shared)
 authz_user_module (shared)
 authz_dbm_module (shared)
 authz_owner_module (shared)
 authz_default_module (shared)
 auth_basic_module (shared)
 auth_digest_module (shared)
 dbd_module (shared)
 dumpio_module (shared)
 ext_filter_module (shared)
 include_module (shared)
 filter_module (shared)
 substitute_module (shared)
 deflate_module (shared)
 log_config_module (shared)
 log_forensic_module (shared)
 logio_module (shared)
 env_module (shared)
 mime_magic_module (shared)
 cern_meta_module (shared)
 expires_module (shared)
 headers_module (shared)
 ident_module (shared)
 usertrack_module (shared)
 unique_id_module (shared)
 setenvif_module (shared)
 version_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 asis_module (shared)
 info_module (shared)
 cgi_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 imagemap_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 rewrite_module (shared)
 limitipconn_module (shared)
Syntax OK
[root@fed9 htdocs]# ../bin/apachectl -V
Server version: Apache/2.2.14 (Unix)
Server built:   Nov 14 2009 18:20:52
Server's Module Magic Number: 20051115:23
Server loaded:  APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/apps/httpd-2.2.14"
 -D SUEXEC_BIN="/apps/httpd-2.2.14/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
[root@fed9 htdocs]#

The above looks similar to the Apache that doesn't work.  The main thing is the old Apache
had all modules except for mod_limitipconnn.so as "static", whereas the new Apache has all
modules as "shared", and the old Apache was on 64-bit Redhat, whereas the new Apache is on
32-bit Fedora 9.

Anyone have any ideas about what might be causing the missing Content-Type on the old Apache?

Thanks,
Jim




</pre>
</div>
</content>
</entry>
<entry>
<title>Static vs. Shared module precedence was Re: ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type always returns 'text/plain'?</title>
<author><name>&lt;ohaya@cox.net&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c20091114224549.22XBH.971489.imail@eastrmwml32%3e"/>
<id>urn:uuid:%3c20091114224549-22XBH-971489-imail@eastrmwml32%3e</id>
<updated>2009-11-15T03:45:49Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

---- ohaya@cox.net wrote: 
&gt; 
&gt; ---- ohaya@cox.net wrote: 
&gt; &gt; Hi,
&gt; &gt; 
&gt; &gt; I'm not sure if this is the appropriate list, or if I should post on the regular
httpd list...
&gt; &gt; 
&gt; &gt; I've been trying to work with an Apache module, mod_limitipconn:
&gt; &gt; 
&gt; &gt; http://dominia.org/djao/limitipconn2.html
&gt; &gt; 
&gt; &gt; This is with Apache 2.2.8/2.2.11.
&gt; &gt; 
&gt; &gt; Our use case is slightly different that the original one for this module.  The original
code is designed to limit the number of connections from any given IP address, whereas in
my case, we want to limit the total number of connections to the entire Apache server instance.
&gt; &gt; 
&gt; &gt; To do that, I commented out one line (an 'if'), as shown below:
&gt; &gt; 
&gt; &gt;     /* Count up the number of connections we are handling right now from
&gt; &gt;      * this IP address */
&gt; &gt;     /* This is modified to not do strcmp(address, ws_record-&gt;client check, in
order
&gt; &gt;        to count ALL connections to this server. */
&gt; &gt;     for (i = 0; i &lt; server_limit; ++i) {
&gt; &gt;       for (j = 0; j &lt; thread_limit; ++j) {
&gt; &gt;         ws_record = ap_get_scoreboard_worker(i, j);
&gt; &gt;         switch (ws_record-&gt;status) {
&gt; &gt;             case SERVER_BUSY_READ:
&gt; &gt;             case SERVER_BUSY_WRITE:
&gt; &gt;             case SERVER_BUSY_KEEPALIVE:
&gt; &gt;             case SERVER_BUSY_LOG:
&gt; &gt;             case SERVER_BUSY_DNS:
&gt; &gt;             case SERVER_CLOSING:
&gt; &gt;             case SERVER_GRACEFUL:
&gt; &gt; /*
&gt; &gt;                 if (strcmp(address, ws_record-&gt;client) == 0)
&gt; &gt; */
&gt; &gt;                     ip_count++;
&gt; &gt;                 break;
&gt; &gt;             default:
&gt; &gt;                 break;
&gt; &gt;         }
&gt; &gt;       }
&gt; &gt;     }
&gt; &gt; 
&gt; &gt; and, after I rebuilt the module, it seems to work ok.
&gt; &gt; 
&gt; &gt; Now, I'm trying to get the module's directive "NoIPLimit" to work.  
&gt; &gt; 
&gt; &gt; According to the README, plus reading the code, the way that this is suppose to
work is that if you specify a MIME type string (substring, actually), the module won't "count"
requests that have any of the MIME types in the directive.
&gt; &gt; 
&gt; &gt; I have the Apache LogLevel set to debug, and it looks like the "content_type" that
the module is retrieving from ALL requests is "text/plain", and I have confirmed that the
actual MIME types are not "text/plain" (I see things like "image/gif", "text/css", etc.),
so the "NoIPLimit" directive doesn't work.
&gt; &gt; 
&gt; &gt; From reading the code, I think that the "content_type" is set in this snippet:
&gt; &gt; 
&gt; &gt;     /* Only check the MIME-type if we have MIME-type stuff in our config.
&gt; &gt;        The extra subreq can be quite expensive. */
&gt; &gt;     if(cfg-&gt;no_limit-&gt;nelts &gt; 0 || cfg-&gt;excl_limit-&gt;nelts &gt; 0)
{
&gt; &gt;         /* Look up the Content-type of this request. We need a subrequest
&gt; &gt;          * here since this module might be called before the URI has been
&gt; &gt;          * translated into a MIME type. */
&gt; &gt;         content_type = ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type;
&gt; &gt; 
&gt; &gt;         /* If there's no Content-type, use the default. */
&gt; &gt;         if (!content_type) {
&gt; &gt;             content_type = ap_default_type(r);
&gt; &gt;         }
&gt; &gt; 
&gt; &gt;         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
&gt; &gt;                 "mod_limitipconn: uri: %s  Content-Type: %s",
&gt; &gt;                 r-&gt;uri, content_type);
&gt; &gt; 
&gt; &gt;         /* Cycle through the exempt list; if our content_type is exempt,
&gt; &gt;          * return OK */
&gt; &gt;         for (i = 0; i &lt; cfg-&gt;no_limit-&gt;nelts; i++) {
&gt; &gt;             if ((ap_strcasecmp_match(content_type, nolim[i]) == 0)
&gt; &gt;                 || (strncmp(nolim[i], content_type, strlen(nolim[i])) == 0))
&gt; &gt;             {
&gt; &gt;                 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
&gt; &gt;                              "mod_limitipconn: OK: %s exempt", content_type);
&gt; &gt;                 return DECLINED;
&gt; &gt;             }
&gt; &gt;         }
&gt; &gt; 
&gt; &gt; and, in particular:
&gt; &gt; 
&gt; &gt;         content_type = ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type;
&gt; &gt; 
&gt; &gt;         /* If there's no Content-type, use the default. */
&gt; &gt;         if (!content_type) {
&gt; &gt;             content_type = ap_default_type(r);
&gt; &gt;         }
&gt; &gt; 
&gt; &gt; I'm not that familiar with Apache module development, but reading the docs, it *seems*
like the above *should* work.
&gt; &gt; 
&gt; &gt; I'm assuming you all on this list *are* familiar with module development, so I was
wondering if you might be able to tell me what, if anything, is wrong with that code (i.e.,
why is "content_type" not being set with the actual content type?
&gt; &gt; 
&gt; &gt; Thanks in advance!!
&gt; &gt; 
&gt; &gt; Jim
&gt; 
&gt; Hi,
&gt; 
&gt; BTW, here's an example of the Apache debug output for mod_limitipconn that illustrates
what I'm seeing:
&gt; 
&gt; [Sun Nov 15 02:21:09 2009] [debug] mod_limitipconn.c(143): [client 192.168.xx.yy] mod_limitipconn:
uri: /anewwsclient/css/body.css  Content-Type: text/plain, referer: http://foo.host.com/anewwsclient
&gt; 
&gt; As you can see, the URI is for a .css, but the Content-Type comes back as "text/plain,
referer: http://foo.host.com/anewwsclient", then, since the mod_limitipconn code checks for
the MIME types in the NoIPLimit directive, (e.g., image/* text/css/*), it fails to detect
this as a MIME type that it should ignore.
&gt; 
&gt; Shouldn't the Content-Type be something like "text/css, referer: http://foo.host.com/anewwsclient"?
&gt; 
&gt; Jim
&gt; 


Hi,

I just noticed that when I run "apachectl -M", I get:

bash-3.00# ./apachectl -M
Loaded Modules:
 core_module (static)
 authn_file_module (static)
 authn_default_module (static)
 authz_host_module (static)
 authz_groupfile_module (static)
 authz_user_module (static)
 authz_default_module (static)
 auth_basic_module (static)
 include_module (static)
 filter_module (static)
 log_config_module (static)
 env_module (static)
 setenvif_module (static)
 ssl_module (static)
 mpm_prefork_module (static)
 http_module (static)
 mime_module (static)
 status_module (static)
 autoindex_module (static)
 asis_module (static)
 cgi_module (static)
 negotiation_module (static)
 dir_module (static)
 actions_module (static)
 userdir_module (static)
 alias_module (static)
 so_module (static)
 limitipconn_module (shared)
Syntax OK

Notice that the static modules apparently are listed before the shared module.  I'm assuming
that this list is in module, order, so it seems like the limitipconn module is "first".

I'm wondering if *this* might be my problem, i.e., since the mod_limitipconn is first, and
the mod_mime (which maps the suffix to mime type) is "after" the mod_limitipconn, if that
might be why mod_limitipconn is apparently not able to determine the correct MIME type?

Jim



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type always returns 'text/plain'?</title>
<author><name>&lt;ohaya@cox.net&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c20091114214352.WER6K.971094.imail@eastrmwml32%3e"/>
<id>urn:uuid:%3c20091114214352-WER6K-971094-imail@eastrmwml32%3e</id>
<updated>2009-11-15T02:43:52Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

---- ohaya@cox.net wrote: 
&gt; Hi,
&gt; 
&gt; I'm not sure if this is the appropriate list, or if I should post on the regular httpd
list...
&gt; 
&gt; I've been trying to work with an Apache module, mod_limitipconn:
&gt; 
&gt; http://dominia.org/djao/limitipconn2.html
&gt; 
&gt; This is with Apache 2.2.8/2.2.11.
&gt; 
&gt; Our use case is slightly different that the original one for this module.  The original
code is designed to limit the number of connections from any given IP address, whereas in
my case, we want to limit the total number of connections to the entire Apache server instance.
&gt; 
&gt; To do that, I commented out one line (an 'if'), as shown below:
&gt; 
&gt;     /* Count up the number of connections we are handling right now from
&gt;      * this IP address */
&gt;     /* This is modified to not do strcmp(address, ws_record-&gt;client check, in order
&gt;        to count ALL connections to this server. */
&gt;     for (i = 0; i &lt; server_limit; ++i) {
&gt;       for (j = 0; j &lt; thread_limit; ++j) {
&gt;         ws_record = ap_get_scoreboard_worker(i, j);
&gt;         switch (ws_record-&gt;status) {
&gt;             case SERVER_BUSY_READ:
&gt;             case SERVER_BUSY_WRITE:
&gt;             case SERVER_BUSY_KEEPALIVE:
&gt;             case SERVER_BUSY_LOG:
&gt;             case SERVER_BUSY_DNS:
&gt;             case SERVER_CLOSING:
&gt;             case SERVER_GRACEFUL:
&gt; /*
&gt;                 if (strcmp(address, ws_record-&gt;client) == 0)
&gt; */
&gt;                     ip_count++;
&gt;                 break;
&gt;             default:
&gt;                 break;
&gt;         }
&gt;       }
&gt;     }
&gt; 
&gt; and, after I rebuilt the module, it seems to work ok.
&gt; 
&gt; Now, I'm trying to get the module's directive "NoIPLimit" to work.  
&gt; 
&gt; According to the README, plus reading the code, the way that this is suppose to work
is that if you specify a MIME type string (substring, actually), the module won't "count"
requests that have any of the MIME types in the directive.
&gt; 
&gt; I have the Apache LogLevel set to debug, and it looks like the "content_type" that the
module is retrieving from ALL requests is "text/plain", and I have confirmed that the actual
MIME types are not "text/plain" (I see things like "image/gif", "text/css", etc.), so the
"NoIPLimit" directive doesn't work.
&gt; 
&gt; From reading the code, I think that the "content_type" is set in this snippet:
&gt; 
&gt;     /* Only check the MIME-type if we have MIME-type stuff in our config.
&gt;        The extra subreq can be quite expensive. */
&gt;     if(cfg-&gt;no_limit-&gt;nelts &gt; 0 || cfg-&gt;excl_limit-&gt;nelts &gt; 0) {
&gt;         /* Look up the Content-type of this request. We need a subrequest
&gt;          * here since this module might be called before the URI has been
&gt;          * translated into a MIME type. */
&gt;         content_type = ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type;
&gt; 
&gt;         /* If there's no Content-type, use the default. */
&gt;         if (!content_type) {
&gt;             content_type = ap_default_type(r);
&gt;         }
&gt; 
&gt;         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
&gt;                 "mod_limitipconn: uri: %s  Content-Type: %s",
&gt;                 r-&gt;uri, content_type);
&gt; 
&gt;         /* Cycle through the exempt list; if our content_type is exempt,
&gt;          * return OK */
&gt;         for (i = 0; i &lt; cfg-&gt;no_limit-&gt;nelts; i++) {
&gt;             if ((ap_strcasecmp_match(content_type, nolim[i]) == 0)
&gt;                 || (strncmp(nolim[i], content_type, strlen(nolim[i])) == 0))
&gt;             {
&gt;                 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
&gt;                              "mod_limitipconn: OK: %s exempt", content_type);
&gt;                 return DECLINED;
&gt;             }
&gt;         }
&gt; 
&gt; and, in particular:
&gt; 
&gt;         content_type = ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type;
&gt; 
&gt;         /* If there's no Content-type, use the default. */
&gt;         if (!content_type) {
&gt;             content_type = ap_default_type(r);
&gt;         }
&gt; 
&gt; I'm not that familiar with Apache module development, but reading the docs, it *seems*
like the above *should* work.
&gt; 
&gt; I'm assuming you all on this list *are* familiar with module development, so I was wondering
if you might be able to tell me what, if anything, is wrong with that code (i.e., why is "content_type"
not being set with the actual content type?
&gt; 
&gt; Thanks in advance!!
&gt; 
&gt; Jim

Hi,

BTW, here's an example of the Apache debug output for mod_limitipconn that illustrates what
I'm seeing:

[Sun Nov 15 02:21:09 2009] [debug] mod_limitipconn.c(143): [client 192.168.xx.yy] mod_limitipconn:
uri: /anewwsclient/css/body.css  Content-Type: text/plain, referer: http://foo.host.com/anewwsclient

As you can see, the URI is for a .css, but the Content-Type comes back as "text/plain, referer:
http://foo.host.com/anewwsclient", then, since the mod_limitipconn code checks for the MIME
types in the NoIPLimit directive, (e.g., image/* text/css/*), it fails to detect this as a
MIME type that it should ignore.

Shouldn't the Content-Type be something like "text/css, referer: http://foo.host.com/anewwsclient"?

Jim



</pre>
</div>
</content>
</entry>
<entry>
<title>Re: ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type always	returns 'text/plain'?</title>
<author><name>Eric Covener &lt;covener@gmail.com&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c1404e5910911141727y63555daau130674a20dcb2a89@mail.gmail.com%3e"/>
<id>urn:uuid:%3c1404e5910911141727y63555daau130674a20dcb2a89@mail-gmail-com%3e</id>
<updated>2009-11-15T01:27:48Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
On Sat, Nov 14, 2009 at 8:10 PM,  &lt;ohaya@cox.net&gt; wrote:
&gt; "MaxClients" was one of the first approaches that I tried when i was asked about this.
&gt;
&gt; The problem with MaxClients that I found was that it appeared that when it was used,
Apache would queue up the requests.  The end-result from the user perspective was that either
response time would look really slow, or their browser would eventually timeout, and they'd
get (in IE) a "The page cannot be displayed".

Wanting your own errordoc makes sense, but the queuing is just:
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listenbacklog


-- 
Eric Covener
covener@gmail.com


</pre>
</div>
</content>
</entry>
<entry>
<title>Re: ap_sub_req_lookup_uri(r-&gt;uri, r, NULL)-&gt;content_type always  returns 'text/plain'?</title>
<author><name>&lt;ohaya@cox.net&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200911.mbox/%3c20091114201033.CFEKF.970362.imail@eastrmwml32%3e"/>
<id>urn:uuid:%3c20091114201033-CFEKF-970362-imail@eastrmwml32%3e</id>
<updated>2009-11-15T01:10:33Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>

---- Eric Covener &lt;covener@gmail.com&gt; wrote: 
&gt; On Sat, Nov 14, 2009 at 7:37 PM,  &lt;ohaya@cox.net&gt; wrote:
&gt; 
&gt; &gt; Our use case is slightly different that the original one for this module. Â The
original code is designed to limit the number of connections from any given IP address, whereas
in my case, we want to limit the total number of connections to the entire Apache server instance.
&gt; 
&gt; What does this get you over just setting MaxClients directly?
&gt; 
&gt; -- 
&gt; Eric Covener
&gt; covener@gmail.com


Eric,

"MaxClients" was one of the first approaches that I tried when i was asked about this.

The problem with MaxClients that I found was that it appeared that when it was used, Apache
would queue up the requests.  The end-result from the user perspective was that either response
time would look really slow, or their browser would eventually timeout, and they'd get (in
IE) a "The page cannot be displayed".

For the situation that I've been asked to look into, they don't want either of the above (slow
response or "The page cannot be displayed"), but they want the user to get some kind of message
like "System too busy.  Please try again later.".

With mod_limitipconn (vs. MaxClients), when mod_limitipconn is "triggered", Apache immediately
(well, almost immediately) sends a 503 response, and with a custom ErrorDocument, we can customize
the message.

This works pretty well, but the problem is that since most pages have embedded content (css,
images, etc.), and, without the working NoIPLimit directive, mod_limitipconn will send 503
responses indiscriminately, i.e., it can send a 503 response to a GET for a CSS, which makes
the pages that the user's see look broken.  

I was hoping that I could get the NoIPLimit directive to work, then I could then configure
mod_limitipconn to not count requests for things like CSS and GIFs, but per my original post,
it looks like, for some reason the "content_type" that it's getting is always "text/plain".
 Actually, I think what's happening is when it calls that ap_...uri(), it's getting nothing,
so it uses the default content type, which happens to be "text/plain".

Thanks,
Jim



</pre>
</div>
</content>
</entry>
</feed>
