Re: apche rewrite and reverse proxy help

2012-10-14 Thread Ben Noordhuis
On Sun, Oct 14, 2012 at 1:12 AM, Abdel wrote: > I have back end website running on Tomcat with the following url > http://local.domain.com/app. External user access the website through apache > proxy with the following url http://www.domain.com/user1 (user1, user2, > etc... It’s uri specific to ea

Re: RPC over HTTP

2012-10-03 Thread Ben Noordhuis
On Wed, Oct 3, 2012 at 2:06 PM, Evgeny Shvidky wrote: > Hi, > > ap_setup_client_block() returns OK. > > I think the problem is that "Content-Length" header value is 1073741824 (1 > GB) and probably apache tries to receive the whole content before it passed > to my module. > Am I right? > If yes,

Re: RPC over HTTP

2012-10-03 Thread Ben Noordhuis
On Wed, Oct 3, 2012 at 11:57 AM, Evgeny Shvidky wrote: > Hi, > > I am developing a new module on C. > One of the requirements of my module is to receive and handle RPC over HTTP > protocol. > RPC over HTTP opens two HTTP/1.1 requests: > One with request method RPC_IN_DATA to send data to the serv

Re: aprmemcache question

2012-09-27 Thread Ben Noordhuis
On Thu, Sep 27, 2012 at 4:29 PM, Joshua Marantz wrote: > Thanks Ben, > > That might be an interesting hack to try, although I wonder whether some of > our friends running mod_pagespeed on FreeBSD might run into trouble with > it. I did confirm that my prefork build has APR built with > APR_HAS_TH

Re: aprmemcache question

2012-09-27 Thread Ben Noordhuis
On Thu, Sep 27, 2012 at 4:05 AM, Joshua Marantz wrote: > RE "failing the build of my module" -- the dominant usage is via > precompiled binaries we supply. Is there an apr query for determining > whether apr was compiled with threads I could do on startup? I don't think there's an official way b

Re: Input filters that alter content-length

2012-09-25 Thread Ben Noordhuis
On Tue, Sep 25, 2012 at 2:51 PM, Ivan Prostran wrote: > Do you suggest chunked transfer encoding? Yep. There's nary a proxy problem you can't solve with chunked encoding.

Re: Input filters that alter content-length

2012-09-25 Thread Ben Noordhuis
On Tue, Sep 25, 2012 at 1:15 PM, Ivan Prostran wrote: > Hi, > > I have the following scenario : > > - Apache/2.2.19 (Solaris 10 SPARC) > > SetInputFilter alterxmlbody (AP_FTYPE_RESOURCE) > SetHandler weblogic-handler > > > The handler forwards requests to multiple weblogic servers > and

Re: Bucket brigade & filter thread safety

2012-09-11 Thread Ben Noordhuis
On Mon, Sep 10, 2012 at 3:53 PM, Alex Bligh wrote: > Ben, > > >> No, but the documentation omits some crucial details. >> apr_pool_create() is thread-safe only if: >> >> 1. libapr is compiled with APR_HAS_THREADS >> 2. APR_POOL_DEBUG is turned off >> 3. the parent pool has a thread-safe allocator

Re: Bucket brigade & filter thread safety

2012-09-10 Thread Ben Noordhuis
On Mon, Sep 10, 2012 at 10:47 AM, Alex Bligh wrote: > Ben, > > Thanks for your reply. > > >>> I am suffering from very occasional corruption of the bucket brigade >>> which normally shows up as a corrupted pool pointer or a bogus bucket >>> entry in thread #1 (for instance a SEGV in apr_brigade_le

Re: Bucket brigade & filter thread safety

2012-09-09 Thread Ben Noordhuis
On Sun, Sep 9, 2012 at 2:31 PM, Alex Bligh wrote: > I am trying to work out how to develop a thread-safe module with two > threads, one thread reading and one thread writing. I'm using mpm-prefork > on apache 2.2.14-5ubuntu8.9 in case that matters. The module is a websocket > proxy. > > My main th

Re: problem with ap_md5 in custom module

2012-08-15 Thread Ben Noordhuis
On Wed, Aug 15, 2012 at 5:13 PM, nik600 wrote: > Dear all > > i'm having a problem with ap_md5, i just want to write a custom module > that compute che md5 checksum of the requested url and give it back to > the user. > > This is my code: > *

Re: setting proxypass value

2012-08-15 Thread Ben Noordhuis
On Wed, Aug 15, 2012 at 10:11 AM, Ian B wrote: > I have a module that retrieves virtualhost config from LDAP backend > (mod_vhost_ldap by Ondrej Sury). It works well however I'd like to extend it > to also get and set a ProxyPass / ProxyPassMatch value for each virtualhost. > > Reading the value f

Re: Anyone have some example code doing simple HTTP GET request from within a module?

