Okay, I was seeing requests for index.html.en as well, but figured it was 
because of the odd way I was testing it overlaid on DocumentRoot where index 
stuff may have been set up. I didn’t try ensuring DirectoryIndex was off and 
was hoping it would just work. :-(

I will have to play some more with that approach later then, when I am supposed 
to be awake, and not at this ridiculous jet lagged induced early morning wake 
up time.

Graham

> On 30 Sep 2015, at 4:21 am, Josh Rodriguez <[email protected]> wrote:
> 
> Hmmm, just tried that. For some reason, it's redirecting WebDAV requests to 
> /.special-listing/index.html...but I've turned the default Directory Listing 
> page option off...
> 
> 
> 
> On Monday, September 28, 2015 at 11:41:54 PM UTC-7, Graham Dumpleton wrote:
> Perhaps mod_rewrite then.
> 
> WSGIScriptAlias /.special-listing /Library/WebServer/Documents/environ.wsgi
> 
> #Script GET /.special-listing
> #Script POST /.special-listing
> 
> RewriteEngine On
> RewriteCond %{PATH_INFO} !^/.special-listing
> RewriteCond %{REQUEST_METHOD} GET [OR]
> RewriteCond %{REQUEST_METHOD} POST
> RewriteRule (.*) /.special-listing$1 [PT,L]
> 
> Graham
> 
>> On 29 Sep 2015, at 4:26 pm, Graham Dumpleton <graham.d...@ <>gmail.com 
>> <http://gmail.com/>> wrote:
>> 
>> Oh, didn’t know that. I only tested overriding for POST case with GET being 
>> the one which goes through normally.
>> 
>> Let me think some more then.
>> 
>> Graham
>> 
>>> On 29 Sep 2015, at 4:20 pm, Josh Rodriguez <hoba...@ <>gmail.com 
>>> <http://gmail.com/>> wrote:
>>> 
>>> Hmm, not sure that this is going to work...not having luck getting the GET 
>>> script to run...
>>> 
>>> According to the mod_actions documentation:
>>> 
>>> "Also note that Script with a method of GET will only be called if there 
>>> are query arguments present (e.g., foo.html?hi). Otherwise, the request 
>>> will proceed normally."
>>> 
>>> 
>>> 
>>> 
>>> On Monday, September 28, 2015 at 6:36:58 PM UTC-7, Graham Dumpleton wrote:
>>> 
>>> > On 29 Sep 2015, at 11:21 am, Graham Dumpleton <graham.d...@ <>gmail.com 
>>> > <http://gmail.com/>> wrote: 
>>> > 
>>> > 
>>> >> On 29 Sep 2015, at 11:17 am, Graham Dumpleton <graham.d...@ <>gmail.com 
>>> >> <http://gmail.com/>> wrote: 
>>> >> 
>>> >> 
>>> >>> On 29 Sep 2015, at 10:38 am, Josh Rodriguez <hoba...@ <>gmail.com 
>>> >>> <http://gmail.com/>> wrote: 
>>> >>> 
>>> >>> I'm trying to use Flask (via mod_wsgi) and mod_dav in the same 
>>> >>> location. I want mod_wsgi/Python to handle GET and POST requests 
>>> >>> (because I want to return enhanced HTML directory listings) while 
>>> >>> mod_dav handles methods like OPTIONS and PROPFIND. 
>>> >>> 
>>> >>> I'm getting an 400 error with the log message "The URL contains 
>>> >>> extraneous path components. The resource could not be identified." when 
>>> >>> I try to access a resource via WebDAV. 
>>> >>> 
>>> >>> I think I've figured out what's up. 
>>> >>> 
>>> >>> I'm using WSGIScriptAlias as follows: 
>>> >>> 
>>> >>> `WSGIScriptAlias / /usr/local/apache2/htdocs/test/test.wsgi` 
>>> >>> 
>>> >>> But when I use a WebDAV client to connect to `/files/`, I find that the 
>>> >>> path that's passed to mod_dav has turned into: 
>>> >>> 
>>> >>> `/usr/local/apache2/htdocs/test/test.wsgi/files` 
>>> >>> 
>>> >>> Which makes sense, given the alias directive. 
>>> >>> 
>>> >>> My question is, is there a way to keep this from happening for WebDAV 
>>> >>> requests? I'm assuming I can't do anything in Flask, that I need to 
>>> >>> catch and modify the request before it reaches mod_dav. 
>>> >> 
>>> >> As a first guess, try adding: 
>>> >> 
>>> >>   <Location /files> 
>>> >>   SetHandler default-handler 
>>> >>   </Location> 
>>> >> 
>>> >> I am not sure whether this will interact with WebDav properly or not, 
>>> >> but I think would normally stop mod_wsgi at least interfering with 
>>> >> requests under that URL. It may be necessary to work out what the 
>>> >> handler name for WebDav is and use it, although from memory I suspect it 
>>> >> doesn’t use the handler concept. 
>>> > 
>>> > Okay. Didn’t grok what you want properly. 
>>> > 
>>> > That will only disable it for selected sub URLs, not by method type. 
>>> > 
>>> > I will have to think some more. Unfortunately the Limit/LimitExcept 
>>> > directives don’t I believe work for handlers, only auth control. 
>>> 
>>> Lets try again. 
>>> 
>>> Presuming you want the whole site to be WebDav, but with GET/POST only 
>>> redirect to a Python script for outputting something different, try the 
>>> following: 
>>> 
>>> 1. Use WSGIScriptAlias to mount your Flask application to generate the 
>>> special listing under a special unique sub URL which isn’t going to match 
>>> anything valid that WebDav may generate. 
>>> 
>>>     WSGIScriptAlias /.my-special-directory-listing 
>>> /usr/local/apache2/htdocs/test/test.wsgi 
>>> 
>>> 2. Enable mod_actions in Apache configuration. 
>>> 
>>> 3. Add a Script directive mapping GET/POST to that special Python script. 
>>> 
>>>     Script GET /.my-special-directory-listing 
>>>     Script POST /.my-special-directory-listing 
>>> 
>>> It is possible that the original information about the URL used may not be 
>>> in the normal WSGI environ variables where Flask expects them. You may need 
>>> to use a WSGI middleware around Flask to tweak the WSGI environ variables, 
>>> copying values from different values that Apache passes through. Look 
>>> through what you might get for the following to see where the original 
>>> details may lie. 
>>> 
>>> CONTEXT_DOCUMENT_ROOT: '/Library/WebServer/Documents' 
>>> CONTEXT_PREFIX: '' 
>>> DOCUMENT_ROOT: '/Library/WebServer/Documents' 
>>> PATH_INFO: '/index.html.en' 
>>> PATH_TRANSLATED: '/Library/WebServer/Documents/index.html.en' 
>>> QUERY_STRING: '' 
>>> REDIRECT_STATUS: '200' 
>>> REDIRECT_URL: '/index.html.en' 
>>> REQUEST_METHOD: 'POST' 
>>> REQUEST_URI: '/' 
>>> SCRIPT_FILENAME: '/Library/WebServer/Documents/environ.wsgi' 
>>> SCRIPT_NAME: '/.special-listing’ 
>>> 
>>> This may be necessary due to how Apache does internal redirects to invoke 
>>> the script for that method type. 
>>> 
>>> Please let me know the results as I will be curious. 
>>> 
>>> Graham
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "modwsgi" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to modwsgi+u...@ <>googlegroups.com <http://googlegroups.com/>.
>>> To post to this group, send email to mod...@ <>googlegroups.com 
>>> <http://googlegroups.com/>.
>>> Visit this group at http://groups.google.com/group/modwsgi 
>>> <http://groups.google.com/group/modwsgi>.
>>> For more options, visit https://groups.google.com/d/optout 
>>> <https://groups.google.com/d/optout>.
>> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/modwsgi 
> <http://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to