Re: Issuing a client side HTTP request from a module

2010-04-22 Thread Saju Pillai

Some Guy wrote:

Hi all,

Is there any facility in the Apache libs that allows module developers to
act as a client?  If not, I'll just use something like curl (or raw
sockets), but wanted to know if there was an Apache way to do this.



You'll have to co-opt a http client library or roll your own.

-srp





Re: *** glibc detected *** double free or corruption (!prev) in cleanup function

2010-04-22 Thread Sorin Manolache
On Thu, Apr 22, 2010 at 05:47, Andrej van der Zee
andrejvander...@gmail.com wrote:
 Hi,

 I have a question about apr_pool_cleanup_register for a child's pool.
 I register a cleanup function that is called when the pool is
 destroyed. In the cleanup function, I join a background thread that
 first writes some log to a database:

 static void mbrace_child_init(apr_pool_t *pool, server_rec *s)
 {
    apr_pool_cleanup_register(pool, 0, mbrace_bgthread_cleanup,
 apr_pool_cleanup_null);
 }

 static apr_status_t mbrace_bgthread_cleanup(void*)
 {
    req_log_mngr-stop()
 }

 But, when it connects to the database in the background thread, it
 sometimes ends up in the error below. I do not fully understand why,
 but are there any restrictions to what I can do in the cleanup
 function?

 When running gdb on the generated core-dump, you can see that it
 happens on line 134.

 125     APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator)
 126     {
 127         apr_uint32_t index;
 128         apr_memnode_t *node, **ref;
 129
 130         for (index = 0; index  MAX_INDEX; index++) {
 131             ref = allocator-free[index];
 132             while ((node = *ref) != NULL) {
 133                 *ref = node-next;
 134                 free(node);    here it happens!!
 135             }
 136         }
 137
 138         free(allocator);
 139     }

 Hopefully somebody can push me in the right direction.

Do you create a background thread per apache process? Or do you have a
single background thread that is used by all apache processes? Which
hook creates the background thread?

It is possible that you create the thread once but you try to join it
several times. I don't know if this is sufficient to get the symptoms
that you see.


Try compiling both apache and apr with debug symbols and run it in a
debugger with -X (i.e. monoprocess). Place a breakpoint on line 134
and see how many times you reach it.

S


Re: Issuing a client side HTTP request from a module

2010-04-22 Thread Sorin Manolache
On Wed, Apr 21, 2010 at 22:51, Nick Kew n...@apache.org wrote:

 On 21 Apr 2010, at 20:42, Some Guy wrote:

 Hi all,

 Is there any facility in the Apache libs that allows module developers to
 act as a client?

 The usual way would be to harness mod_proxy, commonly in a subrequest.
 You don't have to do anything special, just request something configured
 to proxy.

As Nick says, the common solution are subrequests. However, note that
subrequests are not kept alive.

S


Re: Issuing a client side HTTP request from a module

2010-04-22 Thread Nick Kew

On 22 Apr 2010, at 08:25, Sorin Manolache wrote:

 As Nick says, the common solution are subrequests. However, note that
 subrequests are not kept alive.

Backend connections may be kept alive or closed, as detailed in
the mod_proxy docs!

If you want to implement keepalive without mod_proxy, that's a lot
of wheel to reinvent.

-- 
Nick Kew


Re: *** glibc detected *** double free or corruption (!prev) in cleanup function

2010-04-22 Thread bronto

On 4/22/2010 1:09 PM, Andrej van der Zee wrote:

Hi,


   

This and try running httpd through valgrind.

 

How can I do that?

Thanks,
Andrej
   


http://lmgtfy.com/?q=apache+httpd+valgrind


Re: *** glibc detected *** double free or corruption (!prev) in cleanup function

2010-04-22 Thread Andrej van der Zee
Hi Bronto,


 http://lmgtfy.com/?q=apache+httpd+valgrind


Thank you for the tip :) You are funny!

Cheers,
Andrej


Re: *** glibc detected *** double free or corruption (!prev) in cleanup function

2010-04-22 Thread bronto

On 4/22/2010 1:46 PM, Andrej van der Zee wrote:

Hi Bronto,

   

http://lmgtfy.com/?q=apache+httpd+valgrind

 

Thank you for the tip :) You are funny!

Cheers,
Andrej
   

Hi,

yeah, i didn't mean no offense. I just thought that it's rather a FAQ ;)


Re: Issuing a client side HTTP request from a module

2010-04-22 Thread Some Guy
I don't really need keepalive.  Just a really basic http request.  However,
this would be in a non request handler thread, so I'll have no initial
request_rec to create a subrequest from.  It would also be in the parent
process via a monitor hook.  I see the mod_proxy create_worker and
initialize_worker, but the latter call requires a server_rec, which I won't
have.

