The code on master branch is _almost_ done. What's missing is this:
/** * functions.c * curL_query_url() */
if (default_http_proxy != NULL) { res |= curl_easy_setopt(curl, CURLOPT_PROXY, default_http_proxy); }
if (default_http_proxy_port > 0) { res |= curl_easy_setopt(curl, CURLOPT_PROXYPORT, default_http_proxy_port); }
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/541
You can make a pull request with the changes that are needed, in this way it can be reviewed easier and merged if the developer doesn't discover anything wrong.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/541#issuecomment-195279711
Great patch, thanks!
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/541#issuecomment-195935616
We need to add to the TODO to add proxy support on a per connection basis
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/541#issuecomment-195935713
I notice that I had a setting for this in the code, but it is not mentioned in the documentation.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/541#issuecomment-196177840
Ok, this took me on a path longer than expected. We use the defaults when we create the connection objects, not in this part of the code. I've modified the code to handle proxy per connection in the text config and with the default settings in modparams. It resulted in a somewhat larger patch that will be committed soon.
--- 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/issues/541#issuecomment-196891157
I have pushed a commit to trunk, please test. Will write docs soon. Basically you can add "httpproxy" in the external configuration file - per connection - or default in modparams. Will commit to 4.4 too.
--- 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/issues/541#issuecomment-197366327
@filiplx If you have some time to test, I would really appreciate feedback. Thanks!
--- 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/issues/541#issuecomment-197786263
I will try to test it today.
--- 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/issues/541#issuecomment-198266536
Closed #541.
--- 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/issues/541#event-598238980
Committed to 4.4. Please open a new issue if you find a problem. Thanks for your contribution!
--- 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/issues/541#issuecomment-199659132
Did not manage to get default proxy to work.
I used the same config as I used with my home-brewed version of http_client.
The API calls work, it's just the proxy config that isn't applied.
# # Config #
#!define API_SERVER_A "apiA=>http://name:pass@api01.host.com" #!define API_SERVER_B "apiB=>http://name:pass@api02.host.com"
loadmodule "http_client.so" modparam("http_client", "httpcon", API_SERVER_A) modparam("http_client", "httpcon", API_SERVER_B) modparam("http_client", "httpproxy", "proxyhost") modparam("http_client", "httpproxyport", 8181)
/* in functions.c */
if (params->http_proxy != NULL) { LM_INFO("****** ##### CURL proxy [%s] \n", params->http_proxy); res |= curl_easy_setopt(curl, CURLOPT_PROXY, params->http_proxy); } else { LM_INFO("****** ##### CURL proxy NOT SET \n"); }
if (params->http_proxy_port > 0) { LM_INFO("****** ##### CURL proxy port [%d] \n", params->http_proxy_port); res |= curl_easy_setopt(curl, CURLOPT_PROXYPORT, params->http_proxy_port); } else { LM_INFO("****** ##### CURL proxy port NOT SET \n"); }
# # Log #
Mar 24 15:35:35 32048a54378d /usr/sbin/kamailio[8465]: INFO: http_client [functions.c:189]: curL_query_url(): ****** ##### CURL proxy NOT SET Mar 24 15:35:35 32048a54378d /usr/sbin/kamailio[8465]: INFO: http_client [functions.c:196]: curL_query_url(): ****** ##### CURL proxy port NOT SET
--- 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/issues/541#issuecomment-200868545
Ok, will check again. Thanks for testing.
--- 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/issues/541#issuecomment-200873850
Reopened #541.
--- 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/issues/541#event-605022110
Where you using the old http_client_query function? I noticed it doesn't work. For me, the other function used the default_proxy. I committed a patch to trunk, please test again. Added your debugging too so we see the same things.
--- 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/issues/541#issuecomment-202326394
I used http_connect().
When I changed the order of the modparams so that the default proxy config comes before the connection definitions, it worked.
E.g.:
# this works! modparam("http_client", "httpproxy", "proxyhost") modparam("http_client", "httpproxyport", 8181) modparam("http_client", "httpcon", API_SERVER_A) modparam("http_client", "httpcon", API_SERVER_B)
--- 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/issues/541#issuecomment-202907525
Right. This needs to be documented. Possibly add a TODO to fix this so order doesn't matter. Thanks for reporting back!
--- 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/issues/541#issuecomment-203284389
Closed #541.
--- 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/issues/541#event-607815324