http.h

simple http library for c99
git clone git://git.kocotian.pl/http.h.git
Log | Files | Refs | README | LICENSE

commit e3fd5ff9ec3a6a80a964d0443a75085acd81e313
parent 9ba4980e96bd38c469bd6dff556759fb6d87cb72
Author: kocotian <54662947+kocotian@users.noreply.github.com>
Date:   Sun, 11 Oct 2020 17:00:29 +0200

Update README.md
Diffstat:
MREADME.md | 22++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md @@ -5,12 +5,30 @@ just include header in your project and you ready to GET. for example, GET / from suckless.org on port 80: ```c #include "http.h" -void + +int main() { char *response; long long int size; - if((size = httpGET("suckless.org", 80, "/", &response)) == NULL) return -1; + if(!(size = httpGET("suckless.org", 80, "/", &response))) return -1; printf("%s", response); + free(response); + return 0; +} +``` +same as higher, but without HTTP header: +```c +#include "../http.h" + +int +main() +{ + char *response, *data; long long int size; + if(!(size = httpGET("suckless.org", 80, "/", &response))) return -1; + data = strstr(response, "\r\n\r\n") + 4; + printf("%s", data); + free(response); + return 0; } ``` ## compatibility: