This is a discussion on Apache Module - URI->Filename translation phase woes within the Apache Web Server forums, part of the Web Server and Related Forums category; Hello there, I wonder if someone could point me in the direction of a set of simplistic tutorials on apache ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello there,
I wonder if someone could point me in the direction of a set of simplistic tutorials on apache module writing in C. I've had a squizz through the apache site and chugged through "Writing Apache Modules in Perl and C" (good book, but not really a tutorial!) but have a few problems I just can't get to the bottom of! My problem I thought originally could be resolved using mod_rewrite, but after much swearing I can see why the original implementor opted for writing a module (of which the source cannot be found, hence me being here asking silly questions). We've basically got a load of user webspace mounted on nfs, usernames are in the format firstname.lastname, resulting in a url http://server.com/user.name/ The actual files for each customer are stored in a hashed directory structure, picking first letter of first name (f) and first letter of last name (l), located (in the above example) /www/visp/f/l/firstname.lastname/docs/ There are exceptions, eg. if a user's name doesn't have a . in it then its dumped into /www/visp/f/z/firstnamelastname/docs/ I've written a module that manages to split out these correctly and even generate the correct physical filename on the filesystem, but I'm not sure if I'm even using the correct process (simply setting r->filename before returning from the handler) and have come across a few snags: 1) I understand that handlers in the uri->filename phase can't be stacked in apache 1.3, so when I complete and do a return OK, the auto indexing module doesn't get called, so all of the files are visible. 2) If the user doesn't put a trailing / on the URI, all of the files that are listed are linked incorrectly. eg. if the user calls http://server.com/john.smith and then selects the file "example.html" apache tries to call http://server.com/example.html , if the user calls http://server.com/john.smith/ and then selects the file "example.html", apache correctly calls http://server.com/john.smith/example.html I'm basically looking for help! Any online resources or suggestions to the best way to approach this would be appreciated. I can email the source if anyones interested :D cheers, Matt |
| Thread Tools | |
| Display Modes | |
|
|