For that mentioned in issue #15, I wrote a patch. Maybe you have a better way to resolve it.
Add a cleanup for updating state file in case of uploading interupt
bug fix, for merging range wrong
Bug fix, 0 offset should not update state file.
Delete state file if it's corrupt.
bug fix, update state file only for raw input.
I don't really get the idea of cleaning up the state file in an arbitrary request. If a state file was removed, but there were other simultaneous requests, they will be confused. Furthermore, the client can retry a request without starting a new upload session.
I'm afraid I can merge only the commit that implements removal of the state file if it is corrupt.