[libsoup/carlosgc/http2-early-hints: 3/4] get: add --user-agent command line option
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/carlosgc/http2-early-hints: 3/4] get: add --user-agent command line option
- Date: Mon, 21 Mar 2022 19:15:50 +0000 (UTC)
commit 5f40ce0b73bf5051bf48407628c2e5f411975829
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Mon Mar 21 14:07:48 2022 +0100
get: add --user-agent command line option
examples/get.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/examples/get.c b/examples/get.c
index f7bad501..657914ca 100644
--- a/examples/get.c
+++ b/examples/get.c
@@ -112,6 +112,7 @@ on_request_sent (GObject *source, GAsyncResult *result, gpointer user_data)
static const char *ca_file, *proxy;
static char *client_cert_file, *client_key_file;
+static char *user_agent;
static gboolean ntlm;
static gboolean negotiate;
@@ -128,6 +129,9 @@ static GOptionEntry entries[] = {
{ "debug", 'd', 0,
G_OPTION_ARG_NONE, &debug,
"Show HTTP headers", NULL },
+ { "user-agent", 'u', 0,
+ G_OPTION_ARG_STRING, &user_agent,
+ "User agent string", "STRING" },
{ "head", 'h', 0,
G_OPTION_ARG_NONE, &head,
"Do HEAD rather than GET", NULL },
@@ -234,6 +238,9 @@ main (int argc, char **argv)
}
}
+ if (user_agent)
+ soup_session_set_user_agent (session, user_agent);
+
if (debug) {
SoupLogger *logger = soup_logger_new (SOUP_LOGGER_LOG_HEADERS);
soup_session_add_feature (session, SOUP_SESSION_FEATURE (logger));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]