Re: How to fail in case of an error

2013-06-20 Thread Tom Evans
On Wed, Jun 19, 2013 at 1:10 PM,  markus.k...@nokia.com wrote:
 Hi,

 what is the recommended way for a module to fail the start of Apache, if the 
 module cannot be started (e.g. due to a configuration problem)?


It depends. If you know it has failed in a directive configuration
handler, you can return a char* with an error message. httpd will
print out the error message and exit.

If you only know after parsing all the directives, and trying to
combine them in module_init, you can simply exit(3). At this point,
httpd is performing the initial parsing of httpd.conf, when httpd is
running as a single process and thread.

Cheers

Tom


Re: URL decoding in Apache module

2013-06-14 Thread Tom Evans
On Fri, Jun 14, 2013 at 9:01 AM, Sindhi Sindhi sindhi@gmail.com wrote:
 Hi,

 I have a C++ filter module written for Apache.

 I see that all URL's sent to Apache server are encoded. Does Apache already
 do the URL decoding and store it somewhere in the request_rec structure OR
 the filter module should explicitly do a URL decoding?

 If the filter should do the URL decoding then could you please suggest if
 there are any Apache APR API calls I can make to to the decoding?

 Thanks a lot.

http://ci.apache.org/projects/httpd/trunk/doxygen/structrequest__rec.html#a778f7883e201095a1d914ab7422635eb

Cheers

Tom


Re: some key fields of request_rec are null

2013-03-13 Thread Tom Evans
On Tue, Mar 12, 2013 at 8:04 PM, Nce Rt nce...@yahoo.com wrote:
 here is one of the past emails:
 On Wed, Mar 6, 2013 at 4:21 PM, Nce Rt nce...@yahoo.com wrote:


 A custom handler which is registered to run APR_HOOK_FIRST has these fields 
 null when processing http request:
  r-content_type, r-parsed_uri.scheme


 instead of being a moronic moaner, make some common-sensical assumptions if 
 you really know what you're talking about.


There are many different handler phases, all of which you can set your
module to APR_HOOK_FIRST into. You haven't said if this is a content
handler, a fixup handler, etc. If you hook in to post_read_request,
then duh, most of the fields on request_rec are not populated.

But you know all that already, I'm just a moronic moaner, so I'll
leave you to your anger. I'm sure insulting people will eventually
lead you to the correct method.


Re: some key fields of request_rec are null

2013-03-12 Thread Tom Evans
On Mon, Mar 11, 2013 at 7:47 PM, Nce Rt nce...@yahoo.com wrote:
 that's what is null I've been talking about past 2 weeks!!


You still haven't confirmed what handler you are running in. Certain
parts of the request_rec are populated by different handler stages, if
your handler is running before they run, then (surprise!) those parts
of the config won't be filled in.

You've been asked several times what handler your code is running in,
providing context and/or code would be better than just moaning.

Cheers

Tom


Re: How to test if request has been aborted

2011-07-28 Thread Tom Evans
On Thu, Jul 28, 2011 at 7:26 AM, Tony Abo t...@hitech.com wrote:
 I am working on a custom request handler that works with Apache 2.x. There 
 are times that the request may take a considerable amount of time to process. 
 I need to cut the processing short if the user decides to press the stop 
 button on the browser. I cant seem to figure out how to test for that 
 condition from inside the handler. Can anyone help me?

 Thanks in advance,
 Tony

r-connection-aborted

Cheers

Tom


Re: How do I debug a module ?

2009-07-24 Thread Tom Evans
On Fri, 2009-07-24 at 03:00 -0700, ricardo13 wrote:
 hi,
 
 The GDB session is very large.
 
trim valid debug
 
 My module calls mod_teste !!!
 
 Thank you
 Ricardo
 
 
 

So whats the problem? It seems to be working fine. Your breakpoint is on
ap_process_request, and you single step through it, successfully.

If you want to debug your module, set a breakpoint in your module. 

Cheers

Tom



RE: Dynamicly insert 'require' into request

2009-07-22 Thread Tom Evans
On Wed, 2009-07-22 at 10:43 +0100, Ben Davies wrote:
 Okay, so upon further inspection, it appears that there may not be an
 equivalent function for mod_perls set_handlers().
 
 This leads me to a problem: how do I turn off a hook, especially, as the
 check_user() hook expects the r-user property to contain the username,
 meaning that the sending of a 403 happens before the check_user() hook is
 called. Whatever it is I need to do, I need to do in the access() hook.
 
 I was hoping it might be something as simple as removing my require entry
 from the require array. Has anyone had any experience with this? If so,
 could you comment on techniques?
 
 Cheers,
 
 Ben
 

One solution would be to set a note for your hook in an earlier stage,
and then return DECLINED from your handler when you detect that note.

There may be a better way :)

Cheers

Tom



RE: mod_deflate feature needed

2009-07-16 Thread Tom Evans
On Thu, 2009-07-16 at 10:20 -0600, Anthony J. Biacco wrote:
 We're not violating the specs, we're following them. The HTTP spec
 states that you should send out a content-length header with the correct
 trasnfer length, and mod_deflate in this case is not doing that.
 
 -Tony

No it doesn't; it says that 'Applications SHOULD use this field to
indicate the transfer-length of the message-body, unless this is
prohibited by the rules in section 4.4'

Rule 2 of section 4.4 clearly indicates that you must not set it if you
are transferring data using the chunked transfer encoding (in fact, any
transfer encoding other than 'identity').

It is sub optimal in most use cases to buffer the entire response and
gzip encode it, so mod_deflate does the sane thing and so transfers it
in chunks.

Cheers

Tom



Re: Module that forward requests

2009-07-14 Thread Tom Evans
On Tue, 2009-07-14 at 03:22 -0700, ricardo13 wrote:
 Hi,
 
 Yesterday, I studied mod_rewrite very much and I believe that
 fully_qualify_uri() function is where mod_rewrite does proxy.
 
 That's right ?? This is way ??
 
 Other question, I copied fully_qualify_uri() function, but when print value
 r-filename give error:
 For example, in code:
 
 r-filename = apr_psprintf(r-pool, %s://%s%s%s%s, http, ip_machine,
 port_machine, r-filename);
 
 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,MEU_MODULE PROXY:
 %s, r-filename);
 
 In error_log shows:
 MEU_MODULE PROXY:
 http://ip_machine:port_machine(null)\x18#W\xb7[$\x07\bHl\xef\t\xd4m\xef\t\xdcm\xef\t\x04\n\xef\t
 
 What's this ?
 
 Thank you.
 Ricardo
 

It's called C. Character arrays are null terminated, and if they are
not, things that print it tend to keep printing random bits of memory
until they happen to hit a null byte. 

Cheers

Tom