http.h

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

README.md (772B)


      1 # http.h
      2 simple and small http library for C99,
      3 just include header in your project and you ready to GET.
      4 
      5 for example, GET / from suckless.org on port 80:
      6 ```c
      7 #include "http.h"
      8 
      9 int
     10 main(void)
     11 {
     12 	char *response; long long int size;
     13 	if(!(size = httpGET("suckless.org", 80, "/", &response))) return -1;
     14 	printf("%s", response);
     15 	/* or if you don't want http header: printf("%s", truncateHeader(response)); */
     16 	free(response);
     17 	return 0;
     18 }
     19 ```
     20 
     21 ## warning:
     22 `parseResponseLine()` and `getResponseStatus()` may be broken, i'll repair them
     23 
     24 ## compatibility:
     25 any POSIX 7 compliant system: yes
     26 
     27 windows: no
     28 
     29 ## additional features:
     30 if you want to change maximal request length (*default 1024*), `#define MAX_REQUEST_LEN` as new request length __before__ `#including "http.h"`