Re: Why is r-handler a garbled string?
Hi, I've solved the problem, though I may not exactly understand how. It was an issue with the way I was building the module, which was fixed once I added in the flags I got from apr-config --cppflags. (I used to rant that the mostly-undocumented design change to apxs in apache 2.0 was one of the many obstacles in maintaining this multi- source-file C++ module for both apache 1.3 and apache 2. But apr- config actually makes up for it). So I think my module had a struct alignment issue which was somehow fixed by something in -DSOLARIS2=11 -D_POSIX_PTHREAD_SEMANTICS - D_REENTRANT -mt -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64. But when I build my own apache 2.2.9 with debugging symbols (configure --with-included-apr --enable-maintainer-mode), I can't reproduce the problem. NIICE! Does this package ship with build/config.nice? What are the contents of that file? That should tell you how the package was built. Yes, in fact the package does contain config.nice, which begins: CC=/opt/SUNWspro/bin/cc; export CC CFLAGS=-xO3 -xarch=386 -xchip=pentium -xspace -Xa -xildoff - xc99=all -DSSL_EXPERIMENTAL -DSSL_ENGINE -xO4; export CFLAGS Those flags alone don't do the trick for me, but the ones from apr- config make it all work. JD
Re: Why is r-handler a garbled string?
You may be looking at something getting clobbered, and somehow that manifests itself on OpenSolaris but not on the other platform(s). Perhaps that has to do with the way data structures are aligned, endianness (are you on Sparc or Intel?) etc. Perhaps set some breakpoints and see if the handler field is ever intact and where it gets clobbered. In the SUNWapch22 package on OpenSolaris 2008.11, httpd 2.2.9 is stripped, so I can't do much with the debugger. But when I build my own apache 2.2.9 with debugging symbols (configure --with-included-apr --enable-maintainer-mode), I can't reproduce the problem. (And I think I have seen this same problem on amd64 Ubuntu, but I still need to confirm that...) JD
Why is r-handler a garbled string?
Hi, I have a module that runs correctly on some platforms (e.g. Apache 2.2.8 on Mac OS X 10.5) but not on others (e.g. Apache 2.2.9 on OpenSolaris). The problem revolves around the handler name check in a handler: if(strcmp(r-handler,my_name)) return DECLINED; On the problem machine, the name check fails and the handler never runs. In the log from the good platform, I see this: [Mon Dec 29 20:39:13 2008] [debug] handlers.cc(46): r-handler is ndb- cluster But on the bad platform I see this instead: [Mon Dec 29 20:46:25 2008] [debug] handlers.cc(46): r-handler is P \xfa\b\x0c Does anyone have any idea how I might start to unravel this? Thanks, JD
Re: Why is r-handler a garbled string?
On Dec 29, 2008, at 9:20 PM, Sander Temme wrote: On Dec 29, 2008, at 9:06 PM, John David Duncan wrote: I have a module that runs correctly on some platforms (e.g. Apache 2.2.8 on Mac OS X 10.5) but not on others (e.g. Apache 2.2.9 on OpenSolaris). .. [Mon Dec 29 20:46:25 2008] [debug] handlers.cc(46): r-handler is P \xfa\b\x0c Interesting. What's your locale? echo $LANG in the shell that starts Apache? It's en_US.UTF-8 on both of those machines. I also just tried starting apache on the Solaris machine with LANG unset, but that didn't make a difference. JD
Re: mysql auth module
Hi Seth, I'm glad to help out with particular questions on either side -- mysql or apache. JD On Feb 7, 2008, at 6:20 AM, Joe Lewis wrote: Seth Cherney wrote: OK, I signed onto this list about 4 months ago, and have never seen anything remotely close to my low level of skill posed as a Q on the list. I have been trying to rewrite a mysql login module to include more fields to check / update. Certain parts are quite easy, but, basically I could never finish since I understand nothing of controling memory use etc, and would probably wind up with mem bloat from ... How about posting the questions? We can try to walk you through things. I had a mod_sam which included about three different tables for authentication (checking a hosts table to see if they were allowed, checking the password, and also any restrictions, all from MySQL), so the resources are available to assist. (I would do this because the more people that understand a module, the easier it is for them to troubleshoot should they encounter a problem.) Joe -- Joseph Lewis http://sharktooth.org/ Divide the fire, and you will sooner put it out. - Publius Syrus
Re: reference out of date?
Hi, It's a very useful book, even though it predates apache 2. You will need to supplement it (with a few articles on converting modules from apache 1.3 to apache 2, and with the doxygen pages for apache 2 and apr, or with Nick Kew's new book), but I still find it to be an indespensible reference to the Apache API. JD On Mar 27, 2007, at 1:04 PM, Sam Carleton wrote: Many moons ago, around 2001 I believe, I purchased the book Writing Apache Modules with Perl and C by Lincoln Stein and Doug MacEachern. I have not dug it up yet, but I am guessing that it was written for Apache 1.x. For my needs, handling basic requests, will it be out of date? Sam
Per-server config issue
Hi, I am seeing a very strange issue with per-server config processing. Consider a config directive: { ServerThing, (CMD_HAND_TYPE) config_server_thing, NULL, RSRC_CONF, TAKE1, For Testing } I have a struct to hold the per-server configuration (struct srv). An instance of struct srv gets allocated and initialized by an init function, and then when Apache sees ServerThing foo in httpd.conf, it calls config_server_thing: const char *config_server_thing(cmd_parms *cmd, void *m, char *arg) { } So far, so good. But here's the problem: In this function, I should be able to cast the pointer, m, back to the struct srv that was initialized earlier. srv_conf = (struct srv *) m; But after lots of debugging, I find that: 1) The pointer m is not equal to the pointer that was returned from the initialization function. 2) m does not hold a copy of the data structure that was initialized. 3) And m is also not equal to the value of ap_get_module_config(cmd-server-module_config, my_module) Finally, as a work-around, I decided to use: srv_conf = (struct srv *) ap_get_module_config(cmd-server- module_config, my_module); instead of: srv_conf = (struct srv *) m; So, what's the problem? Well... * It's not a merge problem. (I implemented a merging function just in case, but that never gets called). * It's not the vhost issue described on pg. 574 of Writing Apache Modules with Perl and C where your init function might never get called (the init function *is* called, and there are no virtual hosts at all in this config file) * It's not a bug with one particular release of Apache -- I see the same behavior in both 1.3.33 and 2.2.3. * I can't find any obvious problem with my code (all of my per- directory config stuff works perfectly). So, I wonder: is my work-around safe? Should I file a bug? Is there someone in particular I should ask for help? Thanks, JD
apxs
Hi, I have a C++ module. In Apache 1.3, I can't actually build the module with apxs (because it's C++), but I can query apxs to get the compile and link flags: apxs -q LD_SHLIB apxs -q CFLAGS_SHLIB apxs -q LDFLAGS_SHLIB None of this works in Apache 2, and either the change to apxs is poorly documented or I just haven't found the right place to look for the documentation. Can anyone point me to something? (Nick Kew, if your book was in the stores yet, I'd buy it.) JD