]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
rollback the feature of making "ambient upload authority" configurable
authorZooko O'Whielacronx <zooko@zooko.com>
Wed, 21 Jan 2009 03:47:35 +0000 (20:47 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Wed, 21 Jan 2009 03:47:35 +0000 (20:47 -0700)
This reverses some, but not all, of the changes that were committed in the following set of patches.

rolling back:

Sun Jan 18 09:54:30 MST 2009  toby.murray
  * add 'web.ambient_upload_authority' as a paramater to tahoe.cfg

    M ./src/allmydata/client.py -1 +3
    M ./src/allmydata/test/common.py -7 +9
    A ./src/allmydata/test/test_ambient_upload_authority.py
    M ./src/allmydata/web/root.py +12
    M ./src/allmydata/webish.py -1 +4
Sun Jan 18 09:56:08 MST 2009  zooko@zooko.com
  * trivial: whitespace
  I ran emacs's "M-x whitespace-cleanup" on the files that Toby's recent patch had touched that had trailing whitespace on some lines.

    M ./src/allmydata/test/test_ambient_upload_authority.py -9 +8
    M ./src/allmydata/web/root.py -2 +1
    M ./src/allmydata/webish.py -2 +1
Mon Jan 19 14:16:19 MST 2009  zooko@zooko.com
  * trivial: remove unused import noticed by pyflakes

    M ./src/allmydata/test/test_ambient_upload_authority.py -1
Mon Jan 19 21:38:35 MST 2009  toby.murray
  * doc: describe web.ambient_upload_authority

    M ./docs/configuration.txt +14
    M ./docs/frontends/webapi.txt +11
Mon Jan 19 21:38:57 MST 2009  zooko@zooko.com
  * doc: add Toby Murray to the CREDITS

    M ./CREDITS +4

docs/configuration.txt
docs/frontends/webapi.txt
src/allmydata/client.py
src/allmydata/test/test_ambient_upload_authority.py [deleted file]
src/allmydata/web/root.py
src/allmydata/webish.py

index 8642ffa14f68589019a3ad67f19812b3e37b7d53..6df08624724362495319004f1cf2aead3412a4e0 100644 (file)
@@ -70,20 +70,6 @@ web.static = (string, optional)
  With the default settings, http://127.0.0.1:3456/static/foo.html will serve
  the contents of $BASEDIR/public_html/foo.html .
 
-web.ambient_upload_authority = (boolean, optional)
-
- This controls whether a node's web server should provide "ambient"
- upload/create authority by controlling whether it responds to PUT and
- POST requests that do not contain a cap -- i.e. those for uploading
- new unlinked files and creating new unlinked directories. If set to
- True, a node will respond to these requests as usual.  If set to
- False, a node will instead refuse these requests, returning an HTTP
- status of 'Bad Request'.  The default value is True.
-
- Note that setting this to False does not prevent performing operations
- on files and directories that already exist, since all of these operations
- require the presentation of a cap.
-
 tub.port = (integer, optional)
 
  This controls which port the node uses to accept Foolscap connections from
index 5f7dc3842280d3fe688f043a87462414a67590d8..8cc9288f63c2b987b4189cae8d786284886a03d2 100644 (file)
@@ -320,9 +320,6 @@ PUT /uri
  mutable file, and return its write-cap in the HTTP respose. The default is
  to create an immutable file, returning the read-cap as a response.
 
- Note that this operation is available only when the configuration setting
- 'web.ambient_upload_authority' is not False (see configuration.txt).
-
 === Creating A New Directory ===
 
 POST /uri?t=mkdir
@@ -333,9 +330,6 @@ PUT /uri?t=mkdir
  virtual drive. The "PUT" operation is provided for backwards compatibility:
  new code should use POST.
 
- Note that these operations are available only when the configuration setting
- 'web.ambient_upload_authority' is not False (see configuration.txt).
-
 POST /uri/$DIRCAP/[SUBDIRS../]SUBDIR?t=mkdir
 PUT /uri/$DIRCAP/[SUBDIRS../]SUBDIR?t=mkdir
 
@@ -578,9 +572,6 @@ POST /uri?t=mkdir
  "false"), then the HTTP response body will simply be the write-cap of the
  new directory.
 
