summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshish Gupta <ashmew2@gmail.com>2017-09-24 21:05:47 (GMT)
committer Ashish Gupta <ashmew2@gmail.com>2017-09-24 21:05:47 (GMT)
commit86a0d7f6bde68fd2adafb5bfc54c19b97029d794 (patch)
tree1cdf5afbc4132c4a4cf704af4fa8a325f6f18b68
parent72191e346bfd621d217e310f8865efdb34ce4fa3 (diff)
downloadnetsurf-86a0d7f6bde68fd2adafb5bfc54c19b97029d794.tar.gz
netsurf-86a0d7f6bde68fd2adafb5bfc54c19b97029d794.tar.bz2
Support urlencoded POST
-rw-r--r--content/fetchers/httplib_kolibri.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/content/fetchers/httplib_kolibri.c b/content/fetchers/httplib_kolibri.c
index 4cbdcdc..8ca7180 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -108,7 +108,9 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
LOG("[SETUP] Our target URL: %s", nsurl_access(url));
LOG("[SETUP] POST urlencoded data: %s", post_urlenc);
- LOG("[SETUP] Headers : %s", *headers);
+ int i = 0;
+ for(i = 0; headers[i] != NULL; i++)
+ LOG("[SETUP] -- Headers : %s", headers[i]);
struct fetch_multipart_data *printer = post_multipart;
@@ -117,12 +119,21 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
printer = printer->next;
}
- if(post_multipart != NULL)
+ if(post_multipart != NULL) {
LOG("[WARNING] We dont support POST multipart yet!\n");
+ __asm__ __volatile__("int3");
+ }
if(post_urlenc) {
LOG("http_post: %s", nsurl_access(url));
- request = http_post_asm(nsurl_access(url), NULL, 0, *headers, post_urlenc, strlen(post_urlenc));
+ 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));
+ debug_board_printf("--- Sent %d bytes of data.\n", datasent);
+ }
}
else {
/* Do a GET */