summaryrefslogtreecommitdiff
path: root/gweb
diff options
context:
space:
mode:
authorSeonah Moon <seonah1.moon@samsung.com>2018-01-08 13:42:54 +0900
committerSeonah Moon <seonah1.moon@samsung.com>2018-01-08 13:43:31 +0900
commit9362752a471a5c892d679548fbf2828d5fc5684b (patch)
tree83c7d29a28556906938f5c2198d81e2d35f86f92 /gweb
parent22633ced6225d294ce8483efbf2b39ea0c0c1b65 (diff)
downloadconnman-9362752a471a5c892d679548fbf2828d5fc5684b.tar.gz
connman-9362752a471a5c892d679548fbf2828d5fc5684b.tar.bz2
connman-9362752a471a5c892d679548fbf2828d5fc5684b.zip
Imported Upstream version 1.35upstream/1.35
Change-Id: I174854914d9fd06a813270b57d1f7bc2bac63c6a Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
Diffstat (limited to 'gweb')
-rw-r--r--gweb/gresolv.c14
-rw-r--r--gweb/gweb.c16
2 files changed, 13 insertions, 17 deletions
diff --git a/gweb/gresolv.c b/gweb/gresolv.c
index 5cf7a9a6..8a51a9f6 100644
--- a/gweb/gresolv.c
+++ b/gweb/gresolv.c
@@ -181,17 +181,15 @@ static void find_srcaddr(struct sort_result *res)
if (fd < 0)
return;
- if (connect(fd, &res->dst.sa, sizeof(res->dst)) < 0) {
- close(fd);
- return;
- }
+ if (connect(fd, &res->dst.sa, sizeof(res->dst)) < 0)
+ goto out;
- if (getsockname(fd, &res->src.sa, &sl) < 0) {
- close(fd);
- return;
- }
+ if (getsockname(fd, &res->src.sa, &sl) < 0)
+ goto out;
res->reachable = true;
+
+out:
close(fd);
}
diff --git a/gweb/gweb.c b/gweb/gweb.c
index f6828cf2..393afe0a 100644
--- a/gweb/gweb.c
+++ b/gweb/gweb.c
@@ -792,6 +792,9 @@ static void handle_multi_line(struct web_session *session)
char *str;
gchar *value;
+ if (!session->result.last_key)
+ return;
+
str = session->current_header->str;
if (str[0] != ' ' && str[0] != '\t')
@@ -1075,7 +1078,6 @@ static int connect_session_transport(struct web_session *session)
session->addr->ai_addrlen) < 0) {
if (errno != EINPROGRESS) {
debug(session->web, "connect() %s", strerror(errno));
- close(sk);
return -EIO;
}
}
@@ -1346,8 +1348,7 @@ static guint do_request(GWeb *web, const char *url,
g_free(session->address);
session->address = g_strdup(host);
}
- session->address_action = g_timeout_add(0, already_resolved,
- session);
+ session->address_action = g_idle_add(already_resolved, session);
} else {
session->resolv_action = g_resolv_lookup_hostname(web->resolv,
host, resolv_result, session);
@@ -1466,6 +1467,9 @@ GWebParser *g_web_parser_new(const char *begin, const char *end,
{
GWebParser *parser;
+ if (!begin || !end)
+ return NULL;
+
parser = g_try_new0(GWebParser, 1);
if (!parser)
return NULL;
@@ -1474,12 +1478,6 @@ GWebParser *g_web_parser_new(const char *begin, const char *end,
parser->begin_token = g_strdup(begin);
parser->end_token = g_strdup(end);
-
- if (!parser->begin_token) {
- g_free(parser);
- return NULL;
- }
-
parser->func = func;
parser->user_data = user_data;