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, Joe Lewis <[EMAIL PROTECTED]> wrote: If performance is an issue, consider mod_perl along with it. It keeps the CGI in memory to eek out a bit more performance. Otherwise, you can use C to create a binary and link it statically with the ImageMagick libraries. (IM seems to be most efficient). Google is your friend here! Joseph, I am considering using ImageMagick, but perl is out of the question. The software I am working on is going to be packaged software and it is enough to have to package up apache and php, I am not going to add perl to the mix, too;) The options are: C++ CGI, C# CGI, C/C++ apache module I tried to get ImageMagick to work, but I am on Windows and it was a pain in the backend, so I am looking to statically link, as you suggested, for which ever wrapper I go with. Sam
Re: apache module or CGI
On 3/26/07, Issac Goldstand <[EMAIL PROTECTED]> wrote: If the images are already on the server, and needed for the response immediately, you'd need to do it inline, but you could still make life easier on yourself (somewhat) by caching the reduced images to avoid reprocessing. I could give more specific advice if you could share a bit more about what you're trying to accomplish in general. Issac, It is beyond simple. There are a bunch a full size image (4 MB to 16 MB) on the web server that need to be indexed (210x140 size) on the browser, when the user clicks on a thumbnail, they need to get a larger (900x600 size) image to view. They are getting any where from 12 to 96 of the indexed images per page. Like I said above, I fully understand the importance of caching the results. Rather then trying to write the code myself and save the images myself, I am using a second instance of apache running as a reverse proxy to cache the results;) Why reinvent the wheel;) On thought I had was this: When the server gets the request for the image, if it does need to downsize it, add it to a queue and simply make the system wait for the response. I would actually have to create some type of pool of processes so that things don't get too back logged. I am thinking maybe based on IP address or something so that there is only one downsizing per browser. The only issue I have there is what happens if two browsers request the same image, I am sure there is a way that once the image is downsized once, it could be sent to both browsers, but this is starting to get really complex. I am really looking for simplicity. Speed is important, but this is really only a very small piece of what I am doing. Right now, the worst and very much extreme case is 100 viewing stations (browsers) having access. Normal is going to be between 4 and 20 viewing stations. Sam
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? 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
Re: apache module or CGI
On 3/26/07, Ralf Mattes <[EMAIL PROTECTED]> wrote: No -- please don't do that. You are terribly abusing the protocol. An "Error Document" is just this - an indication of what went wrong. The client will still receive a 404 status, and, expecting an _image_, just display the dreaded broken image icon ... Iff you want to go this road you must redirect to a handler that can modify the status. Ok, sounds like a good sound argument to me NOT to go down that road, thanks! BTW, with HTTP/1.1 and chunked encoding there shouldn't be any problem generating the image on the fly and then storing it in the cache. And there _are_ response status that indicate a lengthy content generation ... Like I said, web development is not my expertise, can you point me in the right direction to learn more about these response status? Sam Sam
Re: apache module or CGI
On 3/26/07, Joe Lewis <[EMAIL PROTECTED]> wrote: (Sam - is this supposed to be "O.S. independent"? Are you shipping the source code?) Joe, Relatively OS independent: Windows, OSX, and Linux, maybe other flavors of BSD (myself being an BSD fan). Sam
Re: apache module or CGI
On 3/26/07, Ralf Mattes <[EMAIL PROTECTED]> wrote: And there _are_ response status that indicate a lengthy content generation ... Can you expand on this a bit more, what are the response status? I have no problem looking them up to learn about them, I just need to know what to look up;) Since the OP seems to feel comfortable in C/C++ I'd write a custom handler module that generates the scaled image on the fly and saves it into a cache. Ralf, You are correct, I am very much at home in C/C++. Other then C#, other languages are much less comfortable for me;) It looks like there is a lot of infrastructure code that is needed when implementing an apache handler module and a whole new "framework" to learn. Is the work worth it compared to CGI (maybe FastCGI) for what I am doing? That is the million dollar question I am seeking;) Sam
how to get started?
Ok folks, I am developing on Windows. I have VC6, VS2005, and Cygwin installed. I would prefer ot use VS2005, but VC6 will work, Cygwin is a last resort, VERY last resort. I first thought I would try Ralf's advice of running apxs -g -n fancy_image_handler, but I cannot find apxs on my Windows machine. I then figured, ok well, I will scrap the whole apache module and just do a FastCGI, but I like the idea of using the APR, but darn it to heck, I cannot find ANY documentation on it. I have blown my whole evening mucking around with this and getting NO where, can anyone help me out? -- 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: how to get started?
Ok, I have apxs installed!! I have created a basic project called fancy_image_handler, when I follow the instructions in the comment of the mod_fancy_image_handler.c, here is what I am getting: D:\Temp\fancy_image_handler>apxs -c -i mod_fancy_image_handler.c cl /nologo /MD /W3 /O2 /D WIN32 /D _WINDOWS /D NDEBUG -I"C:\Apache2.2\include" /c /Fomod_fancy_image_handler.lo mod_fancy_image_handler.c mod_fancy_image_handler.c link kernel32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"C:/Apache2.2\lib" /out:mod_fancy_image_handler.so mod_fancy_image_handler.lo Creating library mod_fancy_image_handler.lib and object mod_fancy_image_handler.exp mod_fancy_image_handler.lo : error LNK2001: unresolved external symbol [EMAIL PROTECTED] mod_fancy_image_handler.lo : error LNK2001: unresolved external symbol [EMAIL PROTECTED] mod_fancy_image_handler.so : fatal error LNK1120: 2 unresolved externals apxs:Error: Command failed with rc=6291456 . By the way, thanks a million for getting me this far! I really appreciate it! Sam
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-a86ae7804d5c&imgoid=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: On Mon, 2007-03-26 at 22:05 -0400, Sam Carleton wrote: > Ok folks, > > I am developing on Windows. I have VC6, VS2005, and Cygwin installed. > I would prefer ot use VS2005, but VC6 will work, Cygwin is a last > resort, VERY last resort. I first thought I would try Ralf's advice > of running apxs -g -n fancy_image_handler, but I cannot find apxs on > my Windows machine. Oh, I'm terribly sorry. I only recalled on my way home that you're running on Windows. Not a problem I got it worked out;) I can't comment at all on Windows development - never done it. Iff you want your module to run on Unix/Linux as well it might be a good idea to install VMWare Player and live images for Linux(Ubuntu), Solaris and NetBSD/OpenBSD. 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. There are two issues, equally big, in terms of me doing the development on anything other then Windows: 1: The GUI frontend to the system is all 100% Windows right now, even though the web side can stand on it's own, it would be a pain to have to go back to windows all the time to change the data feeding the kiosk. 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. The way I see it, I will make my best effort to keep the module platform neutral. I am thinking about taking the time to learn how to setup the module with, I think it is called, automake, so that I can see if I can get it to compile and run on one of the other platforms I have, but if it takes too much time, I am willing to shelve it for now, it just means there might be more work later to fix the bugs when I take the GUI cross platform. Can anyone point me to some good, quick and easy documentation to setup an automake project? 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 time). 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: 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.
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?
Ok, I will stick with good old VC6. Thanks. On 3/28/07, Issac Goldstand <[EMAIL PROTECTED]> wrote: Do yourself a favor, and use VC6. Honestly, I've used 2003 also without problems here, but 2005 gives headaches (though hopefully one of the fixes to the bleeding edge apxs on win32 fixes that). Issac Sam Carleton wrote: > 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 -- 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: 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
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
concern about memory management
Folks, I am looking at using the deviL graphics library to downsize the images in the apache module I am developing. Currently it manages it's own memory, I don't know the details, though. Am I getting carried away with wanting to simply up and replace its current memory management system with the apache pools? Sam
translate_name and/or map_to_storage hooks
On 3/27/07, Sam Carleton <[EMAIL PROTECTED]> wrote: 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. Issac, I am not exactly sure how I would leverage either the translate_name hook or map_to_storage hook. The best I can figure is that I should hook translate_name and this is the translation: /coolapp? --> /coolapp?type=index& /coolapp/images? --> /coolapp?type=image& Do I have the right idea? Sam
Re: translate_name and/or map_to_storage hooks
On 4/4/07, Sam Carleton <[EMAIL PROTECTED]> wrote: On 3/27/07, Sam Carleton <[EMAIL PROTECTED]> wrote: > 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. Issac, I am not exactly sure how I would leverage either the translate_name hook or map_to_storage hook. The best I can figure is that I should hook translate_name and this is the translation: /coolapp? --> /coolapp?type=index& /coolapp/images? --> /coolapp?type=image& Do I have the right idea? I have been trying to move forward with the assumption that I am on the right track and continue to run unknowns. How do I identify coolapp as the location? In other words, I have this in my httpd.conf: SetHandler my_cool_app Inside of the translate_name hook, how do I go about determining that /coolapp is the location? Sam
Re: translate_name and/or map_to_storage hooks
On 4/5/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: On 05/04/07, Sam Carleton <[EMAIL PROTECTED]> wrote: > > 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. Probably because you haven't allowed Apache access to the images directory. Ie., you still need to have something like: For starters, the objective is to do away with the PHP code altogether, I don't think I will do that in the first round, just replace the image handler, but I am thinking long term;) The way I have it configured is this: SetHandler mod_my_cool_app I don't understand your comment about not allowing Apache access to the images directory, for starters, from the perspective of Apache, there isn't an images directory, it is elsewhere on the machine that Apache does not have and will not have access to, it is a security thing. But I don't think that is really relevant to the problem. When I type in /coolapp/images in a browser, my module does get called and the URI is /coolapp/images, why is it when I simply set the request's filename (r->filename) to "images" I get a 403? Apache did not have a problem with /coolapp/images, why would it have a problem with /coolapp/images/images? Or does filename mean something different? As I have told others on this wonderful mailing list, my 12+ years of software development have been in GUI development, not web. I have always played with web stuff, but this is my first serious web project and it is for my own new company! Ultimately I am trying to figure out, within the world of Apache modules, what is the best way to distinguish between the different "general" flow paths in my module. One being to generate HTML and the other to generate images. To the end user, I would like the URI for pages to simply be / and the URI for the images to be /images. As it stands right now, I am thinking the easiest way is to simply check to see if the URI is or /images inside of the main handler. Someone else said that the right way to do it is to do this checking in the translate_name hook. Unless I am able to be enlightened, which is questionable, I think I will do it the first way:( 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/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
"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 SetHandler mod_my_cool_app 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: "one module per task"
On 4/9/07, Joe Lewis <[EMAIL PROTECTED]> wrote: Sam Carleton wrote: > When Apache sees > > > SetHandler mod_my_cool_app > > > 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 much). Thanks! 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
controlling access
Ok, folks, I need some advice. It has been a while, so let me recap what I am doing: I am working on a packaged software that is a kiosk based system. It's main purpose is to serve up images. PHP code currently generates the HTML that has img tags that point to the Apache Module. For now, this phase of things is complete! Now I need to deal with access. Depending on which version of my software determine the access. Basic rules: must use custom kiosk browser that has a custom user-agent and can only have two access the site within one minute. Standard rules: Unlimited connection using the custom kiosk browser, no access with other browsers. Advanced rules: All access (the Apache Module will watermark the images when the browser is not the custom kiosk browser) If access is denied, I want to redirect the browser to a friendly page informing the user of what is going on. * Where should I be hooking to control this access? * What is the best approach to redirect the user to a friendly page? Sam P.S. After much thought I have concluded that, even though the user-agent string is very easy to change, it is a very low security risk because those that would want to hack it are my customers customers, the end user, as to get the images without watermarks. They won't have the physical access to learn the proprietary key for the system, so something as basic as user-agent should work just fine!
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
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
Re: process pool does not work
Zeus, I am VERY new at Apache Module writing, myself, but they always say the best way to REALLY learn it is to teach it. I am going to make a guess at this one and I hope the true GURUs will correct me if I am wrong. You did not mention anything about create per-server config structures, are you? I *think* that might be your problem. One thing I learned is that if you have directory configuration stuff, you do need to implement the merge per-dir config to merge the server config structure with the dir config structure. That one took me some time;) I hope this is helpful, if not, I KNOW the GURU's will chime in, once they wake up;) Sam On 5/15/07, Zeus Capricorn <[EMAIL PROTECTED]> wrote: Hi,folks. i want to log the online user's ip in the apache memory and check it through a specific url. first,I use ap_hook_process_connection to log the user's ip and the time,and i use ap_hook_handler to check the result. in the callback function of ap_hook_process_connection,i allocate my_hash(a apr_hash_t) in the pool(c->base_server->process->pool) if my_hash is NULL,and set the c->remote_ip as key,a point to the time now as value. in the callback function of ap_hook_handler,i use apr_hash_next() to get the value one by one. it works not as what i supposed to do .every client which access my specific url can only see his own ip and time,not ALL the clients. could someone help me ?should i use another pool,or something else? thanks in advance. -- 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.
VOT: Tracking users
Gentleman, This is VERY off topic, but it is a Q for guru's and when I think of web guru's I think of my fellow apache module developer. If I am totally out of line asking this here, please be a kind sole and give me some guidance as to where I should be asking this question, fore I know not where to ask other then here... There is this web site I like to frequent. For some reason it has blocked my main workstation from being aloud to post on it. When I login with the same user id/password on any other machine, including virtual machines I am able to post with no problem. Initially I thought it was blocking based on cookies. But both IE7 and Firefox are blocked on the same box. Then I thought it was blocking based on IP address, but my current network is behind a OpenBSD firewall running NAT and any other machine behind the firewall is able to post just fine. Then I thought it was something else that was browser specific, until I just installed the Safari client on the main workstation and the first attempt to post with that browser was ALSO blocked! I even when so far as to think it might be using both the firewall's IP address and the internal IP address of the workstation, so I changed the internal IP address, still blocked, even though virtual machines and other real machines behind the firewall/NAT server post just fine. So I am completed stumped, how is this site blocking my one workstation? What piece of info being sent to the web server by all three browsers that is a common, unique per OS instance? Oh, I am running Win XP SP2. Sam
finding a crash
I have a really annoying bug in my code somewhere, I don't know where. To top it off, it is not consistent! My first thought is to simply rewrite the whole thing, it isn't a major peice of code and I think I got a bit carried away in making it C++ when it should really be simply C code, but... I though I might ask here first if there are any clever tricks to finding crashes... I am working in Windows XP with VC6, so I am able to debug the code. When it crashes, all that I can determine is that one of the pointers in the conf structure is invalid. What is really strange is that this code will work for hundreds of calls but then all of a sudden it simply crashes. What is the best approach to try to find this bug? Are there any special tricks folks could pass on to me? Sam
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
Re: Passing parameters to PHP
On 8/15/07, Brian J. France <[EMAIL PROTECTED]> wrote: > > On Aug 15, 2007, at 3:46 PM, Sam Carleton wrote: > > Is there any way for my apache module to pass parameters in such a way > > that my php code can get at them? > > Stick the data in r->subprocess_env and PHP can access them via > $_SERVER (or apache_getenv if $_SERVER is disabled). I finally got around to using this useful piece of info last night and it worked like a charm! I do have a question though, once it is set, does it stay for the life of Apache or just for that request? Sam
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: 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.
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
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
Web Services programming examples
Where might I go to find an example of an Apache C Module that implements a Web Service? 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.
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
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
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
Access checker not setting environment after RewriteRule
My Apache 2.0 C module is doing a few things. One of the things it is doing is hooking the access checker. In the access checker a configuration file is read in to determine access and key/value pairs are added to the request_rec->subprocess_env so the PHP code to pick up the values as $_SERVER variables. This works fine while the url was something simple like this: http://localhost/index.php?fldoid=258a2b0a-b413-4815-8bf6-fbe6c2a9760d I want to start using some rewrite rules, to leverage browser caching, so I changed the URL to: http://localhost/category/258a2b0a-b413-4815-8bf6-fbe6c2a9760d And added this rewrite rule to the of the document root: RewriteRule ^category/([^/]*)$ index.php?fldoid=$1 [L] The access check hooker is getting called, but when the PHP executes, the $_SERVER variables I need are not defined. Sam
Re: Access checker not setting environment after RewriteRule
On Sat, Mar 22, 2008 at 9:44 PM, Nick Kew <[EMAIL PROTECTED]> wrote: > On Sat, 22 Mar 2008 20:56:03 -0400 > "Sam Carleton" <[EMAIL PROTECTED]> wrote: > > [why access checker for this function?] I didn't really know where else to put it, had not done my reading, which I just got done with now;) Looks like I should add an type_checker hook and if it is a PHP file, setup the environment for the PHP code. > > This works fine while the url was something simple like this: > > > > http://localhost/index.php?fldoid=258a2b0a-b413-4815-8bf6-fbe6c2a9760d > > > > I want to start using some rewrite rules, to leverage browser caching, > > so I changed the URL to: > > > > http://localhost/category/258a2b0a-b413-4815-8bf6-fbe6c2a9760d > > Um, what browser is so broken as to let that affect it? I *thought* browsers cached at the page level, not at the parameter level, in other words I thought that as the fldoid changed, the browser would still simply see that as index.php. So I though that by making it look like folders, the browsers would cache it better. > The RewriteRule triggers an internal redirect. Since you put it in > a , that happens after the access checker. The > subprocess_env vars you set remain with the original request_rec. After some thought, I had a feeling that was what was going on;) Question, how do I make sure that my type_checker gets put in front of the PHP type_checker, if there is one? Is my impression correct that it should be wired in like this: ap_hook_type_checker(my_type_checker, NULL, "php5_module", APR_HOOK_FIRST); And it should ALWAYS return DECLINED? Sam
Converting apr_finfo_t.mtime into a Unix timestamp
My PHP code needs to set the if_modified_since header, but to set it, it needs to consider two times, one of it's data source, but also of a configuration file that is only known to the Apache C Module. Already I am passing a number of variables to the PHP code via the r->subprocess_env, and I would now like to also pass the apr_finfo_t.mtime of the config file, but in a format that PHP can understand. In the PHP code, I am going to be using filemtime() which returns a Unix timestamp. How can I convert apr_finfo_t.mtime into a Unix timestamp? Sam
Re: Converting apr_finfo_t.mtime into a Unix timestamp
On Sun, Mar 23, 2008 at 8:24 PM, Joe Lewis <[EMAIL PROTECTED]> wrote: > > I ran into this just this afternoon, and I am still looking for an > answer, but what I have found may be helpful. > > What I found is that there is an apr_time_ansi_put converts a time_t to > an apr_time_t, but the only thing that may convert the apr_time_t into > the number of seconds since Jan 1st 1970 is apr_time_sec(apr_time_t) . > > With you looking to set a header (a text string), you may want to > consider using apr_rfc822_date() to take the apr_finfo_t.mtime and turn > it directly into a string and then just set the header to that value. Joe, Thank you. I actually do want the Unix timestamp format. (Which is the Jan 1st 1970, isn't it?) In the PHP code, it looks at dates based on the unix timestamp format to determine which is the latest and then converts it to a string. 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.
C/C++ MVC framework
I was just wondering if anyone had ever developed a MVC framework in either C or C++ to develop Apache modules. They seem to be out there for most other languages, why not one for Apache C Module! 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
Re: [MODULES]apache running slow in production
On Fri, Mar 28, 2008 at 3:50 PM, Michael Thomas <[EMAIL PROTECTED]> wrote: > > Get them to look at what memory/cpu allocation running at on their box? > Can they run a test from the box itself (ie. eliminate the network as a > possibility) Good questions. Already checked both: while Apache is serving up the 12 images, the CPU is at 100%, when it is done, the cpu goes right back down, even when hitting it from the server. Sam
Re: [MODULES]apache running slow in production
On Fri, Mar 28, 2008 at 5:38 PM, Joel Westerberg <[EMAIL PROTECTED]> wrote: > I would suggest running strace or ptrace on it during that request. Opps, I forgot to mention that it is running on Windows.
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=$1&imgoid=$2 [L] RewriteRule ^/images/([^/]+)/([^/]+)/([^/]+)$ /theImage?fldoid=$1&imgoid=$2&tn=$3 [L] SetHandler promenadeImages 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
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
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: 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
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
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 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 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 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?
unresolved external ap_lookup_provider...
I am trying to consume mod_auth_basic.c in my own module. Everything is fine except when linking I am getting the error: 1>mod_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
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: > > 1>mod_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 >
Stopping Apache when configuration directive is wrong
Under some circumstances, the value read into my directive will be invalid and thus Apache should NOT continue to execute. What do I need to do to tell Apache to stop executing?
ap_find_linked_module() to get the core_module config block
Anyone know if it is possible to get the core_module config block (core_server_config) by calling ap_find_linked_module()? If so, what string do you pass it? Sam
Setting a handler within a configuration directive
Is there any way to *hide* configuration? I would like to set a handler within a configuration directive. Can it be done? 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? Sam
Re: Setting a handler within a configuration directive
Rick, You are absolutely right on all accounts. The only problem is that I am a one man shop and I simply don't have the resources to have multiple distributable. I prefer taking the risk of folks hacking my software then have multiple distributable. What is that saying, a lock only keeps the honest man honest. Those that are going to steal my code are going to steal it no matter what I do, well I could go to extremes to protect my code, it just isn't that widely used to be worth the effort. I did find what appears to be a good workaround last night after posting the question: My handler checks to see if the authentication is set to basic, if not, my handler is declined, thus, in theory stopping my handler from running if the user removes the AuthType from the location where the hander is set. I would still prefer to hide the setting, but if there is a even better way, I am all ears! 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
understanding apr_strtok()
I am trying to use apr_strtok() for the first time. I am taking the add_cookie() function from mod_rewrite.c, no changes. I am passing in the string, variable 's': KioskViewingStation:KVS_VERSION::5 The first line that executes in the function is: char *tok_cntx; var = apr_strtok(s, ":", &tok_cntx); I am getting an access violation. I have tried initializing tok_cntx to NULL, but that does not seem to have any impact. What is the correct way to use apr_strtok()? Sam
Re: understanding apr_strtok()
On Sat, Dec 13, 2008 at 2:35 AM, Saju Pillai 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
internal redirect
I thought I had seen a way to do an internal redirect in a module such that the browser would never be the wiser. Is there? If so, how do I do it? The reason is that I have coded myself into a hole. I have a kiosk based system using Apache as the server and a custom application that wraps the IE7 WebControl as the client. I have made changes to both client and server that checks the versions of both and makes sure they are in sync. The in the module is done in the access checker hook. Right now I am using the standard HTML Location header to redirect to the error page. The problem I have is that the client that is in the field sees that as an error and displays my almost useless error box to my customer, not a nice web page to inform them to upgrade the client. So the question is: Within the access checker hook, how can I change the URL for this request so the browser sees a successful request but gets a different page? Sam
Re: internal redirect
On Sat, Dec 13, 2008 at 1:04 PM, Sorin Manolache 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: internal redirect (compiling Apache with VS2008)
On Sun, Dec 14, 2008 at 4:03 PM, Sorin Manolache 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 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
[OT] increasing log output
This is a bit off topic. I am the author of a propriety apache module for my custom kiosk style application. I have a prospective customer that is having problems and I cannot figure out how to get additional logging information from Apache. Here is the console output: - 1: [Fri Feb 20 20:04:13 2009] [notice] Disabled use of AcceptEx() WinSock2 API 2: [Fri Feb 20 20:04:13 2009] [notice] Name: 3: [Fri Feb 20 20:04:13 2009] [notice] SerialNum: 4: [Fri Feb 20 20:04:13 2009] [notice] Key: 5: (OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : make_sock: unable to listen for connections on address 0.0.0.0:80 6: no listening sockets available, shutting down 7: Unable to open logs - The 2nd,3rd, and 4th lines are all output by my module, I have him run netstat to check to see what is running on port 80, but there isn't anything. In the past I have seen Apache dump huge amounts of data, I am trying to figure out how to do that so I solve this problem. Any help is much appreciated! Sam
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?
[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 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. >
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?
Joe, Thank you for the quick reply. I added some logging to my ap_hook_access_checker because I know that is called VERY early in the process. When I have a breakpoint on that code, the first time it hits, I remove the break point and let Apache run free. The C#.Net code (WCF) looks like it hangs for about 3 to 6 seconds and than it takes off and runs correctly. When I check the log, the new log entry is there many a times, as it should. When I remove the breakpoint, the new log entry in my ap_hook_access_checker only logs info one time, but TCPMon has two request/responces: --- Begin Requests --- POST /axis2/services/CatalogMgr HTTP/1.1 Content-Type: text/xml; charset=utf-8 VsDebuggerCausalityData: uIDPowW9sDridQlJho6+2Szzk0cAusYZdc1RxUy3/sYItJEwLhXxmhT+gxBNoyrmmgxvUc4ACQAA SOAPAction: "urn:mmpp:catalogmgr/getNode" Host: 127.0.0.1:8041 Content-Length: 337 Expect: 100-continue Connection: Keep-Alive http://schemas.xmlsoap.org/soap/envelope/";>http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd=" http://www.w3.org/2001/XMLSchema";>trueSam POST /axis2/services/CatalogMgr HTTP/1.1 Content-Type: text/xml; charset=utf-8 VsDebuggerCausalityData: uIDPowW9sDridQlJho6+2Szzk0cAusYZdc1RxUy3/sYItJEwLhXxmhT+gxBNoyrmmgxvUc4ACQAA SOAPAction: "urn:mmpp:catalogmgr/getNode" Authorization: Basic UFZG1pbi1TY06a25bm0ZQ== Host: localhost:8041 Content-Length: 337 Expect: 100-continue http://schemas.xmlsoap.org/soap/envelope/";>http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd=" http://www.w3.org/2001/XMLSchema";>trueSam --- End Requests --- --- Begin Response --- HTTP/1.1 401 Authorization Required Date: Sat, 02 May 2009 18:59:28 GMT Server: Apache/2.2.11 (Win32) Axis2C/1.6.0 PHP/5.2.5 WWW-Authenticate: Basic realm="Photo Parata Authentication" Content-Length: 401 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=iso-8859-1 401 Authorization Required Authorization Required This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required. HTTP/1.1 400 Bad Request Date: Sat, 02 May 2009 18:59:28 GMT Server: Apache/2.2.11 (Win32) Axis2C/1.6.0 PHP/5.2.5 Content-Length: 226 Connection: close Content-Type: text/html; charset=iso-8859-1 400 Bad Request Bad Request Your browser sent a request that this server could not understand. --- End Response ---
Re: error in the auth code? (I think I found the key piece of info)
Ok, I think in my last email I covered up the actual problem by adding a CRLF. In the apache log file I am getting this: Invalid URI in request http://schemas.xmlsoap.org/soap/envelope/";>http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd=" http://www.w3.org/2001/XMLSchema";>trueSamPOST /axis2/services/CatalogMgr HTTP/1.1 If you look at the very end, there is the beginning of the second request: POST /axis2/services/CatalogMgr HTTP/1.1 How can these two requests get run together like this? Is some buffer in my Apache module not getting cleared correctly or is the client doing this? Remember the client is simply WCF C#. 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 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 wrote: > > The question is... How do I do that? > By calling ap_discard_request_body(r) in the correct location!
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 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 ServerName apache.my-domain.org ServerName iis.my-domain.org ProxyPass / http://internal-IP-of-IIS-server/ 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 ProxyPass http://internal-IP-of-IIS-server/ 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.
[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
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 wrote: > On Sun, Nov 15, 2009 at 3:44 PM, Sam Carleton > 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 >
What is needed to distribute a Axis/2 Client
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: What is needed to distribute a Axis/2 Client
opps, wrong mailing list :) On Thu, Dec 10, 2009 at 11:18 PM, Sam Carleton wrote: > 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: Finding memory leaks in httpd and httpd modules
On Tue, Feb 16, 2010 at 2:35 PM, Kevac Marko wrote: > On Tue, Feb 16, 2010 at 10:12 PM, 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: [OT] Apache on Windows, how many processes?
Eric, Interesting, so what purpose does the parent process preform with MPM winnt? Is it just legacy? Sam On Mon, May 3, 2010 at 11:56 AM, Eric Covener wrote: > > On Mon, May 3, 2010 at 11:47 AM, Sam Carleton > wrote: > > 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? > > > > winnt MPM is Limited to 1 child (and 1 parent) > > -- > Eric Covener > cove...@gmail.com
strtoul_is_not_a_portable_function_use_strtol_instead
I have spent the last 2 hours looking for strtoul in my code, it isn't there but I keep getting the Apache error that it is there. I am using VS2008 SP1 and am compiling the code as C++. Any thoughts on where I might find strtoul? By hacking the http.h and removing the code, it compiles so I am going to move forward with that until I can find the correct solution.
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.
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
Re: how to best implement my own connection pool
apr_reslist is what I am looking for, but you do seem to be right, mod_dbd should provide all the plumbing I need. I just need to wrap my head around it. Thank you! Sam On Feb 18, 2012, at 7:27 AM, Nick Kew wrote: > > On 18 Feb 2012, at 01:53, Sam Carleton wrote: > >> 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. > > Skimming through your post, it's not clear what you want that mod_dbd > doesn't provide. Why not focus on that question? Once you've identified > the gap, one approach might be to enhance mod_dbd, and if anything > of general interest emerges, maybe propose it for inclusion upstream? > > The other answer is, the easy way is to use apr_reslist, which is what > mod_dbd does. > > -- > Nick Kew