summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/dynhds.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-12-12 01:33:07 (GMT)
committerBrad King <brad.king@kitware.com>2023-12-12 01:33:07 (GMT)
commit548f0cfd1db2f6a4b971df94a0a47655b51ff9d9 (patch)
treebbba54962c79e662d7d04986e113f50efd39654e /Utilities/cmcurl/lib/dynhds.c
parent38f85b839019c0674e9f8abae141e7b087f44c16 (diff)
parentfe5ffe06a9e09b7be5ff432049cb427894a78dcb (diff)
downloadCMake-548f0cfd1db2f6a4b971df94a0a47655b51ff9d9.zip
CMake-548f0cfd1db2f6a4b971df94a0a47655b51ff9d9.tar.gz
CMake-548f0cfd1db2f6a4b971df94a0a47655b51ff9d9.tar.bz2
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2023-12-06 (7161cb17)
Diffstat (limited to 'Utilities/cmcurl/lib/dynhds.c')
-rw-r--r--Utilities/cmcurl/lib/dynhds.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/Utilities/cmcurl/lib/dynhds.c b/Utilities/cmcurl/lib/dynhds.c
index 979b3e8..d754895 100644
--- a/Utilities/cmcurl/lib/dynhds.c
+++ b/Utilities/cmcurl/lib/dynhds.c
@@ -27,6 +27,10 @@
#include "strcase.h"
/* The last 3 #include files should be in this order */
+#ifdef USE_NGHTTP2
+#include <stdint.h>
+#include <nghttp2/nghttp2.h>
+#endif /* USE_NGHTTP2 */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
@@ -365,3 +369,28 @@ CURLcode Curl_dynhds_h1_dprint(struct dynhds *dynhds, struct dynbuf *dbuf)
return result;
}
+#ifdef USE_NGHTTP2
+
+nghttp2_nv *Curl_dynhds_to_nva(struct dynhds *dynhds, size_t *pcount)
+{
+ nghttp2_nv *nva = calloc(1, sizeof(nghttp2_nv) * dynhds->hds_len);
+ size_t i;
+
+ *pcount = 0;
+ if(!nva)
+ return NULL;
+
+ for(i = 0; i < dynhds->hds_len; ++i) {
+ struct dynhds_entry *e = dynhds->hds[i];
+ DEBUGASSERT(e);
+ nva[i].name = (unsigned char *)e->name;
+ nva[i].namelen = e->namelen;
+ nva[i].value = (unsigned char *)e->value;
+ nva[i].valuelen = e->valuelen;
+ nva[i].flags = NGHTTP2_NV_FLAG_NONE;
+ }
+ *pcount = dynhds->hds_len;
+ return nva;
+}
+
+#endif /* USE_NGHTTP2 */