summaryrefslogtreecommitdiffabout
path: root/src
Unidiff
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/sitecing-build.cc5
-rw-r--r--src/sitecing-fastcgi.cc4
-rw-r--r--src/sitecing-plaincgi.cc4
3 files changed, 7 insertions, 6 deletions
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
@@ -4,12 +4,13 @@
4#include <iostream> 4#include <iostream>
5#include <memory> 5#include <memory>
6#include <fstream> 6#include <fstream>
7#include <cassert> 7#include <cassert>
8#include <set> 8#include <set>
9using namespace std; 9using 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"
14#include "sitecing/cgi_component.h" 15#include "sitecing/cgi_component.h"
15#include "sitecing/configuration.h" 16#include "sitecing/configuration.h"
@@ -75,13 +76,13 @@ void build_imports(const string& component) {
75} 76}
76 77
77void build_http_status_handlers(const string& target) { 78void 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) ) {
86 for(config_options::http_status_handlers_t::const_iterator i=lo->http_status_handlers.begin();i!=lo->http_status_handlers.end();++i) { 87 for(config_options::http_status_handlers_t::const_iterator i=lo->http_status_handlers.begin();i!=lo->http_status_handlers.end();++i) {
87 if(stop_list.find(i->first)==stop_list.end()) { 88 if(stop_list.find(i->first)==stop_list.end()) {
@@ -144,13 +145,13 @@ void build(const string& target) {
144 throw konforka::exception(CODEPOINT,"failed to opendir()"); 145 throw konforka::exception(CODEPOINT,"failed to opendir()");
145 for(struct dirent *de=readdir(d);de;de=readdir(d)) { 146 for(struct dirent *de=readdir(d);de;de=readdir(d)) {
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)) {
155 build(subtarget); 156 build(subtarget);
156 }else{ 157 }else{
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
@@ -162,13 +162,13 @@ void sitecing_fastcgi_pm::process(int slot) {
162 sslot->state = scoreboard_slot::state_processing; 162 sslot->state = scoreboard_slot::state_processing;
163 if(multi) 163 if(multi)
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;
173 if(!access(full_component_path.c_str(),F_OK)) 173 if(!access(full_component_path.c_str(),F_OK))
174 break; 174 break;
@@ -181,13 +181,13 @@ void sitecing_fastcgi_pm::process(int slot) {
181 fi.metavars["SITECING_PATH_INFO"]=sitecing_path_info; 181 fi.metavars["SITECING_PATH_INFO"]=sitecing_path_info;
182 action = component_path; 182 action = component_path;
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) {
192 soc.ac->run(__magic_action, 192 soc.ac->run(__magic_action,
193 config.root_source.c_str(), config.root_intermediate.c_str(), config.root_so.c_str(), 193 config.root_source.c_str(), config.root_intermediate.c_str(), config.root_so.c_str(),
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
@@ -47,13 +47,13 @@ void process_request(configuration& config) {
47 string action; 47 string action;
48 config_options::action_handler_t *action_handler; 48 config_options::action_handler_t *action_handler;
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;
58 if(!access(full_component_path.c_str(),F_OK)) 58 if(!access(full_component_path.c_str(),F_OK))
59 break; 59 break;
@@ -66,13 +66,13 @@ void process_request(configuration& config) {
66 ci.metavars["SITECING_PATH_INFO"]=sitecing_path_info; 66 ci.metavars["SITECING_PATH_INFO"]=sitecing_path_info;
67 action = component_path; 67 action = component_path;
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) {
77 soc.ac->run(__magic_action, 77 soc.ac->run(__magic_action,
78 config.root_source.c_str(), config.root_intermediate.c_str(), config.root_so.c_str(), 78 config.root_source.c_str(), config.root_intermediate.c_str(), config.root_so.c_str(),