瀏覽代碼

http_client Add debug and some notes in TODO

Olle E. Johansson 9 年之前
父節點
當前提交
c3c478874e
共有 2 個文件被更改,包括 9 次插入2 次删除
  1. 3 0
      modules/http_client/TODO.txt
  2. 6 2
      modules/http_client/http_client.c

+ 3 - 0
modules/http_client/TODO.txt

@@ -13,6 +13,9 @@ The http_client module - todo
 - save fingerprint of cert for trust-on-first-use procedure
 
 - connection and last status for httpcon-object, needs to be object in process memory, so child_init
+	Note: Right now httpcon-objects are allocated in pkg memory. This is bad for a reload,
+	but good for what we need to do here. 
+	- test what happens if we allocate curlcon objects in shared memory and use locks
 	- if 5xx response or timeout set flag
 	- function in dialplan - httpcon_exists(object)
 	- pv $curlstatus(object) ??

+ 6 - 2
modules/http_client/http_client.c

@@ -1,6 +1,6 @@
 /*
  * http_client Module
- * Copyright (C) 2015 Edvina AB, Olle E. Johansson
+ * Copyright (C) 2015-2016 Edvina AB, Olle E. Johansson
  *
  * Based on part of the utils module and part
  * of the json-rpc-c module
@@ -60,6 +60,7 @@
 #include "../../rpc_lookup.h"
 #include "../../config.h"
 #include "../../lvalue.h"
+#include "../../pt.h"		/* Process table */
 
 #include "functions.h"
 #include "curlcon.h"
@@ -167,7 +168,7 @@ static pv_export_t mod_pvs[] = {
     {{"curlerror", (sizeof("curlerror")-1)}, /* Curl error codes */
      PVT_OTHER, pv_get_curlerror, 0,
 	pv_parse_curlerror, 0, 0, 0},
-    {{"curlredirect", (sizeof("redirect")-1)}, /* Curl error codes */
+    {{"curlredirect", (sizeof("redirect")-1)}, /* Curl last redirect url - not implemented yet */
      PVT_OTHER, pv_get_curlredirect, 0,
 	pv_parse_curlredirect, 0, 0, 0},
     {{0, 0}, 0, 0, 0, 0, 0, 0, 0}
@@ -299,9 +300,12 @@ int curl_support_ipv6()
 /* Child initialization function */
 static int child_init(int rank)
 {	
+	int i = my_pid();
+
 	if (rank==PROC_INIT || rank==PROC_MAIN || rank==PROC_TCP_MAIN) {
 		return 0; /* do nothing for the main process */
 	}
+	LM_DBG("*** http_client module initializing process %d\n", i);
 
     	return 0;
 }