summaryrefslogtreecommitdiff
path: root/frontends/kolibrios/kolibri_http.c
diff options
context:
space:
mode:
authorAshish Gupta <ashmew2@gmail.com>2017-04-05 21:39:01 +0200
committerAshish Gupta <ashmew2@gmail.com>2017-06-10 08:24:39 +0200
commit6fd280bb5b27842a0ef2977798566c37bd4e1d0e (patch)
tree8e5dd8aa1adf8c6550b955d130c81c36b3db9ea5 /frontends/kolibrios/kolibri_http.c
parent9bf5ecfa87d022645e986249270c5a89e27f46fe (diff)
downloadnetsurf-6fd280bb5b27842a0ef2977798566c37bd4e1d0e.tar.gz
netsurf-6fd280bb5b27842a0ef2977798566c37bd4e1d0e.tar.bz2
Add kolibrios/ dir : Step 1 towards porting this to Kolibri OS
Diffstat (limited to 'frontends/kolibrios/kolibri_http.c')
-rw-r--r--frontends/kolibrios/kolibri_http.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/frontends/kolibrios/kolibri_http.c b/frontends/kolibrios/kolibri_http.c
new file mode 100644
index 000000000..dda28a607
--- /dev/null
+++ b/frontends/kolibrios/kolibri_http.c
@@ -0,0 +1,36 @@
+#include "kolibri_http.h"
+
+int kolibri_http_init(void)
+{
+ int asm_init_status = init_network_asm();
+
+ if(asm_init_status == 0)
+ return 0;
+ else
+ return 1;
+}
+
+void http_send(struct http_msg *handle, char *data, int remaining_length) {
+
+ int sent = 0;
+ int total_sent = 0;
+ int retries_left = 5;
+
+ while(remaining_length > 0) {
+ sent = http_send_asm(handle, data + total_sent, remaining_length);
+
+ if(sent == -1) {
+ --retries_left;
+
+ if(retries_left)
+ continue;
+ else {
+ debug_board_write_str("ERROR: HTTP LIBRARY : Could not send data.\n");
+ __asm__ __volatile__("int3");
+ }
+ }
+
+ remaining_length -= sent;
+ total_sent += sent;
+ }
+}