commit aed886a2618e68f4ec08ad42ae31d17df1706910
parent 8c644fc1f4d498ea489add8d40a68f5d3e5899fa
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sat, 30 Oct 2021 15:04:41 +0300
Updated HTTP methods
Diffstat:
2 files changed, 57 insertions(+), 51 deletions(-)
diff --git a/contrib/gen_http_methods_insert.sh b/contrib/gen_http_methods_insert.sh
@@ -4,7 +4,7 @@
# Generate header insert for HTTP methods
#
-# Copyright (c) 2015-2019 Karlson2k (Evgeny Grin) <k2k@yandex.ru>
+# Copyright (c) 2015-2021 Karlson2k (Evgeny Grin) <k2k@yandex.ru>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
@@ -17,7 +17,7 @@ echo '/**
* @defgroup methods HTTP methods
* HTTP methods (as strings).
* See: http://www.iana.org/assignments/http-methods/http-methods.xml
- * Registry export date: '$(date -u +%Y-%m-%d)'
+ * Registry export date: '"$(date -u +%Y-%m-%d)"'
* @{
*/
@@ -26,7 +26,7 @@ gawk -e 'BEGIN {FPAT = "([^,]*)|(\"[^\"]+\")"}
FNR > 1 {
gsub(/^\[|^"\[|\]"$|\]$/, "", $4)
gsub(/\]\[/, "; ", $4)
- if (substr($4, 1, 7) == "RFC7231") {
+ if (substr($4, 1, 26) == "RFC-ietf-httpbis-semantics") {
if ($2 == "yes")
{ safe_m = "Safe. " }
else
@@ -36,7 +36,9 @@ FNR > 1 {
else
{ indem_m = "Not idempotent." }
print "/* " safe_m " " indem_m " " $4 ". */"
- print "#define MHD_HTTP_METHOD_" toupper(gensub(/-/, "_", "g", $1)) " \""$1"\""
+ mthd = gensub(/\*/, "ASTERISK", "g", $1)
+ mthd = gensub(/[^a-zA-Z0-9_]/, "_", "g", mthd)
+ printf ("%-32s \"%s\"\n", "#define MHD_HTTP_METHOD_" toupper(mthd), $1)
}
}' methods.csv >> header_insert_methods.h && \
echo '
@@ -45,7 +47,7 @@ gawk -e 'BEGIN {FPAT = "([^,]*)|(\"[^\"]+\")"}
FNR > 1 {
gsub(/^\[|^"\[|\]"$|\]$/, "", $4)
gsub(/\]\[/, "; ", $4)
- if (substr($4, 1, 7) != "RFC7231") {
+ if (substr($4, 1, 26) != "RFC-ietf-httpbis-semantics") {
if ($2 == "yes")
{ safe_m = "Safe. " }
else
@@ -55,7 +57,9 @@ FNR > 1 {
else
{ indem_m = "Not idempotent." }
print "/* " safe_m " " indem_m " " $4 ". */"
- print "#define MHD_HTTP_METHOD_" toupper(gensub(/-/, "_", "g", $1)) " \""$1"\""
+ mthd = gensub(/\*/, "ASTERISK", "g", $1)
+ mthd = gensub(/[^a-zA-Z0-9_]/, "_", "g", mthd)
+ printf ("%-38s \"%s\"\n", "#define MHD_HTTP_METHOD_" toupper(mthd), $1)
}
}' methods.csv >> header_insert_methods.h && \
echo OK && \
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
@@ -942,87 +942,89 @@ MHD_get_reason_phrase_len_for (unsigned int code);
* @defgroup methods HTTP methods
* HTTP methods (as strings).
* See: http://www.iana.org/assignments/http-methods/http-methods.xml
- * Registry export date: 2020-09-20
+ * Registry export date: 2021-10-30
* @{
*/
/* Main HTTP methods. */
-/* Not safe. Not idempotent. RFC7231, Section 4.3.6. */
-#define MHD_HTTP_METHOD_CONNECT "CONNECT"
-/* Not safe. Idempotent. RFC7231, Section 4.3.5. */
-#define MHD_HTTP_METHOD_DELETE "DELETE"
-/* Safe. Idempotent. RFC7231, Section 4.3.1. */
-#define MHD_HTTP_METHOD_GET "GET"
-/* Safe. Idempotent. RFC7231, Section 4.3.2. */
-#define MHD_HTTP_METHOD_HEAD "HEAD"
-/* Safe. Idempotent. RFC7231, Section 4.3.7. */
-#define MHD_HTTP_METHOD_OPTIONS "OPTIONS"
-/* Not safe. Not idempotent. RFC7231, Section 4.3.3. */
-#define MHD_HTTP_METHOD_POST "POST"
-/* Not safe. Idempotent. RFC7231, Section 4.3.4. */
-#define MHD_HTTP_METHOD_PUT "PUT"
-/* Safe. Idempotent. RFC7231, Section 4.3.8. */
-#define MHD_HTTP_METHOD_TRACE "TRACE"
+/* Not safe. Not idempotent. RFC-ietf-httpbis-semantics, Section 9.3.6. */
+#define MHD_HTTP_METHOD_CONNECT "CONNECT"
+/* Not safe. Idempotent. RFC-ietf-httpbis-semantics, Section 9.3.5. */
+#define MHD_HTTP_METHOD_DELETE "DELETE"
+/* Safe. Idempotent. RFC-ietf-httpbis-semantics, Section 9.3.1. */
+#define MHD_HTTP_METHOD_GET "GET"
+/* Safe. Idempotent. RFC-ietf-httpbis-semantics, Section 9.3.2. */
+#define MHD_HTTP_METHOD_HEAD "HEAD"
+/* Safe. Idempotent. RFC-ietf-httpbis-semantics, Section 9.3.7. */
+#define MHD_HTTP_METHOD_OPTIONS "OPTIONS"
+/* Not safe. Not idempotent. RFC-ietf-httpbis-semantics, Section 9.3.3. */
+#define MHD_HTTP_METHOD_POST "POST"
+/* Not safe. Idempotent. RFC-ietf-httpbis-semantics, Section 9.3.4. */
+#define MHD_HTTP_METHOD_PUT "PUT"
+/* Safe. Idempotent. RFC-ietf-httpbis-semantics, Section 9.3.8. */
+#define MHD_HTTP_METHOD_TRACE "TRACE"
+/* Not safe. Not idempotent. RFC-ietf-httpbis-semantics, Section 18.2. */
+#define MHD_HTTP_METHOD_ASTERISK "*"
/* Additional HTTP methods. */
/* Not safe. Idempotent. RFC3744, Section 8.1. */
-#define MHD_HTTP_METHOD_ACL "ACL"
+#define MHD_HTTP_METHOD_ACL "ACL"
/* Not safe. Idempotent. RFC3253, Section 12.6. */
#define MHD_HTTP_METHOD_BASELINE_CONTROL "BASELINE-CONTROL"
/* Not safe. Idempotent. RFC5842, Section 4. */
-#define MHD_HTTP_METHOD_BIND "BIND"
+#define MHD_HTTP_METHOD_BIND "BIND"
/* Not safe. Idempotent. RFC3253, Section 4.4, Section 9.4. */
-#define MHD_HTTP_METHOD_CHECKIN "CHECKIN"
+#define MHD_HTTP_METHOD_CHECKIN "CHECKIN"
/* Not safe. Idempotent. RFC3253, Section 4.3, Section 8.8. */
-#define MHD_HTTP_METHOD_CHECKOUT "CHECKOUT"
+#define MHD_HTTP_METHOD_CHECKOUT "CHECKOUT"
/* Not safe. Idempotent. RFC4918, Section 9.8. */
-#define MHD_HTTP_METHOD_COPY "COPY"
+#define MHD_HTTP_METHOD_COPY "COPY"
/* Not safe. Idempotent. RFC3253, Section 8.2. */
-#define MHD_HTTP_METHOD_LABEL "LABEL"
+#define MHD_HTTP_METHOD_LABEL "LABEL"
/* Not safe. Idempotent. RFC2068, Section 19.6.1.2. */
-#define MHD_HTTP_METHOD_LINK "LINK"
+#define MHD_HTTP_METHOD_LINK "LINK"
/* Not safe. Not idempotent. RFC4918, Section 9.10. */
-#define MHD_HTTP_METHOD_LOCK "LOCK"
+#define MHD_HTTP_METHOD_LOCK "LOCK"
/* Not safe. Idempotent. RFC3253, Section 11.2. */
-#define MHD_HTTP_METHOD_MERGE "MERGE"
+#define MHD_HTTP_METHOD_MERGE "MERGE"
/* Not safe. Idempotent. RFC3253, Section 13.5. */
-#define MHD_HTTP_METHOD_MKACTIVITY "MKACTIVITY"
+#define MHD_HTTP_METHOD_MKACTIVITY "MKACTIVITY"
/* Not safe. Idempotent. RFC4791, Section 5.3.1; RFC8144, Section 2.3. */
-#define MHD_HTTP_METHOD_MKCALENDAR "MKCALENDAR"
+#define MHD_HTTP_METHOD_MKCALENDAR "MKCALENDAR"
/* Not safe. Idempotent. RFC4918, Section 9.3; RFC5689, Section 3; RFC8144, Section 2.3. */
-#define MHD_HTTP_METHOD_MKCOL "MKCOL"
+#define MHD_HTTP_METHOD_MKCOL "MKCOL"
/* Not safe. Idempotent. RFC4437, Section 6. */
-#define MHD_HTTP_METHOD_MKREDIRECTREF "MKREDIRECTREF"
+#define MHD_HTTP_METHOD_MKREDIRECTREF "MKREDIRECTREF"
/* Not safe. Idempotent. RFC3253, Section 6.3. */
-#define MHD_HTTP_METHOD_MKWORKSPACE "MKWORKSPACE"
+#define MHD_HTTP_METHOD_MKWORKSPACE "MKWORKSPACE"
/* Not safe. Idempotent. RFC4918, Section 9.9. */
-#define MHD_HTTP_METHOD_MOVE "MOVE"
+#define MHD_HTTP_METHOD_MOVE "MOVE"
/* Not safe. Idempotent. RFC3648, Section 7. */
-#define MHD_HTTP_METHOD_ORDERPATCH "ORDERPATCH"
+#define MHD_HTTP_METHOD_ORDERPATCH "ORDERPATCH"
/* Not safe. Not idempotent. RFC5789, Section 2. */
-#define MHD_HTTP_METHOD_PATCH "PATCH"
+#define MHD_HTTP_METHOD_PATCH "PATCH"
/* Safe. Idempotent. RFC7540, Section 3.5. */
-#define MHD_HTTP_METHOD_PRI "PRI"
+#define MHD_HTTP_METHOD_PRI "PRI"
/* Safe. Idempotent. RFC4918, Section 9.1; RFC8144, Section 2.1. */
-#define MHD_HTTP_METHOD_PROPFIND "PROPFIND"
+#define MHD_HTTP_METHOD_PROPFIND "PROPFIND"
/* Not safe. Idempotent. RFC4918, Section 9.2; RFC8144, Section 2.2. */
-#define MHD_HTTP_METHOD_PROPPATCH "PROPPATCH"
+#define MHD_HTTP_METHOD_PROPPATCH "PROPPATCH"
/* Not safe. Idempotent. RFC5842, Section 6. */
-#define MHD_HTTP_METHOD_REBIND "REBIND"
+#define MHD_HTTP_METHOD_REBIND "REBIND"
/* Safe. Idempotent. RFC3253, Section 3.6; RFC8144, Section 2.1. */
-#define MHD_HTTP_METHOD_REPORT "REPORT"
+#define MHD_HTTP_METHOD_REPORT "REPORT"
/* Safe. Idempotent. RFC5323, Section 2. */
-#define MHD_HTTP_METHOD_SEARCH "SEARCH"
+#define MHD_HTTP_METHOD_SEARCH "SEARCH"
/* Not safe. Idempotent. RFC5842, Section 5. */
-#define MHD_HTTP_METHOD_UNBIND "UNBIND"
+#define MHD_HTTP_METHOD_UNBIND "UNBIND"
/* Not safe. Idempotent. RFC3253, Section 4.5. */
-#define MHD_HTTP_METHOD_UNCHECKOUT "UNCHECKOUT"
+#define MHD_HTTP_METHOD_UNCHECKOUT "UNCHECKOUT"
/* Not safe. Idempotent. RFC2068, Section 19.6.1.3. */
-#define MHD_HTTP_METHOD_UNLINK "UNLINK"
+#define MHD_HTTP_METHOD_UNLINK "UNLINK"
/* Not safe. Idempotent. RFC4918, Section 9.11. */
-#define MHD_HTTP_METHOD_UNLOCK "UNLOCK"
+#define MHD_HTTP_METHOD_UNLOCK "UNLOCK"
/* Not safe. Idempotent. RFC3253, Section 7.1. */
-#define MHD_HTTP_METHOD_UPDATE "UPDATE"
+#define MHD_HTTP_METHOD_UPDATE "UPDATE"
/* Not safe. Idempotent. RFC4437, Section 7. */
#define MHD_HTTP_METHOD_UPDATEREDIRECTREF "UPDATEREDIRECTREF"
/* Not safe. Idempotent. RFC3253, Section 3.5. */