author | Michael Krelin <hacker@klever.net> | 2005-04-25 16:36:32 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-04-25 16:36:32 (UTC) |
commit | 981b219f5297ad2ccc1fc1d0e24e41ec009c35a3 (patch) (unidiff) | |
tree | 9fa81d7fe70883ad26d946c902ba06edcebd4516 | |
parent | 54e344b7e3623e807b893b7febad3adfc6c1648f (diff) | |
download | sitecing-981b219f5297ad2ccc1fc1d0e24e41ec009c35a3.zip sitecing-981b219f5297ad2ccc1fc1d0e24e41ec009c35a3.tar.gz sitecing-981b219f5297ad2ccc1fc1d0e24e41ec009c35a3.tar.bz2 |
moved a few utility functions to konforka and bumped konforka version requirement accordingly
-rw-r--r-- | components/exception_dev | 7 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | include/sitecing/sitecing_util.h | 87 | ||||
-rw-r--r-- | lib/component_factory.cc | 31 | ||||
-rw-r--r-- | lib/configuration.cc | 9 | ||||
-rw-r--r-- | lib/sitecing_parser.ll | 13 | ||||
-rw-r--r-- | lib/sitecing_util.cc | 117 | ||||
-rw-r--r-- | lib/sitespace.cc | 3 | ||||
-rw-r--r-- | src/sitecing-build.cc | 5 | ||||
-rw-r--r-- | src/sitecing-fastcgi.cc | 4 | ||||
-rw-r--r-- | src/sitecing-plaincgi.cc | 4 |
11 files changed, 48 insertions, 236 deletions
diff --git a/components/exception_dev b/components/exception_dev index d8c84e1..d62f462 100644 --- a/components/exception_dev +++ b/components/exception_dev | |||
@@ -9,8 +9,9 @@ | |||
9 | #include <cxxabi.h> | 9 | #include <cxxabi.h> |
10 | #include <sitecing/sitecing_util.h> | 10 | #include <sitecing/sitecing_util.h> |
11 | #include <sitecing/util.h> | 11 | #include <sitecing/util.h> |
12 | #include <sitecing/magic.h> | 12 | #include <sitecing/magic.h> |
13 | #include <konforka/util.h> | ||
13 | #include <konforka/exception.h> | 14 | #include <konforka/exception.h> |
14 | </%impl> | 15 | </%impl> |
15 | %%var string message; | 16 | %%var string message; |
16 | %%var string root_source; | 17 | %%var string root_source; |
@@ -253,9 +254,9 @@ | |||
253 | } | 254 | } |
254 | } | 255 | } |
255 | } | 256 | } |
256 | if((oel>0 && !oef.empty()) && (oel!=error_line || oef!=error_file)) { | 257 | if((oel>0 && !oef.empty()) && (oel!=error_line || oef!=error_file)) { |
257 | string ef = "/"+sitecing::combine_path(root_source+component,oef); | 258 | string ef = "/"+konforka::combine_path(root_source+component,oef); |
258 | report_error(ef,oel,remove_roots(cumulative)); | 259 | report_error(ef,oel,remove_roots(cumulative)); |
259 | cumulative.clear(); | 260 | cumulative.clear(); |
260 | } | 261 | } |
261 | } | 262 | } |
@@ -263,9 +264,9 @@ | |||
263 | cumulative += '\n'; | 264 | cumulative += '\n'; |
264 | cumulative += line; | 265 | cumulative += line; |
265 | } | 266 | } |
266 | if(!(cumulative.empty() || error_file.empty() || error_line<0)) { | 267 | if(!(cumulative.empty() || error_file.empty() || error_line<0)) { |
267 | error_file = "/"+sitecing::combine_path(root_source+component,error_file); | 268 | error_file = "/"+konforka::combine_path(root_source+component,error_file); |
268 | report_error(error_file,error_line,remove_roots(cumulative)); | 269 | report_error(error_file,error_line,remove_roots(cumulative)); |
269 | } | 270 | } |
270 | } | 271 | } |
271 | </%code> | 272 | </%code> |
@@ -317,9 +318,9 @@ | |||
317 | </div> | 318 | </div> |
318 | </div> | 319 | </div> |
319 | </%method> | 320 | </%method> |
320 | <%codemethod string strip_roots(const string& filename) %> | 321 | <%codemethod string strip_roots(const string& filename) %> |
321 | string np = sitecing::normalize_path(filename); | 322 | string np = konforka::normalize_path(filename); |
322 | try{ | 323 | try{ |
323 | return sitecing::strip_prefix(np,root_source); | 324 | return sitecing::strip_prefix(np,root_source); |
324 | }catch(sitecing::utility_no_prefix& e){ } | 325 | }catch(sitecing::utility_no_prefix& e){ } |
325 | try{ | 326 | try{ |
diff --git a/configure.ac b/configure.ac index a8aa142..fde326b 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -19,8 +19,12 @@ AC_FUNC_MALLOC | |||
19 | AC_FUNC_REALLOC | 19 | AC_FUNC_REALLOC |
20 | 20 | ||
21 | AC_WITH_PKGCONFIG | 21 | AC_WITH_PKGCONFIG |
22 | 22 | ||
23 | PKG_CHECK_MODULES([KONFORKA],[konforka >= 0.0.1],,[ | ||
24 | AC_MSG_ERROR([no proper version of konforka library found, get it at http://kin.klever.net/konforka/]) | ||
25 | ]) | ||
26 | |||
23 | PKG_CHECK_MODULES([KINGATE],[kingate >= 0.0.1],,[ | 27 | PKG_CHECK_MODULES([KINGATE],[kingate >= 0.0.1],,[ |
24 | AC_MSG_ERROR([no kingate library found, get it at http://kin.klever.net/kingate/]) | 28 | AC_MSG_ERROR([no kingate library found, get it at http://kin.klever.net/kingate/]) |
25 | ]) | 29 | ]) |
26 | HAVE_FCGI=false | 30 | HAVE_FCGI=false |
diff --git a/include/sitecing/sitecing_util.h b/include/sitecing/sitecing_util.h index d1a6c4a..f642c74 100644 --- a/include/sitecing/sitecing_util.h +++ b/include/sitecing/sitecing_util.h | |||
@@ -3,8 +3,9 @@ | |||
3 | 3 | ||
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <string> | 5 | #include <string> |
6 | #include <konforka/exception.h> | 6 | #include <konforka/exception.h> |
7 | #include <konforka/util.h> | ||
7 | 8 | ||
8 | /** | 9 | /** |
9 | * @file | 10 | * @file |
10 | * @brief utility classes and functions. | 11 | * @brief utility classes and functions. |
@@ -20,16 +21,9 @@ namespace sitecing { | |||
20 | public: | 21 | public: |
21 | utility_error(const string& fi,const string& fu,int l,const string& w) | 22 | utility_error(const string& fi,const string& fu,int l,const string& w) |
22 | : konforka::exception(fi,fu,l,w) { } | 23 | : konforka::exception(fi,fu,l,w) { } |
23 | }; | 24 | }; |
24 | /** | 25 | |
25 | * Restricted sequence encountered. | ||
26 | */ | ||
27 | class utility_restricted_sequence : public utility_error { | ||
28 | public: | ||
29 | utility_restricted_sequence(const string& fi,const string& fu,int l,const string& w) | ||
30 | : utility_error(fi,fu,l,w) { } | ||
31 | }; | ||
32 | /** | 26 | /** |
33 | * No prefix or suffix found to strip out. | 27 | * No prefix or suffix found to strip out. |
34 | */ | 28 | */ |
35 | class utility_no_affix : public utility_error { | 29 | class utility_no_affix : public utility_error { |
@@ -54,18 +48,8 @@ namespace sitecing { | |||
54 | : utility_no_affix(fi,fu,l,w) { } | 48 | : utility_no_affix(fi,fu,l,w) { } |
55 | }; | 49 | }; |
56 | 50 | ||
57 | /** | 51 | /** |
58 | * Went up beyond root. | ||
59 | * @todo TODO: wish I could remember the details -- document me. | ||
60 | */ | ||
61 | class utility_beyond_root : public utility_error { | ||
62 | public: | ||
63 | utility_beyond_root(const string& fi,const string& fu,int l,const string& w) | ||
64 | : utility_error(fi,fu,l,w) { } | ||
65 | }; | ||
66 | |||
67 | /** | ||
68 | * The file lock object. Released at the object destruction. | 52 | * The file lock object. Released at the object destruction. |
69 | */ | 53 | */ |
70 | class file_lock { | 54 | class file_lock { |
71 | public: | 55 | public: |
@@ -214,50 +198,8 @@ namespace sitecing { | |||
214 | void unlock(); | 198 | void unlock(); |
215 | }; | 199 | }; |
216 | 200 | ||
217 | /** | 201 | /** |
218 | * normalize_path options enumeration. | ||
219 | * @see normalize_path() | ||
220 | */ | ||
221 | enum normalize_path_options { | ||
222 | /** | ||
223 | * Restrict the /../ sequence. | ||
224 | */ | ||
225 | restrict_dotdot = 1, | ||
226 | /** | ||
227 | * Strip out the leading slash. | ||
228 | */ | ||
229 | strip_leading_slash = 2, | ||
230 | /** | ||
231 | * Strip out the trailing slash. | ||
232 | */ | ||
233 | strip_trailing_slash = 4 | ||
234 | }; | ||
235 | /** | ||
236 | * combine_path options enumeration. | ||
237 | * @see combine_path() | ||
238 | */ | ||
239 | enum combine_path_options { | ||
240 | /** | ||
241 | * The origin is file. Otherwise it is directory. | ||
242 | */ | ||
243 | origin_is_file = 1, | ||
244 | /** | ||
245 | * Fail if we've gone up beyond root. | ||
246 | */ | ||
247 | fail_beyond_root = 2 | ||
248 | }; | ||
249 | |||
250 | /** | ||
251 | * Normalize pathname by stripping duplicate slashes, etc. | ||
252 | * @param path the path name. | ||
253 | * @param opts options. | ||
254 | * @return the normalized path. | ||
255 | * @see normalize_path_options | ||
256 | * @todo TODO: document exceptions. | ||
257 | */ | ||
258 | string normalize_path(const string& path,int opts=(restrict_dotdot|strip_trailing_slash)); | ||
259 | /** | ||
260 | * Strip prefix from the string. | 202 | * Strip prefix from the string. |
261 | * @param str the string. | 203 | * @param str the string. |
262 | * @param prefix prefix to strip. | 204 | * @param prefix prefix to strip. |
263 | * @return the string without prefix. | 205 | * @return the string without prefix. |
@@ -271,32 +213,9 @@ namespace sitecing { | |||
271 | * @return the string without suffix. | 213 | * @return the string without suffix. |
272 | * @todo TODO: document exceptions. | 214 | * @todo TODO: document exceptions. |
273 | */ | 215 | */ |
274 | string strip_suffix(const string& str,const string& suffix); | 216 | string strip_suffix(const string& str,const string& suffix); |
275 | /** | 217 | |
276 | * Get the directory part of the filename. | ||
277 | * @param filename the full file name. | ||
278 | * @return the directory part. | ||
279 | */ | ||
280 | string dir_name(const string& filename); | ||
281 | /** | ||
282 | * Combine path with the relative path. | ||
283 | * @param origin the origin. | ||
284 | * @param relative relative path to combine origin with. | ||
285 | * @param opts options. | ||
286 | * @return the pathc combined. | ||
287 | * @see combine_path_options | ||
288 | * @todo TODO: document exceptions. | ||
289 | */ | ||
290 | string combine_path(const string& origin,const string& relative,int opts=origin_is_file); | ||
291 | |||
292 | /** | ||
293 | * Create directory and parent directories if needed. | ||
294 | * @param path the pathname. | ||
295 | * @param mode the mode for newly created directories. | ||
296 | */ | ||
297 | void make_path(const string& path,mode_t mode); | ||
298 | |||
299 | /** | 218 | /** |
300 | * Change to the directory and pop back at object's destruction (e.g. when | 219 | * Change to the directory and pop back at object's destruction (e.g. when |
301 | * the object goes out of scope). | 220 | * the object goes out of scope). |
302 | */ | 221 | */ |
diff --git a/lib/component_factory.cc b/lib/component_factory.cc index d9692de..af3d911 100644 --- a/lib/component_factory.cc +++ b/lib/component_factory.cc | |||
@@ -10,8 +10,9 @@ | |||
10 | #include <fstream> | 10 | #include <fstream> |
11 | #include <stdexcept> | 11 | #include <stdexcept> |
12 | #include <vector> | 12 | #include <vector> |
13 | using namespace std; | 13 | using namespace std; |
14 | #include <konforka/util.h> | ||
14 | #include "sitecing/component_factory.h" | 15 | #include "sitecing/component_factory.h" |
15 | #include "sitecing/sitecing_util.h" | 16 | #include "sitecing/sitecing_util.h" |
16 | #include "sitecing/sitecing_parser.h" | 17 | #include "sitecing/sitecing_parser.h" |
17 | #include "sitecing/sitecing_exception.h" | 18 | #include "sitecing/sitecing_exception.h" |
@@ -23,16 +24,16 @@ namespace sitecing { | |||
23 | static const char *cc_targets[] = { ".o", ".d" }; | 24 | static const char *cc_targets[] = { ".o", ".d" }; |
24 | 25 | ||
25 | component_factory::component_factory(configuration& c) | 26 | component_factory::component_factory(configuration& c) |
26 | : config(c), | 27 | : config(c), |
27 | root_source(normalize_path(c.root_source,strip_trailing_slash)+'/'), | 28 | root_source(konforka::normalize_path(c.root_source,konforka::strip_trailing_slash)+'/'), |
28 | root_intermediate(normalize_path(c.root_intermediate,strip_trailing_slash)+'/'), | 29 | root_intermediate(konforka::normalize_path(c.root_intermediate,konforka::strip_trailing_slash)+'/'), |
29 | root_so(normalize_path(c.root_so,strip_trailing_slash)+'/') { | 30 | root_so(konforka::normalize_path(c.root_so,konforka::strip_trailing_slash)+'/') { |
30 | } | 31 | } |
31 | 32 | ||
32 | void component_factory::get_dependencies(const string& dst,file_list_t& deps) { | 33 | void component_factory::get_dependencies(const string& dst,file_list_t& deps) { |
33 | deps.clear(); | 34 | deps.clear(); |
34 | string dp = normalize_path(dst,strip_trailing_slash); | 35 | string dp = konforka::normalize_path(dst,konforka::strip_trailing_slash); |
35 | // source documents | 36 | // source documents |
36 | try { // XXX: or just compare it off? | 37 | try { // XXX: or just compare it off? |
37 | string noro = strip_prefix(dp,root_source); | 38 | string noro = strip_prefix(dp,root_source); |
38 | return; | 39 | return; |
@@ -97,9 +98,9 @@ namespace sitecing { | |||
97 | string str; | 98 | string str; |
98 | while(!df.eof()) { | 99 | while(!df.eof()) { |
99 | df >> str; | 100 | df >> str; |
100 | if(str.find_first_of("\\:")==string::npos) | 101 | if(str.find_first_of("\\:")==string::npos) |
101 | deps.push_back(combine_path(config.root_source+nos,str)); | 102 | deps.push_back(konforka::combine_path(config.root_source+nos,str)); |
102 | } | 103 | } |
103 | } | 104 | } |
104 | } | 105 | } |
105 | // XXX: intermediate_deps should be broken down | 106 | // XXX: intermediate_deps should be broken down |
@@ -113,9 +114,9 @@ namespace sitecing { | |||
113 | }catch(utility_no_prefix& unp) { } | 114 | }catch(utility_no_prefix& unp) { } |
114 | } | 115 | } |
115 | 116 | ||
116 | bool component_factory::is_uptodate(const string& dst,file_list_t *deps) { | 117 | bool component_factory::is_uptodate(const string& dst,file_list_t *deps) { |
117 | string dp = normalize_path(dst,strip_trailing_slash); | 118 | string dp = konforka::normalize_path(dst,konforka::strip_trailing_slash); |
118 | try { | 119 | try { |
119 | string noro = strip_prefix(dp,root_intermediate); | 120 | string noro = strip_prefix(dp,root_intermediate); |
120 | for(int ppt=0;(ppt+1)<sizeof(pp_targets)/sizeof(*pp_targets);ppt++) { | 121 | for(int ppt=0;(ppt+1)<sizeof(pp_targets)/sizeof(*pp_targets);ppt++) { |
121 | try { | 122 | try { |
@@ -134,9 +135,9 @@ namespace sitecing { | |||
134 | return true; | 135 | return true; |
135 | } | 136 | } |
136 | 137 | ||
137 | void component_factory::build(const string& dst) { | 138 | void component_factory::build(const string& dst) { |
138 | string dp = normalize_path(dst,strip_trailing_slash); | 139 | string dp = konforka::normalize_path(dst,konforka::strip_trailing_slash); |
139 | // sources | 140 | // sources |
140 | try { | 141 | try { |
141 | string noro = strip_prefix(dp,root_source); | 142 | string noro = strip_prefix(dp,root_source); |
142 | // building the sources is left up to developer | 143 | // building the sources is left up to developer |
@@ -149,9 +150,9 @@ namespace sitecing { | |||
149 | string o = root_intermediate+noro+".o"; | 150 | string o = root_intermediate+noro+".o"; |
150 | cerr << "Linking " << noro << endl; | 151 | cerr << "Linking " << noro << endl; |
151 | if(access(o.c_str(),R_OK)) | 152 | if(access(o.c_str(),R_OK)) |
152 | throw konforka::exception(CODEPOINT,string("can't access compiled component code (")+o+")"); | 153 | throw konforka::exception(CODEPOINT,string("can't access compiled component code (")+o+")"); |
153 | make_path(dir_name(root_so+noro),0755); | 154 | konforka::make_path(konforka::dir_name(root_so+noro),0755); |
154 | file_lock lock_cc(root_intermediate+noro+".o.lock"); | 155 | file_lock lock_cc(root_intermediate+noro+".o.lock"); |
155 | file_lock lock_so(root_so+noro+".so.lock"); | 156 | file_lock lock_so(root_so+noro+".so.lock"); |
156 | int stdO = open((root_intermediate+noro+".ld.stdout").c_str(),O_CREAT|O_TRUNC|O_WRONLY,0664); | 157 | int stdO = open((root_intermediate+noro+".ld.stdout").c_str(),O_CREAT|O_TRUNC|O_WRONLY,0664); |
157 | if(stdO<0) | 158 | if(stdO<0) |
@@ -194,10 +195,10 @@ namespace sitecing { | |||
194 | string o = root_intermediate+nos+".o"; | 195 | string o = root_intermediate+nos+".o"; |
195 | cerr << "Compiling " << nos << endl; | 196 | cerr << "Compiling " << nos << endl; |
196 | if(access(cc.c_str(),R_OK)) | 197 | if(access(cc.c_str(),R_OK)) |
197 | throw konforka::exception(CODEPOINT,string("can't access preprocessed component code (")+cc+")"); | 198 | throw konforka::exception(CODEPOINT,string("can't access preprocessed component code (")+cc+")"); |
198 | make_path(dir_name(cc),0755); | 199 | konforka::make_path(konforka::dir_name(cc),0755); |
199 | string pwd = dir_name(root_source+nos); | 200 | string pwd = konforka::dir_name(root_source+nos); |
200 | auto_chdir dir_changer(pwd); | 201 | auto_chdir dir_changer(pwd); |
201 | file_lock lock_source(root_intermediate+nos+".lock"); | 202 | file_lock lock_source(root_intermediate+nos+".lock"); |
202 | file_lock lock_cc(root_intermediate+nos+".o.lock"); | 203 | file_lock lock_cc(root_intermediate+nos+".o.lock"); |
203 | int stdO = open((root_intermediate+nos+".stdout").c_str(),O_CREAT|O_TRUNC|O_WRONLY,0664); | 204 | int stdO = open((root_intermediate+nos+".stdout").c_str(),O_CREAT|O_TRUNC|O_WRONLY,0664); |
@@ -234,16 +235,16 @@ namespace sitecing { | |||
234 | string src = root_source+nos; | 235 | string src = root_source+nos; |
235 | cerr << "Preprocessing " << nos << endl; | 236 | cerr << "Preprocessing " << nos << endl; |
236 | if(access(src.c_str(),R_OK)) | 237 | if(access(src.c_str(),R_OK)) |
237 | throw konforka::exception(CODEPOINT,string("can't access component source (")+src+")"); | 238 | throw konforka::exception(CODEPOINT,string("can't access component source (")+src+")"); |
238 | make_path(dir_name(root_intermediate+nos),0755); | 239 | konforka::make_path(konforka::dir_name(root_intermediate+nos),0755); |
239 | file_lock lock(root_intermediate+nos+".lock"); | 240 | file_lock lock(root_intermediate+nos+".lock"); |
240 | sitecing_parser parser(*this); | 241 | sitecing_parser parser(*this); |
241 | config_options *co_skeleton = config.lookup_config(nos,config_options::flag_skeleton); | 242 | config_options *co_skeleton = config.lookup_config(nos,config_options::flag_skeleton); |
242 | if(co_skeleton) | 243 | if(co_skeleton) |
243 | parser.skeleton = co_skeleton->skeleton; | 244 | parser.skeleton = co_skeleton->skeleton; |
244 | static const char *id_chars = "abcdefghijklmnopqrstuvwxyz0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | 245 | static const char *id_chars = "abcdefghijklmnopqrstuvwxyz0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
245 | parser.class_name = normalize_path(nos,strip_leading_slash|strip_trailing_slash); | 246 | parser.class_name = konforka::normalize_path(nos,konforka::strip_leading_slash|konforka::strip_trailing_slash); |
246 | for(string::size_type illc = parser.class_name.find_first_not_of(id_chars);illc!=string::npos;illc=parser.class_name.find_first_not_of(id_chars,illc)) { | 247 | for(string::size_type illc = parser.class_name.find_first_not_of(id_chars);illc!=string::npos;illc=parser.class_name.find_first_not_of(id_chars,illc)) { |
247 | string::size_type lc = parser.class_name.find_first_of(id_chars,illc); | 248 | string::size_type lc = parser.class_name.find_first_of(id_chars,illc); |
248 | int n = ((lc==string::npos)?parser.class_name.length():lc)-illc; | 249 | int n = ((lc==string::npos)?parser.class_name.length():lc)-illc; |
249 | parser.class_name.replace(illc,n,n,'_'); | 250 | parser.class_name.replace(illc,n,n,'_'); |
@@ -267,9 +268,9 @@ namespace sitecing { | |||
267 | cerr << "ignoring build request for " << dp << endl; | 268 | cerr << "ignoring build request for " << dp << endl; |
268 | } | 269 | } |
269 | 270 | ||
270 | void component_factory::make(const string& dst) { | 271 | void component_factory::make(const string& dst) { |
271 | string dp = normalize_path(dst,strip_trailing_slash); | 272 | string dp = konforka::normalize_path(dst,konforka::strip_trailing_slash); |
272 | try { | 273 | try { |
273 | string noso = strip_suffix(dp,".so"); | 274 | string noso = strip_suffix(dp,".so"); |
274 | string noro = strip_prefix(noso,root_so); | 275 | string noro = strip_prefix(noso,root_so); |
275 | file_list_t a; | 276 | file_list_t a; |
@@ -316,9 +317,9 @@ namespace sitecing { | |||
316 | return rv; | 317 | return rv; |
317 | } | 318 | } |
318 | 319 | ||
319 | string component_factory::get_classname(const string& component) { | 320 | string component_factory::get_classname(const string& component) { |
320 | string cn = root_intermediate+normalize_path(component,strip_trailing_slash|strip_leading_slash)+".classname"; | 321 | string cn = root_intermediate+konforka::normalize_path(component,konforka::strip_trailing_slash|konforka::strip_leading_slash)+".classname"; |
321 | make(cn); | 322 | make(cn); |
322 | ifstream ifs(cn.c_str()); | 323 | ifstream ifs(cn.c_str()); |
323 | if(!ifs.good()) | 324 | if(!ifs.good()) |
324 | throw konforka::exception(CODEPOINT,"failed to access component .classname"); | 325 | throw konforka::exception(CODEPOINT,"failed to access component .classname"); |
@@ -326,9 +327,9 @@ namespace sitecing { | |||
326 | return cn; | 327 | return cn; |
327 | } | 328 | } |
328 | 329 | ||
329 | void component_factory::get_ancestors(const string& component,file_list_t& rv) { | 330 | void component_factory::get_ancestors(const string& component,file_list_t& rv) { |
330 | string cn = root_intermediate+normalize_path(component,strip_trailing_slash|strip_leading_slash)+".ancestors"; | 331 | string cn = root_intermediate+konforka::normalize_path(component,konforka::strip_trailing_slash|konforka::strip_leading_slash)+".ancestors"; |
331 | make(cn); | 332 | make(cn); |
332 | ifstream ifs(cn.c_str()); | 333 | ifstream ifs(cn.c_str()); |
333 | if(!ifs.good()) | 334 | if(!ifs.good()) |
334 | throw konforka::exception(CODEPOINT,string("failed to access component '")+component+"' .ancestors"); | 335 | throw konforka::exception(CODEPOINT,string("failed to access component '")+component+"' .ancestors"); |
diff --git a/lib/configuration.cc b/lib/configuration.cc index 4ee1526..6b21690 100644 --- a/lib/configuration.cc +++ b/lib/configuration.cc | |||
@@ -5,8 +5,9 @@ | |||
5 | #include <fnmatch.h> | 5 | #include <fnmatch.h> |
6 | #include <cassert> | 6 | #include <cassert> |
7 | #include <stdexcept> | 7 | #include <stdexcept> |
8 | using namespace std; | 8 | using namespace std; |
9 | #include <konforka/util.h> | ||
9 | #include <dotconf.h> | 10 | #include <dotconf.h> |
10 | #include "sitecing/configuration.h" | 11 | #include "sitecing/configuration.h" |
11 | #include "sitecing/sitecing_util.h" | 12 | #include "sitecing/sitecing_util.h" |
12 | #include "sitecing/scoreboard.h" | 13 | #include "sitecing/scoreboard.h" |
@@ -303,9 +304,9 @@ namespace sitecing { | |||
303 | } | 304 | } |
304 | 305 | ||
305 | string configuration::lookup_http_status_handler(const string& target,const string& status) { | 306 | string configuration::lookup_http_status_handler(const string& target,const string& status) { |
306 | string t = "/"; | 307 | string t = "/"; |
307 | t += normalize_path(target,strip_leading_slash); | 308 | t += konforka::normalize_path(target,konforka::strip_leading_slash); |
308 | string rv; | 309 | string rv; |
309 | for(;;) { | 310 | for(;;) { |
310 | if(t[t.length()-1]=='/') { | 311 | if(t[t.length()-1]=='/') { |
311 | loaded_options* lo = lookup_loaded_options(t); | 312 | loaded_options* lo = lookup_loaded_options(t); |
@@ -336,9 +337,9 @@ namespace sitecing { | |||
336 | } | 337 | } |
337 | 338 | ||
338 | config_options::action_handler_t *configuration::lookup_action_handler(const string& target) { | 339 | config_options::action_handler_t *configuration::lookup_action_handler(const string& target) { |
339 | string t = "/"; | 340 | string t = "/"; |
340 | t += normalize_path(target,strip_leading_slash); | 341 | t += konforka::normalize_path(target,konforka::strip_leading_slash); |
341 | for(;;) { | 342 | for(;;) { |
342 | if(t[t.length()-1]=='/') { | 343 | if(t[t.length()-1]=='/') { |
343 | loaded_options* lo = lookup_loaded_options(t); | 344 | loaded_options* lo = lookup_loaded_options(t); |
344 | if( lo && (lo->flags&config_options::flag_action_handlers) ) { | 345 | if( lo && (lo->flags&config_options::flag_action_handlers) ) { |
@@ -368,9 +369,9 @@ namespace sitecing { | |||
368 | } | 369 | } |
369 | 370 | ||
370 | config_options* configuration::lookup_config(const string& target,int flag) { | 371 | config_options* configuration::lookup_config(const string& target,int flag) { |
371 | string t = "/"; // always assume leading slash | 372 | string t = "/"; // always assume leading slash |
372 | t += normalize_path(target,strip_leading_slash); | 373 | t += konforka::normalize_path(target,konforka::strip_leading_slash); |
373 | // XXX: reconsider precedence | 374 | // XXX: reconsider precedence |
374 | for(;;) { | 375 | for(;;) { |
375 | if(t[t.length()-1]=='/') { | 376 | if(t[t.length()-1]=='/') { |
376 | loaded_options* lo = lookup_loaded_options(t); | 377 | loaded_options* lo = lookup_loaded_options(t); |
@@ -413,9 +414,9 @@ namespace sitecing { | |||
413 | } | 414 | } |
414 | 415 | ||
415 | bool configuration::match_autobuild_files(const string& target,const char *fn) { | 416 | bool configuration::match_autobuild_files(const string& target,const char *fn) { |
416 | string t = "/"; | 417 | string t = "/"; |
417 | t += normalize_path(target,strip_leading_slash|strip_trailing_slash); | 418 | t += konforka::normalize_path(target,konforka::strip_leading_slash|konforka::strip_trailing_slash); |
418 | t += "/"; | 419 | t += "/"; |
419 | bool rv = false; | 420 | bool rv = false; |
420 | for(;;) { | 421 | for(;;) { |
421 | if(t[t.length()-1]=='/') { | 422 | if(t[t.length()-1]=='/') { |
diff --git a/lib/sitecing_parser.ll b/lib/sitecing_parser.ll index 4fd6709..8dd8d5f 100644 --- a/lib/sitecing_parser.ll +++ b/lib/sitecing_parser.ll | |||
@@ -6,8 +6,9 @@ | |||
6 | #include <fstream> | 6 | #include <fstream> |
7 | #include <cassert> | 7 | #include <cassert> |
8 | #include <stdexcept> | 8 | #include <stdexcept> |
9 | using namespace std; | 9 | using namespace std; |
10 | #include <konforka/util.h> | ||
10 | #include "sitecing/sitecing_util.h" | 11 | #include "sitecing/sitecing_util.h" |
11 | #include "sitecing/sitecing_exception.h" | 12 | #include "sitecing/sitecing_exception.h" |
12 | using namespace sitecing; | 13 | using namespace sitecing; |
13 | #define sitecing_parser_flexlexer_once | 14 | #define sitecing_parser_flexlexer_once |
@@ -296,10 +297,10 @@ NOIDCHAR [^A-Za-z0-9_] | |||
296 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { | 297 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { |
297 | m.output.erase(0,1); | 298 | m.output.erase(0,1); |
298 | m.output.erase(m.output.length()-1); | 299 | m.output.erase(m.output.length()-1); |
299 | } | 300 | } |
300 | string c = combine_path(component_basename,m.output); | 301 | string c = konforka::combine_path(component_basename,m.output); |
301 | member_variables.push_back(member_variable(m._type,m._name,normalize_path(c,strip_leading_slash),true)); | 302 | member_variables.push_back(member_variable(m._type,m._name,konforka::normalize_path(c,konforka::strip_leading_slash),true)); |
302 | modi.pop_front(); | 303 | modi.pop_front(); |
303 | BEGIN(INITIAL); | 304 | BEGIN(INITIAL); |
304 | } | 305 | } |
305 | } | 306 | } |
@@ -330,10 +331,10 @@ NOIDCHAR [^A-Za-z0-9_] | |||
330 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { | 331 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { |
331 | m.output.erase(0,1); | 332 | m.output.erase(0,1); |
332 | m.output.erase(m.output.length()-1); | 333 | m.output.erase(m.output.length()-1); |
333 | } | 334 | } |
334 | string c = combine_path(component_basename,m.output); | 335 | string c = konforka::combine_path(component_basename,m.output); |
335 | member_variables.push_back(member_variable(m._type,m._name,normalize_path(c,strip_leading_slash),true,true)); | 336 | member_variables.push_back(member_variable(m._type,m._name,konforka::normalize_path(c,konforka::strip_leading_slash),true,true)); |
336 | modi.pop_front(); | 337 | modi.pop_front(); |
337 | BEGIN(INITIAL); | 338 | BEGIN(INITIAL); |
338 | } | 339 | } |
339 | } | 340 | } |
@@ -364,10 +365,10 @@ NOIDCHAR [^A-Za-z0-9_] | |||
364 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { | 365 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { |
365 | m.output.erase(0,1); | 366 | m.output.erase(0,1); |
366 | m.output.erase(m.output.length()-1); | 367 | m.output.erase(m.output.length()-1); |
367 | } | 368 | } |
368 | string c = combine_path(component_basename,m.output); | 369 | string c = konforka::combine_path(component_basename,m.output); |
369 | ancestor_classes.push_back(ancestor_class(m._name,normalize_path(c,strip_leading_slash))); | 370 | ancestor_classes.push_back(ancestor_class(m._name,konforka::normalize_path(c,konforka::strip_leading_slash))); |
370 | modi.pop_front(); | 371 | modi.pop_front(); |
371 | BEGIN(INITIAL); | 372 | BEGIN(INITIAL); |
372 | } | 373 | } |
373 | } | 374 | } |
diff --git a/lib/sitecing_util.cc b/lib/sitecing_util.cc index f892a60..f1432df 100644 --- a/lib/sitecing_util.cc +++ b/lib/sitecing_util.cc | |||
@@ -19,43 +19,8 @@ namespace sitecing { | |||
19 | /* | 19 | /* |
20 | * XXX: all of these utilities could be sheerly optimized. | 20 | * XXX: all of these utilities could be sheerly optimized. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | string normalize_path(const string& path,int opts) { | ||
24 | const char *s = path.c_str(); | ||
25 | string rv; | ||
26 | string::size_type notslash = 0; | ||
27 | if( (*s)=='.' && s[1]=='/' ) | ||
28 | s+=2; | ||
29 | if(opts&strip_leading_slash) | ||
30 | for(;(*s) && (*s)=='/';s++); | ||
31 | for(;*s;s++) { | ||
32 | if( (*s)=='/' ) { | ||
33 | if(s[1]=='/') | ||
34 | continue; | ||
35 | if(s[1]=='.' && s[2]=='/') { | ||
36 | s+=2; | ||
37 | continue; | ||
38 | } | ||
39 | } | ||
40 | if(opts&restrict_dotdot) { | ||
41 | if( | ||
42 | ( rv.empty() && s[0]=='.' && s[1]=='.' && s[2]=='/' )// "^../" | ||
43 | || ( s[0]=='/' && s[1]=='.' && s[2]=='.' && (s[3]==0 || s[3]=='/') ) // "/..(/|$)" | ||
44 | ) | ||
45 | throw utility_restricted_sequence(CODEPOINT,"restricted updir sequence encountered"); | ||
46 | } | ||
47 | rv += *s; | ||
48 | if( (*s) != '/' ) | ||
49 | notslash=rv.length(); | ||
50 | } | ||
51 | if(!(opts&strip_trailing_slash)) | ||
52 | notslash++; | ||
53 | if(notslash<rv.length()) | ||
54 | rv.erase(notslash); // XXX: check the logic of stripping/not strippling trailing slash | ||
55 | return rv; | ||
56 | } | ||
57 | |||
58 | string strip_prefix(const string& str,const string& prefix) { | 23 | string strip_prefix(const string& str,const string& prefix) { |
59 | if( (str.length()<prefix.length()) || str.compare(0,prefix.length(),prefix)) | 24 | if( (str.length()<prefix.length()) || str.compare(0,prefix.length(),prefix)) |
60 | throw utility_no_prefix(CODEPOINT,"no such prefix"); | 25 | throw utility_no_prefix(CODEPOINT,"no such prefix"); |
61 | return str.substr(prefix.length()); | 26 | return str.substr(prefix.length()); |
@@ -66,35 +31,8 @@ namespace sitecing { | |||
66 | throw utility_no_suffix(CODEPOINT,"no such suffix"); | 31 | throw utility_no_suffix(CODEPOINT,"no such suffix"); |
67 | return str.substr(0,str.length()-suffix.length()); | 32 | return str.substr(0,str.length()-suffix.length()); |
68 | } | 33 | } |
69 | 34 | ||
70 | string dir_name(const string& filename) { | ||
71 | string::size_type sl = filename.find_last_of('/'); | ||
72 | if(sl==string::npos) | ||
73 | return ""; // no slashes -- no dir. | ||
74 | string::size_type nosl = filename.find_last_not_of('/',sl); | ||
75 | if(nosl==string::npos) | ||
76 | return ""; // only slashes -- no dir. XXX: only slashes after the last slash... does it mean no dir? | ||
77 | return filename.substr(0,nosl+1); | ||
78 | } | ||
79 | |||
80 | void make_path(const string& path,mode_t mode) { | ||
81 | struct stat st; | ||
82 | for(string::size_type sl=0;sl!=string::npos;sl=path.find('/',sl+1)) { | ||
83 | if(!sl) | ||
84 | continue; | ||
85 | string p = path.substr(0,sl); | ||
86 | if(stat(p.c_str(),&st) || !S_ISDIR(st.st_mode)) { | ||
87 | if(mkdir(p.c_str(),mode)) | ||
88 | throw konforka::exception(CODEPOINT,"failed to mkdir()"); | ||
89 | } | ||
90 | } | ||
91 | if(stat(path.c_str(),&st) || !S_ISDIR(st.st_mode)) { | ||
92 | if(mkdir(path.c_str(),mode)) | ||
93 | throw konforka::exception(CODEPOINT,"failed to mkdir()"); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | void file_lock::lock(const string& f) { | 35 | void file_lock::lock(const string& f) { |
98 | unlock(); | 36 | unlock(); |
99 | fd = open(f.c_str(),O_CREAT|O_RDWR,S_IRUSR|S_IWUSR); | 37 | fd = open(f.c_str(),O_CREAT|O_RDWR,S_IRUSR|S_IWUSR); |
100 | if(fd<0) | 38 | if(fd<0) |
@@ -203,63 +141,8 @@ namespace sitecing { | |||
203 | sem->off(); | 141 | sem->off(); |
204 | locked=false; | 142 | locked=false; |
205 | } | 143 | } |
206 | 144 | ||
207 | string combine_path(const string& origin,const string& relative,int opts) { | ||
208 | string r = normalize_path(relative,0); | ||
209 | string rv; | ||
210 | // XXX: what to do if relative is empty is a question, really. | ||
211 | if(r.empty()) { | ||
212 | return normalize_path( (opts&origin_is_file)?dir_name(origin):origin ,strip_leading_slash|restrict_dotdot|strip_trailing_slash); | ||
213 | }else{ | ||
214 | if(r[0]=='/') { | ||
215 | r.erase(0,1); | ||
216 | }else{ | ||
217 | rv = normalize_path((opts&origin_is_file)?dir_name(origin):origin,restrict_dotdot|strip_trailing_slash); | ||
218 | } | ||
219 | } | ||
220 | string::size_type lsl = rv.rfind('/'); | ||
221 | for(string::size_type sl=r.find('/');sl!=string::npos;sl=r.find('/')) { | ||
222 | assert(sl!=0); | ||
223 | if(sl==1 && r[0]=='.') { | ||
224 | // it's a "./" | ||
225 | r.erase(0,2); | ||
226 | }else if(sl==2 && r[0]=='.' && r[1]=='.') { | ||
227 | // we have a "../" | ||
228 | if(lsl==string::npos) { | ||
229 | if(rv.empty() && (opts&fail_beyond_root)) | ||
230 | throw utility_beyond_root(CODEPOINT,"went beyond root while combining path"); | ||
231 | rv.clear(); | ||
232 | }else{ | ||
233 | rv.erase(lsl); | ||
234 | lsl = rv.rfind('/'); | ||
235 | } | ||
236 | r.erase(0,3); | ||
237 | }else{ | ||
238 | // we have a "something/" | ||
239 | lsl = rv.length(); | ||
240 | rv += '/'; | ||
241 | rv += r.substr(0,sl); | ||
242 | r.erase(0,sl+1); | ||
243 | } | ||
244 | } | ||
245 | if(r.empty()) | ||
246 | return rv+'/'; | ||
247 | if(r.length()==2 && r[0]=='.' && r[0]=='.') { | ||
248 | if(lsl==string::npos) { | ||
249 | if(rv.empty() & (opts&fail_beyond_root)) | ||
250 | throw utility_beyond_root(CODEPOINT,"went beyond root while combining path"); | ||
251 | return "/"; | ||
252 | }else{ | ||
253 | rv.erase(lsl+1); | ||
254 | return rv; | ||
255 | } | ||
256 | } | ||
257 | rv += '/'; | ||
258 | rv += r; | ||
259 | return rv; | ||
260 | } | ||
261 | |||
262 | void auto_chdir::pushdir(const string& td,bool ap) { | 145 | void auto_chdir::pushdir(const string& td,bool ap) { |
263 | /* TODO: make use of fchdir(2) instead */ | 146 | /* TODO: make use of fchdir(2) instead */ |
264 | char *tmp = getcwd(0,0); | 147 | char *tmp = getcwd(0,0); |
265 | assert(tmp); | 148 | assert(tmp); |
diff --git a/lib/sitespace.cc b/lib/sitespace.cc index 0406d11..d5592bf 100644 --- a/lib/sitespace.cc +++ b/lib/sitespace.cc | |||
@@ -1,8 +1,9 @@ | |||
1 | #ifdef USE_PCH | 1 | #ifdef USE_PCH |
2 | #include "pch.h" | 2 | #include "pch.h" |
3 | #else | 3 | #else |
4 | #include <cassert> | 4 | #include <cassert> |
5 | #include <konforka/util.h> | ||
5 | #include "sitecing/sitespace.h" | 6 | #include "sitecing/sitespace.h" |
6 | #include "sitecing/sitecing_util.h" | 7 | #include "sitecing/sitecing_util.h" |
7 | #endif | 8 | #endif |
8 | 9 | ||
@@ -19,9 +20,9 @@ namespace sitecing { | |||
19 | } | 20 | } |
20 | 21 | ||
21 | so_component sitespace::fetch(const string& c,sitecing_interface* scif) { | 22 | so_component sitespace::fetch(const string& c,sitecing_interface* scif) { |
22 | execute_sentenced(); | 23 | execute_sentenced(); |
23 | string sobase = normalize_path(c); | 24 | string sobase = konforka::normalize_path(c); |
24 | string sopath = factory.root_so+sobase+".so"; | 25 | string sopath = factory.root_so+sobase+".so"; |
25 | config_options *co_build = config.lookup_config(sobase,config_options::flag_build); | 26 | config_options *co_build = config.lookup_config(sobase,config_options::flag_build); |
26 | if( (!co_build) || co_build->build ) | 27 | if( (!co_build) || co_build->build ) |
27 | factory.make(sopath); | 28 | factory.make(sopath); |
diff --git a/src/sitecing-build.cc b/src/sitecing-build.cc index 4cad0a3..887ef83 100644 --- a/src/sitecing-build.cc +++ b/src/sitecing-build.cc | |||
@@ -6,8 +6,9 @@ | |||
6 | #include <fstream> | 6 | #include <fstream> |
7 | #include <cassert> | 7 | #include <cassert> |
8 | #include <set> | 8 | #include <set> |
9 | using namespace std; | 9 | using namespace std; |
10 | #include <konforka/util.h> | ||
10 | #include "sitecing/sitecing_util.h" | 11 | #include "sitecing/sitecing_util.h" |
11 | #include "sitecing/util.h" | 12 | #include "sitecing/util.h" |
12 | #include "sitecing/sitespace.h" | 13 | #include "sitecing/sitespace.h" |
13 | #include "sitecing/sitecing_interface_cgi.h" | 14 | #include "sitecing/sitecing_interface_cgi.h" |
@@ -77,9 +78,9 @@ void build_imports(const string& component) { | |||
77 | void build_http_status_handlers(const string& target) { | 78 | void build_http_status_handlers(const string& target) { |
78 | assert(site_space); | 79 | assert(site_space); |
79 | set<string> stop_list; | 80 | set<string> stop_list; |
80 | string t = "/"; | 81 | string t = "/"; |
81 | t += normalize_path(target,strip_leading_slash); | 82 | t += konforka::normalize_path(target,konforka::strip_leading_slash); |
82 | for(;;) { | 83 | for(;;) { |
83 | if(t[t.length()-1]=='/') { | 84 | if(t[t.length()-1]=='/') { |
84 | loaded_options* lo = site_space->config.lookup_loaded_options(t); | 85 | loaded_options* lo = site_space->config.lookup_loaded_options(t); |
85 | if( lo && (lo->flags&config_options::flag_http_status_handlers) ) { | 86 | if( lo && (lo->flags&config_options::flag_http_status_handlers) ) { |
@@ -146,9 +147,9 @@ void build(const string& target) { | |||
146 | if(!strcmp(de->d_name,".")) | 147 | if(!strcmp(de->d_name,".")) |
147 | continue; | 148 | continue; |
148 | if(!strcmp(de->d_name,"..")) | 149 | if(!strcmp(de->d_name,"..")) |
149 | continue; | 150 | continue; |
150 | string subtarget = normalize_path(target+"/"+de->d_name); | 151 | string subtarget = konforka::normalize_path(target+"/"+de->d_name); |
151 | struct stat sts; | 152 | struct stat sts; |
152 | if(stat((site_space->config.root_source+subtarget).c_str(),&sts)) | 153 | if(stat((site_space->config.root_source+subtarget).c_str(),&sts)) |
153 | throw konforka::exception(CODEPOINT,"failed to stat() subtarget"); | 154 | throw konforka::exception(CODEPOINT,"failed to stat() subtarget"); |
154 | if(S_ISDIR(sts.st_mode)) { | 155 | if(S_ISDIR(sts.st_mode)) { |
diff --git a/src/sitecing-fastcgi.cc b/src/sitecing-fastcgi.cc index 756dcee..03587aa 100644 --- a/src/sitecing-fastcgi.cc +++ b/src/sitecing-fastcgi.cc | |||
@@ -164,9 +164,9 @@ void sitecing_fastcgi_pm::process(int slot) { | |||
164 | sl.unlock(); | 164 | sl.unlock(); |
165 | cgi_gateway gw(fi); | 165 | cgi_gateway gw(fi); |
166 | scif.prepare(&gw); | 166 | scif.prepare(&gw); |
167 | try { | 167 | try { |
168 | component_path = normalize_path(gw.path_info(),strip_leading_slash|strip_trailing_slash); | 168 | component_path = konforka::normalize_path(gw.path_info(),konforka::strip_leading_slash|konforka::strip_trailing_slash); |
169 | string full_component_path; | 169 | string full_component_path; |
170 | string sitecing_path_info; | 170 | string sitecing_path_info; |
171 | while(true) { | 171 | while(true) { |
172 | full_component_path = config.root_source+'/'+component_path; | 172 | full_component_path = config.root_source+'/'+component_path; |
@@ -183,9 +183,9 @@ void sitecing_fastcgi_pm::process(int slot) { | |||
183 | action_handler = config.lookup_action_handler(component_path); | 183 | action_handler = config.lookup_action_handler(component_path); |
184 | if(action_handler) { | 184 | if(action_handler) { |
185 | action = action_handler->action; | 185 | action = action_handler->action; |
186 | } | 186 | } |
187 | string pwd = dir_name(full_component_path); | 187 | string pwd = konforka::dir_name(full_component_path); |
188 | if(chdir(pwd.c_str())) | 188 | if(chdir(pwd.c_str())) |
189 | throw konforka::exception(CODEPOINT,"failed to chdir() into document's directory"); | 189 | throw konforka::exception(CODEPOINT,"failed to chdir() into document's directory"); |
190 | so_component soc = ss.fetch(action,&scif); | 190 | so_component soc = ss.fetch(action,&scif); |
191 | if(action_handler) { | 191 | if(action_handler) { |
diff --git a/src/sitecing-plaincgi.cc b/src/sitecing-plaincgi.cc index 3bd291a..2f93cc5 100644 --- a/src/sitecing-plaincgi.cc +++ b/src/sitecing-plaincgi.cc | |||
@@ -49,9 +49,9 @@ void process_request(configuration& config) { | |||
49 | plaincgi_interface ci; | 49 | plaincgi_interface ci; |
50 | cgi_gateway gw(ci); | 50 | cgi_gateway gw(ci); |
51 | scif.prepare(&gw); | 51 | scif.prepare(&gw); |
52 | try { | 52 | try { |
53 | component_path = normalize_path(gw.path_info(),strip_leading_slash|strip_trailing_slash); | 53 | component_path = konforka::normalize_path(gw.path_info(),konforka::strip_leading_slash|konforka::strip_trailing_slash); |
54 | string full_component_path; | 54 | string full_component_path; |
55 | string sitecing_path_info; | 55 | string sitecing_path_info; |
56 | while(true) { | 56 | while(true) { |
57 | full_component_path = config.root_source+'/'+component_path; | 57 | full_component_path = config.root_source+'/'+component_path; |
@@ -68,9 +68,9 @@ void process_request(configuration& config) { | |||
68 | action_handler = config.lookup_action_handler(component_path); | 68 | action_handler = config.lookup_action_handler(component_path); |
69 | if(action_handler) { | 69 | if(action_handler) { |
70 | action = action_handler->action; | 70 | action = action_handler->action; |
71 | } | 71 | } |
72 | string pwd = dir_name(full_component_path); | 72 | string pwd = konforka::dir_name(full_component_path); |
73 | if(chdir(pwd.c_str())) | 73 | if(chdir(pwd.c_str())) |
74 | throw konforka::exception(CODEPOINT,"failed to chdir() into document's directory"); | 74 | throw konforka::exception(CODEPOINT,"failed to chdir() into document's directory"); |
75 | so_component soc = ss.fetch(action,&scif); | 75 | so_component soc = ss.fetch(action,&scif); |
76 | if(action_handler) { | 76 | if(action_handler) { |