Package: parser / 3.4.4-1

107_config_path.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Description: Search for configuration file in PARSER_CONFIG_DIR
Author: Sergey B Kirpichev <skirpichev@gmail.com>

PARSER_CONFIG_DIR=/etc/parser3/

Search priority:
1. Command-line option -c
2. Environment variable CGI_PARSER_CONFIG
3. In the directory with CGI-script itself
4. Default location PARSER_CONFIG_DIR "/" AUTO_FILE_NAME

---
 src/targets/cgi/parser3.C |    3 +++
 1 file changed, 3 insertions(+)

--- a/src/targets/cgi/parser3.C
+++ b/src/targets/cgi/parser3.C
@@ -39,6 +39,7 @@
 #define REDIRECT_PREFIX "REDIRECT_"
 #define PARSER_CONFIG_ENV_NAME "CGI_PARSER_CONFIG"
 #define PARSER_LOG_ENV_NAME "CGI_PARSER_LOG"
+#define PARSER_CONFIG_DIR "/etc/parser3"
 
 /// IIS refuses to read bigger chunks
 const size_t READ_POST_CHUNK_SIZE=0x400*0x400; // 1M
@@ -539,6 +540,8 @@
 					"%s/%s", 
 					beside_binary_path, AUTO_FILE_NAME);
 				config_filespec_cstr=config_filespec_buf;
+                if (!entry_exists(config_filespec_cstr)) // default system-wide...
+                    config_filespec_cstr=PARSER_CONFIG_DIR "/" AUTO_FILE_NAME;
 				fail_on_config_read_problem=entry_exists(config_filespec_cstr);
 			}
 		}