- Note that this operation is available only when the configuration setting
- 'web.ambient_upload_authority' is not False (see configuration.txt).
-
 POST /uri/$DIRCAP/[SUBDIRS../]?t=mkdir&name=CHILDNAME
 
  This creates a new directory as a child of the designated SUBDIR. This will
@@ -625,8 +616,6 @@ POST /uri?t=upload
  the upload results page. The default is to create an immutable file,
  returning the upload results page as a response.
 
- Note that this operation is available only when the configuration setting
- 'web.ambient_upload_authority' is not False (see configuration.txt).
 
 POST /uri/$DIRCAP/[SUBDIRS../]?t=upload
 
index f0208bd4749940f477fe8ca02b7379e7da56dab6..10369bdf20bfdf9778c79c07cd008f9d0c4ddef3 100644 (file)
@@ -266,9 +266,7 @@ class Client(node.Node, pollmixin.PollMixin):
         nodeurl_path = os.path.join(self.basedir, "node.url")
         staticdir = self.get_config("node", "web.static", "public_html")
         staticdir = os.path.expanduser(staticdir)
-        # should we provide ambient upload authority?
-        ambientUploadAuthority = self.get_config("node", "web.ambient_upload_authority", True, boolean=True)
-        ws = WebishServer(webport, nodeurl_path, staticdir, ambientUploadAuthority)
+        ws = WebishServer(webport, nodeurl_path, staticdir)
         self.add_service(ws)
 
     def init_ftp_server(self):
diff --git a/src/allmydata/test/test_ambient_upload_authority.py b/src/allmydata/test/test_ambient_upload_authority.py
deleted file mode 100644 (file)
index 19dbb9b..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-import os
-
-from twisted.trial import unittest
-from twisted.internet import defer, reactor
-from twisted.web import client, http
-
-from allmydata.test.common import SystemTestMixin
-
-
-class TestCase(SystemTestMixin, unittest.TestCase):
-
-    def setAmbientUploadAuthority(self,ambientUploadAuthority):
-        self.ambientUploadAuthority = ambientUploadAuthority
-
-    def _test_ambient_upload_authority(self):
-        self.webip = "127.0.0.1"
-        self.webport = 3456
-        self.basedir = self.mktemp()
-
-        # set up an introducer and a node
-        d = self.set_up_nodes(1)
-        d.addCallback(self._test_ambient_upload_authority2)
-        d.addErrback(self.fail)
-        return d
-
-    def _set_up_nodes_extra_config(self):
-        # we need to remove the 'webport' old-style config file
-        # or else the node won't start
-        os.remove(os.path.join(self.getdir("client0"), "webport"))
-        f = open(os.path.join(self.getdir("client0"), "tahoe.cfg"), "wt")
-        f.write("\n")
-        f.write("[node]\n")
-        f.write("web.ambient_upload_authority = %s\n" % ("false","true")[self.ambientUploadAuthority])
-        f.write("web.port = tcp:%d:interface=%s\n" % (self.webport, self.webip))
-        f.write("\n")
-        f.write("[client]\n")
-        f.write("introducer.furl = %s\n" % self.introducer_furl)
-        f.write("\n")
-        f.write("[storage]\n")
-        f.write("enabled = true\n")
-        f.write("\n")
-        f.close()
-
-
-    def _test_ambient_upload_authority2(self, ignored=None):
-        content_type = 'multipart/form-data; boundary=----------ThIs_Is_tHe_bouNdaRY_$'
-        body = '------------ThIs_Is_tHe_bouNdaRY_$\r\nContent-Disposition: form-data; name="t"\r\n\r\nupload\r\n------------ThIs_Is_tHe_bouNdaRY_$\r\nContent-Disposition: form-data; name="file"; filename="file1.txt"\r\nContent-Type: application/octet-stream\r\n\r\nsome test text\r\n------------ThIs_Is_tHe_bouNdaRY_$--\r\n'
-        headers = {'Content-Type': content_type,
-                   'Content-Length': len(body)}
-
-        deferreds = []
-        expected = (http.BAD_REQUEST, http.OK)[self.ambientUploadAuthority]
-
-        # try to upload using the local web client
-        def tryRequest(pathetc, method, postdata=None, headers=None):
-            url = "http://%s:%d/%s" % (self.webip, self.webport, pathetc)
-            f = client.HTTPClientFactory(url,method, postdata, headers)
-            f.deferred.addCallback(self._cbCheckResponse,[f,expected])
-            f.deferred.addErrback(self._cbCheckResponse,[f,expected])
-            deferreds.append(f.deferred)
-            reactor.connectTCP(self.webip, self.webport, f)
-
-        tryRequest("uri","PUT","non contents\r\n")
-        tryRequest("uri?t=mkdir","PUT")
-        tryRequest("uri?t=mkdir","POST")
-        tryRequest("uri?t=upload","POST",body,headers)
-
-        # give us one deferred that will fire iff all of the above succeed
-        dlist = defer.DeferredList(deferreds,fireOnOneCallback=False,
-                                   fireOnOneErrback=True)
-        dlist.addErrback(self.fail)
-
-        return dlist
-
-    def _cbCheckResponse(self, ignored, cmp):
-        r = cmp[0]
-        expected = cmp[1]
-        self.failUnless(int(r.status) == expected)
-
-
-class TestAmbientUploadAuthorityEnabled(TestCase):
-    def setUp(self):
-        TestCase.setUp(self)
-        self.setAmbientUploadAuthority(True)
-
-    def test_ambient_upload_authority_enabled(self):
-        return self._test_ambient_upload_authority()
-
-class TestAmbientUploadAuthorityDisabled(TestCase):
-    def setUp(self):
-        TestCase.setUp(self)
-        self.setAmbientUploadAuthority(False)
-
-    def test_ambient_upload_authority_disabled(self):
-        return self._test_ambient_upload_authority()
index 15533b8e484c00ef7f9566d65f9f8808c807188d..81f6b367893bf6297713677a2d0e188c0632d4e6 100644 (file)
@@ -22,9 +22,6 @@ class URIHandler(RenderMixin, rend.Page):
     # I live at /uri . There are several operations defined on /uri itself,
     # mostly involved with creation of unlinked files and directories.
 
