Skip to content

Commit 8e52f3d

Browse files
committed
allow blank options; fixes msoulier#141
1 parent 682f1d0 commit 8e52f3d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

partftpy/TftpPacketTypes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def decode_options(self, buffer):
4646
words.pop()
4747

4848
tftpassert(len(words) % 2 == 0, "packet has odd number of option/value pairs")
49-
tftpassert("" not in words, "packet has zerolength option values")
5049

5150
options = {k: v for k, v in zip(words[::2], words[1::2])}
5251
for k in ("blksize", "tsize"):

partftpy/TftpStates.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ def returnSupportedOptions(self, options):
6464
# We support the options blksize and tsize right now.
6565
# FIXME - put this somewhere else?
6666
accepted_options = {}
67-
for option in options:
68-
if option == "blksize":
67+
for option, optval in options.items():
68+
if optval == "":
69+
log.info("Option ignored due to blank value: '%s'", option)
70+
elif option == "blksize":
6971
# Make sure it's valid.
7072
if int(options[option]) > MAX_BLKSIZE:
7173
log.info(

0 commit comments

Comments
 (0)