Demonstrates functions from header.h
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main(int argc, char* argv[]) {
printf(
"Error code %d\n", host.
error);
exit(1);
}
printf(
"Is it present? %s\n",
winyl_has_header(&host,
"Accept-Language") == -1 ?
"No" :
"Yes");
sprintf(value, "%d", INT_MAX);
free(value);
printf(
"Error code %d\n", res.
error);
exit(1);
}
printf(
"Is Content-Type present? %s\n",
winyl_has_header2(&res,
"Content-Type") == -1 ?
"No" :
"Yes");
}
printf(
"Body:\n%s\n", res.
body);
exit(0);
}
Contains the winyl_request function and related.
void winyl_response_close(winyl_response *response)
Frees memory used up by response.
winyl_response winyl_request(winyl *host, char *path, int flags)
Performs a HTTP request.
Represents a HTTP response.
Definition request.h:13
int error
Contains the error code after any winyl call.
Definition request.h:15
char * body
Response body.
Definition request.h:34
Represents a HTTP host.
Definition winyl.h:27
int error
Contains the error code after any winyl call.
Definition winyl.h:29
Contains the winyl_open function and related.
void winyl_close(winyl *host)
Frees memory used up by host.
#define WINYL_INTLEN(x)
Calculates the amount of digits in a positive integer.
Definition winyl.h:15
winyl winyl_open(char *hostname, int port)
Opens an HTTP host with the specified port.