diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-04-15 20:33:02 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-04-15 20:41:27 +0200 |
| commit | 95640d50d9e585e98048c394d6aa1b91a0be1d77 (patch) | |
| tree | 2cfc026dc7bfe50b32e0c689bdc5fb56d055ee42 | |
| parent | 1bcd869d31977b7e73faf41dc5efb9592afae965 (diff) | |
| download | chawan-95640d50d9e585e98048c394d6aa1b91a0be1d77.tar.gz | |
toml: remove broken special case, update docs
Turns out the cure was worse than the disease. Let's just make it a
backwards incompatible change, so that at least the error message is
no longer nonsensical.
| -rw-r--r-- | doc/cha-config.5 | 3 | ||||
| -rw-r--r-- | doc/cha-protocols.7 | 38 | ||||
| -rw-r--r-- | doc/config.md | 2 | ||||
| -rw-r--r-- | doc/protocols.md | 2 | ||||
| -rw-r--r-- | src/config/toml.nim | 12 |
5 files changed, 20 insertions, 37 deletions
diff --git a/doc/cha-config.5 b/doc/cha-config.5 index af553073..bd883e34 100644 --- a/doc/cha-config.5 +++ b/doc/cha-config.5 @@ -16,9 +16,6 @@ The first is additive, meaning old values are not removed. The second is destructive, and clears all definitions in the table specified. .IP \[bu] 2 -For backwards compatibility, \f[CR]table = []\f[R] is equivalent to -\f[CR]table = {}\f[R]. -.IP \[bu] 2 \f[CR][[table\-array]]\f[R] is sugar for \f[CR][table\-array.n]\f[R], where \f[CR]n\f[R] is the number of declared table arrays. For example, you can declare anonymous siteconfs using the syntax diff --git a/doc/cha-protocols.7 b/doc/cha-protocols.7 index a68097b6..048c1d4a 100644 --- a/doc/cha-protocols.7 +++ b/doc/cha-protocols.7 @@ -13,27 +13,23 @@ For protocol\-specific file formats (like gemtext or gopher directories) you will also find an appropriate HTML converter in \f[CR]adapter/format\f[R]. .SS HTTP -HTTP/s support is based on libcurl; supported features largely depend on -your libcurl version. -.PP -The libcurl HTTP adapter can take arbitrary headers and POST data, is -able to use passed userinfo data -(\f[CR]https://username:password\[at]example.org\f[R]), and returns all -headers and response body it receives from libcurl without exception. -.PP -It is possible to build the HTTP adapter using \c -.UR https://github.com/lwthiker/curl-impersonate -curl\-impersonate -.UE \c -\ by setting the compile\-time variable CURLLIBNAME to -\f[CR]libcurl\-impersonate.so\f[R]. -Note that for curl\-impersonate to work, you must set -\f[CR]network.default\-headers = {}\f[R] in the Chawan config. -(Otherwise, the libcurl adapter will happily override curl\-impersonate -headers, which is probably not what you want.) -.PP -The \f[CR]bonus\f[R] directory contains an alternative HTTP client based -on FreeBSD libfetch. +HTTP/s support is implemented in Nim. +It supports HTTP/1.1 with arbitrary headers and POST data, is able to +use passed userinfo data, and returns all headers and response body it +receives without exception. +.PP +Deflate decompression with gzip and zlib headers is supported. +(Content\-Type: gzip, deflate.) +This is based on a modified version of the public domain tinfl.h +decompressor by Rich Geldreich. +.PP +The \f[CR]bonus\f[R] directory contains two alternative HTTP clients: +.IP \[bu] 2 +curlhttp; this is the old HTTP client based on libcurl. +It can be built using curl\-impersonate; see README.md in the bonus/ +directory for details. +.IP \[bu] 2 +libfetch\-http: based on FreeBSD libfetch. It is mostly a proof of concept, as FreeBSD libfetch HTTP support is very limited; in particular, it does not support arbitrary HTTP headers, so e.g. diff --git a/doc/config.md b/doc/config.md index 3cb68e86..61a38ac1 100644 --- a/doc/config.md +++ b/doc/config.md @@ -13,8 +13,6 @@ to toml, with the following exceptions: different semantics. The first is additive, meaning old values are not removed. The second is destructive, and clears all definitions in the table specified. -* For backwards compatibility, `table = []` is equivalent to - `table = {}`. * `[[table-array]]` is sugar for `[table-array.n]`, where `n` is the number of declared table arrays. For example, you can declare anonymous siteconfs using the syntax `[[siteconf]]`. diff --git a/doc/protocols.md b/doc/protocols.md index f1d88c35..50086c31 100644 --- a/doc/protocols.md +++ b/doc/protocols.md @@ -37,7 +37,7 @@ and returns all headers and response body it receives without exception. Deflate decompression with gzip and zlib headers is supported. (Content-Type: gzip, deflate.) This is based on a modified version of -the public domain tinfl.h decompressor by Rich Gelreich. +the public domain tinfl.h decompressor by Rich Geldreich. The `bonus` directory contains two alternative HTTP clients: diff --git a/src/config/toml.nim b/src/config/toml.nim index 6842d7fc..9b68f2f3 100644 --- a/src/config/toml.nim +++ b/src/config/toml.nim @@ -276,17 +276,9 @@ proc flushLine(state: var TomlParser): Err[TomlError] = table.map[keys[i]] = TomlValue(t: tvtTable, tab: node) table = node inc i - let value = node.value - if i == 0 and value.t == tvtArray and value.a.len == 0: - # old delete syntax - let s = keys.join('.') - state.arraySeen.del(s) - table.clear = true - elif keys[i] in table.map: + if table.map.hasKeyOrPut(keys[i], node.value): return state.err("re-definition of node " & keys.join('.')) - else: - table.map[keys[i]] = value - table.nodes.add(state.node) + table.nodes.add(state.node) state.node = nil inc state.line return ok() |