diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2000-10-11 23:50:35 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2000-10-11 23:50:35 +0000 |
commit | 19d611157461f502069736ac1cb65c03666994e6 (patch) | |
tree | 75cff30308d4e67fa06bdc35ab80a48eac14281a /nanohttp.c | |
parent | b0426caeb9ef91efb9a623216d4fcb028feebafb (diff) | |
download | libxml2-19d611157461f502069736ac1cb65c03666994e6.tar.gz |
- nanohttp.c: added xmlNanoHTTPTimeout(int delay), removed a bug
xmlNanoHTTPMethod on input MimeType Tony Lam <Tony.Lam@eng.sun.com>
- xpointer.c: slight extension of xmlXPtrLocationSetMerge
Daniel
Diffstat (limited to 'nanohttp.c')
-rw-r--r-- | nanohttp.c | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -101,8 +101,9 @@ typedef struct xmlNanoHTTPCtxt { } xmlNanoHTTPCtxt, *xmlNanoHTTPCtxtPtr; static int initialized = 0; -static char *proxy = NULL; /* the proxy name if any */ +static char *proxy = NULL; /* the proxy name if any */ static int proxyPort; /* the proxy port if any */ +static unsigned int timeout = 60;/* the select() timeout in seconds */ /** * A bit of portability macros and functions @@ -182,6 +183,19 @@ xmlNanoHTTPCleanup(void) { } /** + * xmlNanoHTTPTimeout: + * @delay: the delay in seconds + * + * Set the HTTP timeout, (default is 60secs). 0 means immediate + * return, while -1 infinite. + */ + +void +xmlNanoHTTPTimeout(int delay) { + timeout = (unsigned int) delay; +} + +/** * xmlNanoHTTPScanURL: * @ctxt: an HTTP context * @URL: The URL used to initialize the context @@ -462,7 +476,7 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) { } } - tv.tv_sec = 10; + tv.tv_sec = timeout; tv.tv_usec = 0; FD_ZERO(&rfd); FD_SET(ctxt->fd, &rfd); @@ -656,7 +670,7 @@ xmlNanoHTTPConnectAttempt(struct in_addr ia, int port) return(-1); } - tv.tv_sec = 60; /* We use 60 second timeouts for now */ + tv.tv_sec = timeout; tv.tv_usec = 0; FD_ZERO(&wfd); @@ -968,7 +982,6 @@ xmlNanoHTTPMethod(const char *URL, const char *method, const char *input, if (URL == NULL) return(NULL); if (method == NULL) method = "GET"; - if (contentType != NULL) *contentType = NULL; retry: if (redirURL == NULL) |