SCTC
the soundcloud.com terminal client
Data Structures | Functions
http.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  http_response
 

Functions

struct http_responsehttp_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_responsehttp_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...
 

Function Documentation

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:

  • follow at max. MAX_REDIRECT_STEPS
  • read everything the server sends (header + body)
Parameters
nwcThe network-connection to use
urlThe URL to request.
hostThe host.
Returns
A pointer to an http_response, or NULL in case of error.

Here is the call graph for this function:

Here is the caller graph for this function:

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:

1 GET <url> HTTP/1.1\r\n
2 Host: <host>\r\n\r\n

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.

Parameters
nwcThe network-connection to use
urlThe URL to request.
hostThe host.
follow_redirect_stepsThe number of redirects allowed (0 = disable rediects).
Returns
A pointer to an http_response, or NULL in case of error.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
respThe http_response to free

Here is the caller graph for this function: