Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/cb502054e4654d892132944f6d3f7cb359b8d7f7
...commit
http://git.netsurf-browser.org/netsurf.git/commit/cb502054e4654d892132944f6d3f7cb359b8d7f7
...tree
http://git.netsurf-browser.org/netsurf.git/tree/cb502054e4654d892132944f6d3f7cb359b8d7f7
The branch, ashmew2/nskolibrios has been updated
via cb502054e4654d892132944f6d3f7cb359b8d7f7 (commit)
via 21564259c82b6fc1f21eba63353f9ba550bf3844 (commit)
via 4008b0e9dee33febb1971f204d6a47e2d150206a (commit)
from 1843934b37c6731fbb60665cd78bcd3f2c82d80d (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=cb502054e4654d892132944f6d3f7cb359b8d7f7
commit cb502054e4654d892132944f6d3f7cb359b8d7f7
Author: Ashish Gupta <[email protected]>
Commit: Ashish Gupta <[email protected]>
POST Multipart works
Private message can be sent on board.kolibrios.org
diff --git a/content/fetchers/httplib_kolibri.c
b/content/fetchers/httplib_kolibri.c
index 501909d..711b5d8 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -13,8 +13,6 @@
#include "content/fetchers/httplib_kolibri.h"
#include "frontends/kolibrios/kolibri_http.h"
-// #define STOP __asm__ __volatile__("int3")
-
extern struct fetch;
struct httpfetcher {
@@ -31,7 +29,6 @@ struct httpfetcher *head = NULL;
void add_to_poll(struct httpfetcher *newfetcher) {
LOG("-=- add: newfetcher 0x%x, newfetcher->handle 0x%x", newfetcher,
newfetcher->handle);
- /* STOP; */
struct httpfetcher *t = head;
assert(newfetcher->next == NULL);
@@ -51,7 +48,6 @@ void add_to_poll(struct httpfetcher *newfetcher) {
void remove_from_poll(struct http_msg *donehttp) {
struct httpfetcher *t = head, *p = head;
LOG("-=- remove: (->handle) donehttp 0x%x", donehttp);
- /* STOP; */
while(t) {
if (t->handle == donehttp) {
@@ -112,20 +108,119 @@ void *setup_fetch(struct fetch *parent_fetch, struct
nsurl *url,
for(i = 0; headers[i] != NULL; i++)
LOG("[SETUP] -- Headers : %s", headers[i]);
- struct fetch_multipart_data *printer = post_multipart;
-
- while(printer != NULL) {
- LOG("Multipart POST : (%s = %s)\n", printer->name, printer->value);
- printer = printer->next;
- }
if(post_multipart != NULL) {
+ struct fetch_multipart_data *printer = post_multipart;
+ while(printer != NULL) {
+ LOG("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");
- return NULL;
- }
+ char *boundary = "--------Netsurf------------KolibriOS----Multipart----";
+ int lenb = strlen(boundary);
+ char *contenttype = "multipart/form-data;
boundary=--------Netsurf------------KolibriOS----Multipart----";
+
+ /* Intermediate boundaries have 2 additional dashes at the beginning */
+ char *iboundary =
"----------Netsurf------------KolibriOS----Multipart----";
+ char *content = NULL;
+ int contentlen = 0;
+
+ printer = post_multipart;
+ while(printer != NULL) {
+ int leninc = strlen(iboundary) + 2 + strlen("Content-Disposition:
form-data; name=") + 1 + strlen(printer->name) + 1 + 2 + 2 +
strlen(printer->value) + 2;
+ contentlen+=leninc;
+ printer = printer -> next;
+ }
+
+ /* Space for last boundary (which has 2 empty boundary dashes) and CRLF */
+ contentlen += strlen(iboundary) + 2 + 2;
+
+ /* Space for terminating NULL */
+ contentlen += 1;
+
+ content = realloc(content, contentlen);
+
+ char *tmp = content;
+ debug_board_printf("Before Loop tmp = %u\n", tmp);
+
+ printer = post_multipart;
+ while(printer != NULL) {
+ int i = 0;
+ strcpy(tmp, iboundary);
+ tmp+=strlen(iboundary);
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ *tmp++ = '\r';
+ *tmp++ = '\n';
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ strcpy(tmp, "Content-Disposition: form-data; name=\"");
+ tmp+= strlen("Content-Disposition: form-data; name=\"");
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ strcpy(tmp, printer->name);
+ tmp += strlen(printer->name);
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ *tmp++ = '"';
+ *tmp++ = '\r';
+ *tmp++ = '\n';
+ *tmp++ = '\r';
+ *tmp++ = '\n';
- if(post_urlenc) {
+ debug_board_printf("tmp = %u\n", tmp);
+
+ strcpy(tmp, printer->value);
+ tmp += strlen(printer->value);
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ *tmp++ = '\r';
+ *tmp++ = '\n';
+
+ debug_board_printf("END OF LOOP tmp = %u\n", tmp);
+
+ printer = printer->next;
+ }
+
+ debug_board_printf("AFTER LOOP tmp = %u, content=%u\n", tmp, content);
+
+ strcpy(tmp, iboundary);
+ tmp+=strlen(iboundary);
+
+ strcpy(tmp, "--");
+ tmp+=2;
+
+ *tmp++ = '\r';
+ *tmp++ = '\n';
+
+ *tmp='\0';
+
+ debug_board_printf("TERMINATING NULL tmp = %u\n", tmp);
+
+ LOG("Multipart request content length : %d", contentlen);
+ LOG("Multipart request content: %s", content);
+
+ request = http_post_asm(nsurl_access(url), NULL, 1<<8, *headers,
contenttype, contentlen - 1);
+
+ if(request != NULL) {
+ int datasent = 0;
+
+ debug_board_printf("--- Sending data : %s with length %u\n", content,
contentlen);
+ 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 data.\n", datasent);
+ }
+ }
+ else if(post_urlenc) {
LOG("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) {
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=21564259c82b6fc1f21eba63353f9ba550bf3844
commit 21564259c82b6fc1f21eba63353f9ba550bf3844
Author: Ashish Gupta <[email protected]>
Commit: Ashish Gupta <[email protected]>
Drop int3 in multipart fetch with log and return NULL
diff --git a/content/fetchers/httplib_kolibri.c
b/content/fetchers/httplib_kolibri.c
index 8ca7180..501909d 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -121,7 +121,8 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl
*url,
if(post_multipart != NULL) {
LOG("[WARNING] We dont support POST multipart yet!\n");
- __asm__ __volatile__("int3");
+ LOG("[NETSURF ERROR] We dont support POST multipart yet!\n");
+ return NULL;
}
if(post_urlenc) {
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=4008b0e9dee33febb1971f204d6a47e2d150206a
commit 4008b0e9dee33febb1971f204d6a47e2d150206a
Author: Ashish Gupta <[email protected]>
Commit: Ashish Gupta <[email protected]>
Revert "Revert file.c to master"
This reverts commit 1843934b37c6731fbb60665cd78bcd3f2c82d80d.
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index 4fa1a21..f200eee 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -42,6 +42,7 @@
#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
+
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/inttypes.h"
@@ -191,6 +192,11 @@ static void fetch_file_free(void *ctx)
/** callback to start a file fetch */
static bool fetch_file_start(void *ctx)
{
+#ifdef _TARGET_IS_KOLIBRIOS
+ struct fetch_file_context *c = ctx;
+ debug_board_printf("[%u] Starting file fetch : %s\n", sys_uptime(),
nsurl_access(c->url));
+#endif
+
return true;
}
@@ -250,6 +256,9 @@ static void fetch_file_process_error(struct
fetch_file_context *ctx, int code)
if (fetch_file_send_callback(&msg, ctx))
goto fetch_file_process_error_aborted;
+#ifdef _TARGET_IS_KOLIBRIOS
+ debug_board_printf("[%u] Finished file fetch : %s\n", sys_uptime(),
nsurl_access(ctx->url));
+#endif
msg.type = FETCH_FINISHED;
fetch_file_send_callback(&msg, ctx);
@@ -332,6 +341,9 @@ static void fetch_file_process_plain(struct
fetch_file_context *ctx,
fetch_file_send_callback(&msg, ctx);
if (ctx->aborted == false) {
+#ifdef _TARGET_IS_KOLIBRIOS
+ debug_board_printf("[%u] Finished file fetch : %s\n", sys_uptime(),
nsurl_access(ctx->url));
+#endif
msg.type = FETCH_FINISHED;
fetch_file_send_callback(&msg, ctx);
}
@@ -435,6 +447,9 @@ fetch_file_process_aborted:
}
if (ctx->aborted == false) {
+#ifdef _TARGET_IS_KOLIBRIOS
+ debug_board_printf("[%u] Finished file fetch : %s\n", sys_uptime(),
nsurl_access(ctx->url));
+#endif
msg.type = FETCH_FINISHED;
fetch_file_send_callback(&msg, ctx);
}
@@ -656,7 +671,13 @@ static void fetch_file_process_dir(struct
fetch_file_context *ctx,
int i; /* directory entry index */
int n; /* number of directory entries */
+#ifndef _TARGET_IS_KOLIBRIOS
n = scandir(ctx->path, &listing, 0, dir_sort_alpha);
+#else
+ /* Don't have scandir yet */
+ n = 1;
+#endif
+
if (n < 0) {
fetch_file_process_error(ctx,
fetch_file_errno_to_http_code(errno));
@@ -735,6 +756,10 @@ static void fetch_file_process_dir(struct
fetch_file_context *ctx,
if (fetch_file_send_callback(&msg, ctx))
goto fetch_file_process_dir_aborted;
+#ifdef _TARGET_IS_KOLIBRIOS
+ debug_board_printf("[%u] Finished file fetch : %s\n", sys_uptime(),
nsurl_access(ctx->url));
+#endif
+
msg.type = FETCH_FINISHED;
fetch_file_send_callback(&msg, ctx);
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/file.c | 25 ++++++++
content/fetchers/httplib_kolibri.c | 122 ++++++++++++++++++++++++++++++++----
2 files changed, 134 insertions(+), 13 deletions(-)
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index 4fa1a21..f200eee 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -42,6 +42,7 @@
#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
+
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/inttypes.h"
@@ -191,6 +192,11 @@ static void fetch_file_free(void *ctx)
/** callback to start a file fetch */
static bool fetch_file_start(void *ctx)
{
+#ifdef _TARGET_IS_KOLIBRIOS
+ struct fetch_file_context *c = ctx;
+ debug_board_printf("[%u] Starting file fetch : %s\n", sys_uptime(),
nsurl_access(c->url));
+#endif
+
return true;
}
@@ -250,6 +256,9 @@ static void fetch_file_process_error(struct
fetch_file_context *ctx, int code)
if (fetch_file_send_callback(&msg, ctx))
goto fetch_file_process_error_aborted;
+#ifdef _TARGET_IS_KOLIBRIOS
+ debug_board_printf("[%u] Finished file fetch : %s\n", sys_uptime(),
nsurl_access(ctx->url));
+#endif
msg.type = FETCH_FINISHED;
fetch_file_send_callback(&msg, ctx);
@@ -332,6 +341,9 @@ static void fetch_file_process_plain(struct
fetch_file_context *ctx,
fetch_file_send_callback(&msg, ctx);
if (ctx->aborted == false) {
+#ifdef _TARGET_IS_KOLIBRIOS
+ debug_board_printf("[%u] Finished file fetch : %s\n", sys_uptime(),
nsurl_access(ctx->url));
+#endif
msg.type = FETCH_FINISHED;
fetch_file_send_callback(&msg, ctx);
}
@@ -435,6 +447,9 @@ fetch_file_process_aborted:
}
if (ctx->aborted == false) {
+#ifdef _TARGET_IS_KOLIBRIOS
+ debug_board_printf("[%u] Finished file fetch : %s\n", sys_uptime(),
nsurl_access(ctx->url));
+#endif
msg.type = FETCH_FINISHED;
fetch_file_send_callback(&msg, ctx);
}
@@ -656,7 +671,13 @@ static void fetch_file_process_dir(struct
fetch_file_context *ctx,
int i; /* directory entry index */
int n; /* number of directory entries */
+#ifndef _TARGET_IS_KOLIBRIOS
n = scandir(ctx->path, &listing, 0, dir_sort_alpha);
+#else
+ /* Don't have scandir yet */
+ n = 1;
+#endif
+
if (n < 0) {
fetch_file_process_error(ctx,
fetch_file_errno_to_http_code(errno));
@@ -735,6 +756,10 @@ static void fetch_file_process_dir(struct
fetch_file_context *ctx,
if (fetch_file_send_callback(&msg, ctx))
goto fetch_file_process_dir_aborted;
+#ifdef _TARGET_IS_KOLIBRIOS
+ debug_board_printf("[%u] Finished file fetch : %s\n", sys_uptime(),
nsurl_access(ctx->url));
+#endif
+
msg.type = FETCH_FINISHED;
fetch_file_send_callback(&msg, ctx);
diff --git a/content/fetchers/httplib_kolibri.c
b/content/fetchers/httplib_kolibri.c
index 8ca7180..711b5d8 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -13,8 +13,6 @@
#include "content/fetchers/httplib_kolibri.h"
#include "frontends/kolibrios/kolibri_http.h"
-// #define STOP __asm__ __volatile__("int3")
-
extern struct fetch;
struct httpfetcher {
@@ -31,7 +29,6 @@ struct httpfetcher *head = NULL;
void add_to_poll(struct httpfetcher *newfetcher) {
LOG("-=- add: newfetcher 0x%x, newfetcher->handle 0x%x", newfetcher,
newfetcher->handle);
- /* STOP; */
struct httpfetcher *t = head;
assert(newfetcher->next == NULL);
@@ -51,7 +48,6 @@ void add_to_poll(struct httpfetcher *newfetcher) {
void remove_from_poll(struct http_msg *donehttp) {
struct httpfetcher *t = head, *p = head;
LOG("-=- remove: (->handle) donehttp 0x%x", donehttp);
- /* STOP; */
while(t) {
if (t->handle == donehttp) {
@@ -112,19 +108,119 @@ void *setup_fetch(struct fetch *parent_fetch, struct
nsurl *url,
for(i = 0; headers[i] != NULL; i++)
LOG("[SETUP] -- Headers : %s", headers[i]);
- struct fetch_multipart_data *printer = post_multipart;
-
- while(printer != NULL) {
- LOG("Multipart POST : (%s = %s)\n", printer->name, printer->value);
- printer = printer->next;
- }
if(post_multipart != NULL) {
+ struct fetch_multipart_data *printer = post_multipart;
+ while(printer != NULL) {
+ LOG("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");
- __asm__ __volatile__("int3");
- }
+ 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----";
+
+ /* Intermediate boundaries have 2 additional dashes at the beginning */
+ char *iboundary =
"----------Netsurf------------KolibriOS----Multipart----";
+ char *content = NULL;
+ int contentlen = 0;
+
+ printer = post_multipart;
+ while(printer != NULL) {
+ int leninc = strlen(iboundary) + 2 + strlen("Content-Disposition:
form-data; name=") + 1 + strlen(printer->name) + 1 + 2 + 2 +
strlen(printer->value) + 2;
+ contentlen+=leninc;
+ printer = printer -> next;
+ }
+
+ /* Space for last boundary (which has 2 empty boundary dashes) and CRLF */
+ contentlen += strlen(iboundary) + 2 + 2;
+
+ /* Space for terminating NULL */
+ contentlen += 1;
+
+ content = realloc(content, contentlen);
+
+ char *tmp = content;
+ debug_board_printf("Before Loop tmp = %u\n", tmp);
+
+ printer = post_multipart;
+ while(printer != NULL) {
+ int i = 0;
+ strcpy(tmp, iboundary);
+ tmp+=strlen(iboundary);
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ *tmp++ = '\r';
+ *tmp++ = '\n';
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ strcpy(tmp, "Content-Disposition: form-data; name=\"");
+ tmp+= strlen("Content-Disposition: form-data; name=\"");
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ strcpy(tmp, printer->name);
+ tmp += strlen(printer->name);
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ *tmp++ = '"';
+ *tmp++ = '\r';
+ *tmp++ = '\n';
+ *tmp++ = '\r';
+ *tmp++ = '\n';
- if(post_urlenc) {
+ debug_board_printf("tmp = %u\n", tmp);
+
+ strcpy(tmp, printer->value);
+ tmp += strlen(printer->value);
+
+ debug_board_printf("tmp = %u\n", tmp);
+
+ *tmp++ = '\r';
+ *tmp++ = '\n';
+
+ debug_board_printf("END OF LOOP tmp = %u\n", tmp);
+
+ printer = printer->next;
+ }
+
+ debug_board_printf("AFTER LOOP tmp = %u, content=%u\n", tmp, content);
+
+ strcpy(tmp, iboundary);
+ tmp+=strlen(iboundary);
+
+ strcpy(tmp, "--");
+ tmp+=2;
+
+ *tmp++ = '\r';
+ *tmp++ = '\n';
+
+ *tmp='\0';
+
+ debug_board_printf("TERMINATING NULL tmp = %u\n", tmp);
+
+ LOG("Multipart request content length : %d", contentlen);
+ LOG("Multipart request content: %s", content);
+
+ request = http_post_asm(nsurl_access(url), NULL, 1<<8, *headers,
contenttype, contentlen - 1);
+
+ if(request != NULL) {
+ int datasent = 0;
+
+ debug_board_printf("--- Sending data : %s with length %u\n", content,
contentlen);
+ 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 data.\n", datasent);
+ }
+ }
+ else if(post_urlenc) {
LOG("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) {
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org