diff --git a/libsoup/soup-headers.c b/libsoup/soup-headers.c
index 465c4f7..f030626 100644
--- a/libsoup/soup-headers.c
+++ b/libsoup/soup-headers.c
@@ -361,6 +361,12 @@ soup_headers_parse_response (const char          *str,
 
 	g_return_val_if_fail (str && *str, FALSE);
 
+	/* Workaround that some broken servers can send extra line breaks */
+	while (*str == '\r' || *str == '\n') {
+		str++;
+		len--;
+	}
+
 	if (!soup_headers_parse (str, len, headers)) 
 		return FALSE;
 
diff --git a/tests/header-parsing.c b/tests/header-parsing.c
index 4c45140..07dad92 100644
--- a/tests/header-parsing.c
+++ b/tests/header-parsing.c
@@ -539,6 +539,12 @@ static struct ResponseTest {
 	  -1, 0, NULL,
 	  { { NULL } }
 	},
+
+    { "HTTP 1.1 response with leading line break",
+      "\nHTTP/1.1 200 OK\r\n", -1,
+	  -1, 0, NULL,
+      { { NULL } }
+    },
 };
 static const int num_resptests = G_N_ELEMENTS (resptests);
 
