1
# Copyright (C) 2006,2011 Canonical Ltd
1
# Copyright (C) 2006 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
36
# TODO: _translate_error should be on the client, not the transport because
37
# error coding is wire protocol specific.
36
39
# TODO: A plain integer from query_version is too simple; should give some
37
40
# capabilities too?
42
# TODO: Server should probably catch exceptions within itself and send them
43
# back across the network. (But shouldn't catch KeyboardInterrupt etc)
44
# Also needs to somehow report protocol errors like bad requests. Need to
45
# consider how we'll handle error reporting, e.g. if we get halfway through a
46
# bulk transfer and then something goes wrong.
39
48
# TODO: Make each request and response self-validatable, e.g. with checksums.
50
# TODO: get/put objects could be changed to gradually read back the data as it
51
# comes across the network
53
# TODO: What should the server do if it hits an error and has to terminate?
41
55
# TODO: is it useful to allow multiple chunks in the bulk data?
43
57
# TODO: If we get an exception during transmission of bulk data we can't just
46
60
# chunk, that indicates it is another chunk. Then you can send an 'error'
47
61
# chunk as long as you finish the previous chunk.
63
# TODO: Clone method on Transport; should work up towards parent directory;
64
# unclear how this should be stored or communicated to the server... maybe
65
# just pass it on all relevant requests?
67
# TODO: Better name than clone() for changing between directories. How about
68
# open_dir or change_dir or chdir?
70
# TODO: Is it really good to have the notion of current directory within the
71
# connection? Perhaps all Transports should factor out a common connection
72
# from the thing that has the directory context?
74
# TODO: The server that manages a connection should be quite small and retain
75
# minimum state because each of the requests are supposed to be stateless.
76
# Then we can write another implementation that maps to http.
78
# TODO: What to do when a client connection is garbage collected? Maybe just
79
# abruptly drop the connection?
81
# TODO: Server in some cases will need to restrict access to files outside of
82
# a particular root directory. LocalTransport doesn't do anything to stop you
83
# ascending above the base directory, so we need to prevent paths
84
# containing '..' in either the server or transport layers. (Also need to
85
# consider what happens if someone creates a symlink pointing outside the
88
# TODO: Server should rebase absolute paths coming across the network to put
89
# them under the virtual root, if one is in use. LocalTransport currently
90
# doesn't do that; if you give it an absolute path it just uses it.
92
# XXX: Arguments can't contain newlines or ascii; possibly we should e.g.
93
# urlescape them instead. Indeed possibly this should just literally be
96
# TODO: Probably want some way for server commands to gradually produce body
97
# data rather than passing it as a string; they could perhaps pass an
98
# iterator-like callback that will gradually yield data; it probably needs a
99
# close() method that will always be closed to do any necessary cleanup.
50
102
# Promote some attributes from submodules into this namespace
51
103
from bzrlib.smart.request import SmartServerRequestHandler