Skip to content
This repository was archived by the owner on May 31, 2021. It is now read-only.

Commit 3393316

Browse files
committed
Catch negative numbers and don't wait at all.
1 parent 44e66bd commit 3393316

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

examples/simple_server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def do_GET(self): # pylint: disable=invalid-name
2828
seconds = float(self.path[1:])
2929
except ValueError:
3030
seconds = 0.0
31+
if seconds < 0:
32+
seconds = 0.0
3133
text = "Waited for {:4.2f} seconds.\nThat's all.\n"
3234
msg = text.format(seconds).encode(ENCODING)
3335
time.sleep(seconds)

0 commit comments

Comments
 (0)