From 19d611157461f502069736ac1cb65c03666994e6 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 11 Oct 2000 23:50:35 +0000 Subject: [PATCH] - nanohttp.c: added xmlNanoHTTPTimeout(int delay), removed a bug xmlNanoHTTPMethod on input MimeType Tony Lam - xpointer.c: slight extension of xmlXPtrLocationSetMerge Daniel --- ChangeLog | 6 ++++++ nanohttp.c | 21 +++++++++++++++++---- xpointer.c | 9 +++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93403a84..bce67b40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Oct 12 01:44:08 CEST 2000 Daniel Veillard + + * nanohttp.c: added xmlNanoHTTPTimeout(int delay), removed a bug + xmlNanoHTTPMethod on input MimeType Tony Lam + * xpointer.c: slight extension of xmlXPtrLocationSetMerge + Thu Oct 12 01:37:53 CEST 2000 Daniel Veillard * config.h.in configure.in nanoftp.c nanohttp.c xmlversion.h.in : diff --git a/nanohttp.c b/nanohttp.c index 82cf1611..19aad548 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -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 @@ -181,6 +182,19 @@ xmlNanoHTTPCleanup(void) { return; } +/** + * 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 @@ -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) diff --git a/xpointer.c b/xpointer.c index d9baf194..2756057d 100644 --- a/xpointer.c +++ b/xpointer.c @@ -381,10 +381,11 @@ xmlXPtrLocationSetAdd(xmlLocationSetPtr cur, xmlXPathObjectPtr val) { /** * xmlXPtrLocationSetMerge: - * @val1: the first LocationSet + * @val1: the first LocationSet or NULL * @val2: the second LocationSet * * Merges two rangesets, all ranges from @val2 are added to @val1 + * if @val1 is NULL, a new set is created and copied from @val2 * * Returns val1 once extended or NULL in case of error. */ @@ -392,8 +393,12 @@ xmlLocationSetPtr xmlXPtrLocationSetMerge(xmlLocationSetPtr val1, xmlLocationSetPtr val2) { int i; - if (val1 == NULL) return(NULL); if (val2 == NULL) return(val1); + if (val1 == NULL) { + val1 = xmlXPtrLocationSetCreate(NULL); + if (val1 == NULL) + return(NULL); + } /* * !!!!! this can be optimized a lot, knowing that both