Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4820 → Rev 4821

/contrib/network/netsurf/netsurf/content/fetch.c
669,7 → 669,10
void
fetch_send_callback(const fetch_msg *msg, struct fetch *fetch)
{
__menuet__debug_out("Inside fetch_send_callback\n");
 
fetch->callback(msg, fetch->p);
__menuet__debug_out("After fetch->callback \n");
}
 
 
/contrib/network/netsurf/netsurf/content/fetchers/curl.c
287,8 → 287,11
struct fetch_curl_context *ctx)
{
ctx->locked = true;
__menuet__debug_out("Inside curl_send_cb, Calling send_cb()\n");
 
fetch_send_callback(msg, ctx->fetchh);
ctx->locked = false;
__menuet__debug_out("Returning ctx->aborted.\n");
 
return ctx->aborted;
}
299,18 → 302,23
fetch_msg msg;
char header[64];
va_list ap;
 
__menuet__debug_out("Inside fetch_curl_send_header\n");
va_start(ap, fmt);
 
vsnprintf(header, sizeof header, fmt, ap);
 
va_end(ap);
__menuet__debug_out("Header is : ");
__menuet__debug_out(header);
 
msg.type = FETCH_HEADER;
msg.data.header_or_data.buf = (const uint8_t *) header;
msg.data.header_or_data.len = strlen(header);
__menuet__debug_out("\nCalling fetch_curl_send_callback\n");
 
fetch_curl_send_callback(&msg, ctx);
 
__menuet__debug_out("Returning ctx->aborted\n");
return ctx->aborted;
}
 