-    def setAmbientUploadAuthority(self, ambientUploadAuthority):
-        self.ambientUploadAuthority = ambientUploadAuthority
-
     def render_GET(self, ctx):
         req = IRequest(ctx)
         uri = get_arg(req, "uri", None)
@@ -38,9 +35,6 @@ class URIHandler(RenderMixin, rend.Page):
         return there
 
     def render_PUT(self, ctx):
-        if not self.ambientUploadAuthority:
-            raise WebError("/uri handling of PUT not enabled on this node")
-
         req = IRequest(ctx)
         # either "PUT /uri" to create an unlinked file, or
         # "PUT /uri?t=mkdir" to create an unlinked directory
@@ -58,9 +52,6 @@ class URIHandler(RenderMixin, rend.Page):
         raise WebError(errmsg, http.BAD_REQUEST)
 
     def render_POST(self, ctx):
-        if not self.ambientUploadAuthority:
-            raise WebError("/uri handling of POST not enabled on this node")
-
         # "POST /uri?t=upload&file=newfile" to upload an
         # unlinked file or "POST /uri?t=mkdir" to create a
         # new directory
@@ -130,9 +121,6 @@ class Root(rend.Page):
         rend.Page.__init__(self, original)
         self.child_operations = operations.OphandleTable()
 
-    def setAmbientUploadAuthority(self, ambientUploadAuthority):
-        self.child_uri.setAmbientUploadAuthority(ambientUploadAuthority)
-
     child_uri = URIHandler()
     child_cap = URIHandler()
     child_file = FileHandler()
index 2675aa0446f8d4a307f5a7cd108bd7b0c681cec0..e3f560709bcad33468c0f6196d8af1921d79c0ba 100644 (file)
@@ -122,13 +122,10 @@ class WebishServer(service.MultiService):
     name = "webish"
     root_class = root.Root
 
-    def __init__(self, webport, nodeurl_path=None, staticdir=None,
-                 ambientUploadAuthority=False):
+    def __init__(self, webport, nodeurl_path=None, staticdir=None):
         service.MultiService.__init__(self)
         self.webport = webport
         self.root = self.root_class()
-        if self.root_class == root.Root:
-            self.root.setAmbientUploadAuthority(ambientUploadAuthority)
         self.site = site = appserver.NevowSite(self.root)
         self.site.requestFactory = MyRequest
         if self.root.child_operations: