aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/http.c15
-rw-r--r--common/http.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/common/http.c b/common/http.c
index 271257df0..9d3997a8d 100644
--- a/common/http.c
+++ b/common/http.c
@@ -2,6 +2,7 @@
* Copyright (C) 1999, 2001, 2002, 2003, 2004, 2006, 2009, 2010,
* 2011 Free Software Foundation, Inc.
* Copyright (C) 2014 Werner Koch
+ * Copyright (C) 2015 g10 Code GmbH
*
* This file is part of GnuPG.
*
@@ -2702,3 +2703,17 @@ http_verify_server_credentials (http_session_t sess)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
#endif
}
+
+/* Return the first query variable with the specified key. If there
+ is no such variable, return NULL. */
+struct uri_tuple_s *
+uri_query_lookup (parsed_uri_t uri, const char *key)
+{
+ struct uri_tuple_s *t;
+
+ for (t = uri->query; t; t = t->next)
+ if (strcmp (t->name, key) == 0)
+ return t;
+
+ return NULL;
+}
diff --git a/common/http.h b/common/http.h
index 3a4443034..17f778d61 100644
--- a/common/http.h
+++ b/common/http.h
@@ -1,6 +1,7 @@
/* http.h - HTTP protocol handler
* Copyright (C) 1999, 2000, 2001, 2003, 2006,
* 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2015 g10 Code GmbH
*
* This file is part of GnuPG.
*
@@ -61,6 +62,8 @@ struct parsed_uri_s
};
typedef struct parsed_uri_s *parsed_uri_t;
+extern struct uri_tuple_s *uri_query_lookup (parsed_uri_t uri, const char *key);
+
typedef enum
{
HTTP_REQ_GET = 1,