[gssdp/wip/client-cache: 30/31] Fill user-agent cache from SSDP packets



commit 035c77b4a9d610b73674c2f287bbd815d8764ed0
Author: Jens Georg <mail jensge org>
Date:   Fri Dec 30 22:03:47 2011 +0100

    Fill user-agent cache from SSDP packets
    
    https://bugzilla.gnome.org/show_bug.cgi?id=653894

 libgssdp/gssdp-client.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index 43d108c..d244374 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -1169,7 +1169,20 @@ socket_source_cb (GSSDPSocketSource *socket_source, GSSDPClient *client)
         ip_string = g_inet_address_to_string (inetaddr);
         port = g_inet_socket_address_get_port (
                                         G_INET_SOCKET_ADDRESS (address));
+
         if (type >= 0) {
+                const char *agent;
+
+                /* update client cache */
+                agent = soup_message_headers_get_one (headers, "Server");
+                if (!agent)
+                        agent = soup_message_headers_get_one (headers, "User-Agent");
+
+                if (agent)
+                        gssdp_client_add_cache_entry (client,
+                                                      ip_string,
+                                                      agent);
+
                 g_signal_emit (client,
                                signals[MESSAGE_RECEIVED],
                                0,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]