Fixed the use of the tsize option in RRQ packets.

This commit is contained in:
Michael P. Soulier 2008-10-08 21:31:34 -04:00
parent 0a5df33dca
commit ca7a06a09b
3 changed files with 8 additions and 8 deletions

6
README
View file

@ -62,7 +62,7 @@ Purpose:
Tftpy is a TFTP library for the Python programming language. It includes
client and server classes, with sample implementations. Hooks are included for
easy inclusion in a UI for populating progress indicators. It supports RFCs
1350, 2347 and 2348.
1350, 2347, 2348 and the tsize option from RFC 2349.
Dependencies:
-------------
@ -81,8 +81,8 @@ Limitations:
------------
- Server only supports downloads.
- Client only supports downloads.
- Only 'octet' mode is supported
- The only option supported is blksize
- Only 'octet' mode is supported.
- The only options supported are blksize and tsize.
Future:
-------

View file

@ -79,7 +79,7 @@ def main():
if options.blocksize:
tftp_options['blksize'] = int(options.blocksize)
if options.tsize:
tftp_options['tsize'] = 1
tftp_options['tsize'] = 0
tclient = tftpy.TftpClient(options.host,
int(options.port),

View file

@ -151,12 +151,12 @@ class TftpPacketInitial(TftpPacket, TftpPacketWithOptions):
if self.options.keys() > 0:
logger.debug("there are options to encode")
for key in self.options:
# Populate the option name
format += "%dsx" % len(key)
options_list.append(key)
# Not all options have values.
if key != 'tsize':
format += "%dsx" % len(str(self.options[key]))
options_list.append(str(self.options[key]))
# Populate the option value
format += "%dsx" % len(str(self.options[key]))
options_list.append(str(self.options[key]))
logger.debug("format is %s" % format)
logger.debug("options_list is %s" % options_list)