소스 검색

optimized XCAP document access - each process has its own curl handle

Vaclav Kubart 19 년 전
부모
커밋
30504e021c
2개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 0
      lib/xcap/ChangeLog
  2. 6 6
      lib/xcap/xcap_client.c

+ 2 - 0
lib/xcap/ChangeLog

@@ -0,0 +1,2 @@
+2006-03-24
+	* optimized XCAP document access - each process has its own curl handle

+ 6 - 6
lib/xcap/xcap_client.c

@@ -49,7 +49,7 @@ static size_t write_data_func(void *ptr, size_t size, size_t nmemb, void *stream
 int xcap_query(const char *uri, xcap_query_params_t *params, char **buf, int *bsize)
 {
 	CURLcode res = -1;
-	CURL *handle;
+	static CURL *handle = NULL; /*FIXME: experimental*/
 	dstring_t data;
 	char *auth = NULL;
 	int i;
@@ -75,10 +75,10 @@ int xcap_query(const char *uri, xcap_query_params_t *params, char **buf, int *bs
 	
 	dstr_init(&data, 512);
 	
-	handle = curl_easy_init();
+	if (!handle) handle = curl_easy_init(); /*FIXME: experimental*/
 	if (handle) {
 		curl_easy_setopt(handle, CURLOPT_URL, uri);
-		/* TRACE_LOG("uri: %s\n", uri ? uri : "<null>"); */
+		TRACE_LOG("uri: %s\n", uri ? uri : "<null>");
 		
 		/* do not store data into a file - store them in memory */
 		curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_data_func);
@@ -107,13 +107,13 @@ int xcap_query(const char *uri, xcap_query_params_t *params, char **buf, int *bs
 		curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1);
 		
 		/* FIXME: experimetns */
-		curl_easy_setopt(handle, CURLOPT_TCP_NODELAY, 1);
-		curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, 10);
+	/*	curl_easy_setopt(handle, CURLOPT_TCP_NODELAY, 1);
+		curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, 10);*/
 		
 		/* Accept headers */
 		
 		res = curl_easy_perform(handle);
-		curl_easy_cleanup(handle);
+		/* curl_easy_cleanup(handle); */ /* FIXME: experimental */
 	}
 	else ERROR_LOG("can't initialize curl handle\n");
 	if (res == 0) {