YAZ  5.23.1
Functions
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>

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

static int decode_headers_content ( ODR  o,
int  off,
Z_HTTP_Header **  headers,
char **  content_buf,
int *  content_len 
)
static
static void dump_http_package ( ODR  o,
const char *  buf,
size_t  len 
)
static
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().

int yaz_decode_http_request ( ODR  o,
Z_HTTP_Request **  hr_p 
)
int yaz_decode_http_response ( ODR  o,
Z_HTTP_Response **  hr_p 
)
int yaz_encode_http_request ( ODR  o,
Z_HTTP_Request hr 
)
int yaz_encode_http_response ( ODR  o,
Z_HTTP_Response hr 
)
Z_GDU* z_get_HTTP_Request ( ODR  o)
Z_GDU* z_get_HTTP_Request_host_path ( ODR  odr,
const char *  host,
const char *  path 
)
Z_GDU* z_get_HTTP_Request_uri ( ODR  odr,
const char *  uri,
const char *  args,
int  use_full_uri 
)
Z_GDU* z_get_HTTP_Response ( ODR  o,
int  code 
)

Definition at line 384 of file http.c.

References z_get_HTTP_Response_details().

Referenced by ir_read(), and process_http_request().

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

Definition at line 378 of file http.c.

References YAZ_VERSION, and z_get_HTTP_Response_server().

Referenced by z_get_HTTP_Response().

Z_GDU* z_get_HTTP_Response_server ( ODR  o,
int  code,
const char *  details,
const char *  server,
const char *  server_url 
)
const char* z_HTTP_errmsg ( int  code)
void z_HTTP_header_add ( ODR  o,
Z_HTTP_Header **  hp,
const char *  n,
const char *  v 
)
void z_HTTP_header_add_basic_auth ( ODR  o,
Z_HTTP_Header **  hp,
const char *  username,
const char *  password 
)
void z_HTTP_header_add_content_type ( ODR  o,
Z_HTTP_Header **  hp,
const char *  content_type,
const char *  charset 
)

Definition at line 147 of file http.c.

References odr_malloc(), and z_HTTP_header_add().

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

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

Definition at line 218 of file http.c.

References Z_HTTP_Header::next, and yaz_strcasecmp().

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

Definition at line 200 of file http.c.

References Z_HTTP_Header::next, odr_malloc(), odr_strdup(), and yaz_strcasecmp().

Referenced by yaz_url_exec(), and z_HTTP_header_add_basic_auth().