Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensions to lost and http_client modules #2675

Merged
merged 10 commits into from Apr 9, 2021
Merged

extensions to lost and http_client modules #2675

merged 10 commits into from Apr 9, 2021

Conversation

wkampich
Copy link
Contributor

Pre-Submission Checklist

  • Commit message has the format required by CONTRIBUTING guide
  • Commits are split per component (core, individual modules, libs, utils, ...)
  • Each component has a single commit (if not, squash them into one commit)
  • No commits to README files for modules (changes must be done to docbook files
    in doc/ subfolder, the README file is autogenerated)

Type Of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)

Checklist:

Description

lost: new features, attributes and a new function to dereference location

  • features: LoST redirect, dynamic HELD url resolving (lost: dynamic HELD url resolving #2574), LoST NAPTR,
    POST request to dereference loation
  • attributes: reponse_time (-1:emergencyDispatch, 0:emergencyRouting, >0[ms]);
    post_request (POST method to dereference location lost: resolve geolocation url using POST #2641); recursion (1:yes/0:no);
    location_profile (PIDF/LO profile selection: 0:first/1:last/2:geo/3:civic);
    verbose 0/1 (detailed LoST response as log INFO);
    geoheader_type (filter schema: 0:any/1:cid/2:http/3:https);
    geoheader_order (0:first/1:last)
  • function: lost_held_dereference (specific function to dereference location
    using POST method); attributes are url (r;string), resp.-time (r;string),
    resp.-type (r;string), pidf (r/w;string) and error (r/w;string)
  • general: The extension of the module allows dynamic querying of LIS/HELD
    and LOST services via NAPTR lookup. In the case of LOST, a redirect
    response is evaluated. In case a lost_held_request (used to connect
    to a LIS via POST or GET) is passed with an empty string ("") for the
    connection parameter, then P-A-I or From header value hostnames are used
    for NAPTR lookup to get a corresponding service.

http_client: http_client_request (api) content-type header support

  • new api call including a content-type argument implemented as new
    function - required to resolve geolocation url using POST (lost: resolve geolocation url using POST #2641)
  • Note: not sure if this is the most elegant solution, but it helps
    to avoid backward compatibility issues

- new api call including a content-type argument implemented as new
  function - required to resolve geolocation url using POST (#2641)
- Note: not sure if this is the most elegant solution, but it helps
  to avoid backward compatibility issues
…tion

- features: LoST redirect, dynamic HELD url resolving (#2574), LoST NAPTR,
  POST request to dereference loation
- attributes: reponse_time (-1:emergencyDispatch, 0:emergencyRouting, >0[ms]);
  post_request (POST method to dereference location #2641); recursion (yes/no);
  location_profile (PIDF/LO profile selection: first/last/geo/civic);
  verbose (detailed LoST response as log INFO);
  geoheader_type (filter schema: any/cid/http/https);
  geoheader_order (first/last)
- function: lost_held_dereference (specific function to dereference location
  using POST method); attributes are url (r), resp.-time (r), resp.-type (r),
  pidf (r/w) and error (r/w)
- general: The extension of the module allows dynamic querying of LIS/HELD
  and LOST services via NAPTR lookup. In the case of LOST, a redirect
  response is evaluated. In case a lost_held_request (used to connect
  to a LIS via POST or GET) is passed with an empty string ("") for the
  connection parameter, then P-A-I or From header value hostnames are used
  for NAPTR lookup to get a corresponding service.
@henningw henningw changed the title Wkampich/dev extensions to lost and http_client modules Mar 15, 2021
@oej
Copy link
Member

oej commented Mar 16, 2021

Please don't create that much duplicated code. Make the old API function call the new as a wrapper with a null argument for content type header. That way we keep backwards compatibility and can add new functions.

Please also add new tests to the API test module.

@henningw
Copy link
Contributor

Please don't create that much duplicated code. Make the old API function call the new as a wrapper with a null argument for content type header. That way we keep backwards compatibility and can add new functions.

Please also add new tests to the API test module.

Hi Olle, i think you are referring to the http_client part of this pull request? Which one in particular, not sure if you know that you can also add comments to individual functions in the review mode.

@wkampich
Copy link
Contributor Author

Please don't create that much duplicated code. Make the old API function call the new as a wrapper with a null argument for content type header. That way we keep backwards compatibility and can add new functions.
Please also add new tests to the API test module.

Hi Olle, i think you are referring to the http_client part of this pull request? Which one in particular, not sure if you know that you can also add comments to individual functions in the review mode.

Hi Olle, Henning, I think I understood Olle's comment - I am about to implement the suggestion ...

@miconda
Copy link
Member

miconda commented Mar 31, 2021

Code duplication was removed for http client module. I guess this can be merged, if no other opinions against.

@oej
Copy link
Member

oej commented Mar 31, 2021

All good. Thanks for fixing!

Copy link
Contributor

@henningw henningw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. I just did a quick review, focus on the usual string handling and memory allocation topics.

src/modules/lost/utilities.c Show resolved Hide resolved
src/modules/lost/functions.c Show resolved Hide resolved
src/modules/lost/functions.c Show resolved Hide resolved
src/modules/lost/functions.c Show resolved Hide resolved
src/modules/lost/functions.c Show resolved Hide resolved
src/modules/lost/functions.c Outdated Show resolved Hide resolved
/* responseTime: emergencyRouting|emergencyDispatch */
if((ltime == 0) && (strlen(ptr) > 0)) {
if(strncasecmp(ptr, HELD_ED, strlen(HELD_ED)) == 0) {
heldreq = lost_held_post_request(&len, -1, rtype);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

src/modules/lost/functions.c Outdated Show resolved Hide resolved
@@ -0,0 +1,255 @@
/*
* lost module naptr functions
* thankfully taken over from the enum module
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several functions (parse_naptr_regexp, naptr_greater, naptr_sort..) copied from the enum module. We could consider moving them to the core. If we want to keep them, the copyright from the author should be present here as well.

#define RED_PROP_MSG (const char *)"message"

#define ERRORS_NODE (const char *)"errors"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section below defines several data structures. In order to prevent overlapping with existing data structures in modules and other libraries you probably want to add a prefix (e.g. lost_list_t, lost_data_t etc..).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@miconda
Copy link
Member

miconda commented Mar 31, 2021

Moving code to the core from existing module must ensure it can be relocated under BSD license.

Regarding the cloning of some str values, they seem to be required due to used functions that require zero-terminated strings, like ipstr that is passed to lost_get_nameinfo(), which is using libc inet_pton().

@henningw
Copy link
Contributor

Good point @miconda regarding the zero termination, then of course one needs to do a copy. The license topic is of course valid as well, the original author of the enum code is Juha.

@miconda
Copy link
Member

miconda commented Mar 31, 2021

@wkampich: lost_copy_string() is not a significant amount of code to replace with pkg_str_dup(), the signature is different as well -- overall, it could be good, but not a must. If you fix the leak, the PR should be ready to merge.

...
# HELD location dereference
if ($hdr(Geolocation)=~"^<http.*$") {
$var(url) = $(hdr(Geolocation){s.select,0,;});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can suggest use

$var(url) = @hf_value.geolocation[1].uri;

Copy link
Member

@miconda miconda Apr 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that @... were SER specific variables, still available, but not with an active maintainer. I would rather recommend using $... instead of @..., so better examples with $hdr(...) when gives what's needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sergey-safarov: you may use the following to dereference multiple header fields:

## response time in ms: 20000, or 'emergencyRouting' or 'emergencyDispatch' 
#!substdef "!MY_LOC_TIME!emergencyDispatch!g"
## location type: 'any', 'civic', 'geodetic', or 'civic geodetic'
#!substdef "!MY_LOC_TYPE!any!g"

...

if(is_present_hf("Geolocation")) {
        $var(count) = 0;
        while($var(count) < $hdrc(Geolocation)) {
                $var(geo) = $(hdr(Geolocation)[$var(count)]);
                if ($var(geo)=~"^<http.*$") {
                        $var(url) = $(var(geo){s.select,0,;});
                        xlog("L_INFO", "### HELD dereferencing location at: $(var(url){s.unbracket})\n");
                        $var(res) = lost_held_dereference("$(var(url){s.unbracket})", "MY_LOC_TIME", "MY_LOC_TYPE", "$var(pidf)", "$var(err)");
                        if ($var(res) == 200) {
                                xlog("L_INFO", "### HELD dereference request returned loc:\n$var(pidf)\n");
                        } else {
                                xlog("L_INFO", "###  held request failed with $var(err)\n");
                        }
                }
        }
}

@sergey-safarov
Copy link
Member

tested this config file

listen=udp:127.0.0.1:5060
loadmodule "xlog.so"
loadmodule "pv.so"
loadmodule "http_client.so"
loadmodule "lost.so"
loadmodule "textopsx.so"

modparam("lost", "exact_type", 1)

request_route {
  $var(geo_uri) = @hf_value.geolocation[1].uri;
  if ($(var(geo_uri){s.select,0,:}) =~ "http|https") {
    $var(res) = lost_held_dereference("$var(geo_uri)", "emergencyDispatch", "civic geodetic", "$var(pidf)", "$var(err)");
    xlog("L_INFO", "HELD location dereference: Result code $var(res)\n$var(pidf)");
  }
}

During URL dereferencing send this request

POST /webhook HTTP/1.1
Host: 217.12.247.98
User-Agent: kamailio (5.5.0-pre0 (x86_64/linux))
Content-Type: application/held+xml;charset=utf-8
Accept: application/pidf+xml,application/held+xml;q=0.5
Content-Length: 192

<?xml version="1.0"?>
<locationRequest xmlns="urn:ietf:params:xml:ns:geopriv:held" responseTime="emergencyDispatch"><locationType exact="false">civic geodetic</locationType></locationRequest>

According to config file modparam("lost", "exact_type", 1) but in real request send locationType exact="false"

<section id="lost.p.post_request">
<title><varname>post_request</varname> (int)</title>
<para>
Dereferencing the location can be done using either the HTTP GET or POST method. This parameter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This parameter" duplicated here.

@sergey-safarov
Copy link
Member

Tested config

listen=udp:127.0.0.1:5060
loadmodule "xlog.so"
loadmodule "pv.so"
loadmodule "http_client.so"
loadmodule "lost.so"
loadmodule "textopsx.so"

modparam("lost", "exact_type", 1)
modparam("lost", "post_request", 1)

request_route {
  $var(id) = "sip:alice@ca.nga911.com";
  $var(res) = lost_held_query("", "$var(id)" , "$var(pidf)", "$var(url)", "$var(err)");
  xlog("L_INFO", "HELD locationRequest: Result code $var(res)\nUrl: $var(url)\n$var(pidf)");
}

works as expected.

@sergey-safarov
Copy link
Member

sergey-safarov commented Apr 4, 2021

tested config

listen=udp:127.0.0.1:5060
loadmodule "xlog.so"
loadmodule "pv.so"
loadmodule "http_client.so"
loadmodule "lost.so"
loadmodule "textopsx.so"

modparam("lost", "exact_type", 1)
modparam("lost", "post_request", 1)
modparam("http_client", "httpcon", "lostsrv=>http://api.example.com/api/lost");


request_route {
  $var(res) = lost_query("lostsrv", "$var(uri)", "$var(name)", "$var(err)");
  xlog("L_INFO", "LOST findService: Result code $var(res)\nUri: $var(uri)\nName: $var(name)\n");
}

Test with one Geolocation header.
LOST request send with HTTP headers like

POST /api/lost HTTP/1.1
Host: api.example.com
User-Agent: kamailio (5.5.0-pre0 (x86_64/linux))
Accept: */*
Content-Type: application/lost+xml;charset=utf-8
Content-Length: 526

Here may be updated

Accept: application/lost+xml

Also in Kamailio console, I can see this error message when Geolocation passed as a value

 1(82) ERROR: <core> [core/parser/parse_body.c:510]: part_multipart_headers_cmp(): error code: "-9" error text: "We reached the end of the buffer".

Looks as here here "ERROR" level misslead.
My test SIPp script attached.

test_call.xml.gz

The script may be started using the command

sipp -m 1 -sf test_call.xml -p 2345 127.0.0.1

@sergey-safarov
Copy link
Member

sergey-safarov commented Apr 4, 2021

Use case when the call contains two Geolocation headers. Related geoheader_type param.

Example

Geolocation: <http://example.org/held-link>
Geolocation: <cid:7607331117@10.3.90.20>

Technically such a call contains Geolocacation by_value and does not require deference first Geolocation header by_reference.

From my point of view.
When used emergencyRouting routing need to prefer Geolocation by_value. This alow delivered call with minimal delays but maybe with low accuracy.
When used emergencyDispatch routing needs to prefer Geolocation by_reference. This alow send HELD request to a mobile carrier and get latest mobile device location.

Technically on Kamailio maybe used emergencyRouting and on PSAP used emergencyDispatch.

So as idea, in lost request check the number of present Geolocation headers, if present more than one header:

  1. and used emergencyRouting then try search by_value Geolocation;
  2. and used emergencyDispatch then try to search and dereference by_reference Geolocation.

@wkampich
Copy link
Contributor Author

wkampich commented Apr 4, 2021

Use case when the call contains two Geolocation headers. Related geoheader_type param.

Example

Geolocation: <http://example.org/held-link>
Geolocation: <cid:7607331117@10.3.90.20>

Technically such a call contains Geolocacation by_value and does not require deference first Geolocation header by_reference.

From my point of view.
When used emergencyRouting routing need to prefer Geolocation by_value. This alow delivered call with minimal delays but maybe with low accuracy.
When used emergencyDispatch routing needs to prefer Geolocation by_reference. This alow send HELD request to a mobile carrier and get latest mobile device location.

Technically on Kamailio maybe used emergencyRouting and on PSAP used emergencyDispatch.

So as idea, in lost request check the number of present Geolocation headers, if present more than one header:

1. and used `emergencyRouting` then try search `by_value` Geolocation;

2. and used `emergencyDispatch` then try to search and dereference `by_reference` Geolocation.

@sergey-safarov: basically that is what lost_query (lost_function) does. You may set the param geoheader_type to get only cid values (LocByValue) - in case there are several Geoloc header providing a cid you may either pick the first or the last one (geoheader_order).

@wkampich
Copy link
Contributor Author

wkampich commented Apr 4, 2021

tested this config file

listen=udp:127.0.0.1:5060
loadmodule "xlog.so"
loadmodule "pv.so"
loadmodule "http_client.so"
loadmodule "lost.so"
loadmodule "textopsx.so"

modparam("lost", "exact_type", 1)

request_route {
  $var(geo_uri) = @hf_value.geolocation[1].uri;
  if ($(var(geo_uri){s.select,0,:}) =~ "http|https") {
    $var(res) = lost_held_dereference("$var(geo_uri)", "emergencyDispatch", "civic geodetic", "$var(pidf)", "$var(err)");
    xlog("L_INFO", "HELD location dereference: Result code $var(res)\n$var(pidf)");
  }
}

During URL dereferencing send this request

POST /webhook HTTP/1.1
Host: 217.12.247.98
User-Agent: kamailio (5.5.0-pre0 (x86_64/linux))
Content-Type: application/held+xml;charset=utf-8
Accept: application/pidf+xml,application/held+xml;q=0.5
Content-Length: 192

<?xml version="1.0"?>
<locationRequest xmlns="urn:ietf:params:xml:ns:geopriv:held" responseTime="emergencyDispatch"><locationType exact="false">civic geodetic</locationType></locationRequest>

According to config file modparam("lost", "exact_type", 1) but in real request send locationType exact="false"

@sergey-safarov: the derefencing function only supports "false" (does not consider the module parameter ... I'll add this info to doc)

@wkampich
Copy link
Contributor Author

wkampich commented Apr 4, 2021

tested config

listen=udp:127.0.0.1:5060
loadmodule "xlog.so"
loadmodule "pv.so"
loadmodule "http_client.so"
loadmodule "lost.so"
loadmodule "textopsx.so"

modparam("lost", "exact_type", 1)
modparam("lost", "post_request", 1)
modparam("http_client", "httpcon", "lostsrv=>http://api.example.com/api/lost");


request_route {
  $var(res) = lost_query("lostsrv", "$var(uri)", "$var(name)", "$var(err)");
  xlog("L_INFO", "LOST findService: Result code $var(res)\nUri: $var(uri)\nName: $var(name)\n");
}

Test with one Geolocation header.
LOST request send with HTTP headers like

POST /api/lost HTTP/1.1
Host: api.example.com
User-Agent: kamailio (5.5.0-pre0 (x86_64/linux))
Accept: */*
Content-Type: application/lost+xml;charset=utf-8
Content-Length: 526

Here may be updated

Accept: application/lost+xml

@sergey-safarov: that looks like another http_client API fix as the API call does not support to set a specific header.

Also in Kamailio console, I can see this error message when Geolocation passed as a value

 1(82) ERROR: <core> [core/parser/parse_body.c:510]: part_multipart_headers_cmp(): error code: "-9" error text: "We reached the end of the buffer".

Looks as here here "ERROR" level misslead.
My test SIPp script attached.

test_call.xml.gz

The script may be started using the command

sipp -m 1 -sf test_call.xml -p 2345 127.0.0.1

@sergey-safarov: I see the same ERROR, but I suspect it is more of a WARNING

@miconda
Copy link
Member

miconda commented Apr 7, 2021

Regarding:

 1(82) ERROR: <core> [core/parser/parse_body.c:510]: part_multipart_headers_cmp(): error code: "-9" error text: "We reached the end of the buffer".

Maybe there are white spaces at the end of body that fit inside the Content-Length in the sipp scenario (try to print the $mb enclosed in some delimiters like [ ] to see it completely. If proves to be a problem, then an issue can be created for this case with a minimal config to reproduce and the sipp scenario for it.

Then related this PR, while not familiar with all its aspects, it seems some of the questions are actually about further improvements (e.g., handling two Geolocation headers). They do not have to be implemented as part of this PR, can be done separately. If no problems need to be solved on this PR, then it should be merged in order to get more chances to be tested before branching 5.5.

@wkampich
Copy link
Contributor Author

wkampich commented Apr 7, 2021

Regarding:

 1(82) ERROR: <core> [core/parser/parse_body.c:510]: part_multipart_headers_cmp(): error code: "-9" error text: "We reached the end of the buffer".

Maybe there are white spaces at the end of body that fit inside the Content-Length in the sipp scenario (try to print the $mb enclosed in some delimiters like [ ] to see it completely. If proves to be a problem, then an issue can be created for this case with a minimal config to reproduce and the sipp scenario for it.

Then related this PR, while not familiar with all its aspects, it seems some of the questions are actually about further improvements (e.g., handling two Geolocation headers). They do not have to be implemented as part of this PR, can be done separately. If no problems need to be solved on this PR, then it should be merged in order to get more chances to be tested before branching 5.5.

I did check parse_body.c and it seems that part_multipart_headers_cmp logs an ERROR in case it does not find a matching header, which is the case when comparing the first part (application/sdp) of the multipart body (see the example xml). So the error happens any time when comparing sup-parts that do not match. In the example provided the second part contains the cid and the function returns the body - I assume if it there is another sub-part before the pidf-lo, we should see another ERROR log. I would propose to log the following as INFO:
error = -9; error_msg = "unsuccessfully reached the end of the buffer";
If you agree I'll commit a fix as part of this PR, the result of a local test as below:

2021-04-07T11:45:17.418411261+02:00  9(16) INFO: {1 1 INVITE 1-1@172.16.16.45} lost [functions.c:844]: lost_function(): ### LOST urn    [urn:service:sos]
2021-04-07T11:45:17.418721057+02:00  9(16) INFO: {1 1 INVITE 1-1@172.16.16.45} lost [functions.c:936]: lost_function(): ### LOST loc    [<7607331117@10.3.90.20>]
2021-04-07T11:45:17.418780681+02:00  9(16) INFO: {1 1 INVITE 1-1@172.16.16.45} <core> [core/parser/parse_body.c:511]: part_multipart_headers_cmp(): result code: "-9" text: "unsuccessfully reached the end of the buffer".

@miconda
Copy link
Member

miconda commented Apr 7, 2021

If it is a valid multipart body, with a header that may not exist, then the log message should be DEBUG. You can make the patch if that's the case.

…om ERR to DBG in case a header does not exist
@wkampich
Copy link
Contributor Author

wkampich commented Apr 8, 2021

If there are no further comments, I will merge the pull request today (late afternoon). Just a note about "handling more than one Geolocation header":
The LoST module creates a list of Geolocation headers (be it multiple values in a header or single headers) and can decide which header type to use to retrieve the location for a LoST request based on certain module parameters. This is done via module functions and does not require any additional steps in kamailio.cfg. The new module function lost_held_dereference can be used when Kamailio is configured as PSAP endpoint, but was intended more for testing purposes. To get the correct Geolocation header value (URL) for this function some additional steps in kamailio.cfg are required.

@oej
Copy link
Member

oej commented Apr 8, 2021

Thank you for your contributions, Wolfgang!

@henningw
Copy link
Contributor

henningw commented Apr 8, 2021

@wkampich Thanks for the update. I think the comments regarding the missing original copyright notice in the natptr.[c,h] files and also the response.h naming are not resolved yet. The copyright notice should be added, I can also do it later if you prefer this.
Regarding the naming comment, I just wanted to let you know that there might be a risk for overlapping data structures, as the s_info_t, s_data_t, cat_t etc.. are pretty generic and might be also defined in another library or module. The typedefs like LIST, INFO, DATA etc.. are in C also globally visible. For this reasons modules usually use the module prefix as part of the typedef, e.g.:

  • typedef enum rms_action_type
  • typedef struct _sr_lua_env
  • typedef struct ipsec_pcscf_api

Several of this typedefs seems to be also not used in your code. But if you think its no big deal for your module, fine.

@sergey-safarov
Copy link
Member

sergey-safarov commented Apr 8, 2021

Hello, @wkampich
Let me review the change about ERROR waring.
I want to try to understand in detail why the error generated. Maybe I can suggest another approach.
Please give today and tomorrow.

@wkampich
Copy link
Contributor Author

wkampich commented Apr 8, 2021

Hello, @wkampich
Let me review the change about ERROR waring.
I want to try to understand in detail why the error generated. Maybe I can suggest another approach.
Please give today and tomorrow.

@sergey-safarov: yes, ok for me - just a hint: the problem is not in the multipart header parsing but in the function that searches for specific header values in several body parts - parsing (successfully) happens beforehand. Just add the following to your sipp example (xml) and you get the error (or debug message) twice:

...
a=maxptime:20

--35129
Content-Type: plain/text

HELLO

--35129
Content-Type: application/pidf+xml
Content-Id: <7607331117@10.3.90.20>
...

@wkampich
Copy link
Contributor Author

wkampich commented Apr 8, 2021

@wkampich Thanks for the update. I think the comments regarding the missing original copyright notice in the natptr.[c,h] files and also the response.h naming are not resolved yet. The copyright notice should be added, I can also do it later if you prefer this.
Regarding the naming comment, I just wanted to let you know that there might be a risk for overlapping data structures, as the s_info_t, s_data_t, cat_t etc.. are pretty generic and might be also defined in another library or module. The typedefs like LIST, INFO, DATA etc.. are in C also globally visible. For this reasons modules usually use the module prefix as part of the typedef, e.g.:

* typedef enum rms_action_type

* typedef struct _sr_lua_env

* typedef struct ipsec_pcscf_api

Several of this typedefs seems to be also not used in your code. But if you think its no big deal for your module, fine.

@henningw: Thanks for the reminder - I'll include your naming and copyright suggestions in a new commit.

@miconda
Copy link
Member

miconda commented Apr 8, 2021

@wkampich, @sergey-safarov: the error message from part_multipart_headers_cmp() does not seem related to the code added in this PR, so, even if it is an issue, it is not required to be fixed by this PR. If proves to be a bug, an issue can be opened, or even better, a new PR can be made to fix it.

@sergey-safarov
Copy link
Member

yes, have checked "ERROR" generation.
This happens because part_multipart_headers_cmp() try search content by "Content-Id".
The first content element (SDP in the example) does not have "Content-Id".
Function reaches the end of the content element and generates the error.

Then part_multipart_headers_cmp() try search "Content-Id" in second element and fount it and then returns result.

Looks as current part_multipart_headers_cmp() implementation handles case when content element do not has "Content-Id" header as error.
Looks as provided fix correct for this case.

@wkampich
Copy link
Contributor Author

wkampich commented Apr 9, 2021

yes, have checked "ERROR" generation.
This happens because part_multipart_headers_cmp() try search content by "Content-Id".
The first content element (SDP in the example) does not have "Content-Id".
Function reaches the end of the content element and generates the error.

Then part_multipart_headers_cmp() try search "Content-Id" in second element and fount it and then returns result.

Looks as current part_multipart_headers_cmp() implementation handles case when content element do not has "Content-Id" header as error.
Looks as provided fix correct for this case.

Ok, thanks for testing. @miconda How shall I proceed? Merge the PR with or without the patch (commit 106b8a6)?

@miconda
Copy link
Member

miconda commented Apr 9, 2021

Merge it with the patch, it is only changing the printing of the log message in that case and should be legit that the header is missing, not being mandatory.

@wkampich wkampich merged commit 9a8ff2b into master Apr 9, 2021
@wkampich wkampich deleted the wkampich/dev branch April 9, 2021 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants