Module: kamailio
Branch: master
Commit: 875fd4cc96d9aab15ab307e8f991a876b8ed31be
URL: https://github.com/kamailio/kamailio/commit/875fd4cc96d9aab15ab307e8f991a87…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-07-04T15:20:21+02:00
http_client: http_query reuse the default user agent setting
- based on GH #674, by Jurijs Ivolga
- useful for simplified upgrade of the configs using utils version of
the http query to the http_client module
---
Modified: modules/http_client/functions.c
---
Diff: https://github.com/kamailio/kamailio/commit/875fd4cc96d9aab15ab307e8f991a87…
Patch: https://github.com/kamailio/kamailio/commit/875fd4cc96d9aab15ab307e8f991a87…
---
diff --git a/modules/http_client/functions.c b/modules/http_client/functions.c
index 258508d..3b6e808 100644
--- a/modules/http_client/functions.c
+++ b/modules/http_client/functions.c
@@ -54,6 +54,7 @@ typedef struct {
char *ciphersuites;
char *http_proxy;
char *failovercon;
+ char *useragent;
unsigned int authmethod;
unsigned int http_proxy_port;
unsigned int tlsversion;
@@ -68,11 +69,11 @@ typedef struct {
} curl_query_t;
-/*
+/*
* curl write function that saves received data as zero terminated
* to stream. Returns the amount of data taken care of.
*
- * This function may be called multiple times for larger responses,
+ * This function may be called multiple times for larger responses,
* so it reallocs + concatenates the buffer as needed.
*/
size_t write_function( void *ptr, size_t size, size_t nmemb, void *stream_ptr)
@@ -228,6 +229,8 @@ static int curL_query_url(struct sip_msg* _m, const char* _url, str* _dst, const
res |= curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_function);
res |= curl_easy_setopt(curl, CURLOPT_WRITEDATA, &stream);
+ if(params->useragent)
+ res |= curl_easy_setopt(curl, CURLOPT_USERAGENT, params->useragent);
if (res != CURLE_OK) {
/* PANIC */
@@ -587,6 +590,9 @@ int http_query(struct sip_msg* _m, char* _url, str* _dst, char* _post)
query_params.http_follow_redirect = default_http_follow_redirect;
query_params.oneline = 1;
query_params.maxdatasize = 0;
+ if(default_useragent.s!=NULL && default_useragent.len>0) {
+ query_params.useragent = default_useragent.s;
+ }
if(default_http_proxy.s!=NULL && default_http_proxy.len>0) {
query_params.http_proxy = default_http_proxy.s;
if(default_http_proxy_port>0) {
This is a complete refactor of cdp log. In particular:
- It removes escape chars for colors in log: they are most of the times not interpreted so they are messing up the logs
- It refactors some log level, moving to ERROR from WARN some errors during peer connections
- In DEBUG level, cdp is too much verbose and also syslogs complains about rate-limiting. Instead of removing some logs (which is quite unfair), let's introduce a new modparam (debug_heavy) in order to activate some logs which gives some side informations about peers status. This modparam is not active by default but this can be enabled easily re-introducing previous debug logs
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/692
-- Commit Summary --
* cdp: Review log level on peer_connect() function
* cdp: Remove escape chars for colors in log
* cdp: Review of logging of cdp
-- File Changes --
M modules/cdp/globals.h (10)
M modules/cdp/mod.c (2)
M modules/cdp/peermanager.c (27)
M modules/cdp/peermanager.h (2)
M modules/cdp/peerstatemachine.c (2)
M modules/cdp/receiver.c (34)
M modules/cdp/receiver.h (2)
M modules/cdp/session.c (74)
M modules/cdp/session.h (2)
M modules/cdp/tcp_accept.c (2)
M modules/cdp/tcp_accept.h (2)
M modules/cdp/transaction.c (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/692.patchhttps://github.com/kamailio/kamailio/pull/692.diff
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/692
Module: kamailio
Branch: master
Commit: cc68bea26eee85b9918716f9fc2bae23a1732b48
URL: https://github.com/kamailio/kamailio/commit/cc68bea26eee85b9918716f9fc2bae2…
Author: Federico Favaro <federico(a)aereo.lan.athonet.com>
Committer: Federico Favaro <fedefava86(a)gmail.com>
Date: 2016-07-01T21:40:05+02:00
cdp: Review of logging of cdp
cdp log at DEBUG level is too verbose
leading to an un-readable log and
rate-limiting. Instead of removing them
completely let's introduce a modparam
to enable the "heavy" debug.
By default it is not activated.
---
Modified: modules/cdp/mod.c
Modified: modules/cdp/peermanager.c
Modified: modules/cdp/peermanager.h
Modified: modules/cdp/receiver.c
Modified: modules/cdp/receiver.h
Modified: modules/cdp/session.c
Modified: modules/cdp/session.h
Modified: modules/cdp/tcp_accept.c
Modified: modules/cdp/tcp_accept.h
Modified: modules/cdp/transaction.c
---
Diff: https://github.com/kamailio/kamailio/commit/cc68bea26eee85b9918716f9fc2bae2…
Patch: https://github.com/kamailio/kamailio/commit/cc68bea26eee85b9918716f9fc2bae2…