         return prepareToFetch(request) != nil
     }
     
+    public override class func canonicalRequestForRequest(request: NSURLRequest) -> NSURLRequest {
+        return request
+    }
+    
+    public class func prepareToFetch(request: NSURLRequest) -> (NSURL, WebCacheSource)? {
+        // subclass should override this
+        return nil
+    }
+
     private var progress: NSProgress?
     private var hasRange = false
     

//---------------------------------------------------------------------------

public class WebCacheProtocol : NSURLProtocol {
    public class func prepareToFetch(request: NSURLRequest) -> (NSURL, WebCacheSource)? {
        return nil
    }

    public override final class func canInitWithRequest(request: NSURLRequest) -> Bool {
        guard NSURLProtocol.propertyForKey("WebCache", inRequest: request) == nil else {
            return false
        }

     
    public override func stopLoading() {
        self.progress?.cancel()
    }
}

