[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] related to issue 971, experimantal

From: Lee Thompson <bm55b_at_yahoo.com>
Date: 2004-06-13 23:34:36 CEST

SUMMARY
-------
Add Last-Modified http header for curl and wget
clients. Very experimental. Needs review.
Related to issue 971.
http://subversion.tigris.org/issues/show_bug.cgi?id=971

ATTACHMENTS
-----------
subversion-1.0.4-issue971.patch

MODIFIED FILES
--------------
subversion/mod_dav_svn/repos.c

DETAILS
-------
I've ben trying to interact with a subversion
repository with web based tools like curl and wget
instead of using the svn client. Other users are
doing similar work. In the first discussion, caching
was mentioned as a motivator

    
http://www.contactor.se/~dast/svnusers/archive-2003-08/0108.shtml

In another discussion, lack of subversion client
install was mentioned

    
http://www.contactor.se/~dast/svnusers/archive-2003-08/0264.shtml

I also remember reading someone who was doing
embedded work and disk space was an issue. Here is
another great wget post.

    
http://www.contactor.se/~dast/svn/archive-2002-12/0331.shtml

In my case, I've got lots of bandwidth and not alot
disk. I've got a huge binary multimedia repository
of 80 Gig and I want to mirror it to various
locations to minimize latency for local users.
A "svn update" would double my disk usage so I've
written a wget script back during the 1st alpha
release of subversion two years ago. Finally got a
chance to figure out why it didn't work...

    wget --server-response \
      --output-file=/var/log/wget_backup.log \
      -nH --cut-dirs=2 \
      --directory-prefix=/usr/local/svn/repos_mirror \
      --recursive --timestamping --level=inf \
      --progress=dot:mega \
      --http-user=JOE --http-passwd=USER \
      http://svn.ABCD.com/svn/repos

Issue 971 logged in subversion pointed me the right
direction. I believe this patch gets my script to
work without exposing the change to the subversion
client to hopefully prevent side effects. Further
work would be required to fix issue 971.

I look forward to your feedback.

Lee Thompson
bm55b@yahoo.com

        
                
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/

diff -urN subversion-1.0.4-orig/subversion/mod_dav_svn/repos.c subversion-1.0.4/subversion/mod_dav_svn/repos.c
--- subversion-1.0.4-orig/subversion/mod_dav_svn/repos.c 2004-03-31 12:12:16.000000000 -0600
+++ subversion-1.0.4/subversion/mod_dav_svn/repos.c 2004-06-13 14:01:07.000000000 -0500
@@ -1822,6 +1822,44 @@
   /* we accept byte-ranges */
   apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
 
+ /* Experimental fix for issue 971, by Lee Thompson, bm55b@yahoo.com.
+ If you add Last-Modified to the request header you can mirror the
+ subversion web site with utilities like wget.
+ To limit exposure to this experiment until subversion developers,
+ can review this change for accuracy, only activate for HEAD
+ or GET requests with user agent set to WGET or CURL.
+ The original bug was for things like SQUID to work, but I didn't
+ open this mod to squid as I didn't have a test for it.
+ Adding Last-Modified probably could be added for most requests
+ and at that point, issue 971 could be closed. */
+ if(r->headers_in && r->method
+ && (strstr(r->method, "HEAD") || strstr(r->method, "GET"))
+ && (r->method_number == M_GET))
+ {
+ const char *ua = apr_table_get(r->headers_in, "User-Agent");
+ if(ua && *ua && (strstr(ua, "curl") || strstr(ua, "Wget")))
+ {
+ const char *datestr;
+ apr_time_t timeval;
+ enum dav_svn_time_format format = dav_svn_time_format_rfc1123;
+
+ /* ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_EGENERAL, r,
+ ** "User-Agent: %s", ua);
+ */
+ if (dav_svn_get_last_modified_time (&datestr, &timeval,
+ resource, format, resource->pool))
+ {
+ /* log failure, move on */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_EGENERAL, r,
+ "dav_svn_get_last_modifed_time failed");
+ }
+ else
+ {
+ apr_table_setn(r->headers_out, "Last-Modified", datestr);
+ }
+ }
+ }
+
   /* For a directory, we will send text/html or text/xml. If we have a delta
      base, then we will always be generating an svndiff. Otherwise,
      we need to fetch the appropriate MIME type from the resource's

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jun 13 23:36:13 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.