improve regex to handle :1234 in url
This commit is contained in:
parent
5063f3e95b
commit
f388d2a57a
3
vger.c
3
vger.c
|
@ -527,6 +527,9 @@ split_request(const char *request, char *hostname, char *path, char *query)
|
|||
getsubexp(request, match[1], hostname);
|
||||
getsubexp(request, match[2], path);
|
||||
getsubexp(request, match[3], query);
|
||||
syslog(LOG_DAEMON, "hostname:%s", hostname);
|
||||
syslog(LOG_DAEMON, "path:%s", path);
|
||||
syslog(LOG_DAEMON, "query:%s", query);
|
||||
|
||||
regfree(&greg);
|
||||
}
|
||||
|
|
11
vger.h
11
vger.h
|
@ -18,9 +18,11 @@
|
|||
* =============
|
||||
* ^gemini://+ : in case of gemini:///
|
||||
* 1: hostname
|
||||
* ([^/|^\?]*) :
|
||||
* catch everything, stop when / or ? is found
|
||||
* then skip multiple /
|
||||
* ([^/|^\?|^:]*) :
|
||||
* catch everything, stop when /, ? or : is found
|
||||
* don't catch :port
|
||||
* [:[0-9]*]? : skip :1234 (port number) if any
|
||||
* / * : skip "/" if any
|
||||
* 2: path
|
||||
* ([^\?]*) :
|
||||
* catch everything and stop at ? if any
|
||||
|
@ -28,7 +30,8 @@
|
|||
* [\?]?(.*)$:
|
||||
* catch everything after ? if any
|
||||
*/
|
||||
static const char *_gemini_regex = "^gemini://+([^/|^\?]*)/*([^\?]*)[\?]?(.*)$";
|
||||
static const char *_gemini_regex =
|
||||
"^gemini://+([^/|^\?|^:]*)[:[0-9]*]?/*([^\?]*)[\?]?(.*)$";
|
||||
|
||||
/* global vars */
|
||||
static int _retcode = 0;
|
||||
|
|
Loading…
Reference in New Issue