From: nishi Date: Sun, 21 Jan 2024 14:16:53 +0000 (+0000) Subject: http data works X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=64d6d7d3199b5db4c78b99e03997351ef7aa8b51;p=libw3.git http data works git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@37 d27a3e52-49c5-7645-884c-6793ebffc270 --- diff --git a/Example/fetch.c b/Example/fetch.c index 5040dc3..64afe18 100644 --- a/Example/fetch.c +++ b/Example/fetch.c @@ -10,7 +10,7 @@ #include #include -void fetch_data(struct W3* w3, size_t size, char* data){ +void fetch_data(struct W3* w3, char* data, size_t size){ write(1, data, size); } diff --git a/Library/HTTP.c b/Library/HTTP.c index cf211d3..39e379b 100644 --- a/Library/HTTP.c +++ b/Library/HTTP.c @@ -126,8 +126,16 @@ void __W3_HTTP_Request(struct W3* w3){ } } free(headers); + phase++; } } + }else if(phase == 2){ + void* funcptr = __W3_Get_Event(w3, "data"); + if(funcptr != NULL){ + void(*func)(struct W3* w3, char*, size_t) = (void(*)(struct W3* w3, char*, size_t))funcptr; + func(w3, buf + i, l - i); + } + break; } } }