YAZ 5.37.0
uri.c File Reference

Implements URI utilities. More...

#include <stdlib.h>
#include <yaz/srw.h>
#include <yaz/matchstr.h>
#include <yaz/yaz-iconv.h>
#include <yaz/snprintf.h>

Go to the source code of this file.

Functions

static int hex_digit (int ch)
static void encode_uri_char (char *dst, char ch)
void yaz_encode_uri_component (char *dst, const char *uri)
 encodes URI component
static unsigned char decode_uri_char (const char *path, size_t *len)
void yaz_decode_uri_component (char *dst, const char *uri, size_t len)
 decodes URI component
void yaz_array_to_uri (char **path, ODR o, char **name, char **value)
int yaz_uri_to_array (const char *path, ODR o, char ***name, char ***val)

Detailed Description

Implements URI utilities.

Definition in file uri.c.

Function Documentation

◆ decode_uri_char()

unsigned char decode_uri_char ( const char * path,
size_t * len )
static

Definition at line 56 of file uri.c.

References hex_digit().

Referenced by yaz_decode_uri_component(), and yaz_uri_to_array().

◆ encode_uri_char()

void encode_uri_char ( char * dst,
char ch )
static

Definition at line 30 of file uri.c.

References yaz_snprintf().

Referenced by yaz_encode_uri_component().

◆ hex_digit()

int hex_digit ( int ch)
static

Definition at line 19 of file uri.c.

Referenced by decode_uri_char().

◆ yaz_array_to_uri()

void yaz_array_to_uri ( char ** path,
ODR o,
char ** name,
char ** value )

◆ yaz_decode_uri_component()

void yaz_decode_uri_component ( char * dst,
const char * uri,
size_t len )

decodes URI component

Parameters
dstdestination string (should be at least strlen(uri)+1)
uriURI component buffer (source)
lennumber of bytes to decode from uri

Definition at line 87 of file uri.c.

References decode_uri_char().

◆ yaz_encode_uri_component()

void yaz_encode_uri_component ( char * dst,
const char * uri )

encodes URI component

Parameters
dstdestination string (should be at least 3*strlen(uri)+1)
uriURI component C-string (source)

Definition at line 46 of file uri.c.

References encode_uri_char().

Referenced by rdf_lookup_node(), and yaz_array_to_uri().

◆ yaz_uri_to_array()

int yaz_uri_to_array ( const char * path,
ODR o,
char *** name,
char *** val )

Definition at line 122 of file uri.c.

References decode_uri_char(), name, odr_malloc(), odr_strdup(), and odr_strdupn().

Referenced by yaz_encode_sru_extra(), yaz_sru_decode(), and ztest_search().