Deprecate TaintedString (#15423)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
This commit is contained in:
parent
7b632f9ccb
commit
78a99587a4
36 changed files with 184 additions and 229 deletions
|
|
@ -81,14 +81,14 @@ proc getEncodedData(allowedMethods: set[RequestMethod]): string =
|
|||
if methodNone notin allowedMethods:
|
||||
cgiError("'REQUEST_METHOD' must be 'POST' or 'GET'")
|
||||
|
||||
iterator decodeData*(data: string): tuple[key, value: TaintedString] =
|
||||
iterator decodeData*(data: string): tuple[key, value: string] =
|
||||
## Reads and decodes CGI data and yields the (name, value) pairs the
|
||||
## data consists of.
|
||||
for (key, value) in uri.decodeQuery(data):
|
||||
yield (key, value)
|
||||
|
||||
iterator decodeData*(allowedMethods: set[RequestMethod] =
|
||||
{methodNone, methodPost, methodGet}): tuple[key, value: TaintedString] =
|
||||
{methodNone, methodPost, methodGet}): tuple[key, value: string] =
|
||||
## Reads and decodes CGI data and yields the (name, value) pairs the
|
||||
## data consists of. If the client does not use a method listed in the
|
||||
## `allowedMethods` set, a `CgiError` exception is raised.
|
||||
|
|
@ -301,10 +301,10 @@ proc setCookie*(name, value: string) =
|
|||
var
|
||||
gcookies {.threadvar.}: StringTableRef
|
||||
|
||||
proc getCookie*(name: string): TaintedString =
|
||||
proc getCookie*(name: string): string =
|
||||
## Gets a cookie. If no cookie of `name` exists, "" is returned.
|
||||
if gcookies == nil: gcookies = parseCookies(getHttpCookie())
|
||||
result = TaintedString(gcookies.getOrDefault(name))
|
||||
result = gcookies.getOrDefault(name)
|
||||
|
||||
proc existsCookie*(name: string): bool =
|
||||
## Checks if a cookie of `name` exists.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue