浏览代码

curl Update TODO and add a note for improvement in the way we handle reading from the server.

We may want to just drop data instead of allocating memory for it. It is not a good situation
to swallow anything.
Olle E. Johansson 10 年之前
父节点
当前提交
9251a6f386
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 7 1
      modules/curl/TODO.txt
  2. 4 0
      modules/curl/functions.c

+ 7 - 1
modules/curl/TODO.txt

@@ -3,18 +3,22 @@ The curl module - todo
 
 - connection parameters
 	timeout=x		- DONE
-	read=line/all
+	read=line/all		- Implemented in API, but not in parameter
 	tlsverify=on/off
 	failover=curlcon	Other curlcon that can be used for failover in case of 5xx response or timeout
 	httpredirect		- DONE
 	useragent		- DONE
 
+
 - Make sure modparams work
 	httpproxy		- Not working with curl
 	tls cert, key, ca	- Not working with curl yet
 	httpredirect		- done
 	timeout			- done
+	maxdatasize		- done
 	
+- Add XAVP parameter setting before running curl_connect
+
 - save fingerprint of cert for trust-on-first-use procedure
 
 - status for curlcon-object, needs to be object in process memory, so child_init
@@ -22,6 +26,8 @@ The curl module - todo
 	- function in dialplan - curlcon_exist(object)
 	- pv $curlstatus(object) ??
 
+- Figure out a way to communicate back the content-type of the response. Another pvar arg?
+
 - pv for curl error codes (result < 100)
 	$curlerror(code)	Result string - DONE
 

+ 4 - 0
modules/curl/functions.c

@@ -60,6 +60,10 @@ static int curL_query_url(struct sip_msg* _m, char* _url, char* _dst, const char
  */
 size_t write_function( void *ptr, size_t size, size_t nmemb, void *stream_ptr)
 {
+    /* A question here is if we can somehow signal maxdatasize and stop filling
+	buffers at maxdatasize - we don't need any more. Or just ignore and stop
+	allocating pkg memory at that point. A good todo.
+     */
     http_res_stream_t *stream = (http_res_stream_t *) stream_ptr;
 
     stream->buf = (char *) pkg_realloc(stream->buf, stream->curr_size +