Commit 11f4c9c6 authored by jehan's avatar jehan

Merge branch 'feature/maddr-for-http'

parents 85b0d43b 9a2b9a08
Pipeline #199 failed with stage
in 0 seconds
belle-sip (Unreleased): Jully 2018
* rfc3262 (100rel) support
* add maddr support for http uri
belle_sip-1.6.2 -- July 21th, 2017
* Build fix for Windows
......
......@@ -27,7 +27,7 @@ from subprocess import call
def main():
print("Deleting old sources...")
ret = call("rm ../grammars/belle_sdp*.c ../grammars/belle_sdp*.h ../grammars/belle_sip_message*.c ../grammars/belle_sip_message*.h", shell=True)
ret = call("rm -f ../grammars/belle_sdp*.c ../grammars/belle_sdp*.h ../grammars/belle_sip_message*.c ../grammars/belle_sip_message*.h", shell=True)
if ret != 0:
print("An error occured while deleting old sources")
return -1
......
......@@ -26,7 +26,7 @@
struct _belle_generic_uri {
belle_sip_object_t object;
belle_sip_parameters_t parameters; /*just for parsing maddr*/
char* scheme;
char* user;
char* user_password;
......@@ -134,7 +134,7 @@ GET_SET_STRING(belle_generic_uri,path);
GET_SET_STRING(belle_generic_uri,query);
GET_SET_STRING(belle_generic_uri,opaque_part);
GET_SET_INT(belle_generic_uri,port,int)
BELLE_NEW(belle_generic_uri,belle_sip_object)
BELLE_NEW(belle_generic_uri,belle_sip_parameters)
BELLE_PARSE(belle_sip_messageParser,belle_,generic_uri)
......
......@@ -2,7 +2,7 @@
* This C source file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sdp.g
* - On : 2018-07-11 16:46:26
* - On : 2018-07-25 17:10:06
* - for the lexer : belle_sdpLexerLexer
*
* Editing it, at least manually, is not wise.
......
......@@ -2,7 +2,7 @@
* This C header file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sdp.g
* - On : 2018-07-11 16:46:26
* - On : 2018-07-25 17:10:06
* - for the lexer : belle_sdpLexerLexer
*
* Editing it, at least manually, is not wise.
......
......@@ -2,7 +2,7 @@
* This C source file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sdp.g
* - On : 2018-07-11 16:46:24
* - On : 2018-07-25 17:10:05
* - for the parser : belle_sdpParserParser
*
* Editing it, at least manually, is not wise.
......
......@@ -2,7 +2,7 @@
* This C header file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sdp.g
* - On : 2018-07-11 16:46:24
* - On : 2018-07-25 17:10:05
* - for the parser : belle_sdpParserParser
*
* Editing it, at least manually, is not wise.
......
......@@ -405,7 +405,10 @@ authority_password : ( unreserved | escaped | AND | EQUAL | PLUS | DOLL
authority_hostport[belle_generic_uri_t* uri]
scope { belle_generic_uri_t* current; }
@init {$authority_hostport::current=uri;}
: host ( COLON port {belle_generic_uri_set_port($authority_hostport::current,$port.ret);})? {belle_generic_uri_set_host($authority_hostport::current,$host.ret);};
: host
(( COLON port {belle_generic_uri_set_port($authority_hostport::current,$port.ret);})?
(semi generic_param [BELLE_SIP_PARAMETERS($authority_hostport::current)])*)
{belle_generic_uri_set_host($authority_hostport::current,$host.ret);};
//****************http end**********************/
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* This C header file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sip_message.g
* - On : 2018-07-11 16:47:03
* - On : 2018-07-25 17:10:14
* - for the lexer : belle_sip_messageLexerLexer
*
* Editing it, at least manually, is not wise.
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* This C header file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sip_message.g
* - On : 2018-07-11 16:46:55
* - On : 2018-07-25 17:10:13
* - for the parser : belle_sip_messageParserParser
*
* Editing it, at least manually, is not wise.
......
......@@ -58,8 +58,14 @@ belle_sip_hop_t* belle_sip_hop_new_from_generic_uri(const belle_generic_uri_t *u
const char *scheme=belle_generic_uri_get_scheme(uri);
int port=belle_generic_uri_get_port(uri);
int well_known_port=0;
host=belle_generic_uri_get_host(uri);
const char *cname=NULL;
host = belle_sip_parameters_get_parameter(BELLE_SIP_PARAMETERS(uri),"maddr");
if (!host)
host = belle_generic_uri_get_host(uri);
else
cname=belle_generic_uri_get_host(uri);
if (strcasecmp(scheme,"http")==0) {
transport="TCP";
well_known_port=80;
......@@ -69,7 +75,7 @@ belle_sip_hop_t* belle_sip_hop_new_from_generic_uri(const belle_generic_uri_t *u
}
return belle_sip_hop_new(transport,
host,
cname,
host,
port > 0 ? port : well_known_port);
}
......
......@@ -51,7 +51,7 @@ static void process_response(void *data, const belle_http_response_event_t *even
counters->two_hundred++;
else if (code>=300 && code <400)
counters->three_hundred++;
else if (code>=300 && code <400)
else if (code>=400 && code <500)
counters->four_hundred++;
BC_ASSERT_PTR_NOT_NULL(body);
}
......@@ -167,6 +167,15 @@ static void one_https_get(void){
}
}
static void one_https_get_with_maddr(void){
http_counters_t counters={0};
if (one_get("https://blabla.linphone.org;maddr=94.23.19.176/",&counters,&counters.response_count) == 0) {
BC_ASSERT_EQUAL(counters.response_count, 1, int, "%d");
BC_ASSERT_EQUAL(counters.io_error_count, 0, int, "%d");
BC_ASSERT_EQUAL(counters.four_hundred,1,int,"%d");
}
}
static void https_get_long_body(void){
http_counters_t counters={0};
if (one_get("https://smtp.linphone.org/linphone.html",&counters, &counters.response_count) == 0) {
......@@ -351,6 +360,7 @@ test_t http_tests[] = {
TEST_NO_TAG("One http GET", one_http_get),
TEST_NO_TAG("http GET of empty body", http_get_empty_body),
TEST_NO_TAG("One https GET", one_https_get),
TEST_NO_TAG("One https GET with maddr", one_https_get_with_maddr),
TEST_NO_TAG("One https GET with http proxy", one_https_get_with_proxy),
TEST_NO_TAG("http request with io error", http_get_io_error),
TEST_NO_TAG("https GET with long body", https_get_long_body),
......
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