Created
November 18, 2015 14:22
Revisions
-
Hyrrmadr created this gist
Nov 18, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,115 @@ Index: subversion/mod_dav_svn/repos.c =================================================================== --- subversion/mod_dav_svn/repos.c (revision 1712076) +++ subversion/mod_dav_svn/repos.c (working copy) @@ -2758,7 +2758,7 @@ bytes"), but many browsers have grown to expect "text/plain" to mean "*shrug*", and kick off their own MIME type detection routines when they see it. So we'll use "text/plain". - + ### Why not just avoid sending a Content-type at all? Is ### that just bad form for HTTP? */ if (! mimetype) @@ -2879,10 +2879,12 @@ " <!ELEMENT updir EMPTY>\n" " <!ELEMENT file EMPTY>\n" " <!ATTLIST file name CDATA #REQUIRED\n" - " href CDATA #REQUIRED>\n" + " href CDATA #REQUIRED\n" + " mtime CDATA #REQUIRED>\n" " <!ELEMENT dir EMPTY>\n" " <!ATTLIST dir name CDATA #REQUIRED\n" - " href CDATA #REQUIRED>\n" + " href CDATA #REQUIRED\n" + " mtime CDATA #REQUIRED>\n" "]>\n"; /* <svn version="1.3.0 (dev-build)" @@ -3044,6 +3046,9 @@ const char *href = name; svn_boolean_t is_dir = (entry->kind == svn_node_dir); const char *repos_relpath = NULL; + char *mtime = "1970-01-01"; + svn_error_t* err; + svn_dirent_t* dirent; svn_pool_clear(entry_pool); @@ -3092,6 +3097,20 @@ href = ap_os_escape_path(entry_pool, href, 0); href = apr_xml_quote_string(entry_pool, href, 1); + if (repos_relpath != NULL && !(err = svn_repos_stat(&dirent, resource->info->root.root, repos_relpath, entry_pool))) + { + if (dirent != NULL) + { +#define EIP_MTIME_FORMAT_SIZE 255 + apr_size_t result; + apr_time_exp_t tm; + + apr_time_exp_lt(&tm, dirent->time); + mtime = apr_palloc(entry_pool, (EIP_MTIME_FORMAT_SIZE) * sizeof(*mtime)); + apr_strftime(mtime, &result, EIP_MTIME_FORMAT_SIZE, "%A, %d %B %Y - %T %Z (UTC %z)", &tm); + } + } + if (gen_html) { /* If our directory was access using the public peg-rev @@ -3100,14 +3119,14 @@ if (resource->info->pegged) { ap_fprintf(output, bb, - " <li><a href=\"%s?p=%ld\">%s</a></li>\n", - href, resource->info->root.rev, name); + " <li><a href=\"%s?p=%ld\">%s</a> (%s)</li>\n", + href, resource->info->root.rev, name, mtime); } else { ap_fprintf(output, bb, - " <li><a href=\"%s\">%s</a></li>\n", - href, name); + " <li><a href=\"%s\">%s</a> (%s)</li>\n", + href, name, mtime); } } else @@ -3122,14 +3141,14 @@ if (resource->info->pegged) { ap_fprintf(output, bb, - " <%s name=\"%s\" href=\"%s?p=%ld\" />\n", - tag, name, href, resource->info->root.rev); + " <%s name=\"%s\" href=\"%s?p=%ld\" mtime=\"%s\" />\n", + tag, name, href, resource->info->root.rev, mtime); } else { ap_fprintf(output, bb, - " <%s name=\"%s\" href=\"%s\" />\n", - tag, name, href); + " <%s name=\"%s\" href=\"%s\" mtime=\"%s\" />\n", + tag, name, href, mtime); } } } @@ -3772,7 +3791,7 @@ if (params->walk_type & DAV_WALKTYPE_AUTH) { const char *repos_relpath = - apr_pstrcat(iterpool, + apr_pstrcat(iterpool, apr_pstrmemdup(iterpool, ctx->repos_path->data, ctx->repos_path->len), @@ -3821,7 +3840,7 @@ ctx->uri->len = uri_len; ctx->repos_path->len = repos_len; } - + svn_pool_destroy(iterpool); return NULL;