[gssdp] Also check HTTP version and request path
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp] Also check HTTP version and request path
- Date: Fri, 1 Jul 2011 18:16:29 +0000 (UTC)
commit 657d9f997d5cdb5b634760a87d0eb4cdf8be0592
Author: Jens Georg <mail jensge org>
Date: Fri Jul 1 20:15:50 2011 +0200
Also check HTTP version and request path
HTTP version has to be 1.1 and request path "*"
libgssdp/gssdp-client.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index 695b380..c0e18e6 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -819,7 +819,9 @@ parse_http_request (char *buf,
SoupMessageHeaders **headers,
int *type)
{
- char *req_method;
+ char *req_method = NULL;
+ char *path = NULL;
+ SoupHTTPVersion version;
*headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_REQUEST);
@@ -827,8 +829,10 @@ parse_http_request (char *buf,
len,
*headers,
&req_method,
- NULL,
- NULL) == SOUP_STATUS_OK) {
+ &path,
+ &version) == SOUP_STATUS_OK &&
+ version == SOUP_HTTP_1_1 &&
+ (path && g_ascii_strncasecmp (path, "*", 1) == 0)) {
if (g_ascii_strncasecmp (req_method,
SSDP_SEARCH_METHOD,
strlen (SSDP_SEARCH_METHOD)) == 0)
@@ -847,6 +851,12 @@ parse_http_request (char *buf,
soup_message_headers_free (*headers);
*headers = NULL;
+ if (path)
+ g_free (path);
+
+ if (req_method)
+ g_free (req_method);
+
return FALSE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]