Skip to content

Commit

Permalink
v2.5.1: Allow ';' as selector separator in resource URI
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaempf committed Jun 2, 2015
1 parent 5fe6b68 commit f9ebca1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2.5.1
- Features
- Allow ';' as separator for URI selectors
(RFC 1866 section 8.2.1)
- Warn if ',' is used as selector separator

2.5.0
- Features
- Rewrite selector and property handling to keep
Expand Down
4 changes: 2 additions & 2 deletions VERSION.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
# set COMPATMINOR to MINOR. (binary incompatible change)
#

# Package version 2.5.0
# Package version 2.5.1
SET(OPENWSMAN_MAJOR "2")
SET(OPENWSMAN_MINOR "5")
SET(OPENWSMAN_PATCH "0")
SET(OPENWSMAN_PATCH "1")

# Plugin API 2.2
SET(OPENWSMAN_PLUGIN_API_MAJOR "2")
Expand Down
20 changes: 19 additions & 1 deletion src/lib/u/uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,17 @@ _u_parse(const char *query, const char *separator)

u_trim(key);
u_trim(val);
/* if we parse a URI (& separator) and the value contains
* ',' and '=', then the query probably has wrong syntax
* and uses ',' instead of '&'
*/
if (*separator == '&') {
if (strchr(val, ',')) {
if (strchr(val, '=')) {
fprintf(stderr, "Maybe wrong use of ',' separator in URI, should be '&'\n");
}
}
}
u_trim_quotes(val);
if (u_string_unify(key) || u_string_unify(val)) {
u_free(key);
Expand Down Expand Up @@ -259,10 +270,17 @@ _u_parse(const char *query, const char *separator)
return NULL;
}

/*
* parse query according to
* http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax
* and RFC 1866 section 8.2.1 : by Tim Berners-Lee in 1995 encourages CGI authors to support ';' in addition to '&'.
*
*/

hash_t *
u_parse_query(const char *query)
{
return _u_parse(query, "&");
return _u_parse(query, "&;");
}

hash_t *
Expand Down

0 comments on commit f9ebca1

Please sign in to comment.