[OT] Apache on Windows, how many processes?
I know in the *nix world that Apache forks different processes and in Windows it is threaded. I was load testing my Windows Apache Module with 50 clients and it never started up a second process, though the thread count did surpass the 50, it went to 53. I am assuming the other three threads where maintenance threads that are not counted in the thread pool. My question is: Will Apache on Windows start up more then one worker process? If so, what does it take to get that to happen?
Re: internal redirect
On Sun, Dec 14, 2008 at 6:37 AM, Sorin Manolache wrote: > I think the 500 was caused by an infinite loop: > if (!ap_is_initial_req(r)) > return DECLINED; > const char *note = apr_table_get(r->notes, "my_note"); > if (note != 0 && strcmp(note, "should_redirect")) > ap_internal_redirect(h, "/invalidClient.html"); I am with you and I see the loop in my code. I am doing things a little different, I am setting the note to the redirect uri: if (!ap_is_initial_req(r)) return DECLINED; const char * redirection = apr_table_get(r->notes, "promenade_redirect"); if( redirection) { ap_internal_redirect( redirection, r); return OK; } return DECLINED; The check at the beginning is short circuiting the handler correctly, but I am still getting a status code of 500. Any thought? Sam
developing custom authentication module
I am ISV developing a system that is using Apache. All the frontend's for system I am developing are all custom desktop applications, or web browsers controls wrapped in my own code. Thus users are not going to be entering username and password, the username and password used will be depended on which frontend being used. It is time for me to implement authentication correctly. I have two objectives with respect to authentication: 1: Protect my customers from unauthorized users. 2: Protect myself from customers hacking the authorization system to get access to features in which they have not purchased. #1 looks straight forward: If my impression is correct, I simply need to implement my own custom provider to check the custom username and password the frontends give it. Q: Is there documentation out there somewhere on how to implementing a new provider? #2 looks a lot more tricky. It seems that I will need to deviate from the normal way Apache's authentication works. For starters, NONE of the configuration can be in the http.conf, not like it is now with AuthType, AuthBasicProvider, etc. There is a 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?
Re: how to append to strings...
On 11/30/07, Arturo 'Buanzo' Busleiman <[EMAIL PROTECTED]> wrote: > I don't quite like the bucket brigades stuff (at least for input > filters), but it's good enough. > I am open to other ideas... All I am trying to do is read in the text element from some XML via expat. The expat parser can break up text elements into multiple pieces; I am simply looking for the best way to build the string. The text is simply a relative path that normally is going to be less then 260 bytes. What approach would you take to build this string? Sam
Re: how to append to strings...
On Nov 30, 2007 5:25 AM, Arturo 'Buanzo' Busleiman <[EMAIL PROTECTED]> wrote: > You might be talking about bucket brigades. You can create a brigade, > transform > each string into a bucket, then insert/append after/before another reference > bucket, > etc. > > This will give you an idea: > > http://www.onlamp.com/pub/a/apache/2001/09/20/apache_2.html That is exactly what I was think about! I read the article and read through the apr_buckets.h and am still seeking more info. Does anyone know if any of the existing modules use a simply bucket system to build a string as an example for me? Sam
how to append to strings...
I am rewriting part of my module to use expat, a parse I have used in years gone by. I know it, I sort of even like it and my XML is pretty simple, except... I need to extract one text element. I know that even though the text I need is in one continues line in the XML, expat can and at times will call my handler multiple times for that one continues string. The question is: What is the correct way to append all the pieces of XML that I am going to get from expat into one string? I recall reading somewhere that Apache has a really slick way of being able to break up a string into pieces so that one can quickly inject something in the middle without having to move any memory around. What ever it is called, I am thinking that is the right solution: build an array of the strings and use this feature of apache to put them together. Am I on the right track? If so, can someone enlighten me as to what exactly I should be looking up in my "Writing Apache Modules with Perl and C" book? Sam
Re: Apache 2.0 module skeleton
On Nov 15, 2007 11:05 AM, Joe Lewis <[EMAIL PROTECTED]> wrote: > Graf László wrote: > > Hi all, > > > > Can somebody give a project skeleton for Apache 2.0 module? > > The tool is apxs. Google it for more information. You might even find > a link that looks like : [snip] > DISCLAIMER : I have not run this on Windows due to myself not being a > proponent of the said OS. I cannot verify if this tool actually works > in this environment. I am by no means a proponent of said OS, but I am a 13 year veteran of developing code for said OS and developer of one Apache Module on said OS. I can confirm that the apxs tool does most definitely work on said OS. Follow the directions and you should be fine, I was;) Sam -- The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
server side includes
As I sit here on hold, I started thinking about my little apache module again. I recall reading in "Writing Apache Modules in Perl and C" how with Perl it is quick and easy to create a server side include handler, I think that is what it was called. How would one go about doing that in a C module? Are there any examples? Sam -- The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
Re: translate_name and/or map_to_storage hooks
On 4/4/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: I missed out on the start of this conversion so really don't know what you are trying to do I have one module that does a few different things. 1: create a index html document of images 2: create a page html document of one image (when user clicks on an image in the index) 3: Handle the image request that are in the HTML of #1 and #2 and send out all the images. Right now I have it all written in PHP, there is a index.php for #1 and #2 and an imageHandler.php for #3. I am trying to understand the best way to separate this logic within my one module. Someone else suggested I look at hooking translate_name. I found my answer to how to determine the location, so I have been playing with it since my post and when I set the r->filename = "images"; and return OK, I get a 403 Forbidden. why aren't you just using mod_rewrite? This is going to be packaged software and I would, ideally, like to keep it all self contained so that end users that decide to start hacking things, cannot get too far.
Re: concern about memory management
On 4/3/07, Burak Arslan <[EMAIL PROTECTED]> wrote: afaik, apache does not offer a proper free() function, which might cause problems with image processing modules(if you're processing multiple images per connection). so i'd not attempt to hack that library only to get the same functionality as before. your call, though. I have not dug deeply into the Apache pools, yet, but... My impression was that I could create use sub pools to get the same effect as free(). My whole sole objective here is to speed up the image processing, my thought is that by using the Apache pools, the memory aspect of the process will be faster.
a thanks and C++ new overloading
Folks, I want to say thank you for taking the time to help me out with getting my module up and going. It is so VERY refreshing to be developing in such a well thought out and structured environment. By day I am working in VB.Net on different small projects where the project leads attitude is: Get it done, don't make too many new modules/class because it will be too complex for me (boss) to understand when you leave. Having the structure of the apache module is the complete and total opposite and very very refreshing! It is also exposing me a little bit to how to make a module system, which I will ultimately need to do for the GUI side of my app. It is all good, very good! Thanks for directing me this way! Last night I did successfully setup a C++ new overload that takes an apache pool. (When used correctly, C++ is simply WONDERFUL!) The question is: How best to make the code reusable? What do I mean? Well, the next version of the GUI is going to be written in C++, there is going to be a lot of code that can and should be shared between the module and the GUI. I just cannot figure out how best to setup the common code to allocate memory for different locations. Any suggestions? Sam
Best way to debug
yea, I tried installing mod_perl and I still got the same problem. I finally simply tried nmake install and it worked, despite the perl error;) So I was up to 1am working on my new apache module! I recall beating my head agaisnt the wall last time I tried writing an apache module, but that was back in the 1.x days, on *NIX, not my native platform, and without a debugger. Today on Windows with a debugger, things are running very smoothly! I do have a debugging question: As we all know, when you fire up httpd, it starts at least one more instance. If I am not mistaken, on Windows it is only one more. When I try to debug in VS6, it attaches to the first instance of httpd, not the one that I actually want to debug. VS6 lacks the ability to debug multiple programs at one time, so... I am using VS2005. This is what I am doing... 1: Compiling on VS6 2: Go to a command window and starting httpd 3: Go to an instances of VS2005 and attaching to both instance of httpd [debug] 4: When down debugging, I deattach VS2005 from the httpd 5: Go to the command line and press + Is there any why to have httpd start up such that it does not start a second process so that I can simply debug with VS6, skipping steps 2 through 4? If no, so be it, it would simply be nice;) Sam On 3/28/07, Issac Goldstand <[EMAIL PROTECTED]> wrote: Ick. The Perl glue likes to take over like that on windows. Try running win32\Configure.pl (directly) and passing --disable-perl-glue. (Or make life easier on yourself by building and installing mod_perl first - you don't need to use it afterward)
reference out of date?
Many moons ago, around 2001 I believe, I purchased the book "Writing Apache Modules with Perl and C" by Lincoln Stein and Doug MacEachern. I have not dug it up yet, but I am guessing that it was written for Apache 1.x. For my needs, handling basic requests, will it be out of date? Sam