Implement seek function for multi-pass authentication upload

This pull request should more cleanly implement the multipass authentication upload.

We probably want to allow ruby users to define their own (ruby) callbacks but that should probably be for a different patchset.

Sorry I made such a mess of the previous pull request I think I successfully preserved your commits :)