HTML5 File API uploader that calculates content hash client side
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Dmedia |
Fix Released
|
High
|
Jason Gerard DeRose |
Bug Description
Large file uploads (or downloads) over HTTP are very likely to incur data errors that TCP doesn't detect (from personal experience uploading to S3, I know this all to well).
I'm pretty sure browsers aren't calculating md5sum for files uploaded (need to confirm). Regardless, it would be much nicer if the actual dmedia-style content-hash (sha1 hash-list) could be calculated client side so that uploads can be verified with 8MiB granularity, so that we can robustly resume uploads.
Fortunately, the HTML5 File API lets us do this easily. Probably some good starting points:
https:/
http://
This seems to be one of the nicer, modern, and maintained JavaScript sha1 implementations:
http://
(Mind blowing that ECMAScript 5 didn't add native md5/sha1.)
For details on how the dmedia content-hash is calculated, see:
http://
Related branches
- James Raymond: Approve
-
Diff: 1453 lines (+1400/-2)8 files modifieddmedia/data/base32.js (+51/-0)
dmedia/data/sha1.js (+330/-0)
dmedia/data/test_uploader.js (+150/-0)
dmedia/data/uploader.js (+240/-0)
dmedia/tests/test_scripts.py (+90/-0)
dmedia/wsgi.py (+321/-0)
dummy-client (+2/-2)
test-server.py (+216/-0)
Changed in dmedia: | |
status: | Triaged → In Progress |
Changed in dmedia: | |
assignee: | nobody → Jason Gerard DeRose (jderose) |
Changed in dmedia: | |
milestone: | 0.4 → 0.5 |
Changed in dmedia: | |
status: | In Progress → Fix Committed |
Changed in dmedia: | |
status: | Fix Committed → Fix Released |
Okay, little update... crypto-js apparently has serious bugs when hashing binary data, produces incorrect results.
Now I'm using the same sha1 implementation that CouchDB uses for Futon - http:// pajhome. org.uk/ crypt/md5/ sha1.html
That one actually works.