![]() |
SCTC
the soundcloud.com terminal client
|
Basic HTTP implementation. More...
#include "_hard_config.h"#include "http.h"#include "helper.h"#include "log.h"#include "network/network.h"#include "url.h"Macros | |
| #define | DEFAULT_BUFFER_SIZE 16384 |
| #define | NWC_GET_BYTE(NWC, BUF, I) |
Functions | |
| struct http_response * | http_request_get_only_header (struct network_conn *nwc, char *url, char *host, size_t follow_redirect_steps) |
| Send an HTTP request to host using nwc and reads the header. More... | |
| struct http_response * | http_request_get (struct network_conn *nwc, char *url, char *host) |
| Send an HTTP request and read the header along with the body. More... | |
| void | http_response_destroy (struct http_response *resp) |
| Free any data associated to the http_response. More... | |
Basic HTTP implementation.
| #define DEFAULT_BUFFER_SIZE 16384 |
| #define NWC_GET_BYTE | ( | NWC, | |
| BUF, | |||
| I | |||
| ) |
| struct http_response* http_request_get | ( | struct network_conn * | nwc, |
| char * | url, | ||
| char * | host | ||
| ) |
Send an HTTP request and read the header along with the body.
Behaves similar to http_request_get_only_header(), but with the following differences:
| nwc | The network-connection to use |
| url | The URL to request. |
| host | The host. |
| struct http_response* http_request_get_only_header | ( | struct network_conn * | nwc, |
| char * | url, | ||
| char * | host, | ||
| size_t | follow_redirect_steps | ||
| ) |
Send an HTTP request to host using nwc and reads the header.
http_request_get_only_header() expects nwc to be connected to the correct server. The parameters url and host are only used for the request itself, as shown below:
Take care: The returned http_response may contain a different nwc than the original passed one. In this case the body needs to be read from the returned http_response::nwc.
| nwc | The network-connection to use |
| url | The URL to request. |
| host | The host. |
| follow_redirect_steps | The number of redirects allowed (0 = disable rediects). |
| void http_response_destroy | ( | struct http_response * | resp | ) |
Free any data associated to the http_response.
This function only frees data, it does not free the connection nwc itself.
| resp | The http_response to free |
1.8.9.1