myMPD
Internal API documentation
Loading...
Searching...
No Matches
http_client.h File Reference

Synchronous HTTP client. More...

#include "dist/sds/sds.h"
#include "src/lib/list.h"
Include dependency graph for http_client.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mg_client_request_t
 
struct  mg_client_response_t
 

Functions

sds get_dnsserver (void)
 
void http_client_response_init (struct mg_client_response_t *mg_client_response)
 
void http_client_response_clear (struct mg_client_response_t *mg_client_response)
 
void http_client_request (struct mg_client_request_t *mg_client_request, struct mg_client_response_t *mg_client_response)
 
sds http_client_get_content_type (struct mg_client_response_t *response)
 

Detailed Description

Synchronous HTTP client.

Function Documentation

◆ get_dnsserver()

sds get_dnsserver ( void  )

Public functions Reads the dns server from resolv.conf

Returns
newly allocated sds string with first nameserver

◆ http_client_get_content_type()

sds http_client_get_content_type ( struct mg_client_response_t response)

Returns a sds pointer to the content-type header from response

Parameters
responsehttp response
Returns
sds or NULL if not found

◆ http_client_request()

void http_client_request ( struct mg_client_request_t mg_client_request,
struct mg_client_response_t mg_client_response 
)

Sends a HTTP request and follows redirects.

Parameters
mg_client_requestpointer to mg_client_request_t struct
mg_client_responsepointer to mg_client_response_t struct to populate

◆ http_client_response_clear()

void http_client_response_clear ( struct mg_client_response_t mg_client_response)

Clears a http response struct for the HTTP client

Parameters
mg_client_responsepointer to mg_client response struct

◆ http_client_response_init()

void http_client_response_init ( struct mg_client_response_t mg_client_response)

Initializes a http response struct for the HTTP client

Parameters
mg_client_responsepointer to mg_client response struct