|
YAZ 5.38.1
|
URL fetch utility. More...
#include <yaz/zgdu.h>Go to the source code of this file.
Typedefs | |
| typedef struct yaz_url * | yaz_url_t |
| handle for our URL fetcher | |
Functions | |
| yaz_url_t | yaz_url_create (void) |
| creates a URL fetcher handle | |
| void | yaz_url_destroy (yaz_url_t p) |
| destroys a URL fetcher | |
| void | yaz_url_set_proxy (yaz_url_t p, const char *proxy) |
| sets proxy for URL fetcher | |
| void | yaz_url_set_max_redirects (yaz_url_t p, int num) |
| sets maximum number of redirects | |
| void | yaz_url_set_verbose (yaz_url_t p, int num) |
| sets verbose level 0=none, >0 verbose | |
| void | yaz_url_set_timeout (yaz_url_t p, int sec, int ns) |
| sets I/O timeout | |
| Z_HTTP_Response * | yaz_url_exec (yaz_url_t p, const char *uri, const char *method, Z_HTTP_Header *headers, const char *buf, size_t len) |
| executes the actual HTTP request (including redirects, etc) | |
| const char * | yaz_url_get_error (yaz_url_t p) |
| get last error from yaz_url_exec | |
| void | yaz_url_set_check_cert (yaz_url_t p, int check_cert) |
| sets whether to check SSL certificates | |
| void | yaz_url_set_cert_fname (yaz_url_t p, const char *fname) |
| sets file with client-side certificate | |
URL fetch utility.
Definition in file url.h.
| yaz_url_t yaz_url_create | ( | void | ) |
creates a URL fetcher handle
Definition at line 34 of file url.c.
References yaz_url::cert_fname, yaz_url::check_cert, yaz_url::cookies, yaz_url::max_redirects, odr_createmem(), ODR_DECODE, ODR_ENCODE, yaz_url::odr_in, yaz_url::odr_out, yaz_url::proxy, yaz_url::timeout_ns, yaz_url::timeout_sec, yaz_url::verbose, yaz_url::w_error, wrbuf_alloc(), xmalloc, yaz_cookies_create(), and yaz_url_create().
Referenced by rdf_lookup_node(), and yaz_url_create().
| void yaz_url_destroy | ( | yaz_url_t | p | ) |
destroys a URL fetcher
| p | handle |
Note: OK to pass NULL as p
Definition at line 51 of file url.c.
References yaz_url::cert_fname, yaz_url::cookies, odr_destroy(), yaz_url::odr_in, yaz_url::odr_out, yaz_url::proxy, yaz_url::w_error, wrbuf_destroy(), xfree, yaz_cookies_destroy(), and yaz_url_destroy().
Referenced by rdf_lookup_node(), and yaz_url_destroy().
| Z_HTTP_Response * yaz_url_exec | ( | yaz_url_t | p, |
| const char * | uri, | ||
| const char * | method, | ||
| Z_HTTP_Header * | headers, | ||
| const char * | buf, | ||
| size_t | len ) |
executes the actual HTTP request (including redirects, etc)
| p | handle |
| uri | URL |
| method | HTTP method |
| headers | HTTP headers to be used (NULL for no custom headers) |
| buf | content buffer for HTTP request, NULL for empty content |
| len | content length for HTTP request |
Use yaz_url_get_error to get details if NULL is returned.
Definition at line 159 of file url.c.
References add_comstack_details(), yaz_url::cert_fname, yaz_url::check_cert, Z_HTTP_Response::code, yaz_url::cookies, cs_close, cs_connect, cs_create_host2(), cs_fileno, CS_FLAGS_CHECK_CERT, cs_get, cs_put, cs_rcvconnect, cs_set_head_only(), cs_set_ssl_certificate_file(), CS_WANT_READ, CS_WANT_WRITE, extract_user_pass(), yaz_poll_fd::fd, Z_HTTP_Response::headers, yaz_poll_fd::input_mask, comstack::io_pending, log_warn(), odr::mem, Z_HTTP_Header::name, Z_HTTP_Header::next, odr_getbuf(), yaz_url::odr_in, yaz_url::odr_out, odr_reset(), odr_setbuf(), odr_strdup(), yaz_url::proxy, yaz_url::timeout_ns, yaz_url::timeout_sec, Z_GDU::u, Z_HTTP_Header::value, yaz_url::verbose, yaz_url::w_error, Z_GDU::which, wrbuf_printf(), wrbuf_rewind(), xfree, yaz_check_location(), yaz_cookies_request(), yaz_cookies_reset(), yaz_cookies_response(), yaz_poll(), yaz_poll_add, yaz_poll_except, yaz_poll_none, yaz_poll_read, yaz_poll_write, yaz_url_exec(), z_GDU(), Z_GDU_HTTP_Response, z_get_HTTP_Request_uri(), z_HTTP_header_add(), z_HTTP_header_add_basic_auth(), z_HTTP_header_lookup(), and z_HTTP_header_set().
Referenced by rdf_lookup_node(), and yaz_url_exec().
| const char * yaz_url_get_error | ( | yaz_url_t | p | ) |
get last error from yaz_url_exec
| p | handle |
Definition at line 140 of file url.c.
References yaz_url::w_error, wrbuf_cstr(), and yaz_url_get_error().
Referenced by rdf_lookup_node(), and yaz_url_get_error().
| void yaz_url_set_cert_fname | ( | yaz_url_t | p, |
| const char * | fname ) |
sets file with client-side certificate
| p | handle |
| fname | file name |
Definition at line 94 of file url.c.
References yaz_url::cert_fname, xfree, xstrdup, and yaz_url_set_cert_fname().
Referenced by yaz_url_set_cert_fname().
| void yaz_url_set_check_cert | ( | yaz_url_t | p, |
| int | check_cert ) |
sets whether to check SSL certificates
| p | handle |
| check_cert | 1 to check certificates, 0 to ignore |
Definition at line 89 of file url.c.
References yaz_url::check_cert, and yaz_url_set_check_cert().
Referenced by yaz_url_set_check_cert().
| void yaz_url_set_max_redirects | ( | yaz_url_t | p, |
| int | num ) |
sets maximum number of redirects
| p | handle |
| num | maximum number of redirects |
Definition at line 73 of file url.c.
References yaz_url::max_redirects, and yaz_url_set_max_redirects().
Referenced by rdf_lookup_node(), and yaz_url_set_max_redirects().
| void yaz_url_set_proxy | ( | yaz_url_t | p, |
| const char * | proxy ) |
sets proxy for URL fetcher
| p | handle |
| proxy | proxy address , e.g "localhost:3128" |
Passing a proxy of NULL disables proxy use.
Definition at line 65 of file url.c.
References yaz_url::proxy, xfree, xstrdup, and yaz_url_set_proxy().
Referenced by yaz_url_set_proxy().
| void yaz_url_set_timeout | ( | yaz_url_t | p, |
| int | sec, | ||
| int | ns ) |
sets I/O timeout
| p | handle |
| sec | major part of timeout in seconds |
| ns | minor part of timeout in nanoseconds |
Definition at line 83 of file url.c.
References yaz_url::timeout_ns, yaz_url::timeout_sec, and yaz_url_set_timeout().
Referenced by rdf_lookup_node(), and yaz_url_set_timeout().
| void yaz_url_set_verbose | ( | yaz_url_t | p, |
| int | num ) |
sets verbose level 0=none, >0 verbose
| p | handle |
| num | verbose level |
Definition at line 78 of file url.c.
References yaz_url::verbose, and yaz_url_set_verbose().
Referenced by yaz_url_set_verbose().