summary refs log tree commit diff stats
path: root/changelog.md
diff options
context:
space:
mode:
authorYardanico <tiberiumk12@gmail.com>2023-10-29 08:21:32 +0300
committerGitHub <noreply@github.com>2023-10-29 06:21:32 +0100
commit94ffc183323c859fc5a395404ac6035ae29cbc5a (patch)
treef7aba4cfcdb3e7b2c6de4f2e13957ffacd78e6bc /changelog.md
parentfbc801d1d15aa2c5f12a3f3bc1e35aad185dafb1 (diff)
downloadNim-94ffc183323c859fc5a395404ac6035ae29cbc5a.tar.gz
Fix #22862 - change the httpclient user-agent to be valid spec-wise (#22882)
Per https://datatracker.ietf.org/doc/html/rfc9110#name-user-agent a
User-Agent is defined as follows:
```
  User-Agent = product *( RWS ( product / comment ) )
```
Where
```
  product         = token ["/" product-version]
  product-version = token
```
In this case, `token` is defined in RFC 7230 -
https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6:
```
     token          = 1*tchar

     tchar          = "!" / "#" / "$" / "%" / "&" / "'" / "*"
                    / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
                    / DIGIT / ALPHA
                    ; any VCHAR, except delimiters
```
or, in the original RFC 2616 -
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2 (next page):
```
       token          = 1*<any CHAR except CTLs or separators>
       separators     = "(" | ")" | "<" | ">" | "@"
                      | "," | ";" | ":" | "\" | <">
                      | "/" | "[" | "]" | "?" | "="
                      | "{" | "}" | SP | HT
```
which means that a `token` cannot have whitespace. Not sure if this
should be in the breaking changelog section - theoretically, some
clients might've relied on the old Nim user-agent?

For some extra info, some other languages seem to have adopted the same
hyphen user agent to specify the language + module, e.g.:
-
https://github.com/python/cpython/blob/main/Lib/urllib/request.py#L1679
(`Python-urllib/<version>`)

Fixes #22862.
Diffstat (limited to 'changelog.md')
-rw-r--r--changelog.md1
1 files changed, 1 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md
index b094dd0eb..454b613f0 100644
--- a/changelog.md
+++ b/changelog.md
@@ -4,6 +4,7 @@
 ## Changes affecting backward compatibility
 
 - `-d:nimStrictDelete` becomes the default. An index error is produced when the index passed to `system.delete` was out of bounds. Use `-d:nimAuditDelete` to mimic the old behavior for backwards compatibility.
+- The default user-agent in `std/httpclient` has been changed to `Nim-httpclient/<version>` instead of `Nim httpclient/<version>` which was incorrect according to the HTTP spec.
 
 ## Standard library additions and changes