|
YAZ 5.35.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 | |
URL fetch utility.
Definition in file url.h.
| yaz_url_t yaz_url_create | ( | void | ) |
creates a URL fetcher handle
Definition at line 32 of file url.c.
References 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, and yaz_cookies_create().
Referenced by rdf_lookup_node().
| void yaz_url_destroy | ( | yaz_url_t | p | ) |
destroys a URL fetcher
| p | handle |
Note: OK to pass NULL as p
Definition at line 47 of file url.c.
References yaz_url::cookies, odr_destroy(), yaz_url::odr_in, yaz_url::odr_out, yaz_url::proxy, yaz_url::w_error, wrbuf_destroy(), xfree, and yaz_cookies_destroy().
Referenced by rdf_lookup_node().
| 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 132 of file url.c.
References Z_HTTP_Response::code, Z_HTTP_Request::content_buf, Z_HTTP_Request::content_len, yaz_url::cookies, cs_close, cs_connect, cs_create_host2(), cs_fileno, cs_get, cs_put, cs_rcvconnect, cs_set_head_only(), CS_WANT_READ, CS_WANT_WRITE, extract_user_pass(), yaz_poll_fd::fd, Z_HTTP_Request::headers, Z_HTTP_Response::headers, Z_GDU::HTTP_Request, Z_GDU::HTTP_Response, yaz_poll_fd::input_mask, comstack::io_pending, log_warn(), odr::mem, Z_HTTP_Request::method, 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, 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().
| const char * yaz_url_get_error | ( | yaz_url_t | p | ) |
get last error from yaz_url_exec
| p | handle |
Definition at line 122 of file url.c.
References yaz_url::w_error, and wrbuf_cstr().
Referenced by rdf_lookup_node().
| 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 68 of file url.c.
References yaz_url::max_redirects.
Referenced by rdf_lookup_node().
| 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 60 of file url.c.
References yaz_url::proxy, xfree, and xstrdup.
| 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 78 of file url.c.
References yaz_url::timeout_ns, and yaz_url::timeout_sec.
Referenced by rdf_lookup_node().
| 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 73 of file url.c.
References yaz_url::verbose.