Commit Graph

19 Commits

Author SHA1 Message Date
mpl 1d32408503 pkg/server: make share handler support share deletions
Since we don't actually ever remove blobs (until we add garbage
collection, and even then), if a share claim gets deleted (with a delete
claim), the only knowledge of the deletion resides in the Index.

So when the share handler verifies the sharing chain, there is nothing
preventing it from reading a supposedly deleted share claim (from the
blobserver), and concluding that the share chain is valid.

This change adds the index handler to the share handler, so it can check
the deletion status of a share claim, and hence support "share
cancellation".

Fixes #914

Change-Id: I572fdddee30e745aa2d2a6720c83c8e8c916515d
2017-03-24 22:33:50 +01:00
mpl 71090f7c80 pkg/server: add files "zipper" to DownloadHandler
We want to add a feature for clients (the web UI), where they can select
a bunch of files and ask the server for a zip archive of all these files.

This CL modifies the DownloadHandler so it does exactly that upon
reception of a POST request with a query parameter of the form
files=sha1-foo,sha1-bar,sha1-baz

This CL also adds a new button to the contextual sidebar of the web UI,
that takes care of sending the download request to the server.

known limitations: only permanodes with file as camliContent are
accepted as a valid selection (i.e. no sets, or static-dirs, etc) for
now.

Implementation detail:
We're creating an ephemeral DOM form on the fly to send the request.
The reason is: if we sent it as a Go http request, we'd have to read
the response manually and then we'd have no way of writing it to disk.
If we did it with an xhr, we could write the response to disk by
creating a File or Blob and then using URL.createObjectURL(), but we'd
have to keep the response in memory while doing so, which is
unacceptable for large enough archives.

Fixes #899

Change-Id: I104f7c5bd10ab3369e28d33752380dd12b5b3e6b
2017-03-17 00:59:19 +01:00
mpl ac4f053414 pkg/server: fix sharing, add tests
There were basically two bugs in bytesHaveSchemaLink:

-typo "blob" vs "bytes" camliType. this wouldn't happen if we used
constants from a pkg for camliTypes, instead of hardcoding them..
-returning early instead of checking all the parts of a file.

Added a test for each of those bugs. They look like they could be
refactored but they're subtly different enough that it might not be
worth it.

Context: working on issue #527

Change-Id: Ifd0bd311ae8a115de2a56994b89127db6f315a75
2016-05-11 23:58:37 +02:00
Brad Fitzpatrick 383f118ccf pkg/server: validate that share hops are only in expected places in schema blobs
Fixes camlistore/camlistore#228
2015-12-28 13:56:47 -08:00
mpl 40be4d8da2 vendor: go4.org/jsonconfig (and errorutil)
Previously pkg/jsonconfig and pkg/errorutil

Copied from go4.org at rev d1b8a2fb2de6160036e4801aa5e4d855571078b8

Change-Id: I673ed55b0825baa2607289b6082f205100261d7a
2015-12-01 17:21:49 +01:00
Aaron Boodman 698f3d0eea Add CORS header to share handler.
Change-Id: Ia12ea1f3de334e6f5b4d29c2a24291d263cc8068
2014-08-31 23:46:37 -07:00
Brad Fitzpatrick bf94a73859 Get rid of SeekFetcher vs StreamingFetcher distinction and complexity.
StreamingFetcher is now just Fetcher, and its FetchStreaming is now
just Fetch.

SeekFetcher is gone. Blobs are max 16 MB anyway, so we can slurp to
memory when needed. The main thing that cared about SeekFetcher
was the GET handler, ServeBlobref, because http.ServeContent needed
one for range requests. That's rewritten in an earlier commit, using
the FakeSeeker from another earlier commit.

Lot of code got simpler as a result.

Change-Id: Ib819413e48a8f9b8d97f596d0fbf771dab211f11
2014-03-14 12:29:13 -07:00
Aaron Boodman d875fcad30 Clean up testing in share_test.go
Change-Id: I481d440636590086f11d8e97d0eb6fcf31f4a097
2013-09-24 11:49:17 -07:00
Brad Fitzpatrick 0f911b0ef4 Require transitive on shares when assembling file schema blobs.
Change-Id: I48be9855829448ddcb076d3b826c0394c1499f99
2013-09-21 17:51:13 +01:00
Aaron Boodman 43135068a5 Check IsTransitive in share handler and add tests.
Also fix a bug in interpretation of via chain, which caused sharing
to be overly permissive.

BUG=https://code.google.com/p/camlistore/issues/detail?id=226

Change-Id: I4459a67d1b40e4a50f111ce708dbfcbd975f3f15
2013-09-21 13:16:01 +01:00
Brad Fitzpatrick 5dad68ae49 Add TODOs on pkg/server/share.go
Change-Id: Ibc01fc6f9c266669bd556348075fdfae66cfc408
2013-09-19 10:28:51 +01:00
Aaron Boodman 544d901840 Add support for downloading an assembled blob via the share URL.
Bug: https://code.google.com/p/camlistore/issues/detail?id=220

Change-Id: I4604105d2679010d6f546692abbce0d57bae2983
2013-09-19 00:14:45 -07:00
Brad Fitzpatrick 128f56887b Handle GET and HEAD the same in more (all?) places.
Change-Id: I486a95f0a6fc127d17dcf0abeb94eab292980156
2013-09-15 20:12:26 +01:00
Brad Fitzpatrick 2cf4d68267 Let shares have expiration times.
Change-Id: Iecae106302ba43c354b6987163830cf78a70d12c
2013-09-08 17:46:40 -07:00
Brad Fitzpatrick ae20a0f7de Ditch App Engine ContextWrapper noise; add test that App Engine always compiles.
I had broken App Engine in my previous commit, since it wasn't part of 'make presubmit'

Change-Id: I32c25efbc7c348ff516128c87b6e817ae0685386
2013-08-21 18:51:10 -05:00
Brad Fitzpatrick 0bdf20884b all: delete pkg/blobref; convert all from *blobref.BlobRef to new blob.Ref
Change-Id: Id2dfb7f19452bedf4f3c9310b36227fd8117b225
2013-08-03 19:54:30 -07:00
Brad Fitzpatrick d832b6a06f Document PrefixHandler and clean up users with accessor functions.
Change-Id: Ib0b23ff3cc548a35c35eae1cdc59a8673dc19638
2013-06-12 11:17:30 +02:00
mpl 0830902ffb schema: add Share type
This changes allows to get rid of the use of map[string]interface{} in
pkg/server/share.go

Change-Id: Ifeae6b194ff4db679be63d0087cb6d1c5df2f3ca
2013-03-11 21:53:56 +01:00
mpl f21cea5131 share: refactored
-pkg/server/share.go handles share(d) blobs.
-pkg/blobserver/gethandler no longer deals with share blobs
and has been rewritten like the other handlers (no more auth
in there).
-client and signhandler changed accordingly.
-serverconfig: auth moved up in makeCamliHandler
-share parameter added to the user level and low level config.
-share URL is now http(s)://host[:port]/[prefix/]share/sha1-xxxx.

Addresses http://camlistore.org/issue/107

Change-Id: I0a2c07ac1a1e435b141702e0ff06dc8182721d65
2013-03-06 19:11:00 +01:00