Hi Robert,
reading your quotation from SIP RFC I would say that with parameters it is wrong
to have a generic function returning a parameter with hardcoded
sensitivity/insensitivity inside. Shouldn't this be given by a parameter of the
get_header_param function?
Vaclav
On Út, lis 05, 2013 at 05:50:58 +0100, Szokovacs Robert wrote:
> On 11/05/2013 01:36 PM, Szokovacs Robert wrote:
> >Hi,
> >
> >according to the RFC3261:
> >"When comparing header fields, field names are always case-
> >insensitive. Unless otherwise stated in the definition of a
> >particular header field, field values, parameter names, and
> >parameter values are case-insensitive. Tokens are always
> >case-insensitive."
> >
> >I propose the attached change to address this issue.
> >
>
> Updated patch:
> get_header_param() should be case-insensitive too
> diff --git a/core/AmUtils.cpp b/core/AmUtils.cpp
> index a56ea03..82a8202 100644
> --- a/core/AmUtils.cpp
> +++ b/core/AmUtils.cpp
> @@ -623,7 +623,7 @@ string get_header_param(const string& hdr_string,
> if (pos == string::npos)
> return "";
> if ((hdr_string.length()>pos+param_name.length()+1)
> - && hdr_string.substr(++pos, param_name.length())==param_name
> + && !strcasecmp(hdr_string.substr(++pos, param_name.length()).c_str(),
> param_name.c_str())
> && hdr_string[pos+param_name.length()] == '=') {
> size_t pos2 = pos+param_name.length()+1;
> while(pos2<hdr_string.length()){
> @@ -725,7 +725,7 @@ string get_header_keyvalue_single(const string&
> param_hdr, const string& name) {
> case ';': // semicolons before the key
> break;
> default:
> - if (curr==name[0]) {
> + if (curr==tolower(name[0]) || curr==toupper(name[0])) {
> if (name.length() == 1)
> st = ST_FINDEQ;
> else
> @@ -739,7 +739,7 @@ string get_header_keyvalue_single(const string&
> param_hdr, const string& name) {
> } break;
>
> case ST_CMPKEY: {
> - if (curr==name[corr]) {
> + if (curr==tolower(name[corr]) || curr==toupper(name[corr])) {
> corr++;
> if (corr == name.length()) {
> st = ST_FINDEQ;
> _______________________________________________
> Semsdev mailing list
> [email protected]
> http://lists.iptel.org/mailman/listinfo/semsdev
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev