You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2009/08/22 12:05:32 UTC

DO NOT REPLY [Bug 47722] New: Small error in the urlmapping example

https://issues.apache.org/bugzilla/show_bug.cgi?id=47722

           Summary: Small error in the urlmapping example
           Product: Apache httpd-2
           Version: 2.3-HEAD
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Documentation
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: felix.schaefer@tu-dortmund.de


--- Comment #0 from Felix <fe...@tu-dortmund.de> 2009-08-22 03:05:30 PDT ---
At the end of http://httpd.apache.org/docs/2.3/en/urlmapping.html#user , there
is ans example for user directories:
"""
AliasMatch ^/upages/([a-zA-Z0-9]+)/?(.*) /home/$1/public_html/$2
"""

One could think the regex would only match "/upages/"+$login, maybe followed by
"/"+$somestuff. The problem here is that the question mark makes the "/"
between the 2 matches optional, and you end up with a regex more akin to
"anything that begins with a small letter, a big letter or a number".

Example: trying to access (with the above example) /upages/favicon.ico makes
apache look for a /home/favicon directory.

The improved AliasMatch I came up with, and which should solve the problem,
would be:
"""
AliasMatch ^/upages/([a-zA-Z0-9]+)(/(.*))?$ /home/$1/public_html/$3
"""

This regex matches either "/upages/"+$login+"/"+$somestuff, or
"/upages/"+$login, which I think fits more closely to the intent.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 47722] Small error in the urlmapping example

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47722

Rich Bowen <rb...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|bugs@httpd.apache.org       |docs@httpd.apache.org

--- Comment #4 from Rich Bowen <rb...@apache.org> 2010-10-29 11:07:01 EDT ---
Moving docs bugs to docs@httpd.a.o ownership.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 47722] Small error in the urlmapping example

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47722



--- Comment #3 from Eric Covener <co...@gmail.com> 2009-08-22 17:03:11 PDT ---
Not sure what I meant with that first regex, it doesn't seem to make any sense. 

I'm not a fan of the narrow view of userids in the proposed regex or of the
seemingly unnecessary complexity of the expression in an example.

To be frank, this section should probably punt to mod_rewrite where you can
more properly mimic mod_userdir, where you can actually tell if the thing
you're about to map to is a directory.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 47722] Small error in the urlmapping example

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47722



--- Comment #1 from Eric Covener <co...@gmail.com> 2009-08-22 06:50:00 PDT ---
Your take looks right to me, leaving bug open for a bit before fixing the regex
in case anyone else chimes in to the contrary.  Thanks for the report.

Maybe better to sacrifice the readability of the substitution for the benefit
of the simpler regex though?

AliasMatch ^/upages/([a-zA-Z0-9]+)(.*) /home/$1/public_html$2

or even 

AliasMatch ^/upages/([^/]+)(.*) /home/$1/public_html$2

Since I'm not completely sold on the idea that /upages/foo.bar shouldn't be
looking for a user.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 47722] Small error in the urlmapping example

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47722



--- Comment #2 from Felix <fe...@tu-dortmund.de> 2009-08-22 14:32:51 PDT ---
Well, IIRC, a login on linux is [a-z0-9]+ (now that I think of it, I'm not even
sure the A-Z would be necessary in the regex), so I'd limit the regex to those,
not sure how it is on other platforms. That would rule out your second
proposition.

Pertaining the first one, you are right that it improves readability, but I'd
still make the / mandatory as a first character for the "rest" after the login
part, or else you might end up again matching "/upages/favicon.ico" to
"/home/favicon/public_html.ico". I think the middle ground would be:
"""
AliasMatch ^/upages/([a-z0-9]+)(/.*)?$ /home/$1/public_html$2
"""

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org