diff options
author | Konstantin Molchanov <moigagoo@live.com> | 2017-03-29 16:54:36 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-29 16:54:36 +0400 |
commit | 04646052aba3e52d962eb20388588ff6be92bda8 (patch) | |
tree | f9d3387bb2d5f9b9dcc0de33527c1f69b9e4527e /lib/pure/net.nim | |
parent | 0c121b38eccde230255d706131c46434e29018e1 (diff) | |
parent | 875e344be0f0202885f0d5ed7f10188835a171d0 (diff) | |
download | Nim-04646052aba3e52d962eb20388588ff6be92bda8.tar.gz |
Merge branch 'devel' into fix_time_offset_in_times_js
Diffstat (limited to 'lib/pure/net.nim')
-rw-r--r-- | lib/pure/net.nim | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/pure/net.nim b/lib/pure/net.nim index 7f6783358..56f8b9399 100644 --- a/lib/pure/net.nim +++ b/lib/pure/net.nim @@ -1010,8 +1010,7 @@ proc readLine*(socket: Socket, line: var TaintedString, timeout = -1, ## the specified time an ETimeout exception will be raised. ## ## The ``maxLength`` parameter determines the maximum amount of characters - ## that can be read before a ``ValueError`` is raised. This prevents Denial - ## of Service (DOS) attacks. + ## that can be read. The result is truncated after that. ## ## **Warning**: Only the ``SafeDisconn`` flag is currently supported. @@ -1047,10 +1046,7 @@ proc readLine*(socket: Socket, line: var TaintedString, timeout = -1, add(line.string, c) # Verify that this isn't a DOS attack: #3847. - if line.string.len > maxLength: - let msg = "recvLine received more than the specified `maxLength` " & - "allowed." - raise newException(ValueError, msg) + if line.string.len > maxLength: break proc recvLine*(socket: Socket, timeout = -1, flags = {SocketFlag.SafeDisconn}, @@ -1069,8 +1065,7 @@ proc recvLine*(socket: Socket, timeout = -1, ## the specified time an ETimeout exception will be raised. ## ## The ``maxLength`` parameter determines the maximum amount of characters - ## that can be read before a ``ValueError`` is raised. This prevents Denial - ## of Service (DOS) attacks. + ## that can be read. The result is truncated after that. ## ## **Warning**: Only the ``SafeDisconn`` flag is currently supported. result = "" |