char *slash_test;
bslash2slash(pNewName);
- if ((pNewName[0] == '/') && (strchr (pNewName, ':') == NULL))
- {
- char vol[256];
-
- _splitpath (ap_server_root, vol, NULL, NULL, NULL);
- pNewName = ap_pstrcat (pPool, vol, pNewName, NULL);
- }
- if ((slash_test = strchr(pNewName, ':')) && (*(slash_test+1) != '/'))
- {
- char vol[_MAX_VOLUME+1];
+ /* Don't try to canonicalize a filename that isn't even valid
+ This way we don't mess up proxy requests or other kinds
+ of special filenames.
+ */
+ if (ap_os_is_filename_valid(pNewName)) {
+ if ((pNewName[0] == '/') && (strchr (pNewName, ':') == NULL))
+ {
+ char vol[256];
+
+ _splitpath (ap_server_root, vol, NULL, NULL, NULL);
+ pNewName = ap_pstrcat (pPool, vol, pNewName, NULL);
+ }
+ if ((slash_test = strchr(pNewName, ':')) && (*(slash_test+1) != '/'))
+ {
+ char vol[_MAX_VOLUME+1];
- _splitpath (pNewName, vol, NULL, NULL, NULL);
- pNewName = ap_pstrcat (pPool, vol, "/", pNewName+strlen(vol), NULL);
+ _splitpath (pNewName, vol, NULL, NULL, NULL);
+ pNewName = ap_pstrcat (pPool, vol, "/", pNewName+strlen(vol), NULL);
+ }
}
strlwr(pNewName);
return pNewName;
inline int ap_os_is_path_absolute(const char *file)
{
- char *s = strchr (file, ':');
+ char *s = strstr (file, "://");
+
+ /* First make sure we aren't looking at a URL such as
+ a proxy:http://blah.
+ */
+ if (!s) {
+ s = strchr (file, ':');
- if (s) {
- if (strncmp(s, "://", 3) != 0)
- /* XXX: we assume that everything before the : is letters */
- return 1;
- }
- else {
- if (file[0] == '/')
- return 1;
+ if (s) {
+ if (strncmp(s, "://", 3) != 0)
+ /* XXX: we assume that everything before the : is letters */
+ return 1;
+ }
+ else {
+ if (file[0] == '/')
+ return 1;
+ }
}
return 0;