[libsoup/content-sniffing] Look for the last occurrence of header in get_one()



commit 7a8bc50855c1f0b0696c3c1cc472d4356f05d51a
Author: Gustavo Noronha Silva <gns gnome org>
Date:   Mon Jun 22 17:26:27 2009 -0300

    Look for the last occurrence of header in get_one()

 libsoup/soup-message-headers.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-message-headers.c b/libsoup/soup-message-headers.c
index f0abb78..218a904 100644
--- a/libsoup/soup-message-headers.c
+++ b/libsoup/soup-message-headers.c
@@ -277,12 +277,18 @@ const char *
 soup_message_headers_get_one (SoupMessageHeaders *hdrs, const char *name)
 {
 	SoupHeader *hdr_array = (SoupHeader *)(hdrs->array->data);
-	int index;
+	int i;
+	int index = -1;
+	int tmp;
 
 	g_return_val_if_fail (name != NULL, NULL);
 
 	name = intern_header_name (name, NULL);
-	index = find_header (hdr_array, name, 0);
+
+	/* We are looking for the last header */
+	for (i = 0; (tmp = find_header (hdr_array, name, i)) != -1; i++)
+		index = tmp;
+
 	return (index == -1) ? NULL : hdr_array[index].value;
 }
 



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