350,22 → 358,6
}
 
 
int is_pid(int k)
{
int error;
asm volatile ("int $0x40":"=a"(error):"a"(18), "b"(21), "c"(k));
return error;
}
 
 
int kill_pid(int k)
{
int error;
asm volatile ("int $0x40":"=a"(error):"a"(18), "b"(18), "c"(k));
return error;
}
 
 
static void fetch_curl_process(struct fetch_curl_context *ctx) {
char ps[96], str[128];
sprintf(ps, "Yay! Path is %s", ctx->path);
373,71 → 365,58
fetch_msg msg;
 
/* ERSATZ DOWNLOADER */
/*
char zapzap[]="<html><body><h1>HOOLE!</h1></body></html>";
size_t file_size=strlen(zapzap);
char *buffer = (char*)malloc(file_size * sizeof(char));
memcpy(buffer, zapzap, file_size * sizeof(char));
*/
 
 
 
 
__menuet__debug_out("AHOY!\n");
struct http_msg *http_ahoy;
 
unsigned int wererat = 0;
char * pa=ctx->path;
asm volatile ("pusha");
wererat = http_get(pa);
asm volatile ("popa");
__menuet__debug_out("HTTP GOT!\n");
int result;
// asm volatile ("pusha"); // TODO: verify if this is still needed. It used to be an issue with the library but should be fixed now.
wererat = http_get(pa, NULL); // TODO: a pointer to additional headers (for cookies etc) can be placed here in the future.
// asm volatile ("popa"); // ....
 
http_ahoy=wererat;
if(wererat == 0) /* Error condition : http_get returned 0 */
__menuet__debug_out("http_get() failed. [ Return Value 0 ]\n");
else
__menuet__debug_out("http_get() Succeeded!. [ Return Value Non zero ]\n");
 
sprintf (str, "Header %d bytes, content %d bytes, recieved %d bytes\n", http_ahoy->header_length, http_ahoy->content_length, http_ahoy->content_received);
__menuet__debug_out(str);
__menuet__debug_out("HTTP GOT!\n");
int result = 1337;
char result_str[12];
char wererat_str[13];
 
asm volatile ("pusha");
result = http_process(wererat);
asm volatile ("popa");
while (result == -1) {
asm volatile ("pusha");
result = http_process(wererat);
asm volatile ("popa");
}
 
http_ahoy=wererat;
sprintf (str, "Header %d bytes, content %d bytes, recieved %d bytes\n", http_ahoy->header_length, http_ahoy->content_length, http_ahoy->content_received);
sprintf (str, "Header %u bytes, content %u bytes, received %u bytes\n", http_ahoy->header_length, http_ahoy->content_length, http_ahoy->content_received);
__menuet__debug_out(str);
 
__menuet__debug_out("Going into the do while loop for http_process\n");
__menuet__debug_out("All content is here\n");
do {
// sprintf(result_str, "%d", result);
// __menuet__debug_out("Result is : ");
// __menuet__debug_out(result_str);
// __menuet__debug_out("\n");
size_t file_size=http_ahoy->content_received;
char *buffer = (char*)malloc(file_size * sizeof(char));
memcpy(buffer, &(http_ahoy->data)+http_ahoy->header_length, file_size);
// asm volatile ("pusha"); // TODO: verify if this is still needed. It used to be an issue with the library but should be fixed now.
result = http_process(wererat);
// asm volatile ("popa"); // ....
} while ((result != 0));
 
// http_free(wererat);
__menuet__debug_out("memcopied\n==\n");
__menuet__debug_out("After the do while loop for http_process.\n");
 
//__menuet__debug_out(buffer);
//__menuet__debug_out("memcopied\n==\n");
if(result == 0)
__menuet__debug_out("http_process() worked successfully!\n");
else
__menuet__debug_out("http_process() failed!\n");
 
// http_ahoy = wererat; // really needed again??
sprintf (str, "Header %u bytes, content %u bytes, received %u bytes\n", http_ahoy->header_length, http_ahoy->content_length, http_ahoy->content_received);
__menuet__debug_out(str);
 
//char zapzap[]="<html><body><h1>HOOLE!</h1></body></html>";
//file_size=strlen(zapzap);
//char *buffer = (char*)malloc(file_size * sizeof(char));
//memcpy(buffer, zapzap, file_size * sizeof(char));
 
 
/* fetch is going to be successful */
fetch_set_http_code(ctx->fetchh, 200);
__menuet__debug_out("Calling fetch_set_http_code call\n");
fetch_set_http_code(ctx->fetchh, http_ahoy->status);
__menuet__debug_out("Returned from fetch_set_http_code call\n");
 
/* Any callback can result in the fetch being aborted.
* Therefore, we _must_ check for this after _every_ call to
444,7 → 423,7
* fetch_file_send_callback().
*/
 
__menuet__debug_out("Calling fetch_curl_send_header: 1\n");
if (fetch_curl_send_header(ctx, "Content-Type: %s",
fetch_filetype(ctx->path)))
goto fetch_file_process_aborted;
451,25 → 430,36
 
/* main data loop */
__menuet__debug_out("inside main data loop\n");
msg.type = FETCH_DATA;
 
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buffer;//&(http_ahoy->data) ; //buffer;
msg.data.header_or_data.len = file_size;
msg.data.header_or_data.buf = http_ahoy->content_ptr; // lets pray this works..x2
 
msg.data.header_or_data.len = http_ahoy->content_received;
__menuet__debug_out("Calling fetch_curl_send_callback\n");
fetch_curl_send_callback(&msg, ctx);
__menuet__debug_out("Calling http_free with wererat = ");
sprintf(wererat_str, "%u", wererat);
__menuet__debug_out(wererat_str);
__menuet__debug_out("\n");
http_free(wererat);
 
if (ctx->aborted == false) {
__menuet__debug_out("ctx->aborted = false\n");
msg.type = FETCH_FINISHED;
__menuet__debug_out("Calling fetch_curl_send_callback\n");
fetch_curl_send_callback(&msg, ctx);
__menuet__debug_out("After Calling fetch_curl_send_callback\n");
}
 
fetch_file_process_aborted:
__menuet__debug_out("Inside fetch file_process_aborted label\n");
return;
 
}
 
 
/**
* Do some work on current fetches.
*
/contrib/network/netsurf/netsurf/content/fetchers/http.c
16,6 → 16,7
 
 
struct http_msg {
// internal used by library, dont mess with these.
unsigned int socket;
unsigned int flags;
unsigned int write_ptr;
22,16 → 23,20
unsigned int buffer_length;
unsigned int chunk_ptr;
unsigned int timestamp;
 
// available for use.
unsigned int status;
unsigned int header_length;
char *content_ptr;
unsigned int content_length;
unsigned int content_received;
char data; //unknown size
char header; //unknown size (actually, it's size is defined in header_length)
};
 
 
int (* __stdcall http_init)();
unsigned int (* __stdcall http_get) (char * url); //yay, it's NOT uint, but hey, C is stubborn, and I'm dumb
// On the next line, we should tell the C compiler that this procedure actually returns a pointer. (to the http_msg struct)
unsigned int (* __stdcall http_get) (char * url, char * add_head); //yay, it's NOT uint, but hey, C is stubborn, and I'm dumb
int (* __stdcall http_process) (unsigned int identifier);
void (* __stdcall http_free) (unsigned int identifier);
 
/contrib/network/netsurf/netsurf/content/fetchers/make.fetch
15,7 → 15,8
OBJS := curl.o data.o file.o about.o resource.o
 
OUTFILE = TEST.o
CFLAGS += -I ../include/ -I ../ -I../../ -I./ -I/home/sourcerer/kos_src/newenginek/kolibri/include -I ../../../libwapcaplet/include/ -I ../../../libcss/include/
 
OUTFILE = TEST.o
CFLAGS += -I ../include/ -I ../ -I../../ -I./ -I/home/sourcerer/kos_src/newenginek/kolibri/include
 
include $(MENUETDEV)/makefiles/Makefile_for_o_lib
/contrib/network/netsurf/netsurf/content/llcache.c
1623,6 → 1623,7
nserror error = NSERROR_OK;
llcache_object *object = p;
llcache_event event;
__menuet__debug_out("Inside llcache_fetch_callback\n");
 
#ifdef LLCACHE_TRACE
LOG(("Fetch event %d for %p", msg->type, object));
1798,8 → 1799,10
 
object->fetch.state = LLCACHE_FETCH_COMPLETE;
}
__menuet__debug_out("Returning from llcache_fetch_callback. (err != NS_OK)\n");
return;
}
__menuet__debug_out("Returning from llcache_fetch_callback.(err = NS_OK)\n");
}
 
/**
/contrib/network/netsurf/netsurf/content/make.content
18,5 → 18,7
 
 
OUTFILE = cont.o
CFLAGS += -I ../include/ -I ../ -I../../ -I./ -I/home/sourcerer/kos_src/newenginek/kolibri/include
CFLAGS += -I ../include/ -I ../ -I../../ -I./ -I/home/sourcerer/kos_src/newenginek/kolibri/include -I ../../libwapcaplet/include/ -I ../../libcss/include/ -I ../../libdom/include/ -I ../../libdom/ -I ../../libhubbub/include/
 
 
include $(MENUETDEV)/makefiles/Makefile_for_o_lib