how to best implement my own connection pool
I am working on a short term solution to a bigger issue. The long term solution is switch databases, that is next on the list, after I patch the current DB. My background: I am the sole developer of this product that uses lots of technologies, one of them is Apache Modules. It has been a long while, likes a year+ since I have had to do anything really hard core, so I am not 100% up to speed with terms and exact techniques. My ultimate goal in this post is to get some definition/direction as to know were to start on this short term solution. I am currently using the DB, SQLite. It is a great and outstanding DB, except... It is File Locking database, when one thread/process writes to it, the whole DB is locked. This is all fine and dandy, except there is one query (not an update/insert/delete) that is pretty intensive and runs a LOT, could be as much as 10~20 times a second. The great part is... It is somewhat static, so I would like to create a system to pool the result in memory and refresh it when it needs to be changed. Here is the pseudo code: Process 1 (not Apache) that creates the static file: 1. Create a Lock file: query.results.lock 2. Dump results from query to a text file: query.results 3. Remove Lock file Right now a request comes in via Axis2/C module (a web service). The WS is what needs access to this new piece. I have already done a lot of hacking on the Axis2/C piece so within the WS code, I have access to the core of the Apache request, server, etc. So in the WS, I want to make a call into this connection pooling code to do the following: 1. Check to see if query.results is in memory, if not load it 2. Check to see there is a lock file, if so use the copy in memory for this 'connection' 3. Check to see if the last modified date/time is newer then in memory, if so, load it, else use what is memory Basically what I am looking for is the same basic connection pooling that is implemented in the mod_dbd. Is there an easy way to do this, or will I simple need to get into the internals of the mod_dbd to figure out what it is doing and do it myself. Sam
Converting a 16-bit string to 8-bit?
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 use Apache functions if they exist.
[OT] Apache on Windows, how many processes?
I know in the *nix world that Apache forks different processes and in Windows it is threaded. I was load testing my Windows Apache Module with 50 clients and it never started up a second process, though the thread count did surpass the 50, it went to 53. I am assuming the other three threads where maintenance threads that are not counted in the thread pool. My question is: Will Apache on Windows start up more then one worker process? If so, what does it take to get that to happen?
Re: Finding memory leaks in httpd and httpd modules
On Tue, Feb 16, 2010 at 2:35 PM, Kevac Marko ma...@kevac.org wrote: On Tue, Feb 16, 2010 at 10:12 PM, mcqueenor...@gmail.com wrote: I have done a lot of c module development. I have found the same problem and wound up simply running the module under load while keeping an eye on memory usage. Use the pools. They are great and will keep you safe. Any other use of memory allocation should be very carefully considered. Of course I am using pools, but using pools is not panacea, especially when non request pool is used :-) I am in agreement with mcqueenorama. I have not done a ton of module programming, but what I have done is HEAVILY used by my app and core to the whole thing. My best advise is don't use the pools other then the request pool unless you REALLY need to, even when the module is initializing there is a temp pool which Apache clears after initialization. I did run into a memory leak once that I found by simply checking all the pool usages, it turned out I was using a server pool rather then a request pool. I NEVER use anything other then a pool for memory allocation. The only exception is 3rd party lib's that allocate memory, such as my usage of SQLite, which I am sure allocates lots of memory, but I rely on it to clean up that memory, assuming I manage the resource correctly. To date, all runs well! Sam
Re: What is needed to distribute a Axis/2 Client
opps, wrong mailing list :) On Thu, Dec 10, 2009 at 11:18 PM, Sam Carleton scarle...@miltonstreet.comwrote: I have been using Axis2/C sololy on the server side until now (I had been using Silverlight as the client). I now need to use Axis2/C on the client side but need to know what exactly needs to be in the clients repository. What files are actually needed? Sam
Re: [OT] ajusting apache timeout
Eric, I was stepping through the Axis2/C code on Apache. I found the issue... I was programmatically setting up the binding on the client and had missed the fact that after I set the SendTimeout to 10 minutes, about 15 lines farther down I set it again to 25 seconds. Sam On Sun, Nov 15, 2009 at 8:08 PM, Eric Covener cove...@gmail.com wrote: On Sun, Nov 15, 2009 at 3:44 PM, Sam Carleton scarle...@miltonstreet.com wrote: I am working on a Axis2/C module that is hosted by Apache 2.2. The client is .Net 3.5. I have set the SendTimeout on the .Net binding to 10 minutes but things are still timing out in about 30 seconds. During what? -- Eric Covener cove...@gmail.com
[OT] ajusting apache timeout
I am working on a Axis2/C module that is hosted by Apache 2.2. The client is .Net 3.5. I have set the SendTimeout on the .Net binding to 10 minutes but things are still timing out in about 30 seconds. I am wondering if anyone in this forum has run into timeout problems that where fixed by modifiying Apache's configuration. Sam
do I need a custom proxy?
I do develop Apache Modules which is why I thought to ask this question here... I run a micro ISV out of my home and I only have one external IP address. I need to have some services on Apache and others on IIS. How would I pull this off since I only have one external IP address? My thought is create a custom mod_proxy that will redirect some URL's from the public facing Apache to the internal IIS. Is this the correct approach or is there an approach that does not require actual development? Sam
Re: do I need a custom proxy?
I did not mention that I am only interested in HTTPS, not HTTP. It is my understanding that virtual host's don't work for HTTPS, is this correct? Sorin Manolache wrote: On Tue, Jun 2, 2009 at 14:45, Sam Carleton scarle...@miltonstreet.com wrote: I do develop Apache Modules which is why I thought to ask this question here... I run a micro ISV out of my home and I only have one external IP address. I need to have some services on Apache and others on IIS. How would I pull this off since I only have one external IP address? My thought is create a custom mod_proxy that will redirect some URL's from the public facing Apache to the internal IIS. Is this the correct approach or is there an approach that does not require actual development? Can't you create two virtual hosts or two locations on your apache, one of them handling requests and the other forwarding them to IIS? Something like VirtualHost * ServerName apache.my-domain.org /VirtualHost VirtualHost * ServerName iis.my-domain.org ProxyPass / http://internal-IP-of-IIS-server/ /VirtualHost and you register apache.my-domain.org and iis.my-domain.org as having the same IP address in the authoritative nameserver of my-domain.org. or Location /apache /Location Location /iis ProxyPass http://internal-IP-of-IIS-server/ /Location S
Re: do I need a custom proxy?
Ray Morris wrote: You could of course run one serer on a non standard port. Yes, except that there are many many access points out there that ONLY allow port 80 and 443 out, if I used a different port for one of the servers, than it would be blocked from such places.
error in the auth code?
Ok, my code is quickly getting out of hand. I have a C#.Net WCF app calling a Axis2/C module running on Apache that has custom authentication module. When I set a breakpoint on the my ap_hook_access_checker function to check the path, like a 2 second pause, than remove the breakpoint, the call to the Axis2/C code is just fine. When there is no pause I get an error 400. I looked at things with TCPMon, there is a noticable difference. It looks to me like TCPMon keeps all the like connections in one group. With the breakpoint in place, TCPMon captures two groups: 1: the first request that errors out with 401 because there is no authorization 2: a dozen or more calls with authorization When there is no breakpoint, there is only one grouping with what looks like two calls/responces, a 401 and then the deadly 400. I get the 400 when I remove the breakpoint from the my ap_hook_access_checker and place a breakpoint in my modified version of mod_authn_file.cpp, check_password function. I am going to do some digging, I am just hoping that someone might beat me to the punch :) Sam
Re: error in the auth code? (I think I found the key piece of info)
On Sat, May 2, 2009 at 3:35 PM, Joe Lewis j...@joe-lewis.com wrote: I expect that the client is doing this. Since you are using C#, it will try and make every request under the same connection. With what you have described, it is more than likely a problem with the client trying to run things together. I'd try and force it to HTTP 1.0 (if you can) on the client side. That will force subsequent requests to the same server to create new TCP connections, rather than reusing. If that does work, then it is definitely in the client trying to bleed stuff together and not buffering properly. (That is actually what I expect). Jon, You nailed problem, but not the cause. The cause is... My code is not flushing the input queue when it kicks back the first 401. I need to detect that it is a POST and clean things up. The question is... How do I do that? Sam
Re: error in the auth code? (I think I found the key piece of info)
On Sat, May 2, 2009 at 3:45 PM, Sam Carleton scarle...@gmail.com wrote: The question is... How do I do that? By calling ap_discard_request_body(r) in the correct location!
[OT] Re: Regarding setup modules for server 2.2
Tarun, First off, this forum is for Apache C Module development, not configuration, so you are a bit off topic. The quick and dirty is this: No module is *needed*, Apache can run just fine without any modules. It will be very limited in what it can do and how you can configure it, but it can run just fine. If you don't need cgi or perl, than no you don't need to load the modules. As far as mod_oprocmgr, I don't know what that does for you. You can either do some research and find out what it does and see if that applies to you or you can just see how things work without. If all is well, then you are good. Personally I would do some research. Sam On Thu, Apr 16, 2009 at 11:43 AM, fortanu82 tarun.nar...@xchanging.com wrote: Hi I have to completely replace the Apache 1.3 HTTP server with Apache 2.2. In Apache 1.3 modules like mod_fastcgi, mod_perl and mod_oprocmgr are present. Now I just wanted to confirm two things, 1) If our application does not use any CGI or perl scripts, Is it necessary to have the modules like mod_perl and mod_fastcgi to be present in the sever. 2) mod_oprocmgr is configured in Apache 1.3 and when I am looking to configure the mod_oprocmgr for Apache 2.2, the module (.so) file is not present. Now my question is - Is this module not required in Apache 2.2? If it is required, how could I install and configure this module. Any help will be really appreciated. Thanks Tarun -- View this message in context: http://www.nabble.com/Regarding-setup-modules-for-server-2.2-tp23080654p23080654.html Sent from the Apache HTTP Server - Module Writers mailing list archive at Nabble.com.
Where did apreq.h go/come from?
I just upgraded from Apache 2.2.8 to 2.2.11. My module uses apreq.h, but that is not part of 2.2.11. Is that an extra header I found somewhere or was it removed?
Re: internal redirect (compiling Apache with VS2008)
On Sun, Dec 14, 2008 at 4:03 PM, Sorin Manolache sor...@gmail.com wrote: Well, no thought. What I do when I'm clueless is compiling an apache server with debug symbols (CFLAGS=-g -O0 -fno-inline), configure it, and start it in debug mode (apache2 -f my_conf.conf -X) in a debugger. Then I set a breakpoint on ap_invoke_handler or on other functions in the request processing call-stack, send a HTTP request and run the server step-by-step. It's labour-intensive until you have set up all your environment, but you can reuse it and it helps development and diagnosis significantly. Darn:( I am running my module in a debugger, but I have never figured out how to compile Apache itself on Windows in VS2008, so I am not able to step through the Apache code. Anyone have any tips for compiling Apache 2.2.8 on Windows with VS2008? Sam
Re: internal redirect
On Sun, Dec 14, 2008 at 4:03 PM, Sorin Manolache sor...@gmail.com wrote: Well, no thought. I tried the redirect in a regular browser and got the EXACT same error. Then it dawned on me: Look at the log file. It was an error in the PHP page that was causing the error:) Live and learn, thank you very much for all your help! Sam
Re: internal redirect
On Sun, Dec 14, 2008 at 6:37 AM, Sorin Manolache sor...@gmail.com wrote: I think the 500 was caused by an infinite loop: if (!ap_is_initial_req(r)) return DECLINED; const char *note = apr_table_get(r-notes, my_note); if (note != 0 strcmp(note, should_redirect)) ap_internal_redirect(h, /invalidClient.html); I am with you and I see the loop in my code. I am doing things a little different, I am setting the note to the redirect uri: if (!ap_is_initial_req(r)) return DECLINED; const char * redirection = apr_table_get(r-notes, promenade_redirect); if( redirection) { ap_internal_redirect( redirection, r); return OK; } return DECLINED; The check at the beginning is short circuiting the handler correctly, but I am still getting a status code of 500. Any thought? Sam
Re: understanding apr_strtok()
On Sat, Dec 13, 2008 at 2:35 AM, Saju Pillai saju.pil...@gmail.com wrote: On 13-Dec-08, at 1:02 PM, Mark Harrison wrote: One thing you can check: Make sure that s points to writable memory. Check that s is on the heap not on a function stack. Try apr_pstrdup(p, s) or memcpy(s) into malloc'd memory. Thank you, that was the issue! Sam
Re: internal redirect
On Sat, Dec 13, 2008 at 1:04 PM, Sorin Manolache sor...@gmail.com wrote: 3. Set a request note (apr_table_set(r-notes, my_note, should_redirect)) and then in the handler hook you check the request note. If it is set, ap_internal_redirect(your_url). This is what I want to do, make it 100% transparent to the client. I put my hook handler at the first one and look for the note, if there I call ap_internal_redirect(), but my client is still getting a status code of 500. The page I am trying to redirect to *IS* a PHP page, does that matter? What format should the string in ap_internal_redirect() take, relative to the server or should the http and the server name be part of the string? I want to redirect to: /invalidClient.html Sam
Re: Setting a handler within a configuration directive
On Mon, Nov 24, 2008 at 10:49 AM, William A. Rowe, Jr. [EMAIL PROTECTED] wrote: Sam Carleton wrote: I am a small one man ISV. My software has different versions which have different features. I want to hide the fact that I am setting a handler and authtype in the http.conf so my customer cannot hack the module into providing features in which they did not purchase. Start the server with -f real.conf. Within real.conf, Include httpd.conf Otherwise no, and if you review server_info, these will show up. Consider the POV of other Administrators, you certainly wouldn't want such things hidden from your purview as the admin, right? So there's no such facility Actually, there is no administrator of the web server, it is a packaged solution where I am distributing the pieces of Apache that are needed to run my app and I have a desktop application that creates the httpd.conf and starts the web server. Ultimately I am going for security by way of obfuscation. I know there are better ways and maybe with time I will move that direction, but one step at a time;) I was going to use SSL until I remembered there are export laws to worry about, so being a one man shop, it simply isn't worth it:) Sam
Re: Setting a handler within a configuration directive
On Mon, Nov 24, 2008 at 10:52 AM, Houser, Rick [EMAIL PROTECTED] wrote: Don't things like SSL client auth (pre-HTTP connection) internally show as basic auth? Isn't it just as trivial to make a module that does nothing more than set the auth-type string to basic? A simple contract (real contract, not EULA garbage), should give you far more protection than any of this. Rick, What do you mean by contract? I am coming from a desktop application development background, so there are some basics about web development that I simply don't know;) Sam
Re: Setting a handler within a configuration directive
On Sun, Nov 23, 2008 at 11:00 PM, William A. Rowe, Jr. [EMAIL PROTECTED] wrote: I have posted a number of questions along these lines and never get a response, is this because folks simply don't know the answer? If folks here don't know the answer, where might I go to find the answer? You are looking for someone who owes you an instant answer? There are various companies out there you can pay for that privilege. forgive me, I never meant to come across rude, I was simply perplexed at why after a couple of days nobody had answered. It had not dawned on me that folks might not understand my question;) Otherwise, if you keep the questions civil, and reply to them yourself with further explanation so that folks understand exactly what it is you are asking, you are more likely to get a response, although it may not be as fast as you were hoping. http://www.catb.org/~esr/faqs/smart-questions.html Thank you, the link has some very good ensight, the real trick for me know is not forgetting what I just learned from reading it. I will try to make it a point to refer back to it from time to time. Sam Carleton wrote: Is there any way to *hide* configuration? I would like to set a handler within a configuration directive. Can it be done? Perhaps you can explain what you are asking? I am a small one man ISV. My software has different versions which have different features. I want to hide the fact that I am setting a handler and authtype in the http.conf so my customer cannot hack the module into providing features in which they did not purchase. Sam
Re: Setting a handler within a configuration directive
On Mon, Nov 24, 2008 at 11:56 AM, Houser, Rick [EMAIL PROTECTED] wrote: Contract, as in the piece of paper you get someone to sign in order to license your software. It would spell out the responsibilities of both parties for support, penalties for violating those terms (ex. running at levels above the paid entitlement), etc. I mean the exact same meaning of the word as used in higher-end desktop software. EULAs don't really hold much legal standing, specifically because they are NOT contracts. You need a signature of some kind from both you and your customer agreeing to the terms. Oh, I am a little slow sometimes;) I am a one man shop with no funds and I am targeting small business owners, we are a very informal group. Even if there was a contact, I don't have the resources to go after them and they aren't really going to have the funds to make it worth going after:) The honest truth is that 99% of my market doesn't even know what Apache is, let alone that there is a conf file that could be changed to get different behavior. Sam
Re: unresolved external ap_lookup_provider...
The problem was/is the lack of a extern C around the ap_provider.h file. I put one in my mod_auth_basic.cpp and all is well. I am wondering if it is possible to have it added to ap_provider.h itself. Anyone know how I would go about getting that done? Sam On Sat, Nov 22, 2008 at 3:43 PM, Sam Carleton [EMAIL PROTECTED] wrote: I am trying to consume mod_auth_basic.c in my own module. Everything is fine except when linking I am getting the error: 1mod_auth_basic.obj : error LNK2019: unresolved external symbol __declspec(dllimport) void * __stdcall ap_lookup_provider(char const *,char const *,char const *) (__imp_?ap_lookup_provider@@[EMAIL PROTECTED]) referenced in function _add_authn_provider My project is C++ so the mod_auth_basic.c is now mod_auth_basic.cpp. I am also doing all the module setup in a different cpp file, so add_authn_provider() is no longer static. I am including libhttpd.lib, which appears to be where ap_lookup_provider is found, at least that is the only library with that string when I grep all the libraries. Does anyone have any suggestions on what I should try? Sam
developing custom authentication module
I am ISV developing a system that is using Apache. All the frontend's for system I am developing are all custom desktop applications, or web browsers controls wrapped in my own code. Thus users are not going to be entering username and password, the username and password used will be depended on which frontend being used. It is time for me to implement authentication correctly. I have two objectives with respect to authentication: 1: Protect my customers from unauthorized users. 2: Protect myself from customers hacking the authorization system to get access to features in which they have not purchased. #1 looks straight forward: If my impression is correct, I simply need to implement my own custom provider to check the custom username and password the frontends give it. Q: Is there documentation out there somewhere on how to implementing a new provider? #2 looks a lot more tricky. It seems that I will need to deviate from the normal way Apache's authentication works. For starters, NONE of the configuration can be in the http.conf, not like it is now with AuthType, AuthBasicProvider, etc. There is a Location directives in the conf that will have a custom directive for my custom Apache module. I would like to fully wire up this custom provider within this directive. To add to the complexity, there are different levels of authentication: None required, user, admin and there will be different locations under the Location directive for each, again, this all needs to be wired up in code when the custom directive for my custom Apache module is called. Q: Any suggestions on how I might achieve this? Sam P.S. I do NOT own the book on writing Apache Module in 2.0, just the older 1.3 book. Would any of this be addressed in that book?
handling custom authentication
I am ISV developing a system that is using Apache. All the frontend's for system I am developing are all custom desktop applications, or web browsers controls wrapped in my own code. Thus users are not going to be entering username and password, the username and password used will be depended on which frontend being used. It is time for me to implement authentication correctly. I have two objectives with respect to authentication: 1: Protect my customers from unauthorized users. 2: Protect myself from customers hacking the authorization system to get access to features in which they have not purchased. #1 looks straight forward: If my impression is correct, I simply need to implement my own custom provider to check the custom username and password the frontends give it. Q: Is there documentation out there somewhere on how to implementing a new provider? #2 looks a lot more tricky. It seems that I will need to deviate from the normal way Apache's authentication works. For starters, NONE of the configuration can be in the http.conf, not like it is now with AuthType, AuthBasicProvider, etc. There is a Location directives in the conf that will have a custom directive for my custom Apache module. I would like to fully wire up this custom provider within this directive. To add to the complexity, there are different levels of authentication: None required, user, admin and there will be different locations under the Location directive for each, again, this all needs to be wired up in code when the custom directive for my custom Apache module is called. Q: Any suggestions on how I might achieve this? Sam P.S. I do NOT own the book on writing Apache Module in 2.0, just the older 1.3 book. Would any of this be addressed in that book?
setting cookies ap_hook_check_user_id vs ap_hook_auth_checker
I am looking for an example of setting a cookie in an apache module. I found mod_auth_memcookie, but it only reads in cookies, it looks like it relies on the php code to actually set the cookie. Also, I see that mod_auth_memcookie is hooking both ap_hook_check_user_id and ap_hook_auth_checker. I am currently only hooking ap_hook_auth_checker and doing my less then ideal checking at that point. What exactly is the difference between the two? What exactly I am trying to do is this: 1: Check for the magic cookie, if present check to see if it is active, if so, OK 2: Assuming something failed above, check all the stuff I am checking now and if all is OK, set the cookie and move on. Sam
Re: setting cookies ap_hook_check_user_id vs ap_hook_auth_checker
On Wed, Jun 18, 2008 at 9:42 PM, Sam Carleton [EMAIL PROTECTED] wrote: I am looking for an example of setting a cookie in an apache module. I found mod_auth_memcookie, but it only reads in cookies, it looks like it relies on the php code to actually set the cookie. I forgot to add that the cookie that is set is going to be used as the session ID in the PHP code that is ultimately to handle the request once it has been OKed by the ap_hook_auth_checker code. Sam
handling authentication
I am working on a ISV that is developing kiosk system with Apache at the core. Considering my many years of software development is in Windows Application development, not web development, I am running into some issues with authentication. I am hoping to gain some insight from those of you that know that understand web development far better then I do. Initially I thought that since the whole system is a kiosk system, each kiosk would have a different IP address, so I could simply differentiate by IP. Low and behold I have customers that is use solutions like NComputing, which allow one physical machine to be turned into 4~6 different kiosk's, all having the same IP address. So the obvious easy solution is to move to using Cookies. The problem I am having is figuring out how exactly to implement it. There are three different issues need to be implemented: 1: Making sure the browser is one of my kiosk browsers application (right now I am doing this by changing the user agent, but am open to other approaches) 2: Making sure each browser is uniquely identified. 3: Making sure that the number of browsers connected does not exceed the customers license. Right now the kiosk browser simply connects to the root of the application, index.php. The Apache module hooks the access checker (ap_hook_access_checker): A: Checks to see if there is a valid license. B: Checks to user agent string to see if it is a kiosk browser C: Based on the type of license, check to see how many clients have connected (based on the IP) in the last X seconds. When using cookies, where should I put the timer? Should I have the Apache module track when the last time a said cookie connected to the module or should I simply set the cookie to timeout in X seconds and renew it on each request? I am thinking it should work like this: A: Checks to see if there is a valid license. B: Check for the cookie C: There is a cookie, check to see if the cookie has expired, if so continue, otherwise update the system concerning the cookie and return OK. D: Checks to user agent string to see if it is a kiosk browser E: Based on the type of license, check to see how many clients have connected (based on the cookies) in the last X seconds. Later in the PHP code, I can use the cookie as the unique identifier. From a security standpoint, is there anything I am missing? Sam
Re: debugging a timeout issue
On Fri, May 9, 2008 at 12:23 AM, Graham Dumpleton [EMAIL PROTECTED] wrote: Since you see one request but not the second, one thing I would perhaps suggest doing is turn off KeepAlive and see if that makes a difference with the client. I am wondering, I do not see the timeout bug but my customer is seeing it. Does it make sense that the same client application configured the same way talking to Apache configured the same way might show different KeepAlive behavior? Sam
debugging a timeout issue
I am a one man ISV that is using an Apache and an Apache Module. I am trying to trouble shoot a timeout issue that I cannot see, my customer is reporting the problem and he can consistently repeat the problem. Sometimes when the .Net 2.0 client makes a call to my Apache module, the .Net code times out, I am trying to figure out which side is having problems. I am thinking it is a .Net, but I wanted to make sure that I throughly confirmed that it is not Apache. I have logged the heck out of my apache module and it never gets called. I have set apache's LogLevel to debug and turned on access logging, but I never see the request come in. I see the first one, but not the second one. Is there anything else I can do to increase the logging of Apache or is it safe to say that the request is NOT leaving the .Net application? Any suggestions on how I can absolutely confirm the issue is in the .Net client? Sam
Re: [MODULES]apache running slow in production
I would like to thank one and all for your help. I took Ray's advise and created a basic timing class (my code is C++) that captured elapse time and put that around all the main calls in my code and found the bug. It was something REALLY stupid on my part, isn't always;) Again, thanks you all for your help! Sam
modules and RewriteRules
I am thinking the slow down is not directly related to the Apache Module, but maybe related to the way I have the RewriteRules setup. I have moved the RewriteRules from the directory level to the server level and for some reason my handler isn't getting called anymore. I am hooking the handler in the middle: ap_hook_handler(promenade_handler, NULL, NULL, APR_HOOK_MIDDLE); Here is my RewriteRules and handler all at the server level: RewriteEngine On RewriteRule ^/images/([^/]+)/([^/]+)$ /theImage?fldoid=$1imgoid=$2 [L] RewriteRule ^/images/([^/]+)/([^/]+)/([^/]+)$ /theImage?fldoid=$1imgoid=$2tn=$3 [L] Location /theImage SetHandler promenadeImages /Location Any thoughts on why I never see the handler promenadeImages get sent to my handler? Sam
Re: modules and RewriteRules
On Sat, Mar 29, 2008 at 1:04 PM, Eric Covener [EMAIL PROTECTED] wrote: Would that require one of the [PT] flag or a Directory container? Eric, Thank you so much, that did it! Sam
apache running slow in production
Folks, Part of my web application contains an Apache C Module, mostly it is a handler to control access and to serve up images, but another part of it does access a SQLite database, which isn't called a whole lot. On my development machine which is a 2.8GHz P IV, the module serves up 12 images very quickly. One of my customers is reporting that it is taking 45 seconds on a Duo Core 1.8GHz machine! If is wasn't for the fact that my customer is 15 hours away, I would go check it out in person. Such as life. Does anyone have any thoughts on how I can trouble shoot this remotely? I can compile and send new code to the customer, I just don't know exactly what I might do to collect data. Sam
development environments...
I have spent my development career in Windows using both DevStudio and Visual Studio. One of the reasons I am going to be using Apache C Modules and Axis2/C is to be cross platform. Does anyone have any recommendations on a good cross platform development environments that has a debugger for Apache C Modules and Axis2/C development? Sam
Re: long running background tasks
On Sun, Mar 16, 2008 at 6:43 PM, ed [EMAIL PROTECTED] wrote: What might be better for you is to add this to a queue, perhaps via means of a unix socket (or IP socket) of another process, that does this work. Actually today the program is only Windows and in time will be Windows, Linux and OSX (aka BSD). After posting I had a feeling that a daemon (Windows NT Service) would be the most likely approach. The only remaining question is: How best to let the daemon process know it is time to grab the task from Apache. In Windows there are named Event Object (http://msdn2.microsoft.com/en-us/library/ms682655(VS.85).aspx) so the Apache Server can set the event and the daemon know it needs to get the new task from Apache. Does the Linux/BSD world have something like named Events? Sam
long running background tasks
When a user logs out of my web application, the application needs to do a somewhat time consuming cleanup. I need Apache to respond in a timely fashion to the log out request. Is there any way to start this as a background process in the apache module? Sam
Understanding how to write large application in apache modules
I am more interested in theory right now than anything else. Currently my web development is 80% PHP and 20% Apache Module. The Apache module is currently a handler for my images and controls security. I have adopted a template type of approach with the PHP code, I found this utility class that allows me to place 100% of my HTML into template files and keep the PHP pure code. I think the concept is pretty standard: The PHP code determines which templates to use to build the page. Then the PHP sets all the variables for those pages. And finally it calls the utility class that actually builds the page replacing the variables in the template with the values I set in the PHP. The more I think about it, the more this sounds like what folks are doing with input and output filter in Apache modules. I am starting to think that it is possible to develop a whole solution solely as an Apache module and simply have it filter HTML template files filling in variables. Is this how folks do it? Sam
Re: how to append to strings...
On 11/30/07, Arturo 'Buanzo' Busleiman [EMAIL PROTECTED] wrote: I don't quite like the bucket brigades stuff (at least for input filters), but it's good enough. I am open to other ideas... All I am trying to do is read in the text element from some XML via expat. The expat parser can break up text elements into multiple pieces; I am simply looking for the best way to build the string. The text is simply a relative path that normally is going to be less then 260 bytes. What approach would you take to build this string? Sam
Re: how to append to strings...
On Nov 30, 2007 5:25 AM, Arturo 'Buanzo' Busleiman [EMAIL PROTECTED] wrote: You might be talking about bucket brigades. You can create a brigade, transform each string into a bucket, then insert/append after/before another reference bucket, etc. This will give you an idea: http://www.onlamp.com/pub/a/apache/2001/09/20/apache_2.html That is exactly what I was think about! I read the article and read through the apr_buckets.h and am still seeking more info. Does anyone know if any of the existing modules use a simply bucket system to build a string as an example for me? Sam
how to append to strings...
I am rewriting part of my module to use expat, a parse I have used in years gone by. I know it, I sort of even like it and my XML is pretty simple, except... I need to extract one text element. I know that even though the text I need is in one continues line in the XML, expat can and at times will call my handler multiple times for that one continues string. The question is: What is the correct way to append all the pieces of XML that I am going to get from expat into one string? I recall reading somewhere that Apache has a really slick way of being able to break up a string into pieces so that one can quickly inject something in the middle without having to move any memory around. What ever it is called, I am thinking that is the right solution: build an array of the strings and use this feature of apache to put them together. Am I on the right track? If so, can someone enlighten me as to what exactly I should be looking up in my Writing Apache Modules with Perl and C book? Sam
Windows compiler options
I have been developing my module with VC6, fore I know that because of the manifest files VC8 is not a viable enviornment, what about VC7.1 (VS2003)? I have that now and am wondering if I can upgrade from VC6 to VC7.1. Sam
Re: trick/tips for finding memory leaks
On 11/26/07, ed [EMAIL PROTECTED] wrote: Generally speaking, if you're using apr routines then they should handle the memory resources for you, there should be little need for allocating on the heap.
trick/tips for finding memory leaks
Thanks to the performance tools of my OS I have confirmed that somewhere in my Apache module there is a memory leak. Are there any tips or tricks out there for find memory leaks in an Apache module? Sam -- The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
performance vs development time
With this memory leak in my simple Apache module, I am considering rewriting the whole module. Right now there are two files small files that the module reads every time. One is a small (less then a 1K) configuration file and the other is a small (1K ~20K) xml file. In the rewrite, I am considering caching the data in these files and reading them only if they are changed. The question though is: Considering how small these files are, will the performance gains be worth the extra development time? Another option would be to switch from using libxml2 to expat for the XML parsing. Oh, what type of load is the server under? The server is driving a kiosk system where there are normally a hand full of kiosk but there could be as many as 100 under very heavy use. Sam
Re: Apache 2.0 module skeleton
On Nov 15, 2007 11:05 AM, Joe Lewis [EMAIL PROTECTED] wrote: Graf László wrote: Hi all, Can somebody give a project skeleton for Apache 2.0 module? The tool is apxs. Google it for more information. You might even find a link that looks like : [snip] DISCLAIMER : I have not run this on Windows due to myself not being a proponent of the said OS. I cannot verify if this tool actually works in this environment. I am by no means a proponent of said OS, but I am a 13 year veteran of developing code for said OS and developer of one Apache Module on said OS. I can confirm that the apxs tool does most definitely work on said OS. Follow the directions and you should be fine, I was;) Sam -- The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
Passing parameters to PHP
Is there any way for my apache module to pass parameters in such a way that my php code can get at them? Sam
determining if browser is on same machine as server
I am working on the access to my kiosk system, one condition I need to handle in a unique way is when a web browser is run on the same physical machine as Apache. It is obvious when using localhost or 127.0.0.1. But when the URL is the machine name, I seem to be getting an IP address. I do see in r-server-server_hostname, is there any way to convert that into the IP address? Sam
understanding configuration data blocks
I simply don't understand how module configuration is suppose to work. I am handling the server and dir config create and merge. For some reason, unknown to me, the server creation function gets called twice in my development environment where I am passing httpd.exe the -X. Of course this means that the function to handle the command gets called twice, too. It might be nice to understand why it gets called twice, but that isn't the problem. The dir configuration creation gets called twice, too but also seems to work fine. Inside my access hook when I make this call: ap_get_module_config(r-server-module_config, my_module) I get an empty configuration block, but when I change the first parameter to r-per_dir_config, I get the server configuration block. What? Why doesn't r-server-module_config return me the server configuration block and r-per_dir_config either return nothing or the applicable dir configuration block. Am I doing something wrong? If not, is this documented somewhere? Sam
OT: mod_xmlns
Folks, This is a bit off topic, but over the last few weeks I have come to know you all as very helpful and extremely knowledgeable about all things Apache and I have a feeling most all things Web related... Thanks to Nick mentioning mod_xmlns in the server side include thread, I just looked up what the module and read the http://apache.webthing.com/mod_xmlns page. After reading it, I am as clueless as to what to do with mod_xmlns as before I read the page:( I have been using XML/XSLT on and off for 8 years now, but being a GUI developer (not web) it has been limited to very basic things like dumping report data to XML and using XSLT to make a pretty HTML report. I get the impression there is XML being used in ways unknown to me. And mod_xmlns plays a role in these usages, unknown to me. Might one or two of you direct me to some more info as to enlighten this dim bulb;) Sam
Re: one module per task
On 4/9/07, Joe Lewis [EMAIL PROTECTED] wrote: Sam Carleton wrote: When Apache sees Location /coolapp SetHandler mod_my_cool_app Location How does it know that mod_my_cool_app is associated with mod_my_cool_app.so? Is it purely from the LoadModule or is there something in the module that I am missing? It doesn't. Simply mod_my_cool_app.so has a function which checks the handler, and either completes the request or returns 'DECLINED so that another module can handle the request. Joe, Oh, that explains the first line of my hander looking something like this: if (strcmp(r-handler, mod_my_cool_app)) return DECLINED; I get it now! This also explains why one is able to place the hander at the very first, first, middle, end or very end of the chain. Slowly, oh so slowly, it begins to come clearer (mind you when it starts off looking like mudd, clearer doesn't mean too muchgrin). Thanks! Sam
server side includes
As I sit here on hold, I started thinking about my little apache module again. I recall reading in Writing Apache Modules in Perl and C how with Perl it is quick and easy to create a server side include handler, I think that is what it was called. How would one go about doing that in a C module? Are there any examples? Sam -- The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
one module per task
On 4/6/07, Nick Kew [EMAIL PROTECTED] wrote: A good starting point is one module per task. How many tasks does your application comprise? How many of those tasks can be accomplished using existing modules? I like the concept on one module one task, but I want to try to keep everything in one main binary, sort of like having one EXE in Windows for a program. I was reading through my old book Writing Apache Modules in Perl and C and it looked like it was possible to put multiple handlers in one perl file. Is it possible to put multiple handlers in one C Module? This seems like a logical approach to having one module doing different things, simply have it contain a different handler for each task. When Apache sees Location /coolapp SetHandler mod_my_cool_app Location How does it know that mod_my_cool_app is associated with mod_my_cool_app.so? Is it purely from the LoadModule or is there something in the module that I am missing? Sam
Re: translate_name and/or map_to_storage hooks
On 4/6/07, Nick Kew [EMAIL PROTECTED] wrote: On Fri, 6 Apr 2007 00:51:52 -0400 Sam Carleton [EMAIL PROTECTED] wrote: (for now, assume that the whole application will be in the apache module.) That assumption seems fundamentally flawed. A substantial and complex application will be built from a number of modules, and is likely to mix preexisting components with new ones. If you're thinking of all your work being one module, then you need to take a step back and review it. A good startingpoint is one module per task. How many tasks does your application comprise? How many of those tasks can be accomplished using existing modules? It's also of course a valid approach to mix-and-match modules with other components such as scripts and backends. But I guess you see that as an intermediate stage in your work. Nick, I think I forgot to mention in the last post that what I am working on is a packaged solution with a GUI frontend. There are going to be two different distributions, the first will be installing apache and all the needed components with the GUI to run on one machine, the pro version will have the apache piece install on another machine, possibly a preexisting apache server. As I said before, I am completely, 100% open to how I should implement this whole application, I just don't want to get carried away using a million different technologies because it will make it that much harder to put together an install;) My goal is a one click install! I have been thinking of keeping the HTML piece in PHP. It sounds like you agree that is a logical approach, correct? Sam
the scoop on etag's
I see there are two different functions regarding etags: AP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak); AP_DECLARE(void) ap_set_etag(request_rec *r); What are they using to actually make the etag? I would like to create my own, custom, etags, how do I go about doing that? Also, are there any apache functions to add me in checking to see if the requested file has been modified or do I simply need to do that by hand? Sam
Re: translate_name and/or map_to_storage hooks
On 4/5/07, Graham Dumpleton [EMAIL PROTECTED] wrote: In a translate name handler, if you assign to r-filename then the map to storage phase will still kick in and ensure that Apache has access to whatever you set r-filename to. Thus, you still need a Directory directive corresponding to the physical location you set r-filename to that marks it as accessible. The translate name handler, unless you also override map to storage handler to work around it, is not really for setting the target to a virtual resource. Thank you, that does make sense. I could try and suggest other approaches, but don't really grasp how you want all this to work so would just probably going around in circles. If in the first instance all you want to do is rewrite URLs to give a different view to the clients, I still suggest you at least first use mod_rewrite to produce what you want. I know you don't want to use mod_rewrite in the long run, but being able to see a set of mod_rewrite rules that demonstrate exactly what you want makes it easier for anyone to understand as it is clearer than some English description. Graham, Here is my problem: I have been a C/C++ programmer for over 10 years and have been working in .Net for the last two, but it has ALL be on the desktop, I have very, very limited experience with web development. I am simply looking for the best, most flexible approach possible. In the short term, I am going to be keeping the HTML generation in PHP, depending on how hard it is to do this module (it is taking up a HUGE amount of time, though I am enjoying it) I would like to port the HTML generation to the module, also. With time the whole application will grow with complexity. From a HTML perspective, there is only two pages, one that displays indexes of images, the other that displays a larger view of one image. In time, there will be shopping charts, admin pages, extra. How do I want it all to tie together? I really don't know, I have never been able to find any good documentation on how to put together a complex web application and keep it manageable, thus this is ultimately the advise I am seeking. I am completely open to how it should all work. Any suggestions? (for now, assume that the whole application will be in the apache module.) Sam
Re: translate_name and/or map_to_storage hooks
On 4/4/07, Graham Dumpleton [EMAIL PROTECTED] wrote: I missed out on the start of this conversion so really don't know what you are trying to do I have one module that does a few different things. 1: create a index html document of images 2: create a page html document of one image (when user clicks on an image in the index) 3: Handle the image request that are in the HTML of #1 and #2 and send out all the images. Right now I have it all written in PHP, there is a index.php for #1 and #2 and an imageHandler.php for #3. I am trying to understand the best way to separate this logic within my one module. Someone else suggested I look at hooking translate_name. I found my answer to how to determine the location, so I have been playing with it since my post and when I set the r-filename = images; and return OK, I get a 403 Forbidden. why aren't you just using mod_rewrite? This is going to be packaged software and I would, ideally, like to keep it all self contained so that end users that decide to start hacking things, cannot get too far.
Re: concern about memory management
On 4/3/07, Burak Arslan [EMAIL PROTECTED] wrote: afaik, apache does not offer a proper free() function, which might cause problems with image processing modules(if you're processing multiple images per connection). so i'd not attempt to hack that library only to get the same functionality as before. your call, though. I have not dug deeply into the Apache pools, yet, but... My impression was that I could create use sub pools to get the same effect as free(). My whole sole objective here is to speed up the image processing, my thought is that by using the Apache pools, the memory aspect of the process will be faster.
Re: a thanks and C++ new overloading
On 3/29/07, Ralf Mattes [EMAIL PROTECTED] wrote: Well, please consider all I say with a certain amount of doubt since I'm not a C++ developer (only did one C++ module, the rest was plain C) and favor C (or Obj. C) over C++, Interesting, Are you doing large projects in C? I know both well and simply cannot imagine developing a large system in C. I know Apache is all in C, but man, I really like my objects;) Obj. C does sound interesting, can you recommend any good sites that can enlighten me more about the subject? but: Since you seem to like the Apache way why not use it for the GUI as well. The memory pooling and eveything prefixed with 'apr_' is actually part of the Apache Portable Runtime which can be used independent from the Apache webserver (Subversion is a prominent example for such a project). You just need to decide whether memory pools[1] are a good fit for your GUI application. Why not? Because I had not stop to make the obvious connection;) [1] For another nice MPS have a look at: http://www.ravenbrook.com/project/mps/doc/2002-01-30/ismm2002-paper/ismm2002.html yea, the whole memory management thing is a huge can or worms, nice to know that there is the above MPS and apache's to pick from. Sam
a thanks and C++ new overloading
Folks, I want to say thank you for taking the time to help me out with getting my module up and going. It is so VERY refreshing to be developing in such a well thought out and structured environment. By day I am working in VB.Net on different small projects where the project leads attitude is: Get it done, don't make too many new modules/class because it will be too complex for me (boss) to understand when you leave. Having the structure of the apache module is the complete and total opposite and very very refreshing! It is also exposing me a little bit to how to make a module system, which I will ultimately need to do for the GUI side of my app. It is all good, very good! Thanks for directing me this way! Last night I did successfully setup a C++ new overload that takes an apache pool. (When used correctly, C++ is simply WONDERFUL!) The question is: How best to make the code reusable? What do I mean? Well, the next version of the GUI is going to be written in C++, there is going to be a lot of code that can and should be shared between the module and the GUI. I just cannot figure out how best to setup the common code to allocate memory for different locations. Any suggestions? Sam
manifest embedding issue?
I know that as of VS200? (2 or 3) that Microsoft started this whole manifest thing. It is also my understanding that, for C/C++ apps, it can be turned off. What exactly is the issue? Considering it seems most of you are *NIX developers, maybe this is something I can dig into and find a solution, maybe not;) Sam
Re: manifest embedding issue?
On 3/28/07, William A. Rowe, Jr. [EMAIL PROTECTED] wrote: MS's primary goal is primacy, be it forcing users into their API, their language extensions, their OS. Sometimes, the best answer is a dash of bubble gum and bailing wire to get around the mess they create, and sometimes it's to ignore their drivel as irrelevant I hear you, though I have always been a Windows developer, I have always disliked M$. The problem is they really know how to make life easy. I simply LOVE .Net development, so quick and easy. The whole manifest thing does make life easier, but it is also a control issue. What a pain, I really like VS2005 interface, oh well. Sam
Best way to debug
yea, I tried installing mod_perl and I still got the same problem. I finally simply tried nmake install and it worked, despite the perl error;) So I was up to 1am working on my new apache module! I recall beating my head agaisnt the wall last time I tried writing an apache module, but that was back in the 1.x days, on *NIX, not my native platform, and without a debugger. Today on Windows with a debugger, things are running very smoothly! I do have a debugging question: As we all know, when you fire up httpd, it starts at least one more instance. If I am not mistaken, on Windows it is only one more. When I try to debug in VS6, it attaches to the first instance of httpd, not the one that I actually want to debug. VS6 lacks the ability to debug multiple programs at one time, so... I am using VS2005. This is what I am doing... 1: Compiling on VS6 2: Go to a command window and starting httpd 3: Go to an instances of VS2005 and attaching to both instance of httpd [debug] 4: When down debugging, I deattach VS2005 from the httpd 5: Go to the command line and press Ctrl+C Is there any why to have httpd start up such that it does not start a second process so that I can simply debug with VS6, skipping steps 2 through 4? If no, so be it, it would simply be nice;) Sam On 3/28/07, Issac Goldstand [EMAIL PROTECTED] wrote: Ick. The Perl glue likes to take over like that on windows. Try running win32\Configure.pl (directly) and passing --disable-perl-glue. (Or make life easier on yourself by building and installing mod_perl first - you don't need to use it afterward)
Re: apache module or CGI (conclusion)
Folks, I want to thank all three of you for your time, thoughts, and input on this matter. I have reached a conclusion... Drum role please It will be a apache module!!! In the end, it came down to portability. I realize that either way I go, I need to be using APR and using apxs, it does appear that an apache module is actually easier to implement. I got the skeleton up and running last night! On my nightly walk I started to think of the possibilities now that I am in the world that I know and love: C/C++. I realized a way to implement the whole web solution in this module, but there are more infrastructure questions I have about how to tell the different pages apart. With the current PHP code, I have two different php pages: index.php: It has two looks, one where it shows thumbnails, another where it shows one larger image. Both pages have parameters passed to via the GET method. imageHandler.php: Given the correct parameters via a GET, it will downsize the image and send it out. My first question is, in an apache module, are there tools to get at the parameters passed to the module or will I still need something like cgic to get at them easily? Second, right now the URL looks like I am using gets, I *THINK* I would like to change that so it simply looks like a path: Rather then the current: index.php?fldoid=f50b8377-d1cf-4407-bb59-a86ae7804d5cimgoid=DSC_8912 I would like to see something like this: index.php/f50b8377-d1cf-4407-bb59-a86ae7804d5c/DSC_8912 I do recall seeing something, in years gone by, about how apache can do this type of thing and convert it back to a normal GET for the script. With a module, do I lose this feature and have to simply parse it myself? More importantly, lets say my module is called mod_coolapp and when I have it installed, you get to it at /coolapp. I want /coolapp to be the equivalent to the index.php and then have say, /coolapp/images be the same as imageHandler.php. Is there any trick to knowing which page is being requested or is it simply a matter of doing a string compare to see if the first part of the string passed the actual URL (/coolapp/) is images? Oh, one final question. I am going to set things up so my customers have great flexibility in what the web page actually looks like. The module will read in a template file to get what the out side, HTML wrapper is and then will call different XSLT scripts to actual transform the XML the module creates into HTML. Is there any standards as to where these resource files should be located? Sam
Re: how to get started?
On 3/27/07, Ralf Mattes [EMAIL PROTECTED] wrote: Oh, I have lots of *NIX machines to pick from, I have a OpenBSD machine (my firewall), Solaris 8, and a SuSE Linux, no need for VMWare. Good. Still - the virtual testserver thing really grew on me: I have a clearly defined build/test environment (ever been bitten by a missing library that was never detected because it happend to be installed on you test system?). Too true, too true. I use Microsoft Virtual PC to test installs in Windows. I would like to get VMWare, but I don't have the $$$ for it right now. My main point is that I can, general speaking, test to make sure my code will run and work in the *NIX world, fore I have a lot of it around me. Before I ever where to ship a *NIX version, I will have VMWare and will use it for the final testing. In my first job I wrote and tested the installs, prior to virtual PCs. The *ONLY* safe way to really test a install was to wipe the hard drive and reinstall the OS. Microsoft has some tools to speed the process up, to a degree, but what a pain and a HUGE time sink. Today I have my virgin config in a virtual PC and simply don't apply changes, got to love it!! 2: I know the tools in Windows to do C/C++ development, been using them for over a decade now. I have never developed in *NIX, so there is most definitely a learning curve. Definitely. I'd dread to heve to learn Windows API and frameworks. I am going to have to learn it before this is all done, because it *IS* going cross platform, it will be interesting (if I am still doing development at that point in timegrin). You mean 'automake the BEAST' ? :-) Gosh, _that's_ a real monster. I'd start with the automake book: GNU Autoconf, Automake, and Libtool, by Tromey et al. But beware: utomake is a moving target and has changed since the book was written ... Unless you need some fancy system dependent functionality and you stick to libapr for portability you might just copy/morify the automake setup of an existing module. Good to know, thanks! Sam
Re: apache module or CGI (conclusion)
On 3/27/07, Issac Goldstand [EMAIL PROTECTED] wrote: More importantly, lets say my module is called mod_coolapp and when I have it installed, you get to it at /coolapp. I want /coolapp to be the equivalent to the index.php and then have say, /coolapp/images be the same as imageHandler.php. Is there any trick to knowing which page is being requested or is it simply a matter of doing a string compare to see if the first part of the string passed the actual URL (/coolapp/) is images? You're going to want to parse/compare the string. The Right Way(tm) to do this would probably be during the translate_name or possibly map_to_storage hooks to separate the URI mapping logic from the actual response processing logic. You totally lost me with the translate_name and map_to_storage, I will have to do some reading on it. Oh, one final question. I am going to set things up so my customers have great flexibility in what the web page actually looks like. The module will read in a template file to get what the out side, HTML wrapper is and then will call different XSLT scripts to actual transform the XML the module creates into HTML. Is there any standards as to where these resource files should be located? I have thought of another question centered around the above concept of making the site configurable: Is the above approach the best and most flexible approach? Is there a better approach? Sam
Can't locate ModPerl/MM.pm
Hay folks, I am trying to get libapreq2 installed on my Windows machine. I fixed the bug in the Makefile that was looking for libapr.lib rather then libapr-1.lib, but I am stumped on the error Can't locate ModPerl/MM.pm Here is the whole thing: C:\Perl\bin\perl.exe Makefile.PL Can't locate ModPerl/MM.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib.) at Makefile.PL line 2. BEGIN failed--compilation aborted at Makefile.PL line 2. NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0x2' Stop.
reference out of date?
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
apache module or CGI
I am working on a image kiosk system. One of the things that needs to happen is downsizing images. Initially this down sizing was happening in the GUI part of the program. I have now modified things so that it is done real time by the PHP code. The problem is that the downsizing is taking much longer in PHP then it did in the GUI (C#). I am thumbnail images (up to 16MB source images) and creating web page style images ( 900x600). I am looking for options to speed things up. My first thought is to keep it simple and write a CGI program in C++ (a language I know and love), but I am a little concerned about the startup cost of calling CGI. When there are up to 100 different browsers hitting the server, will there be any big speed benefits to developing an apache module rather then CGI? I do get the impression that there is quite a bit of framework code to write in doing apache modules, so I am also thinking that I might want to look at FastCGI. What is the best approach? Oh, is FastCGI just an apache thing or will FastCGI programs work with other servers? Sam
Re: apache module or CGI
Interesting concept that I had not considered. My 10+ years of software development have been in GUI development, not web, so more complex things such as you suggest will require a bit more explaining to me;) First, though, I am using a reverse proxy server so that the downsizing only happens once, which works well with the PHP code. Ok, this is what I am doing now: 1: the html page with all the image links is returned the the browser 2: the browser requests all the images 3: the server processes the request and returns the image It sound to me like you are suggesting that rather then #3, the server add the request to the queue and return a (I don't know). Once the server is done down sizing the image it some how tells the web browser it is done. Correct? Sam On 3/26/07, Issac Goldstand [EMAIL PROTECTED] wrote: Are the resized images needed *immediately*? Could you set up a seperate process to downsize the images one at a time, and let Apache/PHP/whomever just add the images to the queue? That way, the requests get processed much faster and you're also guaranteed not to blow the server's resources with too many concurrent requests all downsizing images at the same time. Issac Sam Carleton wrote: I am working on a image kiosk system. One of the things that needs to happen is downsizing images. Initially this down sizing was happening in the GUI part of the program. I have now modified things so that it is done real time by the PHP code. The problem is that the downsizing is taking much longer in PHP then it did in the GUI (C#). I am thumbnail images (up to 16MB source images) and creating web page style images ( 900x600). I am looking for options to speed things up. My first thought is to keep it simple and write a CGI program in C++ (a language I know and love), but I am a little concerned about the startup cost of calling CGI. When there are up to 100 different browsers hitting the server, will there be any big speed benefits to developing an apache module rather then CGI? I do get the impression that there is quite a bit of framework code to write in doing apache modules, so I am also thinking that I might want to look at FastCGI. What is the best approach? Oh, is FastCGI just an apache thing or will FastCGI programs work with other servers? Sam -- The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
Re: apache module or CGI
On 3/26/07, Issac Goldstand [EMAIL PROTECTED] wrote: I'd say then that you need to do in on-the-fly with caching. Caching should be pretty easy - just have a static algorithm for determining the name of the cached image and stat it to see if it already exists. If so serve it; if not, reduce the image, save it and then serve. You don't need a separate process if we're dealing with foreground processing. Issac, So if I understand you correctly, you are saying that CGI (I am really leaning towards FastCGI if it isn't hard to setup) will work fine, one request, one process, no problems. And you are saying that the use of a proxy server is over kill? Joe's idea of sending a 404 when the smaller image does not exist is interesting, is that basically what you are suggesting? Joe, Hum, script-to-generate-thumbnails.pl??? is that not a common extention for perl? grin I ain't doing perl, there ain't no way you can make me :P (this *IS* ment to be funny, by the way) Oh, and I do find your idea interesting. Sam