port = int(mo.group(3))
d = defer.Deferred()
-
+
url = "/vdrive/global/"
if vdrive_fname:
url += urllib.quote(vdrive_fname)
else:
infileobj = open(local_fname, "rb")
instream = stream.FileStream(infileobj)
-
+
d2 = protocol.ClientCreator(reactor, HTTPClientProtocol).connectTCP(host, port)
def got_resp(resp):
outbuf.append("200 (OK); ")
elif resp.code == 201:
outbuf.append("201 (Created); ")
-
+
if verbosity == 2:
if resp.code == 200:
outbuf.append("modified existing mapping of name %s to point to " % (vdrive_fname,))
outbuf.append("created new mapping of name %s to point to " % (vdrive_fname,))
outbuf.append("URI: %s" % (uri,))
-
+
sys.stdout.write(''.join(outbuf))
sys.stdout.write("\n")
d.callback(resp.code)
stream.readStream(resp.stream, gather_uri).addCallback(output_result)
-
+
def send_req(proto):
proto.submitRequest(ClientRequest('PUT', url, {}, instream)).addCallback(got_resp)
exitcode[0] = result
reactor.stop()
return result
-
+
d.addCallbacks(exit, exit)
reactor.run()
return exitcode[0]