e your own input filter module.
That is, if I've understood you aright?
--
Nick Kew
t in what you attached.
Also I'd consider hooking it earlier in the request cycle, or into mod_proxy
instead. How does mod_proxy_fcgi fit your vision?
--
Nick Kew
your
module will continue to work with (at least) future 2.4.x
releases. That give you C or any language with C linkage.
If you deviate from the API, you're on your own.
Alternatives that (broadly speaking) wrap the C API are also
possible: see for example mod_perl and mod_lua.
--
Nick Kew
.
It is, however, as task that's been done in open source
code you can look at, or perhaps use instead of reinventing
their wheel. Either Ironbee or mod_security will scan a
request body for you.
> btw, Nick I bought your book - it was a great help :)
Thanks :)
--
Nick Kew
>> } while (!end && (status == APR_SUCCESS));
>> if (status == APR_SUCCESS) {
>> return DECLINED;
>> } else {
>> return HTTP_INTERNAL_SERVER_ERROR;
>> }
>> }
Minor tip there: you're turning EAGAIN into a fatal error.
--
Nick Kew
is a problem (perhaps due to a bug outside your control),
issue a blocking call to your own upstream and don't return
anything until you have data (or EOS).
Or if I were working around a bug in closed source, I might
try inserting a placeholder such as an empty data bucket.
--
Nick Kew
solve such cases with requests?
Well, I should start by figuring out where and why that's happening.
On the server side, gdb works as fallback tool for that if you have
no better ideas.
If, once you've figured out, you're happy that it's not a symptom
of some deeper bug, you just leave a "been here" breadcrumb.
--
Nick Kew
that'll
in turn run something ahead of mod_ssl getting in to a connection.
Not sure if that actually leads anywhere useful. Just a thought,
if you haven't already tried it. Your main problem is that you
have a hack that shoehorns vhosts in where they don't belong.
--
Nick Kew
esign? Say, a
bucket that serves data from a static file by seek/read,
just to see how it behaves in different configurations
and whether you can make the architecture work for you?
--
Nick Kew
erated file for the benefit
of future byterange requests.
--
Nick Kew
o process it - becomes hopelessly inefficient for large requests.
There's some discussion of the issue in the mod_proxy docs,
as mod_proxy has an option to support HTTP/1.0 backends that
need an explicit Content-Length.
--
Nick Kew
esting in
new development, consider:
- Could you hook your notification into regular piped logging?
- Would regular logging through an API like syslog or spread
serve (there are third-party modules for those).
- Would a security-oriented tool like Ironbee be complete overkill?
--
Nick Kew
clean. So, a few questions:
I don't know a clean answer: it's not a problem I've ever tackled.
But if you don't find a better solution, you can improve a little
on your existing one by running your child_init after other modules
have done theirs with APR_HOOK_LAST.
--
Nick Kew
calling "ap_send_error_response(f->r,HTTP_SERVICE_UNAVAILABLE)"
That would have to go through the filter chain.
Filters are supposed to be about your data. They can in limited
circumstances change metadata (e.g. set a 503), but you'd need
at least to set r->status before the first call to f->next.
--
Nick Kew
request isn't
a file, and has no file descriptor.
If your library is designed to be usable in non-file applications,
it'll offer some mechanism for plugging in your own I/O functions.
If not, you could perhaps try some ugly hack: create some bucket of
file-compatible type for it to write to.
--
Nick Kew
all the
right paths and linkage. Check apxs in the docs.
--
Nick Kew
On Fri, 2014-05-23 at 10:27 -0700, Jeremy Thompson wrote:
> I'm trying to write a module for apache. I've successfully compile in a
> test module that doesn't do a whole lot yet. I would like to be able to use
> tcp/ip sockets in the module to talk to another server.
This may or may not make sen
aintainability.
Either run the update per-process or use shared memory.
In the latter case, use apache's (and apr's) mechanisms
for shared memory and timed monitoring to avoid introducing
new complexity.
--
Nick Kew
es apr_reslist
to maintain a pool of database connections shared across threads.
Your task looks quite similar to that!
--
Nick Kew
h per-request data.
Modules that do such things usually create their own pool (as a child of
the process pool) which they can then maintain privately.
--
Nick Kew
On Thu, 2013-09-05 at 09:20 +, markus.k...@here.com wrote:
> Hi,
>
> I am developing a module which must do some clean-up work, when httpd is
> stopped.
Register a cleanup on the process pool.
If you need that explained, see
http://www.apachetutor.org/dev/pools
--
Nick Kew
ing it dealt with quickly may
be if you also supply a patch, but make sure to address the security
concerns hinted at in the comments if you do that.
You'd also want to move any further discussion to the dev list.
--
Nick Kew
ng curve as you to hack it.
Your startingpoint would probably be APR's network_io module.
If you're thinking HTTP-over-SCTP (if indeed that makes any sense)
then that may be most of what you need to do. If not, or if you want
to do everything as a module, you could start by looking at protocol
modules like mod_ftp or mod_smtp.
--
Nick Kew
e client?
> I tried to find out with "LogLevel debug".
> But this actually leads to nearly no extra lines in the log files.
My usual tool in that situation is gdb.
--
Nick Kew
On 11 May 2013, at 07:35, Sindhi Sindhi wrote:
>
> Could you please advice?
Did you check the answer in the FAQ?
--
Nick Kew
n there another filter could change
all that - e.g. mod_deflate if the data arrive compressed.
Bottom line: don't make assumptions, as there are no guarantees.
You can of course look at existing filters that do similar things
to yours. Or even read about it in my book :-)
--
Nick Kew
libmod_xyzi.so
(could be standard/platform C++ libs such as libstdc++ / libg++).
Use your system tools (likely ldd and nm) to find the
dependencies, an load them before your lib.
--
Nick Kew
t yet loaded. Perhaps file a bug against APR?
> #6 0x7f599b1e4e8b in connect_database (db_pool=0x21c2138,
>error_messages=0x7f599a7c7000, dbd_config=dbd_config@entry=0x2273940)
>at database/dbd.c:35
Would it not make sense for your module to use mod_dbd to manage
a database connection pool?
--
Nick Kew
On 5 Feb 2013, at 02:29, chary wrote:
> I'm writing a mod for apache, and I need some help.
>
> how to do something in a mod when apache is shutting down?
>
> What kind of hooks could be used?
Register your function as a cleanup on the process pool.
--
Nick Kew
).
You can check the return status from the output filter chain.
If there's an error, check for closed connection. You can
do that in a handler or an output filter.
--
Nick Kew
to something
simple like CGI or PHP.
--
Nick Kew
tor.org/
and the new programmer docs at httpd.apache.org.
--
Nick Kew
x it?
My recollection of the problem is from several years ago (I think it
first hit me updating from 2.0 to 2.2), and I have no actual recollection
of what fixed it. My reply to you was based on a quick look at the
code in question, which uses the extern "C" { ... } and works!
--
Nick Kew
On 24 Jul 2012, at 18:23, Cantor, Scott wrote:
> I'm still investigating, just wondering if anybody has seen this.
Yes. It's not new: C++ doesn't like those macros.
Simple fix is to enclose them in extern "C" { ... }.
Alternatively, expand them by hand as per C rules.
--
Nick Kew
ing a
subrequest or internal redirect in a way that doesn't work with 2.0.
--
Nick Kew
e as needing a mutable string.
Can your call be modified to accept a non-null-terminated
pointer together with a length? You would of course determine
those by parsing rather than copying the original.
--
Nick Kew
riginal design envisaged,
I wonder if your issue might be a hint that we should
revisit the API for programmatic configuration, and make
your proposal less hackish?
--
Nick Kew
oblem.
Whoops! That's no longer true since AddOutputFilterByType moved
to mod_filter. Where do the docs still say that?
--
Nick Kew
as handler, that's their
business.
If your module wants to take control of a request then it can
set its own handler (or unset the handler to get the default).
But then it needs to document that it breaks normal configuration!
--
Nick Kew
as handler, that's their
business.
If your module wants to take control of a request then it can
set its own handler (or unset the handler to get the default).
But then it needs to document that it breaks normal configuration!
--
Nick Kew
onstructs, and serves to make your life very easy in the
context of a module!
--
Nick Kew
not the slightest hint how to actually do this, also googling for
> some time didn't get me anything useful either.
You register your own functions for relevant parts of expression parsing.
To get started, I suggest you read the extensive comments in the header
file include/ap_expr.h.
--
Nick Kew
Well, not unless you hack deep in APR to allocate from shm.
But you can achieve a shared hash using mod_socache.
--
Nick Kew
On Sun, 4 Mar 2012 10:19:53 -0800 (PST)
Swaminathan Bhaskar wrote:
>
> Hello,
>
> How can I call another url from an output filter
The easy way is to use a subrequest. "Include Virtual"
from mod_includes is an example.
--
Nick Kew
whose codes is basically the same.
Any subrequests or internal redirects involved? Look carefully at the
request object itself.
Or tyops?
--
Nick Kew
or inclusion upstream?
The other answer is, the easy way is to use apr_reslist, which is what
mod_dbd does.
--
Nick Kew
far as it goes.
2. But would be much more generalisable if it were configurable on/off.
This would remove the issue of running order which you tackled with
APR_HOOK_FIRST.
3. "Be conservative in what you send". The last line of your
robots.txt is unterminated!
--
Nick Kew
some extension to the HTTP
protocol. Maybe there's some such application- or ptotocol-
oriented filter in your chain?
--
Nick Kew
he distro: for example, mod_deflate and mod_sed
offer input filters. mod_security and mod_ironbee are third-party
examples.
I could also recommend the book: see http://www.apachetutor.org/
--
Nick Kew
enting non-http.
--
Nick Kew
socache modules.
I used the latter for mod_authn_socache, which is a simple example.
--
Nick Kew
use higher-level abstractions for shared memory. Older modules
had to work much harder to do the same thing, so looking at them may not
be your best approach.
--
Nick Kew
ctxt->tmpbb);// <-- new code
> apr_sleep(1); // <-- new code
Could that be triggering a timeout?
--
Nick Kew
also submit
another request via #include virtual.
--
Nick Kew
On 16 Oct 2011, at 00:14, Jodi Bosa wrote:
> Is there a module that can record requests+responses before and after other
> filters have been invoked?
You mean like mod_diagnostics?
--
Nick Kew
part of it. There are various workarounds,
with setuid CGI (and variants on that) the most common.
But take a look at mod_privileges, which would enable you
to do what you want on Solaris. You might be able to
hook into selinux to do something similar.
--
Nick Kew
e problem.
This looks reminiscent of
https://issues.apache.org/bugzilla/show_bug.cgi?id=17629
a bug that lurked a long time before being fixed!
I suggest you read that - particularly comment 30 and later,
and see if it sheds any light on your problem.
--
Nick Kew
ew all that: there's always room for more
ways to do a job. But it wasn't clear from your post!
--
Nick Kew
ter the malloc/realloc. See mod_proxy_html
for an example.
--
Nick Kew
details from my
> database.
Are you sure you need a new module? mod_rewrite can set headers for you,
and RewriteMap can get them from a database.
If you are writing a new module, you could look at how that works.
Also, be sure to check out mod_dbd for how to access SQL databases
more generally.
--
Nick Kew
rected from nabble.com.
--
Nick Kew
rected from nabble.com.
--
Nick Kew
a website that appropriates our list and misleads (some) users.
> Sent from the Apache HTTP Server - Module Writers mailing list archive at
> Nabble.com.
But that looks clear enough to me. Is the website so two-faced as to be
unclear about that,
or do you struggle with English?
--
Nick Kew
e confident, you might want to re-write the
parser as a filter, so it can process your data format not just from
a static file but also from a dynamic or proxied source.
--
Nick Kew
http://marc.info/?l=apache-modules&m=113977658131259
>
> In it, Nick gives a pointer to look at the util_ldap source.
That's old!
These days we have two shared memory frameworks: slotmem and socache.
I'd look there first, rather than duplicate older code.
--
Nick Kew
post_config hook: you can
access every vhost with care, or set up something server-wide.
--
Nick Kew
rong configuration hierarchy for the job at hand.
If not, then the fix might be as simple as a merge_config function.
There's a very brief (and ancient) piece at
http://www.apachetutor.org/dev/config
In the book there's a whole chapter, which is both substantially expanded and
updated from that.
--
Nick Kew
That error message is your module failing a test that it was compiled
against the correct API version and is therefore compatible with
the server that's loading it.
--
Nick Kew
uld be fine, compiled against the right (2.2.x) headers.
--
Nick Kew
not compatible with this version of Apache
> (found 0, need 20051115). Please contact the vendor for the correct
> version.
Guessing in the dark
You declare the module with
module AP_MODULE_DECLARE_DATA proxy_fdpass_module;
But you don't instantiate it. The macro commonly used in trunk
doesn't exist in 2.2.
--
Nick Kew
g your needs?
--
Nick Kew
Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html
nfiguration
may depend on the outcome of earlier phases (and in general WILL depend
on at least the configuration walk).
--
Nick Kew
Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html
the internal redirect.
I'm guessing this problematic filter is one that doesn't pass its
(modified) input through to its output? In which case, it should
take responsibility for reading its input through to EOS and for
returning EOS to its caller. If you fix that and still have the
problem, please describe in detail!
--
Nick Kew
Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html
less overhead than apr_atomic or ...
> If this has all been done before, please can you point me to the relevant
> module sources? I think it would save me a lot of time. Alternatively, if
> you think I should just relax and use an atomic increment instead, then let
> me know.
Wh
ke a processing hook can
when it determines the outcome of a request.
The only way you can affect a response status is to return an
error to your caller before passing anything down the chain.
--
Nick Kew
Available for work, contract or permanent.
http://www.webthing.com/~nick/cv.html
mod_xml2.
JSP 1 was an SSI-like language. It would be a little more
work, but mod_includes would be a good startingpoint.
--
Nick Kew
Available for work, contract or permanent.
http://www.webthing.com/~nick/cv.html
uot;INCLUDES", NULL, r,
> r->connection);
Why not an insert_filter hook?
That would be the right place to go, but then be sure to document exactly
how it works and what other modules will be auto-configured.
--
Nick Kew
Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html
adn't crossed my mind to try that with apxs (adjust by hand where
necessary). But in principle, Good Idea! Patches welcome!
Sorry, no new suggestions beyond wrowe's reply or "do it by hand".
--
Nick Kew
Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html
t, you'd need an external library.
You might not need to do anything at all:
(1) You could send data out in 16-bit encoding if you send it with
an appropriate charset parameter in the Content-type header.
(2) If (1) is not an option, an existing module like mod_charset
might be suitable to do
really late (e.g. after quick_handler, post_read, etc...).
Don't.
Use a header_parser hook to manipulate your request headers.
Or if you need to catch them early, a post_read_request.
--
Nick Kew
Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html
rs_out to be preserved when an errordoc is sent for non-2xx
> response.
>
Won't make any difference to someone trying to set a request header in a
response.
--
Nick Kew
Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html
On Wed, 12 Jan 2011 11:24:36 -0800 (PST)
Peter Janovsky wrote:
> is it possible to hook into an event fired when the workers are shutdown,
Any cleanup registered on the child pool will run when the child quits,
if that's any use to you.
--
Nick Kew
Available for work, contract or p
On Wed, 12 Jan 2011 14:49:53 -0500
Victor Ronin wrote:
> Hi,
>
> I need to write a module, which does something at the beginning and at
> the end of each connection.
Register a cleanup on the connection pool.
--
Nick Kew
Available for work, contract or permanent.
http://www.
ing
from a virgin state.
--
Nick Kew
Available for work, contract or permanent.
http://www.webthing.com/~nick/cv.html
it's removed.
Does mod_diagnostics tell you anything if you run it at the same level
as yours?
--
Nick Kew
On Mon, 15 Nov 2010 17:12:01 +0100
Rémy Sanchez wrote:
> [chop]
Since you're at an experimental stage, there's no reason
not to work with trunk/2.3 versions. So use the mod_socache
framework, which is provided for precisely this kind of thing!
--
Nick Kew
stion. post_config and child_init get passed
the first server_rec. The server_rec in any later hook is the
virtual host. Could your problem be setting data in one server
then trying to retrieve it from another?
--
Nick Kew
pen for requests with
> keep-alive true. That somehow sounds like someting I've encoutered
> before but I can't recall when or where :-/ Any ideas what's going on?
Are you clearing all the input once you've consumed it?
--
Nick Kew
eared
> at the end of the final request?
That doesn't really make sense. What is "the final request"?
If it's requests in a connection, use the connection pool.
Otherwise, you're looking at a time-based solution such
as garbage collection.
--
Nick Kew
reconstruct HTTP requests from the bytestream.
That could be done outside apache.
--
Nick Kew
But note that it still relies on configuration: if you really want to
force it, you would also have to undo any other filter configuration.
--
Nick Kew
Who manages this list these days? Can someone remove this
bouncing address? This is the third bounce I've had,
and I expect everyone posting here is getting them.
--
Nick Kew
Begin forwarded message:
Date: Fri, 24 Sep 2010 16:05:17 GMT
From: postmas...@sprint.blackberry.net
filters are optional then by all means leave it to the sysop
and recommend using mod_filter in your documentation.
--
Nick Kew
o another web server at an
> arbitrary URL?
Yes of course you can!
You can run a subrequest that'll use mod_proxy. Or you can use your choice
of HTTP client code.
--
Nick Kew
a meaningful Connection-Request
correspondence in your app, use the connection's configuration
record to pass information to/from the request(s).
--
Nick Kew
handler
from
a C module (such as mod_cgi or mod_perl) to run your script.
Chapter 5 of my book takes you through writing a response handler, from
Hello World through to all you need to switch a CGI script to a module.
http://www.apachetutor.org/
--
Nick Kew
On 10 Jun 2010, at 07:34, Eddy wrote:
> How modify (decrypt data) the body content before all module ?
That's what filters do.
See mod_ssl for secure encryption. Or in your case since it's only the
body content, see for example mod_deflate for a comparable task.
--
Nick Kew
;d also point you at mod_vhost_dbd as an
example that may be nearer to what you want if your needs are
sufficiently complex to demand a new module.
--
Nick Kew
27;d like to get a simpler
> model to follow.
Maybe mod_rewrite will do all you need anyway!
The simplest example to look at in the apache code would be
mod_alias. Otherwise, the end of Chapter 6 of the modules
book[1] leads you through developing a mapper module.
[1] http://www.apachetutor.org/
--
Nick Kew
ess 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
1 - 100 of 245 matches
Mail list logo