Commit a74f5156 authored by Simon Morlat's avatar Simon Morlat

fix bug in header_replace_create2() resulting in incorrect replaces header being constructed

parent bc56a9db
......@@ -101,16 +101,23 @@ BELLESIP_EXPORT unsigned int belle_sip_uri_has_lr_param(const belle_sip_uri_t* u
*
*/
BELLESIP_EXPORT unsigned int belle_sip_uri_is_secure(const belle_sip_uri_t* uri) ;
/**
* Removes the port part of this SipURI.
* Sets the value of the specified header fields to be included in a request constructed from the URI.
*
*/
BELLESIP_EXPORT void belle_sip_uri_remove_port(belle_sip_uri_t* uri) ;
BELLESIP_EXPORT void belle_sip_uri_set_header(belle_sip_uri_t* uri,const char*name, const char*value) ;
/**
* Sets the value of the specified header fields to be included in a request constructed from the URI.
* Removes specified header from uri.
**/
BELLESIP_EXPORT void belle_sip_uri_remove_header(belle_sip_uri_t *uri, const char *name);
/**
* Removes the port part of this SipURI.
*
*/
BELLESIP_EXPORT void belle_sip_uri_set_header(belle_sip_uri_t* uri,const char*name, const char*value) ;
BELLESIP_EXPORT void belle_sip_uri_remove_port(belle_sip_uri_t* uri) ;
/**
* Set the host part of this SipURI to the newly supplied host parameter.
*
......
......@@ -1367,11 +1367,12 @@ static void escaped_to_ascii(const char*a,char*b,size_t n) {
while (a[index_a]!='\0'&& index_a<n)
index_a+=belle_sip_get_char(a+index_a,n-index_a,b+index_b++);
}
#define REPLACES_PREF_OFFSET 10
#define REPLACES_PREF_OFFSET (strlen(BELLE_SIP_REPLACES)+2)
belle_sip_header_replaces_t* belle_sip_header_replaces_create2(const char* escaped_replace) {
belle_sip_header_replaces_t* replaces;
size_t len=strlen(escaped_replace);
char* out=belle_sip_malloc(REPLACES_PREF_OFFSET+len);
char* out=belle_sip_malloc0(REPLACES_PREF_OFFSET+len+1);
strcpy(out,BELLE_SIP_REPLACES ": ");
escaped_to_ascii(escaped_replace,out+REPLACES_PREF_OFFSET,len);
/*now we can parse*/
......
......@@ -148,6 +148,10 @@ void belle_sip_uri_set_header(belle_sip_uri_t* uri,const char* name,const char*
belle_sip_parameters_set_parameter(uri->header_list,name,value);
}
void belle_sip_uri_remove_header(belle_sip_uri_t *uri, const char *name){
belle_sip_parameters_remove_parameter(uri->header_list,name);
}
const belle_sip_list_t* belle_sip_uri_get_header_names(const belle_sip_uri_t* uri) {
return belle_sip_parameters_get_parameter_names(uri->header_list);
}
......
......@@ -693,8 +693,9 @@ int belle_sip_get_char (const char*a,int n,char*out) {
*out=*a;
return 1;
}
return result;
return result;
}
char* belle_sip_to_unescaped_string(const char* buff) {
char output_buff[BELLE_SIP_MAX_TO_STRING_SIZE];
unsigned int i;
......@@ -706,6 +707,7 @@ char* belle_sip_to_unescaped_string(const char* buff) {
output_buff[out_buff_index]='\0';
return belle_sip_strdup(output_buff);
}
char* belle_sip_to_escaped_string(const char* buff) {
char output_buff[BELLE_SIP_MAX_TO_STRING_SIZE];
unsigned int i;
......
......@@ -135,7 +135,7 @@ static int tls_process_data(belle_sip_channel_t *obj,unsigned int revents){
}else{
char tmp[128];
error_strerror(err,tmp,sizeof(tmp));
belle_sip_error("Channel [%p]: SSL handlshake failed : %s",obj,tmp);
belle_sip_error("Channel [%p]: SSL handshake failed : %s",obj,tmp);
goto process_error;
}
......
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