YAZ 5.37.0
http.c File Reference

Implements HTTP decoding. More...

#include "odr-priv.h"
#include <yaz/yaz-version.h>
#include <yaz/yaz-iconv.h>
#include <yaz/matchstr.h>
#include <yaz/zgdu.h>
#include <yaz/base64.h>
#include <yaz/comstack.h>
#include <yaz/snprintf.h>

Go to the source code of this file.

Functions

static int decode_headers_content (ODR o, int off, Z_HTTP_Header **headers, char **content_buf, int *content_len)
void z_HTTP_header_add_content_type (ODR o, Z_HTTP_Header **hp, const char *content_type, const char *charset)
void z_HTTP_header_add_basic_auth (ODR o, Z_HTTP_Header **hp, const char *username, const char *password)
void z_HTTP_header_add (ODR o, Z_HTTP_Header **hp, const char *n, const char *v)
void z_HTTP_header_set (ODR o, Z_HTTP_Header **hp, const char *n, const char *v)
const char * z_HTTP_header_remove (Z_HTTP_Header **hp, const char *n)
const char * z_HTTP_header_lookup (const Z_HTTP_Header *hp, const char *n)
Z_GDUz_get_HTTP_Request (ODR o)
Z_GDUz_get_HTTP_Request_host_path (ODR odr, const char *host, const char *path)
Z_GDUz_get_HTTP_Request_uri (ODR odr, const char *uri, const char *args, int use_full_uri)
Z_GDUz_get_HTTP_Response_server (ODR o, int code, const char *details, const char *server, const char *server_url)
Z_GDUz_get_HTTP_Response_details (ODR o, int code, const char *details)
Z_GDUz_get_HTTP_Response (ODR o, int code)
const char * z_HTTP_errmsg (int code)
int yaz_decode_http_response (ODR o, Z_HTTP_Response **hr_p)
int yaz_decode_http_request (ODR o, Z_HTTP_Request **hr_p)
static void dump_http_package (ODR o, const char *buf, size_t len)
int yaz_encode_http_response (ODR o, Z_HTTP_Response *hr)
int yaz_encode_http_request (ODR o, Z_HTTP_Request *hr)
const char * yaz_check_location (ODR odr, const char *uri, const char *location, int *host_change)

Detailed Description

Implements HTTP decoding.

Definition in file http.c.

Function Documentation

◆ decode_headers_content()

int decode_headers_content ( ODR o,
int off,
Z_HTTP_Header ** headers,
char ** content_buf,
int * content_len )
static

◆ dump_http_package()

void dump_http_package ( ODR o,
const char * buf,
size_t len )
static

◆ yaz_check_location()

const char * yaz_check_location ( ODR odr,
const char * uri,
const char * location,
int * host_change )

Definition at line 659 of file http.c.

References cs_get_host_args(), and odr_malloc().

Referenced by handle_http(), and yaz_url_exec().

◆ yaz_decode_http_request()

◆ yaz_decode_http_response()

◆ yaz_encode_http_request()

◆ yaz_encode_http_response()

◆ z_get_HTTP_Request()

◆ z_get_HTTP_Request_host_path()

Z_GDU * z_get_HTTP_Request_host_path ( ODR odr,
const char * host,
const char * path )

◆ z_get_HTTP_Request_uri()

Z_GDU * z_get_HTTP_Request_uri ( ODR odr,
const char * uri,
const char * args,
int use_full_uri )

◆ z_get_HTTP_Response()

Z_GDU * z_get_HTTP_Response ( ODR o,
int code )

Definition at line 382 of file http.c.

References z_get_HTTP_Response_details().

Referenced by ir_read(), and process_http_request().

◆ z_get_HTTP_Response_details()

Z_GDU * z_get_HTTP_Response_details ( ODR o,
int code,
const char * details )

Definition at line 376 of file http.c.

References YAZ_VERSION, and z_get_HTTP_Response_server().

Referenced by z_get_HTTP_Response().

◆ z_get_HTTP_Response_server()

Z_GDU * z_get_HTTP_Response_server ( ODR o,
int code,
const char * details,
const char * server,
const char * server_url )

◆ z_HTTP_errmsg()

const char * z_HTTP_errmsg ( int code)

◆ z_HTTP_header_add()

◆ z_HTTP_header_add_basic_auth()

void z_HTTP_header_add_basic_auth ( ODR o,
Z_HTTP_Header ** hp,
const char * username,
const char * password )

◆ z_HTTP_header_add_content_type()

void z_HTTP_header_add_content_type ( ODR o,
Z_HTTP_Header ** hp,
const char * content_type,
const char * charset )

Definition at line 148 of file http.c.

References nmem_printf(), odr_getmem, and z_HTTP_header_add().

Referenced by yaz_sru_get_encode(), yaz_sru_post_encode(), and yaz_sru_soap_encode().

◆ z_HTTP_header_lookup()

◆ z_HTTP_header_remove()

const char * z_HTTP_header_remove ( Z_HTTP_Header ** hp,
const char * n )

Definition at line 214 of file http.c.

References Z_HTTP_Header::next, and yaz_strcasecmp().

◆ z_HTTP_header_set()

void z_HTTP_header_set ( ODR o,
Z_HTTP_Header ** hp,
const char * n,
const char * v )