A simple example on how to utilize the library.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[]) {
exit(1);
}
exit(1);
}
}
printf(
"%s\n", res.
body);
exit(0);
}
Contains the winyl_request function and related.
#define WINYL_ERROR_CLOSE
Error calling net_close().
Definition request.h:57
#define WINYL_ERROR_SEND
Error calling net_send().
Definition request.h:53
#define WINYL_ERROR_RECV
Error calling net_recv().
Definition request.h:55
#define WINYL_ERROR_CONNECT
Error calling net_connect().
Definition request.h:51
void winyl_response_close(winyl_response *response)
Frees memory used up by response.
#define WINYL_ERROR_SOCKET
Error calling net_socket().
Definition request.h:49
winyl_response winyl_request(winyl *host, char *path, int flags)
Performs a HTTP request.
Represents a HTTP response.
Definition request.h:13
int http_version
HTTP version. See WINYL_HTTP_1_0 and similar.
Definition request.h:20
struct winyl_header * headers
Header collection; see header.h.
Definition request.h:27
int error
Contains the error code after any winyl call.
Definition request.h:15
char * body
Response body.
Definition request.h:34
int status
HTTP status.
Definition request.h:22
char * status_text
HTTP status text.
Definition request.h:24
int headers_count
Header count.
Definition request.h:29
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.
#define WINYL_ERROR_DNS
Call to net_gethostbyname() failed.
Definition winyl.h:60
void winyl_close(winyl *host)
Frees memory used up by host.
#define WINYL_ERROR_MALLOC
Allocating memory failed.
Definition winyl.h:64
winyl winyl_open(char *hostname, int port)
Opens an HTTP host with the specified port.
#define WINYL_ERROR_PORT
Speficied port is not valid.
Definition winyl.h:58