Author: toad
Date: 2007-04-26 20:16:17 +0000 (Thu, 26 Apr 2007)
New Revision: 12999

Modified:
   trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
Log:
Don't lose the ArchiveStoreContext when following redirects.
On large freesites, the metadata may be included from a separate key; the outer 
archive-manifest is still valid.

Modified: trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-04-26 19:52:43 UTC (rev 12998)
+++ trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-04-26 20:16:17 UTC (rev 12999)
@@ -61,7 +61,7 @@
         */
        public SingleFileFetcher(ClientRequester parent, GetCompletionCallback 
cb, ClientMetadata metadata,
                        ClientKey key, LinkedList metaStrings, FreenetURI 
origURI, int addedMetaStrings, FetchContext ctx,
-                       ArchiveContext actx, int maxRetries, int recursionLevel,
+                       ArchiveContext actx, ArchiveStoreContext ah, int 
maxRetries, int recursionLevel,
                        boolean dontTellClientGet, long l, boolean isEssential,
                        Bucket returnBucket, boolean isFinal) throws 
FetchException {
                super(key, maxRetries, ctx, parent, cb, isEssential, l);
@@ -71,6 +71,7 @@
                this.cancelled = false;
                this.returnBucket = returnBucket;
                this.dontTellClientGet = dontTellClientGet;
+               this.ah = ah;
                //this.uri = uri;
                //this.key = ClientKey.getBaseKey(uri);
                //metaStrings = uri.listMetaStrings();
@@ -347,7 +348,7 @@
                                }

                                // **FIXME** Is key in the call to 
SingleFileFetcher here supposed to be this.key or the same key used in the try 
block above?  MultiLevelMetadataCallback.onSuccess() below uses this.key, thus 
the question
-                               SingleFileFetcher f = new 
SingleFileFetcher(parent, rcb, clientMetadata, key, metaStrings, this.uri, 
addedMetaStrings, ctx, actx, maxRetries, recursionLevel, false, token, true, 
returnBucket, isFinal);
+                               SingleFileFetcher f = new 
SingleFileFetcher(parent, rcb, clientMetadata, key, metaStrings, this.uri, 
addedMetaStrings, ctx, actx, ah, maxRetries, recursionLevel, false, token, 
true, returnBucket, isFinal);
                                if((key instanceof ClientCHK) && 
!((ClientCHK)key).isMetadata())
                                        rcb.onBlockSetFinished(this);
                                if(metadata.isCompressed()) {
@@ -549,7 +550,7 @@
                                returnBucket == null && key instanceof 
ClientKey)
                        return new SimpleSingleFileFetcher((ClientKey)key, 
maxRetries, ctx, requester, cb, isEssential, l);
                if(key instanceof ClientKey)
-                       return new SingleFileFetcher(requester, cb, 
clientMetadata, (ClientKey)key, uri.listMetaStrings(), uri, 0, ctx, actx, 
maxRetries, recursionLevel, dontTellClientGet, l, isEssential, returnBucket, 
isFinal);
+                       return new SingleFileFetcher(requester, cb, 
clientMetadata, (ClientKey)key, uri.listMetaStrings(), uri, 0, ctx, actx, null, 
maxRetries, recursionLevel, dontTellClientGet, l, isEssential, returnBucket, 
isFinal);
                else {
                        return uskCreate(requester, cb, clientMetadata, 
(USK)key, uri.listMetaStrings(), ctx, actx, maxRetries, recursionLevel, 
dontTellClientGet, l, isEssential, returnBucket, isFinal);
                }
@@ -574,7 +575,7 @@
                                        // Want to update the latest known good 
iff the fetch succeeds.
                                        SingleFileFetcher sf = 
                                                new 
SingleFileFetcher(requester, myCB, clientMetadata, usk.getSSK(), metaStrings, 
-                                                               
usk.getURI().addMetaStrings(metaStrings), 0, ctx, actx, maxRetries, 
recursionLevel, 
+                                                               
usk.getURI().addMetaStrings(metaStrings), 0, ctx, actx, null, maxRetries, 
recursionLevel, 
                                                                
dontTellClientGet, l, false, returnBucket, isFinal);
                                        return sf;
                                }
@@ -628,7 +629,7 @@
                        try {
                                if(l == usk.suggestedEdition) {
                                        SingleFileFetcher sf = new 
SingleFileFetcher(parent, cb, clientMetadata, key, metaStrings, 
key.getURI().addMetaStrings(metaStrings),
-                                                       0, ctx, actx, 
maxRetries, recursionLevel+1, dontTellClientGet, token, false, returnBucket, 
true);
+                                                       0, ctx, actx, null, 
maxRetries, recursionLevel+1, dontTellClientGet, token, false, returnBucket, 
true);
                                        sf.schedule();
                                } else {
                                        cb.onFailure(new 
FetchException(FetchException.PERMANENT_REDIRECT, 
newUSK.getURI().addMetaStrings(metaStrings)), null);


Reply via email to