[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 02/08: contrib: published scripts for updat
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 02/08: contrib: published scripts for updating MHD header with new HTTP methods and headers |
Date: |
Sun, 09 Jun 2019 11:15:44 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 56827b9b7acb7927451c5b81e9637134cfb13e98
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Sat Jun 8 15:08:51 2019 +0300
contrib: published scripts for updating MHD header with new HTTP methods
and headers
---
contrib/gen_http_headers_insert.sh | 62 ++++++++++++++++++++++++++++++++++++++
contrib/gen_http_methods_insert.sh | 62 ++++++++++++++++++++++++++++++++++++++
2 files changed, 124 insertions(+)
diff --git a/contrib/gen_http_headers_insert.sh
b/contrib/gen_http_headers_insert.sh
new file mode 100755
index 00000000..6fce2809
--- /dev/null
+++ b/contrib/gen_http_headers_insert.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+#
+# Generate header insert for HTTP headers
+#
+
+# Copyright (c) 2015-2019 Karlson2k (Evgeny Grin) <address@hidden>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+wget -nv http://www.iana.org/assignments/message-headers/perm-headers.csv -O
perm-headers.csv || exit
+echo Generating...
+echo '/**
+ * @defgroup headers HTTP headers
+ * These are the standard headers found in HTTP requests and responses.
+ * See: http://www.iana.org/assignments/message-headers/message-headers.xml
+ * Registry export date: '$(date -u +%Y-%m-%d)'
+ * @{
+ */
+
+/* Main HTTP headers. */' > header_insert_headers.h && \
+gawk -e 'BEGIN {FPAT = "([^,]*)|(\"[^\"]+\")"}
+{
+ if ($3 == "http") {
+ gsub(/^\[|^"\[|\]"$|\]$/, "", $5)
+ rfc_num = substr($5, 4, 4)
+ if (rfc_num >= 7230 && rfc_num <= 7235)
+ {
+ gsub(/\]\[/, "; ", $5)
+ if (length($4) == 0)
+ { $4 = "No category" }
+ else
+ { sub(/^./, toupper(substr($4, 1, 1)), $4) }
+ print "/* " sprintf("%-14.14s", $4 ".") " " $5 " */"
+ print "#define MHD_HTTP_HEADER_" toupper(gensub(/-/, "_", "g", $1)) "
\""$1"\""
+ }
+ }
+}' perm-headers.csv >> header_insert_headers.h && \
+echo '
+/* Additional HTTP headers. */' >> header_insert_headers.h && \
+gawk -e 'BEGIN {FPAT = "([^,]*)|(\"[^\"]+\")"}
+{
+ if ($3 == "http") {
+ gsub(/^\[|^"\[|\]"$|\]$/, "", $5)
+ rfc_num = substr($5, 4, 4)
+ if (!(rfc_num >= 7230 && rfc_num <= 7235))
+ {
+ gsub(/\]\[/, "; ", $5)
+ if (length($4) == 0)
+ { $4 = "No category" }
+ else
+ { sub(/^./, toupper(substr($4, 1, 1)), $4) }
+ print "/* " sprintf("%-14.14s", $4 ".") " " $5 " */"
+ print "#define MHD_HTTP_HEADER_" toupper(gensub(/-/, "_", "g", $1)) "
\""$1"\""
+ }
+ }
+}' perm-headers.csv >> header_insert_headers.h && \
+echo OK && \
+rm perm-headers.csv || exit
diff --git a/contrib/gen_http_methods_insert.sh
b/contrib/gen_http_methods_insert.sh
new file mode 100755
index 00000000..38485848
--- /dev/null
+++ b/contrib/gen_http_methods_insert.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+#
+# Generate header insert for HTTP methods
+#
+
+# Copyright (c) 2015-2019 Karlson2k (Evgeny Grin) <address@hidden>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+wget -nv http://www.iana.org/assignments/http-methods/methods.csv -O
methods.csv || exit
+echo Generating...
+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)'
+ * @{
+ */
+
+/* Main HTTP methods. */' > header_insert_methods.h && \
+gawk -e 'BEGIN {FPAT = "([^,]*)|(\"[^\"]+\")"}
+FNR > 1 {
+ gsub(/^\[|^"\[|\]"$|\]$/, "", $4)
+ gsub(/\]\[/, "; ", $4)
+ if (substr($4, 1, 7) == "RFC7231") {
+ if ($2 == "yes")
+ { safe_m = "Safe. " }
+ else
+ { safe_m = "Not safe." }
+ if ($3 == "yes")
+ { indem_m = "Idempotent. " }
+ else
+ { indem_m = "Not idempotent." }
+ print "/* " safe_m " " indem_m " " $4 ". */"
+ print "#define MHD_HTTP_METHOD_" toupper(gensub(/-/, "_", "g", $1)) "
\""$1"\""
+ }
+}' methods.csv >> header_insert_methods.h && \
+echo '
+/* Additional HTTP methods. */' >> header_insert_methods.h && \
+gawk -e 'BEGIN {FPAT = "([^,]*)|(\"[^\"]+\")"}
+FNR > 1 {
+ gsub(/^\[|^"\[|\]"$|\]$/, "", $4)
+ gsub(/\]\[/, "; ", $4)
+ if (substr($4, 1, 7) != "RFC7231") {
+ if ($2 == "yes")
+ { safe_m = "Safe. " }
+ else
+ { safe_m = "Not safe." }
+ if ($3 == "yes")
+ { indem_m = "Idempotent. " }
+ else
+ { indem_m = "Not idempotent." }
+ print "/* " safe_m " " indem_m " " $4 ". */"
+ print "#define MHD_HTTP_METHOD_" toupper(gensub(/-/, "_", "g", $1)) "
\""$1"\""
+ }
+}' methods.csv >> header_insert_methods.h && \
+echo OK && \
+rm methods.csv || exit
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [libmicrohttpd] branch master updated (c530ee3b -> fb550a49), gnunet, 2019/06/09
- [GNUnet-SVN] [libmicrohttpd] 04/08: microhttpd.h: moved deprecated HTTP code definitions to the end of the list, gnunet, 2019/06/09
- [GNUnet-SVN] [libmicrohttpd] 05/08: microhttpd.h: moved together deprecated and non-standard HTTP status codes, deprecated more HTTP status codes, gnunet, 2019/06/09
- [GNUnet-SVN] [libmicrohttpd] 06/08: contrib: implemented script for importing HTTP status codes, gnunet, 2019/06/09
- [GNUnet-SVN] [libmicrohttpd] 01/08: Updated .gitattributes, normalized line ending in source file, gnunet, 2019/06/09
- [GNUnet-SVN] [libmicrohttpd] 08/08: microhttpd.d: fixed Doxy for MHD_get_reason_phrase_for(), gnunet, 2019/06/09
- [GNUnet-SVN] [libmicrohttpd] 07/08: Updated HTTP status codes, gnunet, 2019/06/09
- [GNUnet-SVN] [libmicrohttpd] 02/08: contrib: published scripts for updating MHD header with new HTTP methods and headers,
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 03/08: libmicrohttpd.h: Updated HTTP methods and headers, gnunet, 2019/06/09