Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/f22a0ef3cd7aa7071c2ed85630a85eb1b2dd2e36
...commit
http://git.netsurf-browser.org/netsurf.git/commit/f22a0ef3cd7aa7071c2ed85630a85eb1b2dd2e36
...tree
http://git.netsurf-browser.org/netsurf.git/tree/f22a0ef3cd7aa7071c2ed85630a85eb1b2dd2e36
The branch, ashmew2/nskolibrios has been updated
via f22a0ef3cd7aa7071c2ed85630a85eb1b2dd2e36 (commit)
via 346baf80d8a0785d48a2faeae0af42258e22150d (commit)
from ea8d49cc5da9f13baff2f44d8cf0ddde774e77bb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=f22a0ef3cd7aa7071c2ed85630a85eb1b2dd2e36
commit f22a0ef3cd7aa7071c2ed85630a85eb1b2dd2e36
Author: Ashish Gupta <[email protected]>
Commit: Ashish Gupta <[email protected]>
Fix infinite fetching processing in http fetcher
diff --git a/content/fetchers/httplib_kolibri.c
b/content/fetchers/httplib_kolibri.c
index 93dfce2..28c3ec8 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -27,7 +27,7 @@ struct httpfetcher *head = NULL;
void add_to_poll(struct httpfetcher *newfetcher) {
- NSLOG(fetch, DEBUG, "-=- add: newfetcher 0x%x, newfetcher->handle 0x%x",
newfetcher, newfetcher->handle);
+ NSLOG(fetch, DEBUG, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x",
head, newfetcher, newfetcher->handle);
struct httpfetcher *t = head;
assert(newfetcher->next == NULL);
@@ -44,12 +44,12 @@ void add_to_poll(struct httpfetcher *newfetcher) {
}
}
-struct httpfetcher* remove_from_poll(struct http_msg *donehttp) {
+struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
struct httpfetcher *t = head, *p = head;
- NSLOG(fetch, DEBUG, "-=- remove: (->handle) donehttp 0x%x", donehttp);
+ NSLOG(fetch, DEBUG, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x",
head, removee, removee->handle);
while(t) {
- if (t->handle == donehttp) {
+ if (t == removee) {
if(t == head) {
p = t->next;
head = p;
@@ -65,7 +65,7 @@ struct httpfetcher* remove_from_poll(struct http_msg
*donehttp) {
p = t;
t = t->next;
- }
+ }
return head;
}
@@ -261,25 +261,24 @@ void *setup_fetch(struct fetch *parent_fetch, struct
nsurl *url,
}
bool start_fetch(void *httpf) {
- NSLOG(fetch, DEBUG, "-=- start_fetch : httpf: 0x%x", httpf);
+ NSLOG(fetch, DEBUG, "start_fetch : httpf: 0x%x", httpf);
add_to_poll((struct httpfetcher *) httpf);
return true;
}
bool abort_fetch(void *httpf) {
- NSLOG(fetch, DEBUG, "aborting fetch 0x%x", ((struct httpfetcher
*)httpf)->owner);
- remove_from_poll(((struct httpfetcher *) httpf)->handle);
+ NSLOG(fetch, DEBUG, "aborting fetch 0x%x,", ((struct httpfetcher
*)httpf)->owner);
+ remove_from_poll((struct httpfetcher *) httpf);
fetch_remove_from_queues(((struct httpfetcher *)httpf)->owner);
fetch_free(((struct httpfetcher *)httpf)->owner);
return true;
}
bool free_fetch(void *httpf) {
- NSLOG(fetch, DEBUG, "free_fetch called for 0x%x", ((struct httpfetcher
*)httpf)->owner);
+ NSLOG(fetch, DEBUG, "free_fetch fetch 0x%x", ((struct httpfetcher
*)httpf)->owner);
http_disconnect_asm((((struct httpfetcher *)httpf)->handle));
- NSLOG(fetch, DEBUG, "Freeing fetch 0x%x", ((struct httpfetcher
*)httpf)->owner);
http_free_asm((((struct httpfetcher *)httpf)->handle));
free((struct httpfetcher *)httpf);
@@ -292,6 +291,7 @@ void poll_fetch(lwc_string *scheme) {
assert(supported_scheme);
struct httpfetcher *t = head;
+ NSLOG(fetch, DEBUG, "poller head = 0x%x", t);
while(t != NULL) {
NSLOG(fetch, DEBUG, "-- Polling for t 0x%x, http_msg 0x%x, fetch 0x%x [
hcbdone = %s ]", t, t->handle, t->owner, t->headercbdone == true ? "true" :
"false");
@@ -310,8 +310,12 @@ void poll_fetch(lwc_string *scheme) {
NSLOG(fetch, ERROR, "---- http_msg -> flags = 0x%x", t->handle->flags);
msg.data.header_or_data.buf = (const uint8_t *) "HTTPLIB ERROR";
msg.data.header_or_data.len = strlen("HTTPLIB ERROR");
+ struct httpfetcher *t2 = remove_from_poll(t);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
+
+ t = t2;
+ continue;
}
if(t->headercbdone == false) {
@@ -354,9 +358,7 @@ void poll_fetch(lwc_string *scheme) {
fetch_msg msg;
msg.type = FETCH_NOTMODIFIED;
fetch_send_callback(&msg, t->owner);
- t = remove_from_poll(t->handle);
- /* t = t->next; */
- /* t = head; */
+ t = remove_from_poll(t);
continue;
}
else {
@@ -372,9 +374,10 @@ void poll_fetch(lwc_string *scheme) {
msg.data.redirect = newlocation;
NSLOG(fetch, INFO, "---- [3xx] : Redirect to %s",
msg.data.redirect);
+ struct httpfetcher *t2 = remove_from_poll(t);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
- t = remove_from_poll(t->handle);
+ t = t2;
/* t = t->next; */
/* t = head; */
continue;
@@ -387,8 +390,9 @@ void poll_fetch(lwc_string *scheme) {
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
fetch_remove_from_queues(t->owner);
+ struct httpfetcher *t2 = remove_from_poll(t);
fetch_free(t->owner);
- t = remove_from_poll(t->handle);
+ t = t2;
/* t = t->next; */
/* t = head; */
continue;
@@ -431,11 +435,11 @@ void poll_fetch(lwc_string *scheme) {
fetch_send_callback(&msg, t->owner);
NSLOG(fetch, DEBUG, "---- FETCH_FINISHED for fetch 0x%x", t->owner);
- struct httpfetcher *tnext = t->next;
fetch_remove_from_queues(t->owner);
- fetch_free(t->owner);
/* t = head; */
- t = remove_from_poll(t->handle);
+ struct httpfetcher *t2 = remove_from_poll(t);
+ fetch_free(t->owner);
+ t = t2;
/* t = next; */
continue;
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=346baf80d8a0785d48a2faeae0af42258e22150d
commit 346baf80d8a0785d48a2faeae0af42258e22150d
Author: Ashish Gupta <[email protected]>
Commit: Ashish Gupta <[email protected]>
Use libnslog.
Get rid of LOG() macro calls and replace with calls to NSLOG.
diff --git a/content/fetch.c b/content/fetch.c
index 64e639c..54029b3 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -65,16 +65,6 @@
#include "javascript/fetcher.h"
#include "content/urldb.h"
-/* Define this to turn on verbose fetch logging */
-#define DEBUG_FETCH_VERBOSE
-
-/** Verbose fetcher logging */
-#ifdef DEBUG_FETCH_VERBOSE
-#define FETCH_LOG(x...) LOG(x)
-#else
-#define FETCH_LOG(x...)
-#endif
-
/** The maximum number of fetchers that can be added */
#define MAX_FETCHERS 10
@@ -791,8 +781,7 @@ void fetch_remove_from_queues(struct fetch *fetch)
/* exported interface documented in content/fetch.h */
void fetch_set_http_code(struct fetch *fetch, long http_code)
{
- NSLOG(fetch, DEBUG, "Setting HTTP code to %ld", http_code);
- FETCH_LOG("Setting HTTP code to %ld for fetch 0x%x", http_code, fetch);
+ NSLOG(fetch, DEBUG, "fetch 0x%x, Setting HTTP code to %ld", fetch,
http_code);
fetch->http_code = http_code;
}
diff --git a/content/fetchers/httplib_kolibri.c
b/content/fetchers/httplib_kolibri.c
index 18055d1..93dfce2 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -27,7 +27,7 @@ struct httpfetcher *head = NULL;
void add_to_poll(struct httpfetcher *newfetcher) {
- LOG("-=- add: newfetcher 0x%x, newfetcher->handle 0x%x", newfetcher,
newfetcher->handle);
+ NSLOG(fetch, DEBUG, "-=- add: newfetcher 0x%x, newfetcher->handle 0x%x",
newfetcher, newfetcher->handle);
struct httpfetcher *t = head;
assert(newfetcher->next == NULL);
@@ -46,7 +46,7 @@ void add_to_poll(struct httpfetcher *newfetcher) {
struct httpfetcher* remove_from_poll(struct http_msg *donehttp) {
struct httpfetcher *t = head, *p = head;
- LOG("-=- remove: (->handle) donehttp 0x%x", donehttp);
+ NSLOG(fetch, DEBUG, "-=- remove: (->handle) donehttp 0x%x", donehttp);
while(t) {
if (t->handle == donehttp) {
@@ -74,14 +74,14 @@ bool init_fetcher(lwc_string *scheme) {
bool supported_scheme;
assert(lwc_string_isequal(scheme, corestring_lwc_http, &supported_scheme) ==
lwc_error_ok);
- LOG("Initializing http library!");
+ NSLOG(fetch, DEBUG, "Initializing http library!");
debug_board_printf("---- [NETSURF] Trying to initialize http library.\n");
if(kolibri_http_init() == 0) {
- LOG("[INFO] Loaded http.obj library successfully.\n");
+ NSLOG(fetch, DEBUG, "[INFO] Loaded http.obj library successfully.\n");
debug_board_printf("---- [NETSURF] Successfully initialized http
library.\n");
}
else {
- LOG("[ERROR] Could not load http.obj library.\n");
+ NSLOG(fetch, ERROR, "[ERROR] Could not load http.obj library.\n");
debug_board_printf("---- [NETSURF] Could not initialize http library.
Exiting.\n");
assert(0 && 1);
return false;
@@ -105,23 +105,20 @@ void *setup_fetch(struct fetch *parent_fetch, struct
nsurl *url,
struct http_msg* request = NULL;
- LOG("[SETUP] Our target URL: %s", nsurl_access(url));
- LOG("[SETUP] POST urlencoded data: %s", post_urlenc);
+ NSLOG(fetch, DEBUG, "[SETUP] Our target URL: %s", nsurl_access(url));
+ NSLOG(fetch, DEBUG, "[SETUP] POST urlencoded data: %s", post_urlenc);
int i = 0;
for(i = 0; headers[i] != NULL; i++)
- LOG("[SETUP] -- Headers : %s", headers[i]);
+ NSLOG(fetch, DEBUG, "[SETUP] -- Headers : %s", headers[i]);
if(post_multipart != NULL) {
struct fetch_multipart_data *printer = post_multipart;
while(printer != NULL) {
- LOG("Multipart POST : (%s = %s)\n", printer->name, printer->value);
+ NSLOG(fetch, DEBUG, "Multipart POST : (%s = %s)\n", printer->name,
printer->value);
/* debug_board_printf("Multipart POST : (%s = %s)\n", printer->name,
printer->value); */
printer = printer->next;
}
-
- LOG("[WARNING] We dont support POST multipart yet!\n");
- LOG("[NETSURF ERROR] We dont support POST multipart yet!\n");
char *boundary = "--------Netsurf------------KolibriOS----Multipart----";
int lenb = strlen(boundary);
char *contenttype = "multipart/form-data;
boundary=--------Netsurf------------KolibriOS----Multipart----";
@@ -208,8 +205,8 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl
*url,
/* debug_board_printf("TERMINATING NULL tmp = %u\n", tmp); */
- LOG("Multipart request content length : %d", contentlen);
- LOG("Multipart request content: %s", content);
+ NSLOG(fetch, DEBUG, "Multipart request content length : %d", contentlen);
+ NSLOG(fetch, DEBUG, "Multipart request content: %s", content);
request = http_post_asm(nsurl_access(url), NULL, 1<<8, *headers,
contenttype, contentlen - 1);
@@ -219,28 +216,28 @@ void *setup_fetch(struct fetch *parent_fetch, struct
nsurl *url,
/* LOG("--- Sending data : with length %u\n", contentlen); */
datasent = http_send_asm(request, content, contentlen - 1);
/* debug_board_printf("--- Sent %d bytes of data.\n", datasent); */
- LOG("--- Sent %d bytes of multipart post data.\n", datasent);
+ NSLOG(fetch, DEBUG, "--- Sent %d bytes of multipart post data.\n",
datasent);
}
}
else if(post_urlenc) {
- LOG("http_post: %s", nsurl_access(url));
+ NSLOG(fetch, DEBUG, "http_post: %s", nsurl_access(url));
request = http_post_asm(nsurl_access(url), NULL, 0, *headers,
"application/x-www-form-urlencoded", strlen(post_urlenc));
if(request != NULL) {
int datasent = 0;
/* Send all the data here itself. Move this later to polling maybe. */
/* debug_board_printf("--- Sending data : %s with length %u\n",
post_urlenc, strlen(post_urlenc)); */
datasent = http_send_asm(request, post_urlenc, strlen(post_urlenc));
- LOG("--- Sent %d bytes of urlencoded data.\n", datasent);
+ NSLOG(fetch, DEBUG, "--- Sent %d bytes of urlencoded data.\n", datasent);
}
}
else {
/* Do a GET */
- LOG("http_get: %s", nsurl_access(url));
+ NSLOG(fetch, DEBUG, "http_get: %s", nsurl_access(url));
request = http_get_asm(nsurl_access(url), NULL, 0, *headers);
}
if(request == NULL) {
- LOG("Failed to allocate http buffer. Could be multiple reasons for failure
(like DNS resolution)", request);
+ NSLOG(fetch, ERROR, "Failed to allocate http buffer. Could be multiple
reasons for failure (like DNS resolution)", request);
return NULL;
}
@@ -264,14 +261,14 @@ void *setup_fetch(struct fetch *parent_fetch, struct
nsurl *url,
}
bool start_fetch(void *httpf) {
- LOG("-=- start_fetch : httpf: 0x%x", httpf);
+ NSLOG(fetch, DEBUG, "-=- start_fetch : httpf: 0x%x", httpf);
add_to_poll((struct httpfetcher *) httpf);
return true;
}
bool abort_fetch(void *httpf) {
- LOG("aborting fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
+ NSLOG(fetch, DEBUG, "aborting fetch 0x%x", ((struct httpfetcher
*)httpf)->owner);
remove_from_poll(((struct httpfetcher *) httpf)->handle);
fetch_remove_from_queues(((struct httpfetcher *)httpf)->owner);
fetch_free(((struct httpfetcher *)httpf)->owner);
@@ -279,10 +276,10 @@ bool abort_fetch(void *httpf) {
}
bool free_fetch(void *httpf) {
- LOG("free_fetch called for 0x%x", ((struct httpfetcher *)httpf)->owner);
+ NSLOG(fetch, DEBUG, "free_fetch called for 0x%x", ((struct httpfetcher
*)httpf)->owner);
http_disconnect_asm((((struct httpfetcher *)httpf)->handle));
- LOG("Freeing fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
+ NSLOG(fetch, DEBUG, "Freeing fetch 0x%x", ((struct httpfetcher
*)httpf)->owner);
http_free_asm((((struct httpfetcher *)httpf)->handle));
free((struct httpfetcher *)httpf);
@@ -297,20 +294,20 @@ void poll_fetch(lwc_string *scheme) {
struct httpfetcher *t = head;
while(t != NULL) {
- LOG("-- Polling for t 0x%x, http_msg 0x%x, fetch 0x%x [ hcbdone = %s ]",
t, t->handle, t->owner, t->headercbdone == true ? "true" : "false");
- LOG("--- http_msg struct at : %x", t->handle);
- LOG("--- Header starts at : %x", &(t->handle->http_header));
- LOG("--- Header Length: %d", t->handle->header_length);
- LOG("--- Content starts at : %x", &(t->handle->content_ptr));
- LOG("--- Content Length (received / total): %d / %d",
t->handle->content_received, t->handle->content_length);
- LOG("--- ^ was for url : %s", nsurl_access(t->url));
+ NSLOG(fetch, DEBUG, "-- Polling for t 0x%x, http_msg 0x%x, fetch 0x%x [
hcbdone = %s ]", t, t->handle, t->owner, t->headercbdone == true ? "true" :
"false");
+ NSLOG(fetch, DEBUG, "--- http_msg struct at : %x", t->handle);
+ NSLOG(fetch, DEBUG, "--- Header starts at : %x",
&(t->handle->http_header));
+ NSLOG(fetch, DEBUG, "--- Header Length: %d", t->handle->header_length);
+ NSLOG(fetch, DEBUG, "--- Content starts at : %x",
&(t->handle->content_ptr));
+ NSLOG(fetch, DEBUG, "--- Content Length (received / total): %d / %d",
t->handle->content_received, t->handle->content_length);
+ NSLOG(fetch, DEBUG, "--- ^ was for url : %s", nsurl_access(t->url));
int ret = http_receive_asm(t->handle);
if(t->handle->flags & HTTP_ERRORS) {
fetch_msg msg;
msg.type = FETCH_ERROR;
- LOG("---- [ERROR] http_msg -> flags = 0x%x", t->handle->flags);
+ NSLOG(fetch, ERROR, "---- http_msg -> flags = 0x%x", t->handle->flags);
msg.data.header_or_data.buf = (const uint8_t *) "HTTPLIB ERROR";
msg.data.header_or_data.len = strlen("HTTPLIB ERROR");
fetch_send_callback(&msg, t->owner);
@@ -319,8 +316,8 @@ void poll_fetch(lwc_string *scheme) {
if(t->headercbdone == false) {
if (t->handle->flags & HTTP_GOT_HEADER) {
- LOG("---- Received all HTTP Headers.");
- LOG("---- response status code = %d", t->handle->status);
+ NSLOG(fetch, DEBUG, "---- Received all HTTP Headers.");
+ NSLOG(fetch, DEBUG, "---- response status code = %d",
t->handle->status);
fetch_set_http_code(t->owner, t->handle->status);
if(t->handle->status >= 200 && t->handle->status < 300) {
@@ -343,7 +340,7 @@ void poll_fetch(lwc_string *scheme) {
char *xx = (char *) malloc(j - plen + 1);
strncpy(xx, ptr + plen, j-plen);
xx[j-plen] = '\0';
- LOG("Headerline: %s", xx);
+ NSLOG(fetch, DEBUG, "Headerline: %s", xx);
fetch_send_callback(&msg, t->owner);
free(xx);
@@ -374,7 +371,7 @@ void poll_fetch(lwc_string *scheme) {
newlocation[lenloc]='\0';
msg.data.redirect = newlocation;
- LOG("---- [3xx] : Redirect to %s", msg.data.redirect);
+ NSLOG(fetch, INFO, "---- [3xx] : Redirect to %s",
msg.data.redirect);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
t = remove_from_poll(t->handle);
@@ -386,7 +383,7 @@ void poll_fetch(lwc_string *scheme) {
else {
fetch_msg msg;
msg.type = FETCH_ERROR;
- LOG(" ---- [ERROR] Unhandled HTTP Code : %d", t->handle->status);
+ NSLOG(fetch, DEBUG, " ---- [ERROR] Unhandled HTTP Code : %d",
t->handle->status);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
fetch_remove_from_queues(t->owner);
@@ -398,16 +395,16 @@ void poll_fetch(lwc_string *scheme) {
}
}
else {
- LOG("---- Headers not received yet.");
+ NSLOG(fetch, DEBUG, "---- Headers not received yet.");
}
}
else if(ret == -1) {
/* If data was received send it to netsurf core with FETCH_DATA */
- LOG("Calledback vs received : %u vs %u!", t->datalen_cb_done,
t->handle->content_received);
+ NSLOG(fetch, DEBUG, "Calledback vs received : %u vs %u!",
t->datalen_cb_done, t->handle->content_received);
if(t->handle->content_received > t->datalen_cb_done) {
fetch_msg msg;
- LOG("Doing a data callback\n");
+ NSLOG(fetch, DEBUG, "Doing a data callback\n");
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *)
(t->handle->content_ptr + t->datalen_cb_done);
msg.data.header_or_data.len = t->handle->content_received -
t->datalen_cb_done;
@@ -432,7 +429,7 @@ void poll_fetch(lwc_string *scheme) {
msg.data.header_or_data.buf = NULL;
msg.data.header_or_data.len = 0;
fetch_send_callback(&msg, t->owner);
- LOG("---- FETCH_FINISHED for fetch 0x%x", t->owner);
+ NSLOG(fetch, DEBUG, "---- FETCH_FINISHED for fetch 0x%x", t->owner);
struct httpfetcher *tnext = t->next;
fetch_remove_from_queues(t->owner);
@@ -443,7 +440,7 @@ void poll_fetch(lwc_string *scheme) {
continue;
}
- LOG("Main loop: t going from 0x%x to 0x%x", t->owner, t->next != NULL ?
t->next->owner : NULL);
+ NSLOG(fetch, DEBUG, "Main loop: t going from 0x%x to 0x%x", t->owner,
t->next != NULL ? t->next->owner : NULL);
t = t->next;
}
}
diff --git a/frontends/kolibrios/gui.c b/frontends/kolibrios/gui.c
index a60bce5..159053d 100644
--- a/frontends/kolibrios/gui.c
+++ b/frontends/kolibrios/gui.c
@@ -467,7 +467,7 @@ process_cmdline(int argc, char** argv)
/* {0, 0, 0, 0 } */
/* }; /\* no long options *\/ */
- LOG("argc %d, argv %p", argc, argv);
+ NSLOG(netsurf, INFO, "argc %d, argv %p", argc, argv);
fename = "kolibri";
febpp = 32;
@@ -597,7 +597,7 @@ static void framebuffer_run(void)
nsfb_event_t event;
int timeout; /* timeout in miliseconds */
- LOG("framebuffer_run() executing!");
+ NSLOG(netsurf, DEBUG, "framebuffer_run() executing!");
while (fb_complete != true) {
/* run the scheduler and discover how long to wait for
@@ -2181,7 +2181,7 @@ main(int argc, char** argv)
if (ret != NSERROR_OK)
die("Options failed to initialise");
- LOG("Resources are at : %s", respath);
+ NSLOG(netsurf, INFO, "Resources are at : %s", respath);
options = filepath_find(respaths, "Choices");
nsoption_read(options, nsoptions);
@@ -2231,8 +2231,8 @@ main(int argc, char** argv)
urldb_load_cookies(nsoption_charp(cookie_file));
/* create an initial browser window */
- LOG("calling browser_window_create with Size(hxw)=%dx%d\n", feheight,
fewidth);
- LOG("calling browser_window_create with URL=%s\n", feurl);
+ NSLOG(netsurf, DEBUG, "calling browser_window_create with
Size(hxw)=%dx%d\n", feheight, fewidth);
+ NSLOG(netsurf, DEBUG, "calling browser_window_create with URL=%s\n",
feurl);
ret = nsurl_create(feurl, &url);
if (ret == NSERROR_OK) {
@@ -2254,7 +2254,7 @@ main(int argc, char** argv)
netsurf_exit();
if (fb_font_finalise() == false)
- LOG("Font finalisation failed.");
+ NSLOG(netsurf, CRITICAL, "Font finalisation failed.");
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
diff --git a/frontends/kolibrios/schedule.c b/frontends/kolibrios/schedule.c
index a0d9da0..90e458a 100644
--- a/frontends/kolibrios/schedule.c
+++ b/frontends/kolibrios/schedule.c
@@ -196,12 +196,12 @@ void list_schedule(void)
tv = get_tick_count();
- LOG("schedule list at %u", tv);
+ NSLOG(netsurf, DEBUG, "schedule list at %u", tv);
cur_nscb = schedule_list;
while (cur_nscb != NULL) {
- LOG("Schedule %p at %ld", cur_nscb, cur_nscb->tv);
+ NSLOG(netsurf, DEBUG, "Schedule %p at %ld", cur_nscb,
cur_nscb->tv);
cur_nscb = cur_nscb->next;
}
}
-----------------------------------------------------------------------
Summary of changes:
content/fetch.c | 13 +----
content/fetchers/httplib_kolibri.c | 107 ++++++++++++++++++------------------
frontends/kolibrios/gui.c | 12 ++--
frontends/kolibrios/schedule.c | 4 +-
4 files changed, 63 insertions(+), 73 deletions(-)
diff --git a/content/fetch.c b/content/fetch.c
index 64e639c..54029b3 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -65,16 +65,6 @@
#include "javascript/fetcher.h"
#include "content/urldb.h"
-/* Define this to turn on verbose fetch logging */
-#define DEBUG_FETCH_VERBOSE
-
-/** Verbose fetcher logging */
-#ifdef DEBUG_FETCH_VERBOSE
-#define FETCH_LOG(x...) LOG(x)
-#else
-#define FETCH_LOG(x...)
-#endif
-
/** The maximum number of fetchers that can be added */
#define MAX_FETCHERS 10
@@ -791,8 +781,7 @@ void fetch_remove_from_queues(struct fetch *fetch)
/* exported interface documented in content/fetch.h */
void fetch_set_http_code(struct fetch *fetch, long http_code)
{
- NSLOG(fetch, DEBUG, "Setting HTTP code to %ld", http_code);
- FETCH_LOG("Setting HTTP code to %ld for fetch 0x%x", http_code, fetch);
+ NSLOG(fetch, DEBUG, "fetch 0x%x, Setting HTTP code to %ld", fetch,
http_code);
fetch->http_code = http_code;
}
diff --git a/content/fetchers/httplib_kolibri.c
b/content/fetchers/httplib_kolibri.c
index 18055d1..28c3ec8 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -27,7 +27,7 @@ struct httpfetcher *head = NULL;
void add_to_poll(struct httpfetcher *newfetcher) {
- LOG("-=- add: newfetcher 0x%x, newfetcher->handle 0x%x", newfetcher,
newfetcher->handle);
+ NSLOG(fetch, DEBUG, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x",
head, newfetcher, newfetcher->handle);
struct httpfetcher *t = head;
assert(newfetcher->next == NULL);
@@ -44,12 +44,12 @@ void add_to_poll(struct httpfetcher *newfetcher) {
}
}
-struct httpfetcher* remove_from_poll(struct http_msg *donehttp) {
+struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
struct httpfetcher *t = head, *p = head;
- LOG("-=- remove: (->handle) donehttp 0x%x", donehttp);
+ NSLOG(fetch, DEBUG, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x",
head, removee, removee->handle);
while(t) {
- if (t->handle == donehttp) {
+ if (t == removee) {
if(t == head) {
p = t->next;
head = p;
@@ -65,7 +65,7 @@ struct httpfetcher* remove_from_poll(struct http_msg
*donehttp) {
p = t;
t = t->next;
- }
+ }
return head;
}
@@ -74,14 +74,14 @@ bool init_fetcher(lwc_string *scheme) {
bool supported_scheme;
assert(lwc_string_isequal(scheme, corestring_lwc_http, &supported_scheme) ==
lwc_error_ok);
- LOG("Initializing http library!");
+ NSLOG(fetch, DEBUG, "Initializing http library!");
debug_board_printf("---- [NETSURF] Trying to initialize http library.\n");
if(kolibri_http_init() == 0) {
- LOG("[INFO] Loaded http.obj library successfully.\n");
+ NSLOG(fetch, DEBUG, "[INFO] Loaded http.obj library successfully.\n");
debug_board_printf("---- [NETSURF] Successfully initialized http
library.\n");
}
else {
- LOG("[ERROR] Could not load http.obj library.\n");
+ NSLOG(fetch, ERROR, "[ERROR] Could not load http.obj library.\n");
debug_board_printf("---- [NETSURF] Could not initialize http library.
Exiting.\n");
assert(0 && 1);
return false;
@@ -105,23 +105,20 @@ void *setup_fetch(struct fetch *parent_fetch, struct
nsurl *url,
struct http_msg* request = NULL;
- LOG("[SETUP] Our target URL: %s", nsurl_access(url));
- LOG("[SETUP] POST urlencoded data: %s", post_urlenc);
+ NSLOG(fetch, DEBUG, "[SETUP] Our target URL: %s", nsurl_access(url));
+ NSLOG(fetch, DEBUG, "[SETUP] POST urlencoded data: %s", post_urlenc);
int i = 0;
for(i = 0; headers[i] != NULL; i++)
- LOG("[SETUP] -- Headers : %s", headers[i]);
+ NSLOG(fetch, DEBUG, "[SETUP] -- Headers : %s", headers[i]);
if(post_multipart != NULL) {
struct fetch_multipart_data *printer = post_multipart;
while(printer != NULL) {
- LOG("Multipart POST : (%s = %s)\n", printer->name, printer->value);
+ NSLOG(fetch, DEBUG, "Multipart POST : (%s = %s)\n", printer->name,
printer->value);
/* debug_board_printf("Multipart POST : (%s = %s)\n", printer->name,
printer->value); */
printer = printer->next;
}
-
- LOG("[WARNING] We dont support POST multipart yet!\n");
- LOG("[NETSURF ERROR] We dont support POST multipart yet!\n");
char *boundary = "--------Netsurf------------KolibriOS----Multipart----";
int lenb = strlen(boundary);
char *contenttype = "multipart/form-data;
boundary=--------Netsurf------------KolibriOS----Multipart----";
@@ -208,8 +205,8 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl
*url,
/* debug_board_printf("TERMINATING NULL tmp = %u\n", tmp); */
- LOG("Multipart request content length : %d", contentlen);
- LOG("Multipart request content: %s", content);
+ NSLOG(fetch, DEBUG, "Multipart request content length : %d", contentlen);
+ NSLOG(fetch, DEBUG, "Multipart request content: %s", content);
request = http_post_asm(nsurl_access(url), NULL, 1<<8, *headers,
contenttype, contentlen - 1);
@@ -219,28 +216,28 @@ void *setup_fetch(struct fetch *parent_fetch, struct
nsurl *url,
/* LOG("--- Sending data : with length %u\n", contentlen); */
datasent = http_send_asm(request, content, contentlen - 1);
/* debug_board_printf("--- Sent %d bytes of data.\n", datasent); */
- LOG("--- Sent %d bytes of multipart post data.\n", datasent);
+ NSLOG(fetch, DEBUG, "--- Sent %d bytes of multipart post data.\n",
datasent);
}
}
else if(post_urlenc) {
- LOG("http_post: %s", nsurl_access(url));
+ NSLOG(fetch, DEBUG, "http_post: %s", nsurl_access(url));
request = http_post_asm(nsurl_access(url), NULL, 0, *headers,
"application/x-www-form-urlencoded", strlen(post_urlenc));
if(request != NULL) {
int datasent = 0;
/* Send all the data here itself. Move this later to polling maybe. */
/* debug_board_printf("--- Sending data : %s with length %u\n",
post_urlenc, strlen(post_urlenc)); */
datasent = http_send_asm(request, post_urlenc, strlen(post_urlenc));
- LOG("--- Sent %d bytes of urlencoded data.\n", datasent);
+ NSLOG(fetch, DEBUG, "--- Sent %d bytes of urlencoded data.\n", datasent);
}
}
else {
/* Do a GET */
- LOG("http_get: %s", nsurl_access(url));
+ NSLOG(fetch, DEBUG, "http_get: %s", nsurl_access(url));
request = http_get_asm(nsurl_access(url), NULL, 0, *headers);
}
if(request == NULL) {
- LOG("Failed to allocate http buffer. Could be multiple reasons for failure
(like DNS resolution)", request);
+ NSLOG(fetch, ERROR, "Failed to allocate http buffer. Could be multiple
reasons for failure (like DNS resolution)", request);
return NULL;
}
@@ -264,25 +261,24 @@ void *setup_fetch(struct fetch *parent_fetch, struct
nsurl *url,
}
bool start_fetch(void *httpf) {
- LOG("-=- start_fetch : httpf: 0x%x", httpf);
+ NSLOG(fetch, DEBUG, "start_fetch : httpf: 0x%x", httpf);
add_to_poll((struct httpfetcher *) httpf);
return true;
}
bool abort_fetch(void *httpf) {
- LOG("aborting fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
- remove_from_poll(((struct httpfetcher *) httpf)->handle);
+ NSLOG(fetch, DEBUG, "aborting fetch 0x%x,", ((struct httpfetcher
*)httpf)->owner);
+ remove_from_poll((struct httpfetcher *) httpf);
fetch_remove_from_queues(((struct httpfetcher *)httpf)->owner);
fetch_free(((struct httpfetcher *)httpf)->owner);
return true;
}
bool free_fetch(void *httpf) {
- LOG("free_fetch called for 0x%x", ((struct httpfetcher *)httpf)->owner);
+ NSLOG(fetch, DEBUG, "free_fetch fetch 0x%x", ((struct httpfetcher
*)httpf)->owner);
http_disconnect_asm((((struct httpfetcher *)httpf)->handle));
- LOG("Freeing fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
http_free_asm((((struct httpfetcher *)httpf)->handle));
free((struct httpfetcher *)httpf);
@@ -295,32 +291,37 @@ void poll_fetch(lwc_string *scheme) {
assert(supported_scheme);
struct httpfetcher *t = head;
+ NSLOG(fetch, DEBUG, "poller head = 0x%x", t);
while(t != NULL) {
- LOG("-- Polling for t 0x%x, http_msg 0x%x, fetch 0x%x [ hcbdone = %s ]",
t, t->handle, t->owner, t->headercbdone == true ? "true" : "false");
- LOG("--- http_msg struct at : %x", t->handle);
- LOG("--- Header starts at : %x", &(t->handle->http_header));
- LOG("--- Header Length: %d", t->handle->header_length);
- LOG("--- Content starts at : %x", &(t->handle->content_ptr));
- LOG("--- Content Length (received / total): %d / %d",
t->handle->content_received, t->handle->content_length);
- LOG("--- ^ was for url : %s", nsurl_access(t->url));
+ NSLOG(fetch, DEBUG, "-- Polling for t 0x%x, http_msg 0x%x, fetch 0x%x [
hcbdone = %s ]", t, t->handle, t->owner, t->headercbdone == true ? "true" :
"false");
+ NSLOG(fetch, DEBUG, "--- http_msg struct at : %x", t->handle);
+ NSLOG(fetch, DEBUG, "--- Header starts at : %x",
&(t->handle->http_header));
+ NSLOG(fetch, DEBUG, "--- Header Length: %d", t->handle->header_length);
+ NSLOG(fetch, DEBUG, "--- Content starts at : %x",
&(t->handle->content_ptr));
+ NSLOG(fetch, DEBUG, "--- Content Length (received / total): %d / %d",
t->handle->content_received, t->handle->content_length);
+ NSLOG(fetch, DEBUG, "--- ^ was for url : %s", nsurl_access(t->url));
int ret = http_receive_asm(t->handle);
if(t->handle->flags & HTTP_ERRORS) {
fetch_msg msg;
msg.type = FETCH_ERROR;
- LOG("---- [ERROR] http_msg -> flags = 0x%x", t->handle->flags);
+ NSLOG(fetch, ERROR, "---- http_msg -> flags = 0x%x", t->handle->flags);
msg.data.header_or_data.buf = (const uint8_t *) "HTTPLIB ERROR";
msg.data.header_or_data.len = strlen("HTTPLIB ERROR");
+ struct httpfetcher *t2 = remove_from_poll(t);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
+
+ t = t2;
+ continue;
}
if(t->headercbdone == false) {
if (t->handle->flags & HTTP_GOT_HEADER) {
- LOG("---- Received all HTTP Headers.");
- LOG("---- response status code = %d", t->handle->status);
+ NSLOG(fetch, DEBUG, "---- Received all HTTP Headers.");
+ NSLOG(fetch, DEBUG, "---- response status code = %d",
t->handle->status);
fetch_set_http_code(t->owner, t->handle->status);
if(t->handle->status >= 200 && t->handle->status < 300) {
@@ -343,7 +344,7 @@ void poll_fetch(lwc_string *scheme) {
char *xx = (char *) malloc(j - plen + 1);
strncpy(xx, ptr + plen, j-plen);
xx[j-plen] = '\0';
- LOG("Headerline: %s", xx);
+ NSLOG(fetch, DEBUG, "Headerline: %s", xx);
fetch_send_callback(&msg, t->owner);
free(xx);
@@ -357,9 +358,7 @@ void poll_fetch(lwc_string *scheme) {
fetch_msg msg;
msg.type = FETCH_NOTMODIFIED;
fetch_send_callback(&msg, t->owner);
- t = remove_from_poll(t->handle);
- /* t = t->next; */
- /* t = head; */
+ t = remove_from_poll(t);
continue;
}
else {
@@ -374,10 +373,11 @@ void poll_fetch(lwc_string *scheme) {
newlocation[lenloc]='\0';
msg.data.redirect = newlocation;
- LOG("---- [3xx] : Redirect to %s", msg.data.redirect);
+ NSLOG(fetch, INFO, "---- [3xx] : Redirect to %s",
msg.data.redirect);
+ struct httpfetcher *t2 = remove_from_poll(t);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
- t = remove_from_poll(t->handle);
+ t = t2;
/* t = t->next; */
/* t = head; */
continue;
@@ -386,28 +386,29 @@ void poll_fetch(lwc_string *scheme) {
else {
fetch_msg msg;
msg.type = FETCH_ERROR;
- LOG(" ---- [ERROR] Unhandled HTTP Code : %d", t->handle->status);
+ NSLOG(fetch, DEBUG, " ---- [ERROR] Unhandled HTTP Code : %d",
t->handle->status);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
fetch_remove_from_queues(t->owner);
+ struct httpfetcher *t2 = remove_from_poll(t);
fetch_free(t->owner);
- t = remove_from_poll(t->handle);
+ t = t2;
/* t = t->next; */
/* t = head; */
continue;
}
}
else {
- LOG("---- Headers not received yet.");
+ NSLOG(fetch, DEBUG, "---- Headers not received yet.");
}
}
else if(ret == -1) {
/* If data was received send it to netsurf core with FETCH_DATA */
- LOG("Calledback vs received : %u vs %u!", t->datalen_cb_done,
t->handle->content_received);
+ NSLOG(fetch, DEBUG, "Calledback vs received : %u vs %u!",
t->datalen_cb_done, t->handle->content_received);
if(t->handle->content_received > t->datalen_cb_done) {
fetch_msg msg;
- LOG("Doing a data callback\n");
+ NSLOG(fetch, DEBUG, "Doing a data callback\n");
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *)
(t->handle->content_ptr + t->datalen_cb_done);
msg.data.header_or_data.len = t->handle->content_received -
t->datalen_cb_done;
@@ -432,18 +433,18 @@ void poll_fetch(lwc_string *scheme) {
msg.data.header_or_data.buf = NULL;
msg.data.header_or_data.len = 0;
fetch_send_callback(&msg, t->owner);
- LOG("---- FETCH_FINISHED for fetch 0x%x", t->owner);
+ NSLOG(fetch, DEBUG, "---- FETCH_FINISHED for fetch 0x%x", t->owner);
- struct httpfetcher *tnext = t->next;
fetch_remove_from_queues(t->owner);
- fetch_free(t->owner);
/* t = head; */
- t = remove_from_poll(t->handle);
+ struct httpfetcher *t2 = remove_from_poll(t);
+ fetch_free(t->owner);
+ t = t2;
/* t = next; */
continue;
}
- LOG("Main loop: t going from 0x%x to 0x%x", t->owner, t->next != NULL ?
t->next->owner : NULL);
+ NSLOG(fetch, DEBUG, "Main loop: t going from 0x%x to 0x%x", t->owner,
t->next != NULL ? t->next->owner : NULL);
t = t->next;
}
}
diff --git a/frontends/kolibrios/gui.c b/frontends/kolibrios/gui.c
index a60bce5..159053d 100644
--- a/frontends/kolibrios/gui.c
+++ b/frontends/kolibrios/gui.c
@@ -467,7 +467,7 @@ process_cmdline(int argc, char** argv)
/* {0, 0, 0, 0 } */
/* }; /\* no long options *\/ */
- LOG("argc %d, argv %p", argc, argv);
+ NSLOG(netsurf, INFO, "argc %d, argv %p", argc, argv);
fename = "kolibri";
febpp = 32;
@@ -597,7 +597,7 @@ static void framebuffer_run(void)
nsfb_event_t event;
int timeout; /* timeout in miliseconds */
- LOG("framebuffer_run() executing!");
+ NSLOG(netsurf, DEBUG, "framebuffer_run() executing!");
while (fb_complete != true) {
/* run the scheduler and discover how long to wait for
@@ -2181,7 +2181,7 @@ main(int argc, char** argv)
if (ret != NSERROR_OK)
die("Options failed to initialise");
- LOG("Resources are at : %s", respath);
+ NSLOG(netsurf, INFO, "Resources are at : %s", respath);
options = filepath_find(respaths, "Choices");
nsoption_read(options, nsoptions);
@@ -2231,8 +2231,8 @@ main(int argc, char** argv)
urldb_load_cookies(nsoption_charp(cookie_file));
/* create an initial browser window */
- LOG("calling browser_window_create with Size(hxw)=%dx%d\n", feheight,
fewidth);
- LOG("calling browser_window_create with URL=%s\n", feurl);
+ NSLOG(netsurf, DEBUG, "calling browser_window_create with
Size(hxw)=%dx%d\n", feheight, fewidth);
+ NSLOG(netsurf, DEBUG, "calling browser_window_create with URL=%s\n",
feurl);
ret = nsurl_create(feurl, &url);
if (ret == NSERROR_OK) {
@@ -2254,7 +2254,7 @@ main(int argc, char** argv)
netsurf_exit();
if (fb_font_finalise() == false)
- LOG("Font finalisation failed.");
+ NSLOG(netsurf, CRITICAL, "Font finalisation failed.");
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
diff --git a/frontends/kolibrios/schedule.c b/frontends/kolibrios/schedule.c
index a0d9da0..90e458a 100644
--- a/frontends/kolibrios/schedule.c
+++ b/frontends/kolibrios/schedule.c
@@ -196,12 +196,12 @@ void list_schedule(void)
tv = get_tick_count();
- LOG("schedule list at %u", tv);
+ NSLOG(netsurf, DEBUG, "schedule list at %u", tv);
cur_nscb = schedule_list;
while (cur_nscb != NULL) {
- LOG("Schedule %p at %ld", cur_nscb, cur_nscb->tv);
+ NSLOG(netsurf, DEBUG, "Schedule %p at %ld", cur_nscb,
cur_nscb->tv);
cur_nscb = cur_nscb->next;
}
}
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org