2012-06-22 Thread Ben Noordhuis
On Sat, Jun 23, 2012 at 4:47 AM, wrote: > Per earlier threads on this list, I've been working on an Apache module.  For > the time being, I'm kind of stuck because of the problems that I've run into > with trying to integrate my module with a 3rd party library, so just for my > module, which i

Re: UNSOLVED was Re: SOLVED was Re: How to compiling/link/use Apache module that uses shared library?

2012-06-21 Thread Ben Noordhuis
On Fri, Jun 22, 2012 at 3:32 AM, wrote: > Program received signal SIGSEGV, Segmentation fault. > 0x003518d6c1e1 in BN_num_bits () from /lib64/libcrypto.so.4 > > So, it's actually blowing up in "BN_num_bits()" in /lib64/libcrypto.so.4? Type `bt full` and you'll get a backtrace + locals. That

Re: How to compiling/link/use Apache module that uses shared library?

2012-06-21 Thread Ben Noordhuis
On Thu, Jun 21, 2012 at 8:43 PM, wrote: > I tried that, which allowed me to start Apache, but am getting a segfault. Run it through gdb and inspect the backtrace. Compiling with debug symbols and optimizations disabled (-g -O0) will help.

Re: Best (safest) way to edit char string (from envvars)?

2012-06-20 Thread Ben Noordhuis
On Wed, Jun 20, 2012 at 4:35 PM, wrote: > Hi, > > I am working on a module, and I get one of the SSL envvars, SSL_CLIENT_CERT, > using apr_table_get() into a const char *. > > The client cert char string returned has the extra beginning line (-BEGIN > CERTIFICATE-) and ending line (

Re: How to access client certificate PEM and incoming request headers in a module?

2012-06-18 Thread Ben Noordhuis
On Mon, Jun 18, 2012 at 8:53 AM, wrote: > I added a call to header_request_env_var(r, "REMOTE_URI"), just to see what > it got (running Apache in single-process mode): > > printf("REMOTE_URI=[%s]\n", header_request_env_var(r, "REMOTE_URI") ); > > Then I pointed a browser to http:///test, where /

Re: How to access client certificate PEM and incoming request headers in a module?

2012-06-17 Thread Ben Noordhuis
On Mon, Jun 18, 2012 at 5:45 AM, wrote: > I haven't actually tried your suggestion yet, but, re. the SSL variables, I > was looking at mod_headers.c, and in there, there are two separate functions: > > static const char *header_request_env_var(request_rec *r, char *a) > { >    const char *s = ap

Re: How to access client certificate PEM and incoming request headers in a module?

2012-06-17 Thread Ben Noordhuis
On Sun, Jun 17, 2012 at 9:46 PM, wrote: > Hi, > > I am starting to look into implementing an Apache module that can use > information from an incoming request, including several headers and the > subject string from a client certificate to do authentication. > > I've been looking at the source

Re: Get the directory of the module

2012-06-11 Thread Ben Noordhuis
On Mon, Jun 11, 2012 at 10:10 PM, Bart Wiegmans wrote: > Hello everybody, > > For a project I'm doing, I need to install a few bytecode files > alongside my module. I was planning on placing them in the modules > directory but I realised that at runtime I do not know where that is. > What is more,

Re: Change Request-Header before mod_rewrite

2012-06-04 Thread Ben Noordhuis
On Mon, Jun 4, 2012 at 10:53 PM, Marc apocalypse17 wrote: > Hi all, > > I just developed my first apache module following the tutorial on the apache > website. The module is responsible for adding one header value to the active > request which must be checked in a mod_rewrite ReWriteCondition. >

Re: mod_ssl ignores connection->aborted & eos_sent

2012-03-07 Thread Ben Noordhuis
On Tue, Mar 6, 2012 at 13:27, Daniil A Megrabjan wrote: > Anyway, as far as I understood I'm not allowed to change the default > behavior of mod_ssl. In this case there is the other question -  how to > register my hook to be really before  mod_ssl? and even if request has > been received on 443 T

Re: mod_ssl ignores connection->aborted & eos_sent

2012-03-05 Thread Ben Noordhuis
On Mon, Mar 5, 2012 at 22:34, Daniil A Megrabjan wrote: > Hello, > > I'm writing a module which serves a special URL. > In cases when URL-string matches the special pattern my module sends the > connection(SCM_RIGHTS) between HTTP client and Apache to another process. > Furthermore, Apache child

Re: thread ID

2012-03-01 Thread Ben Noordhuis
On Thu, Mar 1, 2012 at 17:29, wrote: > Hello, > > I would need a memory buffer associated per worker thread (in the worker > MPM) or to each process (in the prefork MPM). > > In order to do that, I would need a map thread<->buffer. So, I would > need a sort of thread ID/key/handle that stays the

Re: Performance Evaluation of a Module

2012-02-08 Thread Ben Noordhuis
On Wed, Feb 8, 2012 at 14:01, Oğuzhan TOPGÜL wrote: > Hi all, > I have developed an apache module and i want to evaluate the performance of > my module. > I want to see how my module increases the load. I want to measure the > effect of my module on processor and memory. > I decided to set an eval

Re: Developing Authn/Authz Modules

2011-10-01 Thread Ben Noordhuis
On Sat, Oct 1, 2011 at 23:05, Suneet Shah wrote: > Hello, > > I am trying to build my apache module which needs to carry out > authentication and authorization functions based on the value of a cookie. > To start with, I have just created a shell with the intent that I wanted the > functions for a

Re: cross-process and cross-thread file locking

2011-09-29 Thread Ben Noordhuis
On Thu, Sep 29, 2011 at 16:54, thomas bonfort wrote: > Hi all, sorry in advance if this is a dumb question. > > The apr documentation for apr_file_lock states "Locks are established > on a per-thread/process basis; a second lock by the same thread will > not block." but this is not the behavior I

Re: Infinite data stream from a non-HTTPD external process via HTTPD

2011-09-20 Thread Ben Noordhuis
On Tue, Sep 20, 2011 at 11:13, Henrik Strand wrote: > I would like to send an infinite data stream from a non-HTTPD external > process via HTTPD to the client connection. Both HTTP and HTTPS must be > supported. What kind of external process are we talking here? Something that prints to stdout, l

Re: Question about malloc / realloc in module

2011-09-14 Thread Ben Noordhuis
On Wed, Sep 14, 2011 at 14:01, Christoph Gröver wrote: > In a module I have to allocate and reallocate a chunk of memory. > Because (AFAIK) Apache or its libraries do not support reallocation > I use the standard functions malloc/realloc (and free), of course. Don't do that. Use apr_palloc() and

Re: po

2011-09-01 Thread Ben Noordhuis
On Thu, Sep 1, 2011 at 13:52, Joshua Marantz wrote: > Hi, > > I've been load-testing our module > (mod_pagespeed) > with httpd 2.2.16 built with these options: >     --enable-pool-debug --with-mpm=worker > I've been getting periodic aborts

Re: mutex permission denied

2011-08-17 Thread Ben Noordhuis
On Wed, Aug 17, 2011 at 15:20, Jason Funk wrote: > I am trying to implement an apr proc mutex in my module. When I created the > mutex with APR_LOCK_DEFAULT the mutex is successfully created but I am > getting "Permission Denied" when I try to acquire the lock. I ran > "apr_proc_mutex_defname" to

Re: mod_proxy and modified headers in filters.

2011-08-08 Thread Ben Noordhuis
On Mon, Aug 8, 2011 at 10:29, Zaid Amireh wrote: > I'm writing a module for Apache 2.2 that changes the content and thus needs > to set a new C-L header, all is working perfectly for static files and > content generated from content handlers (PHP & Ruby Passenger Phusion), an > issue arose when

Re: Sharing information between threads and processes.

2011-07-21 Thread Ben Noordhuis
On Thu, Jul 21, 2011 at 13:25, Zaid Amireh wrote: > On Jul 21, 2011, at 1:53 PM, Nick Kew wrote: >> How near do the socache modules come to meeting your needs? > > mod_disk_cache would unfortunately make my code pretty complex and maybe slow > as I'm not caching documents but rather tokens and st

Re: creating reverse proxy workers dynamically

2011-07-07 Thread Ben Noordhuis
On Thu, Jul 7, 2011 at 07:19, Jodi Bosa wrote: > It seems I may need to create HTTPS reverse proxy workers DYNAMICALLY - what > is best way to do this? > > In other words, from manual I see config directive: > >    ProxyPass /example http://backend.example.com connectiontimeout=5 > timeout=30 > >

Re: illegal instruction 4

2011-07-07 Thread Ben Noordhuis
On Thu, Jul 7, 2011 at 16:33, MK wrote: > I have a mod_perl based module running a service on an openVZ slice. > It was working fine for a few weeks, but when I went to use it today I > get delivered an empty page and in the apache error.log: > > child exit signal Illegal instruction (4) > > Which

Re: proxying another protocol to http/https

2011-07-07 Thread Ben Noordhuis
On Thu, Jul 7, 2011 at 02:56, Jodi Bosa wrote: > I would like to leverage mod_proxy and mod_proxy_http to proxy client > requests (from another protocol). > Assuming I have input & output filters that handle the other protocol with > the client, shouldn't I simply be able to: > > > Handler > { >  

Re: Module External Configuration

2011-06-21 Thread Ben Noordhuis
On Tue, Jun 21, 2011 at 23:26, Jason Funk wrote: > One last question about shared memory... > > I have my configuration now being loaded successfully into a shared memory > segment.. now my problem is that someone could change the config so that the > resulting structure wouldn't fit in the shared

Re: Socket transfer from Apache httpd to a non-httpd process

2011-06-16 Thread Ben Noordhuis
On Thu, Jun 16, 2011 at 10:32, Henrik Strand wrote: > I've tried writing data to the socket directly after my non-httpd daemon > process receives the socket descriptor and this results in that the > client receives this data. However, very shortly afterwards the > connections is closed and I'm not

Re: Vary:User-Agent, best practices, and making the web faster.

2011-06-06 Thread Ben Noordhuis
On Sun, Jun 5, 2011 at 21:37, Joshua Marantz wrote: > Does Magento actually vary the content of CSS & JS based on user-agent?  Or > does it only vary the content of HTML? I don't know. I'm by no means a Magento expert, I only run into it from time to time. That site I broke? That was in the summe

Re: Add a variable on http header

2011-06-06 Thread Ben Noordhuis
On Mon, Jun 6, 2011 at 14:15, Maurizio Totti wrote: > I would try to set an http header variable "on the fly" but without success > :-( > I write this simple module to test the functionality > > http://pastebin.com/b8hcZTtb > > I don't understand my error, someone can help me? - Is your module s

Re: Vary:User-Agent, best practices, and making the web faster.

2011-06-05 Thread Ben Noordhuis
On Sun, Jun 5, 2011 at 13:42, Joshua Marantz wrote: > This is a case where the content varies based on user-agent.  The > recommendation on the mod_deflate doc page is add vary:user-agent for any > non-image.  Can you think of a case where the absence of a vary:user-agent > header causes broken be

Re: Vary:User-Agent, best practices, and making the web faster.

2011-06-05 Thread Ben Noordhuis
On Sun, Jun 5, 2011 at 02:15, Joshua Marantz wrote: > On Sat, Jun 4, 2011 at 7:58 PM, Ben Noordhuis wrote: >> Some popular OSS packages depend on Vary: User-Agent to make >> downstream proxies (reverse or forward) do the right thing. > > I'm pretty interested in deconst

Re: Vary:User-Agent, best practices, and making the web faster.

2011-06-04 Thread Ben Noordhuis
On Sun, Jun 5, 2011 at 00:34, Joshua Marantz wrote: > It was with some reluctance that I brought this up.  It occurs to me that > this idea propagates the sort of spec violations that led to this issue > (inappropriate user of Vary:User-Agent) in the first place.   However, I'm > trying to figure

Re: Vary:User-Agent, best practices, and making the web faster.

2011-06-04 Thread Ben Noordhuis
On Sat, Jun 4, 2011 at 21:26, Joshua Marantz wrote: > I think what we'd do is basically let mod_pagespeed ignore "Vary:User-Agent" > if we saw that it was inserted per this exact pattern.  This would, to be This seems like a stupendously bad idea. Warn about it in your docs, complain about it in

Re: mod_gnutls and mod_proxy (TLS termination)

2011-05-04 Thread Ben Noordhuis
On Wed, May 4, 2011 at 17:50, Hardy Griech wrote: > Sorry, my fault.  I focused on ssl_proxy_enable() which is not called in my > case.  ssl_engine_disable() does the job. > > So my problem is hopefully solved. > > Disadvantage of this solution is, that mod_ssl and mod_gnutls cannot be > loaded si

Re: mod_gnutls and mod_proxy (TLS termination)

2011-05-03 Thread Ben Noordhuis
On Tue, May 3, 2011 at 21:10, Hardy Griech wrote: > On 03.05.2011 00:13, Ben Noordhuis wrote: >> >> On Mon, May 2, 2011 at 20:51, Hardy Griech  wrote: >>> >>> Now my concern is, how can I reliably catch the condition that the >>> connection has been i

Re: mod_gnutls and mod_proxy (TLS termination)

2011-05-02 Thread Ben Noordhuis
On Mon, May 2, 2011 at 20:51, Hardy Griech wrote: > Now my concern is, how can I reliably catch the condition that the > connection has been initiated by mod_proxy.  Any ideas? r->proxyreq != PROXYREQ_NONE? Does 'initiated' mean 'request from an external reverse proxy' or 'request handled by mod_

Re: mod_gnutls and mod_proxy (TLS termination)

2011-04-29 Thread Ben Noordhuis
> - mod_ssl (openssl?) does not obey the maximum fragmentation > length requested by the clients I think that this has been fixed in openssl 1.0.0.a. Monkey curiosity: why do you need it? > - install 'apache2-dbg' > - enter gdb with the above command line > - run (in gdb) > - break gdb when the

Re: mod_gnutls and mod_proxy (TLS termination)

2011-04-29 Thread Ben Noordhuis
On Fri, Apr 29, 2011 at 10:27, Hardy Griech wrote: > I'm trying to use mod_gnutls for TLS termination without success. My first suggestion would be to use mod_ssl. Alternatively, compile Apache and mod_gnutls with -g -O0 and run it with `gdb --args httpd -X -e debug`. Put a breakpoint on the pre

Re: KeepAlive -- why is it off by default?

2011-04-11 Thread Ben Noordhuis
On Tue, Apr 12, 2011 at 02:18, Joshua Marantz wrote: > What are the reasons someone might wish to turn KeepAlive off?  The only one > I can think of is in single-process mode (httpd -X) it can be a drag to > refresh a page with lots of resources; but this seems like a secondary issue > that could

Re: Changing request method

2011-04-04 Thread Ben Noordhuis
On Tue, Apr 5, 2011 at 00:10, Jason Cwik wrote: > I'm trying to write a module that will improve REST compatibility with Flex > & JS by implementing support for X-Http-Method-Override to change the > request method when only GET/POST are the only methods supported from the > client. > > I've read

Re: module interaction

2011-03-26 Thread Ben Noordhuis
On Sun, Mar 27, 2011 at 00:23, Simone Caruso wrote: > I think provider or apr_optional are what i'm looking for, > i read mod_authnz_ldap for a provider sample and mod_ldap for apr_optional, > maybe i have understood the logic, but... i don't understand the difference > between these two approache

Re: module interaction

2011-03-26 Thread Ben Noordhuis
On Sat, Mar 26, 2011 at 16:09, Brian McQueen wrote: > If you want to share functions then put them into a library and they > will be shared in the usual way like normal c functions. If you want > to pass data between modules there are are notes and environment. This. And there is also the provide

Re: how to parse html content in handler

2011-03-24 Thread Ben Noordhuis
On Thu, Mar 24, 2011 at 13:10, Whut  Jia wrote: > Hi,all > I want to parse a html content and withdraw some element in myself apache > handler.Please ask how to do it. > Thanks, > Jia Hey, have a look at how mod_proxy_html[1] does it. [1] http://apache.webthing.com/mod_proxy_html/

Re: ordering output filters

2011-03-14 Thread Ben Noordhuis
On Mon, Mar 14, 2011 at 16:54, Joshua Marantz wrote: > Even in the absence of 'remove_comments', it would be preferable to have > mod_pagespeed run after mod_includes so that it has an opportunity to > optimize the included text.  The user can achieve this by putting this line > into his config fi

Re: Saving the original request URI ahead of a mod_rewrite

2011-03-13 Thread Ben Noordhuis
On Sun, Mar 13, 2011 at 13:15, Eric Covener wrote: > r->main doesn't change on an internal redirect AFAICT. You're right. And there is ap_internal_fast_redirect() that works different still. The only thing I can think of that should work for all three is to follow r->main until it's NULL, then fo

Re: Saving the original request URI ahead of a mod_rewrite

2011-03-12 Thread Ben Noordhuis
On Sun, Mar 13, 2011 at 04:02, Eric Covener wrote: > OP specifically mentions "internal redirect" and rewrite-in-htaccess. Hah, the moment I fired off that email I thought "oh wait, mod_rewrite *does* do an internal redirect somewhere". Internal redirects share a pool so your suggestion would wo

Re: POST body in request_rec

2011-03-12 Thread Ben Noordhuis
Hi Jodi, On Sun, Mar 13, 2011 at 01:29, Jodi Bosa wrote: > how do I access the BODY contents for a POST request? You need to register an input filter for that. > Also, r->method shows "POST" and apr_table_get(r->headers_in, > "Content-Length") returns 300 bytes, but yet r->clength says 0. r->c

Re: Saving the original request URI ahead of a mod_rewrite

2011-03-12 Thread Ben Noordhuis
On Sun, Mar 13, 2011 at 02:48, Eric Covener wrote: >> So I like #1 best.  Any other opinions or ideas? > > I solved a similar problem recently by using apr_pool_userdata_set on > r->pool which you can still find after the internal redirects of > rewrite in htaccess / with PT flag. What Joshua is

Re: APR global mutexes

2011-03-08 Thread Ben Noordhuis
2011/3/9 Massimo Manghi : > the subject might suggest the message is an off-topic > for the list. Technically it is, d...@apr.apache.org would have been a better place for it. > To put it simple my question is: can every module in APR be used > also to build standalone applications? More specific

Re: Converting a 16-bit string to 8-bit?

2011-03-05 Thread Ben Noordhuis
On Sat, Mar 5, 2011 at 02:11, Adelle Hartley wrote: > Thanks for the feedback.  Is there any documentation for the apr_xlate > functions? My pleasure, Adelle. Documentation: I don't think so save for the source itself[1]. [1] https://github.com/apache/apr/blob/trunk/xlate/xlate.c

Re: Converting a 16-bit string to 8-bit?

2011-03-04 Thread Ben Noordhuis
On Fri, Mar 4, 2011 at 02:24, Adelle Hartley wrote: > This is a helper class I wrote for the module I'm working on.  It assumes > the native wide encoding is UTF-32.  To make it cross platform, you'd have > to check what the correct wide encoding is. > > This is my first apache module, so any corr

Re: Converting a 16-bit string to 8-bit?

2011-03-03 Thread Ben Noordhuis
On Thu, Mar 3, 2011 at 17:12, Sam Carleton wrote: > I am looking at using a 3rd party library that only operates on 16-bit > strings.  Is there a built in functions to convert the strings back to > 8-bit?  I am currenly on Windows and Windows has built in functions I could > use, I would prefer to

Re: Help with apr mutex

2011-03-01 Thread Ben Noordhuis
On Tue, Mar 1, 2011 at 17:32, Joshua Marantz wrote: > Is there any design doc or examples on how these can be used to, say, > construct > a server-wide cache that can be accessed from any of the child processes in > (say) prefork mode? I don't know of any design documents or tutorials but as to

Re: Help with apr mutex

2011-02-28 Thread Ben Noordhuis
On Mon, Feb 28, 2011 at 18:26, Simone Caruso wrote: > I wrote a simple cache inside my module with apr_shm and apr_rmm Simone, have a look at ap_socache.h and ap_slotmem.h, they're two simple cache facilities that were added in 2.3.0. Might save you some work. :)

Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Ben Noordhuis
On Fri, Feb 11, 2011 at 14:11, Zeno Davatz wrote: >> Apache on Windows serves all requests from a single process. > > Apache on Linux does not do that? Nope. The worker and event MPMs are hybrids: serving requests from many processes, where each process has many threads. And if all processes are

Re: mod_ruby on Apache for Windows 2.2.17

2011-02-11 Thread Ben Noordhuis
On Fri, Feb 11, 2011 at 08:25, Zeno Davatz wrote: > I am trying to debug mod_ruby to load in Apache for Windows. So far > Apache for Windows does start with mod_ruby.so but it seems that httpd > does not start correctly with mod_ruby enabled in Apache for Windows. I don't have a solution for you

Re: Filter to modify request headers

2011-01-25 Thread Ben Noordhuis
On Tue, Jan 25, 2011 at 23:22, Jodi Bosa wrote: > What would be a good early hook to modify request headers that is _AFTER_ > mod_ssl is finished decrypting request? > > When I do a ap_add_input_filter() from a ap_hook_insert_filter() seems to > trigger really late (e.g. after quick_handler, post_

Re: Re: How to send a jpeg-file in Handler

2011-01-19 Thread Ben Noordhuis
2011/1/19 Whut Jia : > Can I don't use sub-request?? > I want only a single picture to client;Just like the same as sending a text : > r->content_type="text/html"; > ap_rputs("helloworld",r); > return OK; Not sure what you mean. If it's a single static image, convert it to a C byte array and send

Re: How to send a jpeg-file in Handler

2011-01-19 Thread Ben Noordhuis
2011/1/19 Whut Jia : > I want to return a local jpeg-file to client when client request url is > /image/metto .In handler module ,I should how to write?? ap_sub_req_lookup_uri() or ap_sub_req_lookup_file()?

Re: module configuration kill

2011-01-12 Thread Ben Noordhuis
On Wed, Jan 12, 2011 at 22:56, Peter Janovsky wrote: > that is definitely of use.  thank you.  where would i call > apr_pool_register_cleanup?  originally i thought it would be in register_hooks >From your child_init hook. Register it with ap_hook_child_init() from your register_hooks function.

Re: mod_sflow

2011-01-09 Thread Ben Noordhuis
On Sat, Jan 8, 2011 at 00:06, Neil McKee wrote: > This module is designed to work in both "prefork" and "worker" models.  I > would really > appreciate it if someone could review the design to make sure I made > appropriate choices > about where to use pipes, shared-memory, mutex locking,  and s

Re: Help trying to figure out why an output_filter is not called.

2011-01-05 Thread Ben Noordhuis
On Wed, Jan 5, 2011 at 22:03, Joshua Marantz wrote: > Right you are.  That's much simpler then.  Thanks! My pleasure, Joshua. Two quick questions, hope you don't mind: Is mod_pagespeed an official Google project? Or is it something you guys do on your day off? And are there plans for a nginx por

Re: Help trying to figure out why an output_filter is not called.

2011-01-05 Thread Ben Noordhuis
On Wed, Jan 5, 2011 at 20:40, Joshua Marantz wrote: > So if I try to remove the 'expires' filter from my handler (which runs > early) then mod_expires will have a handler that runs later that inserts it > after my module has completed. No, it's the other way around. mod_expires uses the insert_fi

Re: Help trying to figure out why an output_filter is not called.

2011-01-05 Thread Ben Noordhuis
On Wed, Jan 5, 2011 at 15:54, Joshua Marantz wrote: > Can you elaborate?   Is this a common practice, to write bytes directly to > the network from an output filter?  What should I look for?  The owner of Not common but sometimes you can't avoid it (search the mailing list, there are a few exampl

Re: Help trying to figure out why an output_filter is not called.

2011-01-05 Thread Ben Noordhuis
On Wed, Jan 5, 2011 at 14:45, Joshua Marantz wrote: > other filter be somehow finding our filter and killing it?  Or sending the > bytes directly to the network before our filter has a chance to run? Possibly, yes. By the way, why the complex setup? If you don't want the mod_headers filter to ru

Re: Overriding mod_rewrite from another module

2011-01-03 Thread Ben Noordhuis
On Mon, Jan 3, 2011 at 23:19, Joshua Marantz wrote: > My goal is not to remove authentication from the server; only from messing > with my module's rewritten resource.  The above statement is just observing > that, while it's possible to shunt off mod_rewrite by returning OK from an > upstream han

Re: Overriding mod_rewrite from another module

2011-01-01 Thread Ben Noordhuis
On Sat, Jan 1, 2011 at 00:16, Joshua Marantz wrote: > Thanks for the quick response and the promising idea for a hack.  Looking at > mod_rewrite.c this does indeed look a lot more surgical, if, perhaps, > fragile, as mod_rewrite.c doesn't expose that string-constant in any formal > interface (even

Re: Overriding mod_rewrite from another module

2010-12-31 Thread Ben Noordhuis
On Fri, Dec 31, 2010 at 18:17, Joshua Marantz wrote: > Is there a better way to solve the original problem: preventing mod_rewrite > from corrupting mod_pagespeed's resources? >From memory and from a quick peek at mod_rewrite.c: in your translate_name hook, set a "mod_rewrite_rewritten" note in r

Re: Re: compile a file written by C++ into apache

2010-11-30 Thread Ben Noordhuis
2010/11/30 whut_jia : > In Apache2.2, I compile a c++ source file with g++ as below: > g++ -fPIC -shared -o mod_validate.so mod_validate.cpp -I/usr/include/httpd > -I/usr/include/apr-1 -I/opt/opensaml/include > After it , I copy mod_calidate.so into apache module location ,and this > module work

Re: compile a file written by C++ into apache

2010-11-30 Thread Ben Noordhuis
2010/11/30 whut_jia : > I write a module by C++ supporting the generation of SAML assertion, so in my >  module I called the OpenSAML Library.The question is how I compile this > source file written by c++ language into my apache server. Like you compile any mixed project: define a function in y

Re: Can i send multi-request(with Range:bytes=start-lenth) on a single connection?

2010-11-23 Thread Ben Noordhuis
2010/11/24 zhoubug : > Can i send multi-request(with Range:bytes=start-lenth) on a single > connection? > i want to reuse a connection with keep-alive,and send second request > after receive > the first response,but the apache response with 501 error? > what should i do if i want reuse the connecti

Re: Shared memory ?

2010-11-15 Thread Ben Noordhuis
On Mon, Nov 15, 2010 at 17:12, Rémy Sanchez wrote: > I'm coding a module to somehow replace/complement mod_security (it's more a > proof of concept than a real project for now). The first thing that I'd like > to have is a DNSBL, so that detected intruders are instantly banned when > added to the

Re: ownership & mmaped files - I have to be missing something...

2010-11-11 Thread Ben Noordhuis
On Thu, Nov 11, 2010 at 08:28, Mike Meyer wrote: > Is there a hook that runs after config in the parent, but as the > unprivileged id that I should be using? I couldn't find one (either in There isn't one, setuid() is called right before the child_init hook. Having said that, can't you open() th

Re: Determining if a bucket is created by

2010-10-29 Thread Ben Noordhuis
On Sat, Oct 30, 2010 at 00:24, Travis Bassetti wrote: > #include directive via mod_include.    Is there a way to tell when a bucket is > created via #include?   I want to exclude processing the bucket if it was > created by the #echo directive.    I can't tell if there is a difference in > the >

Re: How to init an mmaped file?

2010-10-25 Thread Ben Noordhuis
Mike, is your code available anywhere?

Re: How to access client socket from a protocol handler

2010-10-24 Thread Ben Noordhuis
On Sun, Oct 24, 2010 at 11:09, Alexander Farber wrote: > So for content handlers the convention is > to use "SetHandler XXX" in httpd.conf and > then at the runtime they check for that string with > > if (!r->handler || (strcmp(r->handler, "XXX") != 0)) { >    return DECLINED; > } > > But for prot

Re: How to access client socket from a protocol handler

2010-10-23 Thread Ben Noordhuis
On Sun, Oct 24, 2010 at 00:00, Alexander Farber wrote: > I've created a module using bb (the source code at the bottom) > and it suffers from the same problem (hijacks the port 80 too). > Could it be that "SetHandler" is a wrong directive for protocol handler? The wrong directive, yes. SetHandler

Re: How to access client socket from a protocol handler

2010-10-23 Thread Ben Noordhuis
Alexander, take a look at mod_echo.c (included in the source tarball). It's a great example of how a protocol handler should work and it just might convince you to use bucket brigades after all. :) You need to check if your handler is enabled for the current vhost. If it's not, return DECLINED. If

Re: How to access client socket from a protocol handler

2010-10-23 Thread Ben Noordhuis
On Sat, Oct 23, 2010 at 10:13, Alexander Farber wrote: > I wonder why my mod_perl module works and the C one not. Your connection handler should return DECLINED for vhosts it doesn't handle (I wager mod_perl did this for you). You can get the vhost with conn->base_server and your module's per-se

Re: How to access client socket from a protocol handler

2010-10-22 Thread Ben Noordhuis
On Sat, Oct 23, 2010 at 00:15, Alexander Farber wrote: > Should I maybe try > apr_socket_t *socket = conn->cs->desc->s > or something similar instead? Probably not, the conn_config solution is most portable across Apache versions. > And what do you mean by &core_module > in my case (source code

Re: How to access client socket from a protocol handler

2010-10-22 Thread Ben Noordhuis
On Sat, Oct 23, 2010 at 00:01, Mike Meyer wrote: > I use that to get the socket so I can poll for it to have data in it, > and do other things while I'm waiting. Is there a better alternative > for that, or is this an exception? You could do it through apr_bucket_read(APR_NONBLOCK_READ) but polli

Re: How to access client socket from a protocol handler

2010-10-22 Thread Ben Noordhuis
On Fri, Oct 22, 2010 at 23:08, Alexander Farber wrote: > Unfortunately there aren't many example for the protocol handlers > on the web or in Nick's book. I've come up with the following, > but don't know how to get the client socket via conn_rec? apr_socket_t *client = ap_get_module_config(conn

Re: How do I get hold of session information?

2010-10-20 Thread Ben Noordhuis
Most people hack on Apache in their own time and nobody likes writing documentation so yes, what documentation there is, is often sparse. "Use the source, Luke" is the best advice I can give you.

Re: How do I get hold of session information?

2010-10-19 Thread Ben Noordhuis
On Tue, Oct 19, 2010 at 17:30, Paul Donaldson wrote: > Thank you. I will take a look at mod_session. Will my module be able to check > if > mod_session is "enabled" (sorry, I don't know the Apache terminology) and, if > it > is, talk to it and ask it for what it has stored in its session? Yes.

Re: How do I get hold of session information?

2010-10-19 Thread Ben Noordhuis
On Tue, Oct 19, 2010 at 17:05, Paul Donaldson wrote: > I assume that if I were to make a request to a web site hosted on Apache then > the capability exists for one of the server side web pages to create a session > and store some piece of data in it. What I want to do in my module is get hold > o

Re: Memory Pool

2010-10-12 Thread Ben Noordhuis
Martin, if you are working in a constrained environment, then you are probably better off using something like libmicrohttpd[1] or libevent's evhttp interface[2]. Apache has a rather heavy resource footprint. [1] http://www.gnu.org/software/libmicrohttpd/ [2] http://monkey.org/~provos/libevent/dox

Re: Memory Pool

2010-10-11 Thread Ben Noordhuis
On Mon, Oct 11, 2010 at 16:40, Martin Townsend wrote: > use, or should I set a flag and then use a hook like fix-ups that will check > this flag and then call  apr_pool_clear()? This. You can use a request note for a flag.

Re: Memory Pool

2010-10-11 Thread Ben Noordhuis
On Mon, Oct 11, 2010 at 16:14, Martin Townsend wrote: > I have created a pool from the child pool for storing warning messages that > can live across requests, the final request will insert the warnings into > the response.  How do I ensure that this pool is cleared at the end of the > final reque

Re: New module for anonymous ip logging

2010-10-06 Thread Ben Noordhuis
On Wed, Oct 6, 2010 at 09:35, Franz Schwartau wrote: > But how exactly can I "abort"? If NULL is returned from log_ip_hash() a > '-' is printed for the % directive from mod_log_iphash only. Return HTTP_INTERNAL_SERVER_ERROR from your post_config hook. Or anything but OK or DECLINED, really.

  1   2   >