summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authordjazz <daniel.j.hede@gmail.com>2020-06-12 10:16:38 +0200
committerGitHub <noreply@github.com>2020-06-12 10:16:38 +0200
commit1168c75381446f8c81ce3f5f329ce2dab238415c (patch)
tree221eb3b6af3e38c1aaf5bba31ce4ceb7c621f8d3 /lib
parent67d34366dc442cd655c78ce41a3fa50491736eb6 (diff)
downloadNim-1168c75381446f8c81ce3f5f329ce2dab238415c.tar.gz
httpcore: Add http code 308 Permanent Redirect (#14639)
* httpcore: Add http code 308
* httpclient: Add 308 to redirection proc
* fix typo
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/httpclient.nim2
-rw-r--r--lib/pure/httpcore.nim2
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim
index 42735ad4e..1ac3ae185 100644
--- a/lib/pure/httpclient.nim
+++ b/lib/pure/httpclient.nim
@@ -457,7 +457,7 @@ proc sendFile(socket: Socket | AsyncSocket,
   file.close()
 
 proc redirection(status: string): bool =
-  const redirectionNRs = ["301", "302", "303", "307"]
+  const redirectionNRs = ["301", "302", "303", "307", "308"]
   for i in items(redirectionNRs):
     if status.startsWith(i):
       return true
diff --git a/lib/pure/httpcore.nim b/lib/pure/httpcore.nim
index 78cb66ded..9c51887cb 100644
--- a/lib/pure/httpcore.nim
+++ b/lib/pure/httpcore.nim
@@ -66,6 +66,7 @@ const
   Http304* = HttpCode(304)
   Http305* = HttpCode(305)
   Http307* = HttpCode(307)
+  Http308* = HttpCode(308)
   Http400* = HttpCode(400)
   Http401* = HttpCode(401)
   Http403* = HttpCode(403)
@@ -272,6 +273,7 @@ proc `$`*(code: HttpCode): string =
   of 304: "304 Not Modified"
   of 305: "305 Use Proxy"
   of 307: "307 Temporary Redirect"
+  of 308: "308 Permanent Redirect"
   of 400: "400 Bad Request"
   of 401: "401 Unauthorized"
   of 403: "403 Forbidden"