Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/a10cb1289498ac0450aa5352d2808f3e37142a7d
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/a10cb1289498ac0450aa5352d2808f3e37142a7d
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/a10cb1289498ac0450aa5352d2808f3e37142a7d

The branch, ashmew2/netsurf-kolibrios has been updated
       via  a10cb1289498ac0450aa5352d2808f3e37142a7d (commit)
      from  9f915f96616f48e243f5bc7238b18b6ec16f1c05 (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=a10cb1289498ac0450aa5352d2808f3e37142a7d
commit a10cb1289498ac0450aa5352d2808f3e37142a7d
Author: Ashish Gupta <[email protected]>
Commit: Ashish Gupta <[email protected]>

    Do multiple FETCH_DATA callbacks from http fetcher instead of just one 
large callback

diff --git a/content/fetchers/httplib_kolibri.c 
b/content/fetchers/httplib_kolibri.c
index 6800cab..3361b04 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -21,6 +21,7 @@ struct httpfetcher {
   struct http_msg *handle;
   struct fetch *owner;
   bool headercbdone;
+  unsigned int datalen_cb_done;
 
   struct httpfetcher *next;
 };
@@ -98,7 +99,7 @@ bool init_fetcher(lwc_string *scheme) {
 
   return supported_scheme;
 }
-  
+
 bool supported_url_check(const struct nsurl *url) {
   bool supported;
   lwc_string *url_scheme = nsurl_get_component(url, NSURL_SCHEME);
@@ -156,6 +157,7 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl 
*url,
   newfetcher->handle = request;
   newfetcher->headercbdone = false;
   newfetcher->owner = parent_fetch;
+  newfetcher->datalen_cb_done = 0;
 
   return newfetcher;
 }
@@ -296,19 +298,36 @@ void poll_fetch(lwc_string *scheme) {
         LOG("---- Headers not received yet.");
       }
     }
+    else if(ret == -1) {
+      /* If data was received send it to netsurf core with FETCH_DATA */
+      /* LOG("Doing a data callback; so far : %u vs %u!", t->datalen_cb_done, 
t->handle->content_received); */
+
+      if(t->handle->content_received > t->datalen_cb_done) {
+        fetch_msg msg;
+        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;
+        fetch_send_callback(&msg, t->owner);
+        t->datalen_cb_done = t->handle->content_received;
+      }
+    }
     else if(ret == 0) {
-      fetch_msg msg;
-      msg.type = FETCH_DATA;
-      msg.data.header_or_data.buf = (const uint8_t *)t->handle->content_ptr;
-      msg.data.header_or_data.len = t->handle->content_length;
-      fetch_send_callback(&msg, t->owner);
-
-      LOG("---- FETCH_FINISHED for fetch 0x%x", t->owner);
+      if(t->handle->content_received > t->datalen_cb_done) {
+        /* Callback any remaining data before finishing off */
+        fetch_msg msg;
+        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;
+        fetch_send_callback(&msg, t->owner);
+        t->datalen_cb_done = t->handle->content_received;
+      }
 
+      fetch_msg msg;
       msg.type = FETCH_FINISHED;
       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);
 
       struct httpfetcher *tnext = t->next;
       remove_from_poll(t->handle);


-----------------------------------------------------------------------

Summary of changes:
 content/fetchers/httplib_kolibri.c |   35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/content/fetchers/httplib_kolibri.c 
b/content/fetchers/httplib_kolibri.c
index 6800cab..3361b04 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -21,6 +21,7 @@ struct httpfetcher {
   struct http_msg *handle;
   struct fetch *owner;
   bool headercbdone;
+  unsigned int datalen_cb_done;
 
   struct httpfetcher *next;
 };
@@ -98,7 +99,7 @@ bool init_fetcher(lwc_string *scheme) {
 
   return supported_scheme;
 }
-  
+
 bool supported_url_check(const struct nsurl *url) {
   bool supported;
   lwc_string *url_scheme = nsurl_get_component(url, NSURL_SCHEME);
@@ -156,6 +157,7 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl 
*url,
   newfetcher->handle = request;
   newfetcher->headercbdone = false;
   newfetcher->owner = parent_fetch;
+  newfetcher->datalen_cb_done = 0;
 
   return newfetcher;
 }
@@ -296,19 +298,36 @@ void poll_fetch(lwc_string *scheme) {
         LOG("---- Headers not received yet.");
       }
     }
+    else if(ret == -1) {
+      /* If data was received send it to netsurf core with FETCH_DATA */
+      /* LOG("Doing a data callback; so far : %u vs %u!", t->datalen_cb_done, 
t->handle->content_received); */
+
+      if(t->handle->content_received > t->datalen_cb_done) {
+        fetch_msg msg;
+        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;
+        fetch_send_callback(&msg, t->owner);
+        t->datalen_cb_done = t->handle->content_received;
+      }
+    }
     else if(ret == 0) {
-      fetch_msg msg;
-      msg.type = FETCH_DATA;
-      msg.data.header_or_data.buf = (const uint8_t *)t->handle->content_ptr;
-      msg.data.header_or_data.len = t->handle->content_length;
-      fetch_send_callback(&msg, t->owner);
-
-      LOG("---- FETCH_FINISHED for fetch 0x%x", t->owner);
+      if(t->handle->content_received > t->datalen_cb_done) {
+        /* Callback any remaining data before finishing off */
+        fetch_msg msg;
+        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;
+        fetch_send_callback(&msg, t->owner);
+        t->datalen_cb_done = t->handle->content_received;
+      }
 
+      fetch_msg msg;
       msg.type = FETCH_FINISHED;
       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);
 
       struct httpfetcher *tnext = t->next;
       remove_from_poll(t->handle);


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to