Skip to content
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

move cgi to nimble packages #20951

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@

- Using an unnamed break in a block is deprecated. This warning will become an error in future versions! Use a named block with a named break instead.

- Several Standard libraries are moved to nimble packages, use `nimble` to install them:
- move `std/cgi` to https://github.com/nim-lang/cgi

## Standard library additions and changes

[//]: # "Changes:"
Expand Down
3 changes: 0 additions & 3 deletions doc/lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,6 @@ Internet Protocols and Support
* [asyncstreams](asyncstreams.html)
This module provides `FutureStream` - a future that acts as a queue.

* [cgi](cgi.html)
This module implements helpers for CGI applications.

* [cookies](cookies.html)
This module contains helper procs for parsing and generating cookies.

Expand Down
315 changes: 0 additions & 315 deletions lib/pure/cgi.nim

This file was deleted.

1 change: 0 additions & 1 deletion tests/effects/tstrict_funcs_imports.nim
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import
base64,
bitops,
browsers,
cgi,
chains,
colors,
complex,
Expand Down
10 changes: 8 additions & 2 deletions tests/gc/growobjcrash.nim
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import std/[cgi, strtabs]
import std/[uri, strtabs]

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)

proc handleRequest(query: string): StringTableRef =
iterator foo(): StringTableRef {.closure.} =
var params = {:}.newStringTable()
for key, val in cgi.decodeData(query):
for key, val in decodeData(query):
params[key] = val
yield params

Expand Down
2 changes: 1 addition & 1 deletion tests/js/tstdlib_imports.nim
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import std/[
# Internet protocols:
cookies, httpcore, mimetypes, uri,
# fails due to FFI: asyncdispatch, asyncfile, asyncftpclient, asynchttpserver,
# asyncnet, cgi, httpclient, nativesockets, net, selectors, smtp
# asyncnet, httpclient, nativesockets, net, selectors, smtp
# works but no need to test: asyncstreams, asyncfutures

# Threading:
Expand Down
27 changes: 0 additions & 27 deletions tests/stdlib/tcgi.nim
Original file line number Diff line number Diff line change
@@ -1,27 +0,0 @@
import std/unittest
import std/[cgi, strtabs, sugar]
import std/assertions

block: # Test cgi module
const queryString = "foo=bar&фу=бар&checked=✓&list=1,2,3&with_space=text%20with%20space"

block: # test query parsing with readData
let parsedQuery = readData(queryString)

check parsedQuery["foo"] == "bar"
check parsedQuery["фу"] == "бар"
check parsedQuery["checked"] == "✓"
check parsedQuery["list"] == "1,2,3"
check parsedQuery["with_space"] == "text with space"

expect KeyError:
discard parsedQuery["not_existing_key"]

# bug #15369
let queryString = "a=1&b=0&c=3&d&e&a=5&a=t%20e%20x%20t&e=http%3A%2F%2Fw3schools.com%2Fmy%20test.asp%3Fname%3Dst%C3%A5le%26car%3Dsaab"

doAssert collect(for pair in decodeData(queryString): pair) ==
@[("a", "1"), ("b", "0"), ("c", "3"),
("d", ""),("e", ""), ("a", "5"), ("a", "t e x t"),
("e", "http://w3schools.com/my test.asp?name=ståle&car=saab")
]