Permalink
Commits on Mar 29, 2013
  1. @snej

    Make TDPusher more careful abut bumping the checkpoint

    It now works similarly to the puller, using an NSIndexSet to keep track of which sequences haven't
    yet been uploaded, and only advancing the checkpoint to just before the first sequence in the set.
    This will fix possible edge cases/race conditions where the checkpoint may have been advanced too
    optimistically, causing a doc that failed to be pushed once to never be retried. (Fixes #246)
    snej committed Mar 29, 2013
  2. @snej

    Make returned error strings more compatible with CouchDB's

    These strings are in JSON "error" properties in error responses and in individual items
    of a _bulk_docs response.
    snej committed Mar 29, 2013
Commits on Mar 28, 2013
  1. @snej

    Better logging if change tracker fails HTTP auth

    If TDSocketChangeTracker gets a 401 or 407 and can't find a credential, or the credential is rejected,
    it now logs a message of the form
        TDSocketChangeTracker[...]: HTTP auth failed; sent Authorization: %@  ;  got WWW-Authenticate: %@
    showing the Authorization header it sent (if any, else null) and the WWW-Authenticate response header.
    These headers are also returned in the NSError as keys "HTTPAuthorization" and "HTTPAuthenticateHeader"
    (although this is of limited use since this info won't make it all the way up to the public replication API, yet.)
    This should help in diagnosing issue #242.
    snej committed Mar 28, 2013
Commits on Mar 27, 2013
  1. @snej

    Rename "BrowserID" --> "Persona"

    Note that this invalidates all saved persistent replications that used Persona/BrowserID auth,
    because the property in the replication doc was renamed too.
    It also changes the server endpoint that the replicator hits to log in from /db/browserid to /db/persona.
    
    (This is equivalent to commit 111859c from CouchbaseLite, although it's not a direct cherry-pick. I had to make the same changes manually because too many things have been renamed for a merge to work.)
    snej committed Mar 27, 2013
  2. @snej
Commits on Mar 26, 2013
  1. @snej

    Fix: Puller would lose checkpoint if first doc couldn't be pulled

    If the first new revision received by the puller fails to be read or
    written, the last-sequence ID won't advance. But the puller was instead
    getting a null sequence ID instead of the checkpointed one, and trying
    to save that, which deleted the checkpoint. So the next pull would start
    over from the beginning.
    snej committed Mar 26, 2013
  2. @snej

    Fix: "?" in doc ID wasn't being escaped

    TDEscapeID wasn't escaping "?". This led to the replicator constructing
    invalid URLs for docs whose ID contains "?", which meant they'd never get
    replicated.
    snej committed Mar 26, 2013
  3. @snej

    Fix: Pull checkpoints weren't getting restored correctly

    TDPuller was saving its checkpoints to the remote JSON doc as numbers but
    they were then read back and cast to string, causing the comparison to
    fail. This meant the puller would start over from the beginning every time.
    
    I also added some more logging.
    snej committed Mar 26, 2013
Commits on Mar 23, 2013
  1. @snej
Commits on Mar 18, 2013
  1. @snej
Commits on Mar 8, 2013
  1. @snej

    Push replicator now encodes non-string filter params as JSON.

    I'm not sure whether such parameters are allowed, but JSON encoding seems like the reasonable
    way to send them to the remote _changes feed (as opposed to calling ObjC -description on them,
    which the code used to do...)
    Potential fix for issue #239.
    snej committed Mar 8, 2013
Commits on Feb 26, 2013
  1. @snej

    Fix for TDMultipartDownloader in case NSURLConnection gets two responses

    It's possible in rare cases for the didReceiveResponse: delegate method to be called twice.
    Handle this correctly by creating a new _reader within that call.
    Thanks to @kjots, @chaisehocking, @drekka for tracking this down!
    Speculatively fixes #236.
    snej committed Feb 26, 2013
Commits on Feb 10, 2013
  1. @snej

    Don't stop a push replication if the _revs_diff call gets an error

    Took out the -stop call. The remaining call to -revisionFailed will ensure that the
    pull is retried later. And in the case being reported, where the call fails due to being
    canceled when going offline, the replication will continue when it goes back online.
    Fixes #233.
    snej committed Feb 10, 2013
Commits on Feb 5, 2013
  1. @snej

    Fixed compile errors reported by Xcode 4.6

    Make sure to run "git submodule sync" after pulling this commit.
    snej committed Feb 5, 2013
Commits on Jan 28, 2013
  1. @snej

    Make sure views compiled from JS get rebuilt if the map/reduce fn cha…

    …nges
    
    …Although currently this only takes effect next time the app is launched, i.e.
    it isn't watching for edits of the design docs while running.
    
    Also moved the code that triggers the compilation out of TDRouter and into
    TD_View and TD_Database.
    snej committed Jan 28, 2013
Commits on Jan 24, 2013
  1. @snej
Commits on Jan 23, 2013
  1. @snej

    Fix crash in TDJSViewCompiler

    The compiled function objects were getting GC'd, after which calling them would crash.
    snej committed Jan 23, 2013
Commits on Jan 17, 2013
  1. @snej

    Fix a path-escaping bug with replication

    Regression from the initial BrowserID patch (649d14f)
    snej committed Jan 17, 2013
  2. @snej

    BrowserID improvements

    * Parse email address out of assertion rather than requiring it to be provided separately.
    * Also get the expiration date, and don't return assertions that have expired.
    
    Conflicts:
    	Source/API/TDReplication.h
    	Source/API/TDReplication.m
    snej committed Jan 16, 2013
Commits on Jan 15, 2013
  1. @snej

    Oops, I broke replication with that last commit

    Fixes #219
    snej committed Jan 15, 2013
  2. @snej

    More BrowserID work (don't store assertion in database)

    BrowserID assertions are extremely short-lived, so it doesn't make sense
    to store them in a persistent replication's document. Instead, store the
    email address only. The assertion is registered with the authorizer
    before starting replication.
    
    Conflicts:
    	Source/API/TDReplication.h
    	Source/API/TDReplication.m
    	TouchDB.xcodeproj/project.pbxproj
    snej committed Jan 15, 2013
  3. @snej

    Change tracker needs to send cookies in its request

    TDSocketChangeTracker uses CFHTTPMessageCreateRequest, which is too low-level to use the shared
    cookie store, so it doesn't send any cookies. This breaks BrowserID auth, which is session-based.
    Fixed this by explicitly getting the cookies from the NSHTTPCookieStore and adding their headers.
    snej committed Jan 13, 2013
  4. @snej

    Dumb bug fixes (TDReplication, TDBrowserIDAuthorizer)

    Conflicts:
    	Source/API/TDReplication.m
    snej committed Jan 13, 2013
  5. @snej

    More replicator improvements

    * Created a TD_DatabaseManager method to create replicators
    
    Conflicts:
    	Source/TDReplicatorManager.m
    	Source/TD_DatabaseManager.m
    snej committed Jan 11, 2013
  6. @snej

    Merge branch 'stable'

    1.0.1 release
    
    Conflicts:
    	TouchDB.xcodeproj/project.pbxproj
    snej committed Jan 15, 2013
  7. @snej
  8. @snej

    Support for BigCouch array-format sequence IDs

    BigCouch is now using arrays as sequence IDs; TouchDB didn't format these properly.
    Fixes #218.
    snej committed Jan 15, 2013
Commits on Jan 11, 2013
  1. @snej

    BrowserID support for replicator (untested)

    To use it with non persistent replications, set a TDBrowserIDAuthorizer.
    
    With persistent replications, add a "auth" sub-object of the "source"
    or "target" object (just as for OAuth) and in it put a "browserid"
    object with an "assertion" property whose value is the BrowserID
    assertion.
    
    This obviously requires that the remote server have BrowserID support.
    There is a CouchDB-BrowserID plugin, and IrisCouch's servers have it.
    snej committed Jan 10, 2013
  2. @snej
  3. @snej

    Allow multiple replications with the same (source, target) dbs

    It can be useful to have multiple replications with the same source and target,
    if their filters are different.
    snej committed Jan 11, 2013
  4. @snej

    Bump version to 1.004

    snej committed Jan 9, 2013
Commits on Jan 9, 2013
  1. @snej

    Bump version to 1.004

    snej committed Jan 9, 2013
  2. @snej

    Fix a crash when TDSocketChangeTracker gets an error

    During the -errorOccurred: method's call to [self stop], the delegate would end up releasing the tracker,
    causing it to be dealloced prematurely. Moved the stop call to the end, and for safety's sake added a
    temporary retain during the entire stream:handleEvent: call.
    (Bug reported by Joerg Birkhold.)
    snej committed Jan 4, 2013
Commits on Jan 5, 2013
  1. @snej

    Added optional JavaScript map/reduce capability.

    TDJSViewCompiler is a plugin that allows TouchDB to run JavaScript
    map/reduce functions. It requires JavaScriptCore, which on iOS you'll
    need to build and link into your app.
    
    This class is included as source code but not built into TouchDB.
    If you want to use it, compile it into your app.
    snej committed Jan 5, 2013
Commits on Jan 4, 2013
  1. @snej

    Fix a crash when TDSocketChangeTracker gets an error

    During the -errorOccurred: method's call to [self stop], the delegate would end up releasing the tracker,
    causing it to be dealloced prematurely. Moved the stop call to the end, and for safety's sake added a
    temporary retain during the entire stream:handleEvent: call.
    (Bug reported by Joerg Birkhold.)
    snej committed Jan 4, 2013