summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/content.h3
-rw-r--r--content/fetch.c15
-rw-r--r--content/fetch.h2
-rw-r--r--content/fetchcache.c8
4 files changed, 16 insertions, 12 deletions
diff --git a/content/content.h b/content/content.h
index 249e21192..72034b316 100644
--- a/content/content.h
+++ b/content/content.h
@@ -71,7 +71,8 @@ typedef enum {
CONTENT_MSG_ERROR, /**< error occurred */
CONTENT_MSG_STATUS, /**< new status string */
CONTENT_MSG_REDIRECT, /**< replacement URL */
- CONTENT_MSG_REFORMAT /**< content_reformat done */
+ CONTENT_MSG_REFORMAT, /**< content_reformat done */
+ CONTENT_MSG_AUTH /**< authentication required */
} content_msg;
/** Linked list of users of a content. */
diff --git a/content/fetch.c b/content/fetch.c
index b7f48b506..391aa14d3 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -150,6 +150,7 @@ struct fetch * fetch_start(char *url, char *referer,
CURLcode code;
CURLMcode codem;
xmlURI *uri;
+ struct login *li;
LOG(("fetch %p, url '%s'", fetch, url));
@@ -268,12 +269,11 @@ struct fetch * fetch_start(char *url, char *referer,
code = curl_easy_setopt(fetch->curl_handle, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
assert(code == CURLE_OK);
-#ifdef riscos
- if (LOGIN.string != NULL) {
- code = curl_easy_setopt(fetch->curl_handle, CURLOPT_USERPWD, LOGIN.string);
+ if ((li=login_list_get(url)) != NULL) {
+ code = curl_easy_setopt(fetch->curl_handle, CURLOPT_USERPWD, li->logindetails);
+
assert(code == CURLE_OK);
}
-#endif
/* POST */
if (fetch->post_urlenc) {
@@ -545,16 +545,11 @@ bool fetch_process_headers(struct fetch *f)
return true;
}
-#ifdef riscos
/* handle HTTP 401 (Authentication errors) */
if (http_code == 401) {
- /* this shouldn't be here... */
- ro_gui_401login_open(xstrdup(f->host), xstrdup(f->realm),
- xstrdup(f->url));
- f->callback(FETCH_ERROR, f->p, "",0);
+ f->callback(FETCH_AUTH, f->p, xstrdup(f->realm),0);
return true;
}
-#endif
/* handle HTTP errors (non 2xx response codes) */
if (f->only_2xx && strncmp(f->url, "http", 4) == 0 &&
diff --git a/content/fetch.h b/content/fetch.h
index 762664923..492645df9 100644
--- a/content/fetch.h
+++ b/content/fetch.h
@@ -14,7 +14,7 @@
#include <stdbool.h>
-typedef enum {FETCH_TYPE, FETCH_DATA, FETCH_FINISHED, FETCH_ERROR, FETCH_REDIRECT} fetch_msg;
+typedef enum {FETCH_TYPE, FETCH_DATA, FETCH_FINISHED, FETCH_ERROR, FETCH_REDIRECT, FETCH_AUTH} fetch_msg;
struct content;
struct fetch;
diff --git a/content/fetchcache.c b/content/fetchcache.c
index 13ddbc9c5..28c098034 100644
--- a/content/fetchcache.c
+++ b/content/fetchcache.c
@@ -154,6 +154,14 @@ void fetchcache_callback(fetch_msg msg, void *p, char *data, unsigned long size)
content_destroy(c);
break;
+ case FETCH_AUTH:
+ /* data -> string containing the Realm */
+ LOG(("FETCH_AUTH, '%s'", data));
+ c->fetch = 0;
+ content_broadcast(c, CONTENT_MSG_AUTH, data);
+ cache_destroy(c);
+ break;
+
default:
assert(0);
}