-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix several newline problems #15028
fix several newline problems #15028
Conversation
Is there any reason checks are with |
@@ -146,7 +146,11 @@ proc send*(ftp: AsyncFtpClient, m: string): Future[TaintedString] {.async.} = | |||
## Send a message to the server, and wait for a primary reply. | |||
## ``\c\L`` is added for you. | |||
## | |||
## You need to make sure that the message ``m`` doesn't contain any newline | |||
## characters. Failing to do so will raise ``AssertionDefect``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In non-release mode, right? Aren't assertions turned off for release mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Varriount doAssert assertions are always enabled
@@ -245,7 +245,8 @@ proc contentLength*(response: Response | AsyncResponse): int = | |||
## | |||
## A ``ValueError`` exception will be raised if the value is not an integer. | |||
var contentLengthHeader = response.headers.getOrDefault("Content-Length") | |||
return contentLengthHeader.parseInt() | |||
result = contentLengthHeader.parseInt() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use parseSaturatedNatural
because that cannot raise an overflow exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but that changes the documented behaviour:
A
ValueError
exception will be raised if the value is not an integer.
import parseutils, strutils
var a = "123.45"
var b: int
discard parseSaturatedNatural(a, b)
echo b # ==> 123
var c = parseInt(a)
echo c # ==> ValueError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok...
* prevent newlines where they shouldn't be * 'contentLength' shouldn't be negative (cherry picked from commit 5fafa2f)
* prevent newlines where they shouldn't be * 'contentLength' shouldn't be negative (cherry picked from commit 5fafa2f)
* prevent newlines where they shouldn't be * 'contentLength' shouldn't be negative
No description provided.