aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-30 15:04:41 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-30 16:49:46 +0300
commitaed886a2618e68f4ec08ad42ae31d17df1706910 (patch)
tree74992a56b25eb5841517677869c5ab7a812d1022 /contrib
parent8c644fc1f4d498ea489add8d40a68f5d3e5899fa (diff)
downloadlibmicrohttpd-aed886a2618e68f4ec08ad42ae31d17df1706910.tar.gz
libmicrohttpd-aed886a2618e68f4ec08ad42ae31d17df1706910.zip
Updated HTTP methods
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/gen_http_methods_insert.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/contrib/gen_http_methods_insert.sh b/contrib/gen_http_methods_insert.sh
index 38485848..65076081 100755
--- a/contrib/gen_http_methods_insert.sh
+++ b/contrib/gen_http_methods_insert.sh
@@ -4,7 +4,7 @@
4# Generate header insert for HTTP methods 4# Generate header insert for HTTP methods
5# 5#
6 6
7# Copyright (c) 2015-2019 Karlson2k (Evgeny Grin) <k2k@yandex.ru> 7# Copyright (c) 2015-2021 Karlson2k (Evgeny Grin) <k2k@yandex.ru>
8# 8#
9# Copying and distribution of this file, with or without modification, are 9# Copying and distribution of this file, with or without modification, are
10# permitted in any medium without royalty provided the copyright notice 10# permitted in any medium without royalty provided the copyright notice
@@ -17,7 +17,7 @@ echo '/**
17 * @defgroup methods HTTP methods 17 * @defgroup methods HTTP methods
18 * HTTP methods (as strings). 18 * HTTP methods (as strings).
19 * See: http://www.iana.org/assignments/http-methods/http-methods.xml 19 * See: http://www.iana.org/assignments/http-methods/http-methods.xml
20 * Registry export date: '$(date -u +%Y-%m-%d)' 20 * Registry export date: '"$(date -u +%Y-%m-%d)"'
21 * @{ 21 * @{
22 */ 22 */
23 23
@@ -26,7 +26,7 @@ gawk -e 'BEGIN {FPAT = "([^,]*)|(\"[^\"]+\")"}
26FNR > 1 { 26FNR > 1 {
27 gsub(/^\[|^"\[|\]"$|\]$/, "", $4) 27 gsub(/^\[|^"\[|\]"$|\]$/, "", $4)
28 gsub(/\]\[/, "; ", $4) 28 gsub(/\]\[/, "; ", $4)
29 if (substr($4, 1, 7) == "RFC7231") { 29 if (substr($4, 1, 26) == "RFC-ietf-httpbis-semantics") {
30 if ($2 == "yes") 30 if ($2 == "yes")
31 { safe_m = "Safe. " } 31 { safe_m = "Safe. " }
32 else 32 else
@@ -36,7 +36,9 @@ FNR > 1 {
36 else 36 else
37 { indem_m = "Not idempotent." } 37 { indem_m = "Not idempotent." }
38 print "/* " safe_m " " indem_m " " $4 ". */" 38 print "/* " safe_m " " indem_m " " $4 ". */"
39 print "#define MHD_HTTP_METHOD_" toupper(gensub(/-/, "_", "g", $1)) " \""$1"\"" 39 mthd = gensub(/\*/, "ASTERISK", "g", $1)
40 mthd = gensub(/[^a-zA-Z0-9_]/, "_", "g", mthd)
41 printf ("%-32s \"%s\"\n", "#define MHD_HTTP_METHOD_" toupper(mthd), $1)
40 } 42 }
41}' methods.csv >> header_insert_methods.h && \ 43}' methods.csv >> header_insert_methods.h && \
42echo ' 44echo '
@@ -45,7 +47,7 @@ gawk -e 'BEGIN {FPAT = "([^,]*)|(\"[^\"]+\")"}
45FNR > 1 { 47FNR > 1 {
46 gsub(/^\[|^"\[|\]"$|\]$/, "", $4) 48 gsub(/^\[|^"\[|\]"$|\]$/, "", $4)
47 gsub(/\]\[/, "; ", $4) 49 gsub(/\]\[/, "; ", $4)
48 if (substr($4, 1, 7) != "RFC7231") { 50 if (substr($4, 1, 26) != "RFC-ietf-httpbis-semantics") {
49 if ($2 == "yes") 51 if ($2 == "yes")
50 { safe_m = "Safe. " } 52 { safe_m = "Safe. " }
51 else 53 else
@@ -55,7 +57,9 @@ FNR > 1 {
55 else 57 else
56 { indem_m = "Not idempotent." } 58 { indem_m = "Not idempotent." }
57 print "/* " safe_m " " indem_m " " $4 ". */" 59 print "/* " safe_m " " indem_m " " $4 ". */"
58 print "#define MHD_HTTP_METHOD_" toupper(gensub(/-/, "_", "g", $1)) " \""$1"\"" 60 mthd = gensub(/\*/, "ASTERISK", "g", $1)
61 mthd = gensub(/[^a-zA-Z0-9_]/, "_", "g", mthd)
62 printf ("%-38s \"%s\"\n", "#define MHD_HTTP_METHOD_" toupper(mthd), $1)
59 } 63 }
60}' methods.csv >> header_insert_methods.h && \ 64}' methods.csv >> header_insert_methods.h && \
61echo OK && \ 65echo OK && \