mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 22:41:30 +03:00
[project @ 2003-12-26 16:20:57 by bursa]
Enable cookies. svn path=/import/netsurf/; revision=443
This commit is contained in:
parent
eb7cc625e7
commit
894703b53b
@ -151,7 +151,7 @@ void fetch_quit(void)
|
||||
struct fetch * fetch_start(char *url, char *referer,
|
||||
void (*callback)(fetch_msg msg, void *p, char *data, unsigned long size),
|
||||
void *p, bool only_2xx, char *post_urlenc,
|
||||
struct form_successful_control *post_multipart)
|
||||
struct form_successful_control *post_multipart, bool cookies)
|
||||
{
|
||||
struct fetch *fetch = xcalloc(1, sizeof(*fetch)), *host_fetch;
|
||||
CURLcode code;
|
||||
@ -298,6 +298,16 @@ struct fetch * fetch_start(char *url, char *referer,
|
||||
assert(code == CURLE_OK);
|
||||
}
|
||||
|
||||
/* Cookies */
|
||||
if (cookies) {
|
||||
code = curl_easy_setopt(fetch->curl_handle, CURLOPT_COOKIEFILE,
|
||||
messages_get("cookiefile"));
|
||||
assert(code == CURLE_OK);
|
||||
code = curl_easy_setopt(fetch->curl_handle, CURLOPT_COOKIEJAR,
|
||||
messages_get("cookiejar"));
|
||||
assert(code == CURLE_OK);
|
||||
}
|
||||
|
||||
/* add to the global curl multi handle */
|
||||
codem = curl_multi_add_handle(curl_multi, fetch->curl_handle);
|
||||
assert(codem == CURLM_OK || codem == CURLM_CALL_MULTI_PERFORM);
|
||||
|
@ -24,9 +24,9 @@ extern bool fetch_active;
|
||||
|
||||
void fetch_init(void);
|
||||
struct fetch * fetch_start(char *url, char *referer,
|
||||
void (*callback)(fetch_msg msg, void *p, char *data, unsigned long size),
|
||||
void *p, bool only_2xx, char *post_urlenc,
|
||||
struct form_successful_control *post_multipart);
|
||||
void (*callback)(fetch_msg msg, void *p, char *data, unsigned long size),
|
||||
void *p, bool only_2xx, char *post_urlenc,
|
||||
struct form_successful_control *post_multipart, bool cookies);
|
||||
void fetch_abort(struct fetch *f);
|
||||
void fetch_poll(void);
|
||||
void fetch_quit(void);
|
||||
|
@ -43,7 +43,7 @@ struct content * fetchcache(const char *url0, char *referer,
|
||||
void *p2, const char *error),
|
||||
void *p1, void *p2, unsigned long width, unsigned long height,
|
||||
bool only_2xx, char *post_urlenc,
|
||||
struct form_successful_control *post_multipart)
|
||||
struct form_successful_control *post_multipart, bool cookies)
|
||||
{
|
||||
struct content *c;
|
||||
char *url = xstrdup(url0);
|
||||
@ -72,7 +72,7 @@ struct content * fetchcache(const char *url0, char *referer,
|
||||
c->width = width;
|
||||
c->height = height;
|
||||
c->fetch = fetch_start(url, referer, fetchcache_callback, c, only_2xx,
|
||||
post_urlenc, post_multipart);
|
||||
post_urlenc, post_multipart, cookies);
|
||||
free(url);
|
||||
if (c->fetch == 0) {
|
||||
LOG(("warning: fetch_start failed"));
|
||||
|
@ -25,6 +25,6 @@ struct content * fetchcache(const char *url, char *referer,
|
||||
void *p2, const char *error),
|
||||
void *p1, void *p2, unsigned long width, unsigned long height,
|
||||
bool only_2xx, char *post_urlenc,
|
||||
struct form_successful_control *post_multipart);
|
||||
struct form_successful_control *post_multipart, bool cookies);
|
||||
|
||||
#endif
|
||||
|
@ -169,7 +169,7 @@ void css_revive(struct content *c, unsigned int width, unsigned int height)
|
||||
c->data.css.import_content[i] = fetchcache(
|
||||
c->data.css.import_url[i], c->url,
|
||||
css_atimport_callback, c, i,
|
||||
c->width, c->height, true, 0, 0);
|
||||
c->width, c->height, true, 0, 0, false);
|
||||
if (c->data.css.import_content[i] == 0)
|
||||
continue;
|
||||
if (c->data.css.import_content[i]->status != CONTENT_STATUS_DONE)
|
||||
@ -335,7 +335,7 @@ void css_atimport(struct content *c, struct css_node *node)
|
||||
c->data.css.import_url[i] = url1;
|
||||
c->data.css.import_content[i] = fetchcache(
|
||||
c->data.css.import_url[i], c->url, css_atimport_callback,
|
||||
c, i, c->width, c->height, true, 0, 0);
|
||||
c, i, c->width, c->height, true, 0, 0, false);
|
||||
if (c->data.css.import_content[i] &&
|
||||
c->data.css.import_content[i]->status != CONTENT_STATUS_DONE)
|
||||
c->active++;
|
||||
@ -383,7 +383,7 @@ void css_atimport_callback(content_msg msg, struct content *css,
|
||||
c->data.css.import_url[i] = xstrdup(error);
|
||||
c->data.css.import_content[i] = fetchcache(
|
||||
c->data.css.import_url[i], c->url, css_atimport_callback,
|
||||
c, i, css->width, css->height, true, 0, 0);
|
||||
c, i, css->width, css->height, true, 0, 0, false);
|
||||
if (c->data.css.import_content[i] &&
|
||||
c->data.css.import_content[i]->status != CONTENT_STATUS_DONE)
|
||||
c->active++;
|
||||
|
@ -225,7 +225,7 @@ void browser_window_open_location_historical(struct browser_window* bw,
|
||||
bw->history_add = false;
|
||||
bw->loading_content = fetchcache(url, 0, browser_window_callback, bw, 0,
|
||||
gui_window_get_width(bw->window), 0, false,
|
||||
post_urlenc, post_multipart);
|
||||
post_urlenc, post_multipart, true);
|
||||
if (bw->loading_content == 0) {
|
||||
browser_window_set_status(bw, "Unable to fetch document");
|
||||
return;
|
||||
|
@ -186,7 +186,7 @@ void html_convert_css_callback(content_msg msg, struct content *css,
|
||||
c->active--;
|
||||
c->data.html.stylesheet_content[i] = fetchcache(
|
||||
error, c->url, html_convert_css_callback,
|
||||
c, i, css->width, css->height, true, 0, 0);
|
||||
c, i, css->width, css->height, true, 0, 0, false);
|
||||
if (c->data.html.stylesheet_content[i] != 0 &&
|
||||
c->data.html.stylesheet_content[i]->status != CONTENT_STATUS_DONE)
|
||||
c->active++;
|
||||
@ -257,7 +257,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
|
||||
#endif
|
||||
c->url,
|
||||
html_convert_css_callback,
|
||||
c, 0, c->width, c->height, true, 0, 0);
|
||||
c, 0, c->width, c->height, true, 0, 0, false);
|
||||
assert(c->data.html.stylesheet_content[0] != 0);
|
||||
if (c->data.html.stylesheet_content[0]->status != CONTENT_STATUS_DONE)
|
||||
c->active++;
|
||||
@ -311,7 +311,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
|
||||
(i + 1) * sizeof(*c->data.html.stylesheet_content));
|
||||
c->data.html.stylesheet_content[i] = fetchcache(url, c->url,
|
||||
html_convert_css_callback, c, i,
|
||||
c->width, c->height, true, 0, 0);
|
||||
c->width, c->height, true, 0, 0, false);
|
||||
if (c->data.html.stylesheet_content[i] &&
|
||||
c->data.html.stylesheet_content[i]->status != CONTENT_STATUS_DONE)
|
||||
c->active++;
|
||||
@ -400,7 +400,7 @@ void html_fetch_object(struct content *c, char *url, struct box *box)
|
||||
c->data.html.object[i].content = fetchcache(url, c->url,
|
||||
html_object_callback,
|
||||
c, i, c->width, c->height,
|
||||
true, 0, 0); /* we don't know the object's
|
||||
true, 0, 0, false); /* we don't know the object's
|
||||
dimensions yet; use
|
||||
parent's as an estimate */
|
||||
if (c->data.html.object[i].content) {
|
||||
@ -490,7 +490,7 @@ void html_object_callback(content_msg msg, struct content *object,
|
||||
c->data.html.object[i].url = xstrdup(error);
|
||||
c->data.html.object[i].content = fetchcache(
|
||||
error, c->url, html_object_callback,
|
||||
c, i, 0, 0, true, 0, 0);
|
||||
c, i, 0, 0, true, 0, 0, false);
|
||||
if (c->data.html.object[i].content) {
|
||||
c->active++;
|
||||
if (c->data.html.object[i].content->status == CONTENT_STATUS_DONE)
|
||||
@ -535,7 +535,7 @@ void html_revive(struct content *c, unsigned int width, unsigned int height)
|
||||
c->data.html.object[i].content = fetchcache(
|
||||
c->data.html.object[i].url, c->url,
|
||||
html_object_callback,
|
||||
c, i, 0, 0, true, 0, 0);
|
||||
c, i, 0, 0, true, 0, 0, false);
|
||||
if (c->data.html.object[i].content &&
|
||||
c->data.html.object[i].content->status != CONTENT_STATUS_DONE)
|
||||
c->active++;
|
||||
|
Loading…
Reference in New Issue
Block a user