kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
July 2020
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
26 participants
390 discussions
Start a n
N
ew thread
git:5.4:ef819eb3: sipdump: if drop executed in event route, skip writing to file
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.4 Commit: ef819eb33cdaa8e143148915296c60e03179e819 URL:
https://github.com/kamailio/kamailio/commit/ef819eb33cdaa8e143148915296c60e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2020-07-16T17:31:06+02:00 sipdump: if drop executed in event route, skip writing to file (cherry picked from commit 1672a9b356cc864310d0ade139d7c8bb6c4c4b11) --- Modified: src/modules/sipdump/sipdump_mod.c --- Diff:
https://github.com/kamailio/kamailio/commit/ef819eb33cdaa8e143148915296c60e…
Patch:
https://github.com/kamailio/kamailio/commit/ef819eb33cdaa8e143148915296c60e…
--- diff --git a/src/modules/sipdump/sipdump_mod.c b/src/modules/sipdump/sipdump_mod.c index a9868462e7..41550e78f2 100644 --- a/src/modules/sipdump/sipdump_mod.c +++ b/src/modules/sipdump/sipdump_mod.c @@ -323,7 +323,7 @@ static sipdump_info_t* sipdump_event_info = NULL; /** * */ -void sipdump_event_route(sipdump_info_t* sdi) +int sipdump_event_route(sipdump_info_t* sdi) { int backup_rt; run_act_ctx_t ctx; @@ -352,6 +352,10 @@ void sipdump_event_route(sipdump_info_t* sdi) } sipdump_event_info = NULL; set_route_type(backup_rt); + if(ctx.run_flags & DROP_R_F) { + return DROP_R_F; + } + return RETURN_R_F; } /** @@ -396,7 +400,10 @@ int sipdump_msg_received(sr_event_param_t *evp) get_valid_proto_string(evp->rcv->proto, 0, 0, &sdi.proto); if(sipdump_mode & SIPDUMP_MODE_EVROUTE) { - sipdump_event_route(&sdi); + if(sipdump_event_route(&sdi) == DROP_R_F) { + /* drop() used in event_route - all done */ + return 0; + } } if(!(sipdump_mode & SIPDUMP_MODE_WFILE)) {
4 years, 5 months
1
0
0
0
git:5.2:f2a987a8: db_redis: fix unfiltered table deletion
by Richard Fuchs
Module: kamailio Branch: 5.2 Commit: f2a987a8c4aacb1538f44b890f922d495ef103f6 URL:
https://github.com/kamailio/kamailio/commit/f2a987a8c4aacb1538f44b890f922d4…
Author: Richard Fuchs <rfuchs(a)sipwise.com> Committer: Richard Fuchs <rfuchs(a)sipwise.com> Date: 2020-07-16T11:26:39-04:00 db_redis: fix unfiltered table deletion --- Modified: src/modules/db_redis/redis_dbase.c --- Diff:
https://github.com/kamailio/kamailio/commit/f2a987a8c4aacb1538f44b890f922d4…
Patch:
https://github.com/kamailio/kamailio/commit/f2a987a8c4aacb1538f44b890f922d4…
--- diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c index acddbdfd5b..82054a9b51 100644 --- a/src/modules/db_redis/redis_dbase.c +++ b/src/modules/db_redis/redis_dbase.c @@ -1329,12 +1329,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con if (tmp) db_redis_key_free(&tmp); - // skip if delete all rows - if (!*manual_keys_count) { - db_redis_key_free (&query_v); - goto skipkeys; - } - if (db_redis_key_prepend_string(&query_v, "HMGET", 5) != 0) { LM_ERR("Failed to set hmget command to pre-delete query\n"); goto error; @@ -1426,7 +1420,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con db_vals = NULL; db_redis_free_reply(&reply); - skipkeys: if (db_redis_key_add_string(&query_v, "DEL", 3) != 0) { LM_ERR("Failed to add del command to delete query\n"); goto error; @@ -2064,6 +2057,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k, } else { LM_DBG("no columns given to build query keys, falling back to full table scan\n"); keys_count = 0; + do_table_scan = 1; } if (db_redis_perform_delete(_h, con, _k, _v, query_ops, _n,
4 years, 5 months
1
0
0
0
git:5.3:3bc06fdb: db_redis: fix unfiltered table deletion
by Richard Fuchs
Module: kamailio Branch: 5.3 Commit: 3bc06fdb87d86d3269f7774f52b8040be1c1f76c URL:
https://github.com/kamailio/kamailio/commit/3bc06fdb87d86d3269f7774f52b8040…
Author: Richard Fuchs <rfuchs(a)sipwise.com> Committer: Richard Fuchs <rfuchs(a)sipwise.com> Date: 2020-07-16T11:26:20-04:00 db_redis: fix unfiltered table deletion --- Modified: src/modules/db_redis/redis_dbase.c --- Diff:
https://github.com/kamailio/kamailio/commit/3bc06fdb87d86d3269f7774f52b8040…
Patch:
https://github.com/kamailio/kamailio/commit/3bc06fdb87d86d3269f7774f52b8040…
--- diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c index 97fd19ee01..8965f7d65a 100644 --- a/src/modules/db_redis/redis_dbase.c +++ b/src/modules/db_redis/redis_dbase.c @@ -1325,12 +1325,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con if (tmp) db_redis_key_free(&tmp); - // skip if delete all rows - if (!*manual_keys_count) { - db_redis_key_free (&query_v); - goto skipkeys; - } - if (db_redis_key_prepend_string(&query_v, "HMGET", 5) != 0) { LM_ERR("Failed to set hmget command to pre-delete query\n"); goto error; @@ -1422,7 +1416,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con db_vals = NULL; db_redis_free_reply(&reply); - skipkeys: if (db_redis_key_add_string(&query_v, "DEL", 3) != 0) { LM_ERR("Failed to add del command to delete query\n"); goto error; @@ -2060,6 +2053,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k, } else { LM_DBG("no columns given to build query keys, falling back to full table scan\n"); keys_count = 0; + do_table_scan = 1; } if (db_redis_perform_delete(_h, con, _k, _v, query_ops, _n,
4 years, 5 months
1
0
0
0
git:5.4:a472aaae: db_redis: fix unfiltered table deletion
by Richard Fuchs
Module: kamailio Branch: 5.4 Commit: a472aaae69f7bd483c232cc5c9f59078bad1e938 URL:
https://github.com/kamailio/kamailio/commit/a472aaae69f7bd483c232cc5c9f5907…
Author: Richard Fuchs <rfuchs(a)sipwise.com> Committer: Richard Fuchs <rfuchs(a)sipwise.com> Date: 2020-07-16T11:26:05-04:00 db_redis: fix unfiltered table deletion --- Modified: src/modules/db_redis/redis_dbase.c --- Diff:
https://github.com/kamailio/kamailio/commit/a472aaae69f7bd483c232cc5c9f5907…
Patch:
https://github.com/kamailio/kamailio/commit/a472aaae69f7bd483c232cc5c9f5907…
--- diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c index 9c81385a39..c9a25adf36 100644 --- a/src/modules/db_redis/redis_dbase.c +++ b/src/modules/db_redis/redis_dbase.c @@ -1698,12 +1698,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con if (tmp) db_redis_key_free(&tmp); - // skip if delete all rows - if (!*manual_keys_count) { - db_redis_key_free (&query_v); - goto skipkeys; - } - if (db_redis_key_prepend_string(&query_v, "HMGET", 5) != 0) { LM_ERR("Failed to set hmget command to pre-delete query\n"); goto error; @@ -1795,7 +1789,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con db_vals = NULL; db_redis_free_reply(&reply); - skipkeys: if (db_redis_key_add_string(&query_v, "DEL", 3) != 0) { LM_ERR("Failed to add del command to delete query\n"); goto error; @@ -2655,6 +2648,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k, } else { LM_DBG("no columns given to build query keys, falling back to full table scan\n"); keys_count = 0; + do_table_scan = 1; } if (db_redis_perform_delete(_h, con, _k, _v, query_ops, _n,
4 years, 5 months
1
0
0
0
git:master:8e9b8fc4: db_redis: fix unfiltered table deletion
by Richard Fuchs
Module: kamailio Branch: master Commit: 8e9b8fc4f384eac90c94beffdc5c87a04506d2b4 URL:
https://github.com/kamailio/kamailio/commit/8e9b8fc4f384eac90c94beffdc5c87a…
Author: Richard Fuchs <rfuchs(a)sipwise.com> Committer: Richard Fuchs <rfuchs(a)sipwise.com> Date: 2020-07-16T11:25:04-04:00 db_redis: fix unfiltered table deletion --- Modified: src/modules/db_redis/redis_dbase.c --- Diff:
https://github.com/kamailio/kamailio/commit/8e9b8fc4f384eac90c94beffdc5c87a…
Patch:
https://github.com/kamailio/kamailio/commit/8e9b8fc4f384eac90c94beffdc5c87a…
--- diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c index 9c81385a39..c9a25adf36 100644 --- a/src/modules/db_redis/redis_dbase.c +++ b/src/modules/db_redis/redis_dbase.c @@ -1698,12 +1698,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con if (tmp) db_redis_key_free(&tmp); - // skip if delete all rows - if (!*manual_keys_count) { - db_redis_key_free (&query_v); - goto skipkeys; - } - if (db_redis_key_prepend_string(&query_v, "HMGET", 5) != 0) { LM_ERR("Failed to set hmget command to pre-delete query\n"); goto error; @@ -1795,7 +1789,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con db_vals = NULL; db_redis_free_reply(&reply); - skipkeys: if (db_redis_key_add_string(&query_v, "DEL", 3) != 0) { LM_ERR("Failed to add del command to delete query\n"); goto error; @@ -2655,6 +2648,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k, } else { LM_DBG("no columns given to build query keys, falling back to full table scan\n"); keys_count = 0; + do_table_scan = 1; } if (db_redis_perform_delete(_h, con, _k, _v, query_ops, _n,
4 years, 5 months
1
0
0
0
git:master:ded4fa4f: core: use static map for header name and type for parsing
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: ded4fa4ff22f10fd3ad996741190cc5aa2fbcaff URL:
https://github.com/kamailio/kamailio/commit/ded4fa4ff22f10fd3ad996741190cc5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2020-07-16T13:27:00+02:00 core: use static map for header name and type for parsing - simplified header name parsing by using indexed (at startup) mapping of header name and type in a static array --- Modified: src/core/parser/hf.h Modified: src/core/parser/parse_hname2.c Modified: src/core/parser/parse_hname2.h Modified: src/main.c --- Diff:
https://github.com/kamailio/kamailio/commit/ded4fa4ff22f10fd3ad996741190cc5…
Patch:
https://github.com/kamailio/kamailio/commit/ded4fa4ff22f10fd3ad996741190cc5…
4 years, 5 months
2
1
0
0
git:master:732eba4e: core: parser - use str cmp function directly for hdr name parsing
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 732eba4e8aeafe535d48c370d104406f3315f749 URL:
https://github.com/kamailio/kamailio/commit/732eba4e8aeafe535d48c370d104406…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2020-07-16T14:15:01+02:00 core: parser - use str cmp function directly for hdr name parsing --- Modified: src/core/parser/parse_hname2.c --- Diff:
https://github.com/kamailio/kamailio/commit/732eba4e8aeafe535d48c370d104406…
Patch:
https://github.com/kamailio/kamailio/commit/732eba4e8aeafe535d48c370d104406…
--- diff --git a/src/core/parser/parse_hname2.c b/src/core/parser/parse_hname2.c index 5f610e4c81..84f8c7782f 100644 --- a/src/core/parser/parse_hname2.c +++ b/src/core/parser/parse_hname2.c @@ -29,7 +29,6 @@ #include <stdio.h> #include <ctype.h> -#include "../strutils.h" #include "../dprint.h" #include "parse_hname2.h" @@ -247,7 +246,9 @@ char *parse_sip_header_name(char* const begin, const char* const end, if(_ksr_hdr_map_idx[hdr->name.s[0]].idxs >= 0) { for(i = _ksr_hdr_map_idx[hdr->name.s[0]].idxs; i <= _ksr_hdr_map_idx[hdr->name.s[0]].idxe; i++) { - if(cmp_hdrname_str(&hdr->name, &_ksr_hdr_map[i].hname) == 0) { + if(hdr->name.len == _ksr_hdr_map[i].hname.len + && strncasecmp(hdr->name.s, _ksr_hdr_map[i].hname.s, + hdr->name.len) == 0) { hdr->type = _ksr_hdr_map[i].htype; } }
4 years, 5 months
1
0
0
0
git:master:570db71b: sipdump: insert P-KSR-SIPDump header if SIPDUMP_MODE_WPCAPEX flag is set
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 570db71b3d9fe3125d1a3da9c3bcc983c812d92d URL:
https://github.com/kamailio/kamailio/commit/570db71b3d9fe3125d1a3da9c3bcc98…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2020-07-16T14:00:09+02:00 sipdump: insert P-KSR-SIPDump header if SIPDUMP_MODE_WPCAPEX flag is set - inserted header contains sip message specific meta data (transport, pid, proc no) --- Modified: src/modules/sipdump/sipdump_pcap.c --- Diff:
https://github.com/kamailio/kamailio/commit/570db71b3d9fe3125d1a3da9c3bcc98…
Patch:
https://github.com/kamailio/kamailio/commit/570db71b3d9fe3125d1a3da9c3bcc98…
--- diff --git a/src/modules/sipdump/sipdump_pcap.c b/src/modules/sipdump/sipdump_pcap.c index a897d302aa..1a559cea59 100644 --- a/src/modules/sipdump/sipdump_pcap.c +++ b/src/modules/sipdump/sipdump_pcap.c @@ -28,6 +28,8 @@ #include "sipdump_write.h" +extern int sipdump_mode; + /* structures related to PCAP headers imported from open source Asterisk project * fuction to write to PCAP file adapted for internal structures * source: res_pjsip_logger.c - License GPLv2 - Copyright (C) Digium, Inc.*/ @@ -113,8 +115,15 @@ void sipdump_init_pcap(FILE *fs) } } +static char *_sipdump_pcap_data_buf = NULL; + void sipdump_write_pcap(FILE *fs, sipdump_data_t *spd) { + str data = str_init(""); + str mval = str_init(""); + str sproto = str_init("none"); + char *p = NULL; + struct pcap_record_header v_pcap_record_header = { .ts_sec = spd->tv.tv_sec, .ts_usec = spd->tv.tv_usec, @@ -139,10 +148,40 @@ void sipdump_write_pcap(FILE *fs, sipdump_data_t *spd) return; } + data = spd->data; + if((sipdump_mode & SIPDUMP_MODE_WPCAPEX) && (spd->data.len < BUF_SIZE - 256)) { + if(_sipdump_pcap_data_buf == NULL) { + _sipdump_pcap_data_buf = (char*)malloc(BUF_SIZE); + } + if(_sipdump_pcap_data_buf != NULL) { + data.s = _sipdump_pcap_data_buf; + data.len = 0; + mval.s = q_memchr(spd->data.s, '\n', spd->data.len); + p = data.s; + if(mval.s != NULL) { + data.len = mval.s - spd->data.s + 1; + memcpy(p, spd->data.s, data.len); + p += data.len; + get_valid_proto_string(spd->protoid, 0, 0, &sproto); + mval.len = snprintf(p, BUF_SIZE - (data.len + 1), + "P-KSR-SIPDump: %.*s pid=%d pno=%d\r\n", + sproto.len, sproto.s, spd->pid, spd->procno); + if(mval.len < 0 || mval.len >= BUF_SIZE - (data.len + 1)) { + data = spd->data; + } else { + data.len += mval.len; + p += mval.len; + mval.s += 1; + memcpy(p, mval.s, spd->data.s + spd->data.len - mval.s); + data.len += spd->data.s + spd->data.len - mval.s; + } + } + } + } /* always store UDP */ v_pcap_udp_header.src = ntohs(spd->src_port); v_pcap_udp_header.dst = ntohs(spd->dst_port); - v_pcap_udp_header.length = ntohs(sizeof(struct pcap_udp_header) + spd->data.len); + v_pcap_udp_header.length = ntohs(sizeof(struct pcap_udp_header) + data.len); /* IP header */ if (spd->afid == AF_INET6) { @@ -161,7 +200,7 @@ void sipdump_write_pcap(FILE *fs, sipdump_data_t *spd) } memcpy(&v_pcap_ipv6_header.ip6_dst, &ip6addr, sizeof(struct in6_addr)); v_pcap_ipv6_header.ip6_ctlun.ip6_un1.ip6_un1_plen = htons(sizeof(struct pcap_udp_header) - + spd->data.len); + + data.len); v_pcap_ipv6_header.ip6_ctlun.ip6_un1.ip6_un1_nxt = IPPROTO_UDP; } else { LM_DBG("ipv4 = %s -> %s\n", spd->src_ip.s, spd->dst_ip.s); @@ -179,13 +218,13 @@ void sipdump_write_pcap(FILE *fs, sipdump_data_t *spd) } memcpy(&v_pcap_ipv4_header.ip_dst, &ip4addr, sizeof(uint32_t)); v_pcap_ipv4_header.ip_len = htons(sizeof(struct pcap_udp_header) - + sizeof(struct pcap_ipv4_header) + spd->data.len); + + sizeof(struct pcap_ipv4_header) + data.len); v_pcap_ipv4_header.ip_protocol = IPPROTO_UDP; /* UDP */ } /* add up all the sizes for this record */ v_pcap_record_header.orig_len = sizeof(struct pcap_ethernet_header) + pcap_ip_header_len - + sizeof(struct pcap_udp_header) + spd->data.len; + + sizeof(struct pcap_udp_header) + data.len; v_pcap_record_header.incl_len = v_pcap_record_header.orig_len; if (fwrite(&v_pcap_record_header, sizeof(struct pcap_record_header), 1, fs) != 1) { @@ -200,7 +239,7 @@ void sipdump_write_pcap(FILE *fs, sipdump_data_t *spd) if (fwrite(&v_pcap_udp_header, sizeof(struct pcap_udp_header), 1, fs) != 1) { LM_ERR("writing UDP header to pcap failed: %s\n", strerror(errno)); } - if (fwrite(spd->data.s, spd->data.len, 1, fs) != 1) { + if (fwrite(data.s, data.len, 1, fs) != 1) { LM_ERR("writing UDP payload to pcap failed: %s\n", strerror(errno)); } fflush(fs);
4 years, 5 months
1
0
0
0
git:master:6d76b79b: core: strutils - trim trailing spaces when comparing hdr names
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 6d76b79b81bf448fa1f34753c1d000dc6c1870e0 URL:
https://github.com/kamailio/kamailio/commit/6d76b79b81bf448fa1f34753c1d000d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2020-07-16T09:16:40+02:00 core: strutils - trim trailing spaces when comparing hdr names --- Modified: src/core/strutils.c Modified: src/core/strutils.h --- Diff:
https://github.com/kamailio/kamailio/commit/6d76b79b81bf448fa1f34753c1d000d…
Patch:
https://github.com/kamailio/kamailio/commit/6d76b79b81bf448fa1f34753c1d000d…
--- diff --git a/src/core/strutils.c b/src/core/strutils.c index e106dfe713..75d5b1ec10 100644 --- a/src/core/strutils.c +++ b/src/core/strutils.c @@ -28,6 +28,7 @@ #include "dprint.h" #include "ut.h" +#include "trim.h" #include "strutils.h" /*! \brief @@ -453,16 +454,24 @@ int cmpi_str(str *s1, str *s2) int cmp_hdrname_str(str *s1, str *s2) { + str n1, n2; + n1 = *s1; + n2 = *s2; + trim_trailing(&n1); + trim_trailing(&n2); /* todo: parse hdr name and compare with short/long alternative */ - return cmpi_str(s1, s2); + return cmpi_str(&n1, &n2); } -int cmp_hdrname_strzn(str *s1, char *s2, size_t n) +int cmp_hdrname_strzn(str *s1, char *s2, size_t len) { - str s; - s.s = s2; - s.len = n; - return cmpi_str(s1, &s); + str n1, n2; + n1 = *s1; + n2.s = s2; + n2.len = len; + trim_trailing(&n1); + trim_trailing(&n2); + return cmpi_str(&n1, &n2); } int cmp_str_params(str *s1, str *s2) diff --git a/src/core/strutils.h b/src/core/strutils.h index 4747f898fd..fbaef7ee7a 100644 --- a/src/core/strutils.h +++ b/src/core/strutils.h @@ -43,7 +43,7 @@ int cmp_str(str *s1, str *s2); int cmpi_str(str *s1, str *s2); int cmp_hdrname_str(str *s1, str *s2); -int cmp_hdrname_strzn(str *s1, char *s2, size_t n); +int cmp_hdrname_strzn(str *s1, char *s2, size_t len); int cmp_uri_str(str *s1, str *s2); int cmp_uri_light_str(str *s1, str *s2); int cmp_aor_str(str *s1, str *s2);
4 years, 5 months
1
0
0
0
git:master:7135feee: core: parser - trim trailing whitespaces in header name
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 7135feee9cdc93efa8c0c3e4abf24a9335ce42de URL:
https://github.com/kamailio/kamailio/commit/7135feee9cdc93efa8c0c3e4abf24a9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2020-07-16T09:09:48+02:00 core: parser - trim trailing whitespaces in header name --- Modified: src/core/parser/parse_hname2.c --- Diff:
https://github.com/kamailio/kamailio/commit/7135feee9cdc93efa8c0c3e4abf24a9…
Patch:
https://github.com/kamailio/kamailio/commit/7135feee9cdc93efa8c0c3e4abf24a9…
--- diff --git a/src/core/parser/parse_hname2.c b/src/core/parser/parse_hname2.c index 9db38afbca..58c833e55f 100644 --- a/src/core/parser/parse_hname2.c +++ b/src/core/parser/parse_hname2.c @@ -27,9 +27,10 @@ */ #include "../comp_defs.h" +#include "../trim.h" +#include "../ut.h" /* q_memchr */ #include "parse_hname2.h" #include "keys.h" -#include "../ut.h" /* q_memchr */ #define LOWER_BYTE(b) ((b) | 0x20) #define LOWER_DWORD(d) ((d) | 0x20202020) @@ -238,6 +239,7 @@ char* parse_hname2(char* const begin, const char* const end, struct hdr_field* c goto other; } else { hdr->name.len = p - hdr->name.s; + trim_trailing(&hdr->name); return (p + 1); } @@ -252,6 +254,7 @@ char* parse_hname2(char* const begin, const char* const end, struct hdr_field* c } else { hdr->type = HDR_OTHER_T; hdr->name.len = p - hdr->name.s; + trim_trailing(&hdr->name); /*hdr_update_type(hdr);*/ return (p + 1); }
4 years, 5 months
1
0
0
0
← Newer
1
...
18
19
20
21
22
23
24
...
39
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Results per page:
10
25
50
100
200