netutils/netlib/netlib_parseurl.c: Add a more flexible version of netlib_parsehttpurl. This one can parse any URL, and is extensible so future improvements keep the same API.

This commit is contained in:
Sebastien Lorquet
2019-04-26 13:08:38 -06:00
committed by Gregory Nutt
parent 601659ff59
commit fe0954cd62
4 changed files with 238 additions and 0 deletions

View File

@@ -185,6 +185,28 @@ struct netlib_ipv6_route_s
#endif
#endif /* HAVE_ROUTE_PROCFS */
#ifdef CONFIG_NETUTILS_NETLIB_GENERICURLPARSER
struct url_s
{
FAR char *scheme;
int schemelen;
FAR char *user;
int userlen;
FAR char *password;
int passwordlen;
FAR char *host;
int hostlen;
int port;
FAR char *path;
int pathlen;
FAR char *parameters;
int parameterslen;
FAR char *bookmark;
int bookmarklen;
};
#endif
/****************************************************************************
* Public Data
****************************************************************************/
@@ -323,6 +345,10 @@ int netlib_parsehttpurl(FAR const char *url, uint16_t *port,
FAR char *hostname, int hostlen,
FAR char *filename, int namelen);
#ifdef CONFIG_NETUTILS_NETLIB_GENERICURLPARSER
int netlib_parseurl(FAR const char *str, FAR struct url_s *url);
#endif
/* Generic server logic */
int netlib_listenon(uint16_t portno);