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/asyncnet.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/asyncnet.nim')
-rw-r--r-- | lib/pure/asyncnet.nim | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index 2d5c65001..1ec751a64 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -464,8 +464,7 @@ proc recvLineInto*(socket: AsyncSocket, resString: FutureVar[string], ## The partial line **will be lost**. ## ## 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. ``resString`` will be truncated after that. ## ## **Warning**: The ``Peek`` flag is not yet implemented. ## @@ -519,10 +518,7 @@ proc recvLineInto*(socket: AsyncSocket, resString: FutureVar[string], socket.currPos.inc() # Verify that this isn't a DOS attack: #3847. - if resString.mget.len > maxLength: - let msg = "recvLine received more than the specified `maxLength` " & - "allowed." - raise newException(ValueError, msg) + if resString.mget.len > maxLength: break else: var c = "" while true: @@ -546,10 +542,7 @@ proc recvLineInto*(socket: AsyncSocket, resString: FutureVar[string], resString.mget.add c # Verify that this isn't a DOS attack: #3847. - if resString.mget.len > maxLength: - let msg = "recvLine received more than the specified `maxLength` " & - "allowed." - raise newException(ValueError, msg) + if resString.mget.len > maxLength: break resString.complete() proc recvLine*(socket: AsyncSocket, @@ -569,8 +562,7 @@ proc recvLine*(socket: AsyncSocket, ## The partial line **will be lost**. ## ## 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**: The ``Peek`` flag is not yet implemented. ## |