Commit 8482a2a0 authored by Simon Morlat's avatar Simon Morlat

Merge branch 'master' into feature/resolver-improvements

parents a3ab888d f1ae0683
...@@ -613,8 +613,8 @@ static int tls_process_data(belle_sip_channel_t *obj,unsigned int revents){ ...@@ -613,8 +613,8 @@ static int tls_process_data(belle_sip_channel_t *obj,unsigned int revents){
if (tls_process_handshake(obj)==-1) goto process_error; if (tls_process_handshake(obj)==-1) goto process_error;
} }
} else if (obj->stack->http_proxy_host && !channel->http_proxy_connected) { } else if (obj->stack->http_proxy_host && !channel->http_proxy_connected) {
char response[256]; char response[256]={0};
err = stream_channel_recv((belle_sip_stream_channel_t*)obj,response,sizeof(response)); err = stream_channel_recv((belle_sip_stream_channel_t*)obj,response,sizeof(response)-1);
if (err<0 ){ if (err<0 ){
belle_sip_error("Channel [%p]: connection refused by http proxy [%s:%i] status [%s]" belle_sip_error("Channel [%p]: connection refused by http proxy [%s:%i] status [%s]"
,channel ,channel
......
...@@ -78,8 +78,7 @@ static belle_http_provider_t *prov=NULL; ...@@ -78,8 +78,7 @@ static belle_http_provider_t *prov=NULL;
static int http_before_all(void) { static int http_before_all(void) {
stack=belle_sip_stack_new(NULL); stack=belle_sip_stack_new(NULL);
if (userhostsfile) belle_sip_tester_set_dns_host_file(stack);
belle_sip_stack_set_dns_user_hosts_file(stack,userhostsfile);
prov=belle_sip_stack_create_http_provider(stack,"0.0.0.0"); prov=belle_sip_stack_create_http_provider(stack,"0.0.0.0");
if (belle_sip_tester_get_root_ca_path() != NULL) { if (belle_sip_tester_get_root_ca_path() != NULL) {
......
...@@ -268,18 +268,13 @@ static void process_auth_requested_for_algorithm(void *user_ctx, belle_sip_auth_ ...@@ -268,18 +268,13 @@ static void process_auth_requested_for_algorithm(void *user_ctx, belle_sip_auth_
} }
} }
static const char *listener_user_data[2] = {NULL, NULL};
int register_before_all(void) { int register_before_all(void) {
belle_sip_listening_point_t *lp; belle_sip_listening_point_t *lp;
stack = belle_sip_stack_new(NULL); stack = belle_sip_stack_new(NULL);
const char *client[2] = {NULL, NULL};
char *default_hosts = NULL;
if (!userhostsfile){ belle_sip_tester_set_dns_host_file(stack);
userhostsfile = default_hosts = bc_tester_res("tester_hosts");
}
belle_sip_stack_set_dns_user_hosts_file(stack, userhostsfile);
if (default_hosts) bc_free(default_hosts);
lp = belle_sip_stack_create_listening_point(stack, "0.0.0.0", 7060, "UDP"); lp = belle_sip_stack_create_listening_point(stack, "0.0.0.0", 7060, "UDP");
prov = belle_sip_stack_create_provider(stack, lp); prov = belle_sip_stack_create_provider(stack, lp);
...@@ -305,7 +300,7 @@ int register_before_all(void) { ...@@ -305,7 +300,7 @@ int register_before_all(void) {
listener_callbacks.process_auth_requested = process_auth_requested_for_algorithm; listener_callbacks.process_auth_requested = process_auth_requested_for_algorithm;
listener_callbacks.listener_destroyed = NULL; listener_callbacks.listener_destroyed = NULL;
listener = belle_sip_listener_create_from_callbacks(&listener_callbacks, (void *)client); listener = belle_sip_listener_create_from_callbacks(&listener_callbacks, (void *)listener_user_data);
return 0; return 0;
} }
......
...@@ -179,6 +179,18 @@ int belle_sip_tester_set_log_file(const char *filename) { ...@@ -179,6 +179,18 @@ int belle_sip_tester_set_log_file(const char *filename) {
return 0; return 0;
} }
void belle_sip_tester_set_dns_host_file(belle_sip_stack_t *stack){
if (userhostsfile){
belle_sip_stack_set_dns_user_hosts_file(stack, userhostsfile);
}else{
char *default_hosts = bc_tester_res("tester_hosts");
if (default_hosts){
belle_sip_stack_set_dns_user_hosts_file(stack, default_hosts);
bc_free(default_hosts);
}
}
}
#if !defined(__ANDROID__) && !defined(TARGET_OS_IPHONE) && !(defined(BELLE_SIP_WINDOWS_PHONE) || defined(BELLE_SIP_WINDOWS_UNIVERSAL)) #if !defined(__ANDROID__) && !defined(TARGET_OS_IPHONE) && !(defined(BELLE_SIP_WINDOWS_PHONE) || defined(BELLE_SIP_WINDOWS_UNIVERSAL))
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <bctoolbox/tester.h> #include <bctoolbox/tester.h>
#include "belle-sip/belle-sip.h"
#define MULTIPART_BOUNDARY "---------------------------14737809831466499882746641449" #define MULTIPART_BOUNDARY "---------------------------14737809831466499882746641449"
...@@ -58,7 +60,7 @@ void belle_sip_tester_uninit(void); ...@@ -58,7 +60,7 @@ void belle_sip_tester_uninit(void);
void belle_sip_tester_before_each(void); void belle_sip_tester_before_each(void);
void belle_sip_tester_after_each(void); void belle_sip_tester_after_each(void);
int belle_sip_tester_set_log_file(const char *filename); int belle_sip_tester_set_log_file(const char *filename);
extern const char *userhostsfile; void belle_sip_tester_set_dns_host_file(belle_sip_stack_t *stack);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment