move regex to vger.h
This commit is contained in:
parent
2b835bc39c
commit
26ca6c422d
15
vger.c
15
vger.c
|
@ -514,21 +514,6 @@ split_request(const char *request, char *hostname, char *path, char *query)
|
|||
char buf[BUFSIZ] = {'\0'}; /* to handle error messages */
|
||||
int ret = 0;
|
||||
|
||||
const char *gemini_regex = "^gemini://+([^/|^\?]*)/*([^\?]*)[\?]?(.*)$";
|
||||
/*
|
||||
* ^gemini://+ : in case of gemini:///
|
||||
* 1: hostname
|
||||
* ([^/|^\?]*) :
|
||||
* catch everything, stop when / or ? is found
|
||||
* then skip multiple /
|
||||
* 2: path
|
||||
* ([^\?]*) :
|
||||
* catch everything and stop at ? if any
|
||||
* 3 : query
|
||||
* [\?]?(.*)$:
|
||||
* catch everything after ? if any
|
||||
*/
|
||||
|
||||
if ((ret = regcomp(&greg, gemini_regex, REG_EXTENDED)) != 0) {
|
||||
regerror(ret, &greg, buf, sizeof(buf));
|
||||
regfree(&greg);
|
||||
|
|
16
vger.h
16
vger.h
|
@ -11,6 +11,22 @@
|
|||
*/
|
||||
#define GEMINI_REQUEST_MAX 1025
|
||||
|
||||
/* gemini_regex:
|
||||
* =============
|
||||
* ^gemini://+ : in case of gemini:///
|
||||
* 1: hostname
|
||||
* ([^/|^\?]*) :
|
||||
* catch everything, stop when / or ? is found
|
||||
* then skip multiple /
|
||||
* 2: path
|
||||
* ([^\?]*) :
|
||||
* catch everything and stop at ? if any
|
||||
* 3 : query
|
||||
* [\?]?(.*)$:
|
||||
* catch everything after ? if any
|
||||
*/
|
||||
const char *gemini_regex = "^gemini://+([^/|^\?]*)/*([^\?]*)[\?]?(.*)$";
|
||||
|
||||
/* global vars */
|
||||
static int _retcode = 0;
|
||||
static ssize_t _datasiz = 0;
|
||||
|
|
Loading…
Reference in New Issue