aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cookie-jar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cookie-jar.c')
-rw-r--r--src/cookie-jar.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/cookie-jar.c b/src/cookie-jar.c
index cd8e4b8..f2e340b 100644
--- a/src/cookie-jar.c
+++ b/src/cookie-jar.c
@@ -70,14 +70,16 @@ uzbl_cookie_jar_set_handler(UzblCookieJar *jar, const gchar* handler) {
}
char *get_cookies(UzblCookieJar *jar, SoupURI *uri) {
- gchar *result;
+ gchar *result, *path;
GString *s = g_string_new ("GET");
+ path = uri->path[0] ? uri->path : "/";
+
if(has_socket_handler(jar)) {
g_string_append_c(s, 0); /* null-terminate the GET */
g_string_append_len(s, uri->scheme, strlen(uri->scheme)+1);
g_string_append_len(s, uri->host, strlen(uri->host)+1 );
- g_string_append_len(s, uri->path, strlen(uri->path)+1 );
+ g_string_append_len(s, path, strlen(path)+1 );
result = do_socket_request(jar, s->str, s->len);
/* try it again; older cookie daemons closed the connection after each request */
@@ -160,7 +162,8 @@ changed(SoupCookieJar *jar, SoupCookie *old_cookie, SoupCookie *new_cookie) {
GString *s = g_string_new ("PUT");
- gchar *scheme = (new_cookie->secure == TRUE) ? "https" : "http";
+ gchar *scheme = new_cookie->secure ? "https" : "http";
+
if(has_socket_handler(uzbl_jar)) {
g_string_append_c(s, 0); /* null-terminate the PUT */
g_string_append_len(s, scheme, strlen(scheme)+1);
@@ -239,7 +242,7 @@ static gchar *do_socket_request(UzblCookieJar *jar, gchar *request, int request_
gchar *result = NULL;
if(jar->connection_fd < 0)
- connect_cookie_socket(jar); /* connection was lost, reconnect */
+ connect_cookie_socket(jar); /* connection was lost, reconnect */
/* write request */
ret = write(jar->connection_fd, request, request_length);
@@ -259,7 +262,8 @@ static gchar *do_socket_request(UzblCookieJar *jar, gchar *request, int request_
if(errno == EINTR) continue;
g_printerr("talk_to_socket: poll failed while waiting for input (%s)\n",
strerror(errno));
- disconnect_cookie_socket(jar);
+ if(errno != ETIMEDOUT)
+ disconnect_cookie_socket(jar);
return NULL;
}