Commit 8879d69c authored by Bill Stoddard's avatar Bill Stoddard
Browse files

Get mod_cern_meta to work on Windows. The problem was in the

"skip leading slash" logic, which is inheriently broken on Windows
because full Windows filenames begin with a drive letter or UNC
path.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89046 13f79535-47bb-0310-9956-ffa450edef68
parent 767ee194
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -309,6 +309,7 @@ static int scan_meta_file(request_rec *r, apr_file_t *f)
static int add_cern_meta_data(request_rec *r)
{
    char *metafilename;
    char *leading_slash;
    char *last_slash;
    char *real_file;
    char *scrap_book;
@@ -337,10 +338,10 @@ static int add_cern_meta_data(request_rec *r)

    /* what directory is this file in? */
    scrap_book = apr_pstrdup(r->pool, r->filename);
    /* skip leading slash, recovered in later processing */
    scrap_book++;

    leading_slash = strchr(scrap_book, '/');
    last_slash = strrchr(scrap_book, '/');
    if (last_slash != NULL) {
    if ((last_slash != NULL) && (last_slash != leading_slash)) {
	/* skip over last slash */
	real_file = last_slash;
	real_file++;
@@ -354,7 +355,7 @@ static int add_cern_meta_data(request_rec *r)
	return DECLINED;
    };

    metafilename = apr_pstrcat(r->pool, "/", scrap_book, "/",
    metafilename = apr_pstrcat(r->pool, scrap_book, "/",
			   dconf->metadir ? dconf->metadir : DEFAULT_METADIR,
			   "/", real_file,
		 dconf->metasuffix ? dconf->metasuffix : DEFAULT_METASUFFIX,