SB

On Thu, Apr 22, 2010 at 3:48 AM, Nick Kew n...@apache.org wrote:


 On 22 Apr 2010, at 08:25, Sorin Manolache wrote:

  As Nick says, the common solution are subrequests. However, note that
  subrequests are not kept alive.

 Backend connections may be kept alive or closed, as detailed in
 the mod_proxy docs!

 If you want to implement keepalive without mod_proxy, that's a lot
 of wheel to reinvent.

 --
 Nick Kew



Re: Issuing a client side HTTP request from a module

2010-04-22 Thread Nick Kew

On 22 Apr 2010, at 15:14, Some Guy wrote:

 I don't really need keepalive.  Just a really basic http request.  However,
 this would be in a non request handler thread, so I'll have no initial
 request_rec to create a subrequest from.  It would also be in the parent
 process via a monitor hook.

In that case, you're probably the exception to the general advice to
use mod_proxy.  Simplest would probably be DIY with your choice
of HTTP client library.

-- 
Nick Kew


My own module and catching Proxy Request

2010-04-22 Thread Petr Hracek
Hello *,

I hope that I am sending those question to the correct discussion list.

In my Apache2 (2.2.3) configuration file I have:
VirtualHost _default_:443
SSLEngine on
DocumentRoot /opt/apache/htdocs/ssldocs
ProxyPass   /PAC/   http://192.168.187.101:8080/PACCBAdmin
ProxyPassReverse/PAC/   http://192.168.187.150:8080/PACCBAdmin/
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteMap unity txt:/opt/apache/conf/unity.map
RewriteRule ^/([^/]+)$  ${unity:$1|/$1} [L]
RewriteRule ^/([^/]+)/(.*)  ${unity:$1|/opt/apache/htdocs/ssldocs/$1}/$2 [L]
RewriteLog /var/log/apache2/rewrite_log
RewriteLogLevel 3

Location /PAC/
ProxyPassReverseCookiePath /PACCBAdmin /PAC
Order Allow,Deny
Allow from all
/Location

/VirtualHost

In the my modules which takes care about AAA, Security issues, etc.
I would like to catch in my module when URL contains /PAC/ (which means that
this is proxy) than it tell to module that this request is not a bussiness
for them.
Is it possible to do that somehow?
I have found that r-proxyreq contains if the Request is Proxy or not.

Thank you in advance
-- 
Best Regards / S pozdravem
Petr Hracek


Re: Oxygen icons for Apache

2010-04-22 Thread Javier Llorente
On Wednesday 21 April 2010 23:24:57 Javier Llorente wrote:

 Here's a more detailed explanation of my situation:
 
 I have hand picked some Oxygen icons, adapted (modified) some Oxygen and
 Crystal icons, and created the configuration  README.
 
 The Oxygen icons are under both LGPL and CC-by-SA
 Quoting http://creativecommons.org/licenses/by-sa/3.0/
 [...]
 Share Alike — If you alter, transform, or build upon this work, you may
 distribute the resulting work only under the same, similar or a compatible
 license.
 
 It seems to me that the cc-by-sa is ok in this case. I could re-license my
 collection to have it under the Apache license.
 
 The Crystal icons are under the LGPL (only, no dual licensing from what
  I've read). So I understand that here lies the problem. I could look for a
  solution like replacing them (they're just a few).
 
 Another possibility could be having distributions (if they choose to do so)
 shipping Apache with this collection of icons enabled by default. But I
  prefer contributing my grain of salt upstream so that anyone can use it,
  regardless of the distribution.
 
 BTW, thanks a lot for you explanation on licensing :)
 

I have just talked with Pinheiro and he told me that the Oxygen icons are no 
longer dual-licensed. They're under the LGPL only, so they cannot be part of 
Apache.
However, distributions can still make them the default icons. That's good 
enough :)

Greetings,
-- 
Javier Llorente


signature.asc
Description: This is a digitally signed message part.


Re: svn commit: r937055 - in /httpd/httpd/trunk/docs/manual/mod: mod_ratelimit.html.en mod_ratelimit.xml

2010-04-22 Thread Jeff Trawick
On Thu, Apr 22, 2010 at 4:51 PM,  rbo...@apache.org wrote:
 Author: rbowen
 Date: Thu Apr 22 20:51:56 2010
 New Revision: 937055

 URL: http://svn.apache.org/viewvc?rev=937055view=rev
 Log:
 Working example configuration, thanks to Paul.

 Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_ratelimit.html.en
    httpd/httpd/trunk/docs/manual/mod/mod_ratelimit.xml

 Modified: httpd/httpd/trunk/docs/manual/mod/mod_ratelimit.xml
 URL: 
 http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_ratelimit.xml?rev=937055r1=937054r2=937055view=diff
 ==
 --- httpd/httpd/trunk/docs/manual/mod/mod_ratelimit.xml (original)
 +++ httpd/httpd/trunk/docs/manual/mod/mod_ratelimit.xml Thu Apr 22 20:51:56 
 2010

 -example
 +exampletitleExample Configufation/title

