[libsoup] tests: headers: allow checks on non present headers fields
- From: Lionel Landwerlin <llandwerlin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] tests: headers: allow checks on non present headers fields
- Date: Sun, 19 Jan 2014 18:31:12 +0000 (UTC)
commit 1b2a752663896bec558049fc050504517b0d1743
Author: Lionel Landwerlin <llandwerlin gmail com>
Date: Thu Jan 16 10:52:43 2014 +0000
tests: headers: allow checks on non present headers fields
https://bugzilla.gnome.org/show_bug.cgi?id=722341
tests/header-parsing.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/tests/header-parsing.c b/tests/header-parsing.c
index 52b2279..b02bc98 100644
--- a/tests/header-parsing.c
+++ b/tests/header-parsing.c
@@ -455,7 +455,7 @@ static struct ResponseTest {
SoupHTTPVersion version;
guint status_code;
const char *reason_phrase;
- Header headers[4];
+ Header headers[10];
} resptests[] = {
/***********************/
/*** VALID RESPONSES ***/
@@ -521,6 +521,19 @@ static struct ResponseTest {
}
},
+ /* Tests from Cockpit */
+
+ { "Response w/ 3 headers, check case-insensitivity",
+ "HTTP/1.0 200 ok\r\nHeader1: value3\r\nHeader2: field\r\nHead3: Another \r\n", -1,
+ SOUP_HTTP_1_0, SOUP_STATUS_OK, "ok",
+ { { "header1", "value3" },
+ { "Header2", "field" },
+ { "hEAD3", "Another" },
+ { "Something else", NULL },
+ { NULL }
+ }
+ },
+
/*****************************/
/*** RECOVERABLE RESPONSES ***/
/*****************************/
@@ -732,7 +745,15 @@ check_headers (Header *headers, SoupMessageHeaders *hdrs)
break;
}
value = soup_message_headers_get_list (hdrs, headers[i].name);
- if (!value || strcmp (value, headers[i].value) != 0) {
+ if (g_strcmp0 (value, headers[i].value) != 0) {
+ ok = FALSE;
+ break;
+ }
+ }
+ /* If we have remaining fields to check, they should return NULL */
+ for (; headers[i].name; i++) {
+ value = soup_message_headers_get_list (hdrs, headers[i].name);
+ if (value) {
ok = FALSE;
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]