Ulfius
HTTP Framework for REST Applications in C
Functions
URL, POST and Header parameters

Functions

int ulfius_add_header_to_response (struct _u_response *response, const char *key, const char *value)
 
int ulfius_set_string_body_request (struct _u_request *request, const char *string_body)
 
int ulfius_set_binary_body_request (struct _u_request *request, const char *binary_body, const size_t length)
 
int ulfius_set_empty_body_request (struct _u_request *request)
 
int ulfius_set_string_body_response (struct _u_response *response, const unsigned int status, const char *body)
 
int ulfius_set_binary_body_response (struct _u_response *response, const unsigned int status, const char *body, const size_t length)
 
int ulfius_set_empty_body_response (struct _u_response *response, const unsigned int status)
 

Detailed Description

URL, POST and Header management functions

Function Documentation

◆ ulfius_add_header_to_response()

int ulfius_add_header_to_response ( struct _u_response response,
const char *  key,
const char *  value 
)

ulfius_add_header_to_response add a header to the response

Parameters
responsethe response to be updated
keythe key of the header
valuethe value of the header
Returns
U_OK on success

◆ ulfius_set_string_body_request()

int ulfius_set_string_body_request ( struct _u_request request,
const char *  string_body 
)

ulfius_set_string_body_request Set a string string_body to a request, replace any existing body in the request

Parameters
requestthe request to be updated
string_bodystring to set to the body response must end with a '\0' character
Returns
U_OK on success

ulfius_set_string_body_request Set a string string_body to a request string_body must end with a '\0' character return U_OK on success

◆ ulfius_set_binary_body_request()

int ulfius_set_binary_body_request ( struct _u_request request,
const char *  binary_body,
const size_t  length 
)

ulfius_set_binary_body_request Set a binary binary_body to a request, replace any existing body in the request

Parameters
requestthe request to be updated
binary_bodyan array of char to set to the body response
lengththe length of binary_body to set to the request body return U_OK on success

ulfius_set_binary_body_request Add a binary binary_body to a request return U_OK on success

◆ ulfius_set_empty_body_request()

int ulfius_set_empty_body_request ( struct _u_request request)

ulfius_set_empty_body_request Set an empty request body

Parameters
requestthe request to be updated
Returns
U_OK on success

ulfius_set_empty_body_request Set an empty request body return U_OK on success

◆ ulfius_set_string_body_response()

int ulfius_set_string_body_response ( struct _u_response response,
const unsigned int  status,
const char *  body 
)

ulfius_set_string_body_response Add a string body to a response, replace any existing body in the response

Parameters
responsethe response to be updated
statusthe http status code to set to the response
bodythe string body to set, must end with a '\0' character
Returns
U_OK on success

◆ ulfius_set_binary_body_response()

int ulfius_set_binary_body_response ( struct _u_response response,
const unsigned int  status,
const char *  body,
const size_t  length 
)

ulfius_set_binary_body_response Add a binary body to a response, replace any existing body in the response

Parameters
responsethe response to be updated
statusthe http status code to set to the response
bodythe array of char to set
lengththe length of body to set to the request body
Returns
U_OK on success

◆ ulfius_set_empty_body_response()

int ulfius_set_empty_body_response ( struct _u_response response,
const unsigned int  status 
)

ulfius_set_empty_body_response Set an empty response with only a status

Parameters
responsethe response to be updated
statusthe http status code to set to the response
Returns
U_OK on success