Configuwation would have been more cute.


Re: Issuing a client side HTTP request from a module

2010-04-22 Thread Some Guy
Wow that looks pretty straightforward.  Can this be issued from the parent?

SB

On Thu, Apr 22, 2010 at 4:21 PM, alin vasile alinachegal...@yahoo.comwrote:

 check the thread Doing a subrequest with ap_run_sub_req in the same list




 
 From: Some Guy teknos...@gmail.com
 To: modules-...@httpd.apache.org
 Sent: Thu, April 22, 2010 5:14:07 PM
 Subject: Re: Issuing a client side HTTP request from a module

 I don't really need keepalive.  Just a really basic http request.  However,
 this would be in a non request handler thread, so I'll have no initial
 request_rec to create a subrequest from.  It would also be in the parent
 process via a monitor hook.  I see the mod_proxy create_worker and
 initialize_worker, but the latter call requires a server_rec, which I won't
 have.

 SB

 On Thu, Apr 22, 2010 at 3:48 AM, Nick Kew n...@apache.org wrote:

 
  On 22 Apr 2010, at 08:25, Sorin Manolache wrote:
 
   As Nick says, the common solution are subrequests. However, note that
   subrequests are not kept alive.
 
  Backend connections may be kept alive or closed, as detailed in
  the mod_proxy docs!
 
  If you want to implement keepalive without mod_proxy, that's a lot
  of wheel to reinvent.
 
  --
  Nick Kew
 







HTTP trailers?

2010-04-22 Thread Mark Nottingham
I couldn't find any obvious way to set HTTP trailers in Apache 2.x without 
taking over all response processing (a la nph).

Did I miss something?

Cheers,

--
Mark Nottingham http://www.mnot.net/



Re: HTTP trailers?

2010-04-22 Thread Sander Temme
Mark, 

On Apr 22, 2010, at 5:40 PM, Mark Nottingham wrote:

 I couldn't find any obvious way to set HTTP trailers in Apache 2.x without 
 taking over all response processing (a la nph).

Stupid question: what is an HTTP trailer?  Is this in the context of Chunked 
transfer-encoding? 

S.

-- 
Sander Temme
scte...@apache.org
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF





Re: HTTP trailers?

2010-04-22 Thread Brian J. France

On Apr 22, 2010, at 8:40 PM, Mark Nottingham wrote:
 I couldn't find any obvious way to set HTTP trailers in Apache 2.x without 
 taking over all response processing (a la nph).
 
 Did I miss something?


I started hacking on this at work, but got the point where I can't insert a 
filter in the right spot.

The problem I ran into is that if the Content-Length header is set (which 
ap_content_length_filter_handle sets), then the chunking filter doesn't kick 
in.  Something about wanting to use sendfile so don't chunk.

I can't get a filter inserted after ap_content_length_filter_handle, but before 
ap_http_header_filter (which adds the chunking filter).

My plan was to insert a filter that removes the Content-Length header so the 
response will be chunked and add another filter after the chunking filter that 
would search for ASCII_ZERO ASCII_CRLF ASCII_CRLF and insert the trailer data 
before the last ASCII_CRLF.  This was just a proof of concept to see if it 
would work and output data in the right format.

If it all worked my plan was add a trailers hook and call the hook in 
chunk_filter.c in place of the /* trailers */ comment.

Brian

After typing this up and working through it again, I think I can add a filter 
AP_FTYPE_TRANSCODE+1 for the after chunking filter and AP_FTYPE_PROTOCOL+1 and 
get them to be in the right order.  Will test that out now.



Re: HTTP trailers?

2010-04-22 Thread Mark Nottingham
Yes; see
  http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1

Cheers,


On 23/04/2010, at 11:44 AM, Sander Temme wrote:

 Mark, 
 
 On Apr 22, 2010, at 5:40 PM, Mark Nottingham wrote:
 
 I couldn't find any obvious way to set HTTP trailers in Apache 2.x without 
 taking over all response processing (a la nph).
 
 Stupid question: what is an HTTP trailer?  Is this in the context of Chunked 
 transfer-encoding? 
 
 S.
 
 -- 
 Sander Temme
 scte...@apache.org
 PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF
 
 
 


--
Mark Nottingham http://www.mnot.net/