return string("");
if (strcasecmp(auth_type, "shibboleth")) {
if (!strcasecmp(auth_type, "basic") && m_dc->bBasicHijack == 1) {
- core_dir_config* conf= (core_dir_config*)
- ap_get_module_config(m_req->per_dir_config,
+ core_dir_config* conf= (core_dir_config*)ap_get_module_config(m_req->per_dir_config,
ap_find_linked_module("http_core.c"));
- auth_type = conf->ap_auth_type = "shibboleth";
+ auth_type = conf->ap_auth_type = "shibboleth";
}
}
return string(auth_type);
const char* w = ap_getword_white(m_req->pool, &t);
rline->tokens.push_back(w);
while (*t) {
- w = ap_getword_conf(m_req->pool, &t);
- rline->tokens.push_back(w);
+ w = ap_getword_conf(m_req->pool, &t);
+ rline->tokens.push_back(w);
}
ht->elements.push_back(rline);
}
return ht;
}
- virtual HTGroupTable* getGroupTable(string &user) {
+ virtual HTGroupTable* getGroupTable(string& user) {
if (m_dc->szAuthGrpFile && !user.empty()) {
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(m_req),
"getGroupTable() using groups file: %s\n",
m_dc->szAuthGrpFile);
try {
- HTGroupTableApache *gt = new HTGroupTableApache(m_req, user.c_str(),
+ HTGroupTableApache *gt = new HTGroupTableApache(m_req, user.c_str(),
m_dc->szAuthGrpFile);
- return gt;
+ return gt;
} catch (...) { }
}
return NULL;
virtual void* sendPage(
const string& msg,
- const string& content_type,
- const saml::Iterator<header_t>& headers=EMPTY(header_t),
- int code=200
+ int code=200,
+ const string& content_type="text/html",
+ const Iterator<header_t>& headers=EMPTY(header_t)
) {
m_req->content_type = ap_psprintf(m_req->pool, content_type.c_str());
while (headers.hasNext()) {
}
ap_send_http_header(m_req);
ap_rprintf(m_req, msg.c_str());
- return (void*)DONE;
+ return (void*)((code==200) ? DONE : code);
}
virtual void* sendRedirect(const string& url) {
ap_table_set(m_req->headers_out, "Location", url.c_str());
virtual string getRemoteUser(void) {
return getHeader(string("remote-user"));
}
- virtual void* sendPage(const string& msg, const string& content_type,
- const Iterator<header_t>& headers=EMPTY(header_t), int code=200) {
+ virtual void* sendPage(
+ const string& msg,
+ int code=200,
+ const string& content_type="text/html",
+ const Iterator<header_t>& headers=EMPTY(header_t)) {
string hdr = string ("Connection: close\r\nContent-type: ") + content_type + "\r\n";
while (headers.hasNext()) {
const header_t& h=headers.next();
hdr += h.first + ": " + h.second + "\r\n";
}
hdr += "\r\n";
- // XXX Need to handle "code"
- m_pfc->ServerSupportFunction(m_pfc, SF_REQ_SEND_RESPONSE_HEADER, "200 OK", (DWORD)hdr.c_str(), 0);
+ const char* codestr="200 OK";
+ switch (code) {
+ case 403: codestr="403 Forbidden"; break;
+ case 404: codestr="404 Not Found"; break;
+ case 500: codestr="500 Server Error"; break;
+ }
+ m_pfc->ServerSupportFunction(m_pfc, SF_REQ_SEND_RESPONSE_HEADER, (void*)codestr, (DWORD)hdr.c_str(), 0);
DWORD resplen = msg.size();
m_pfc->WriteClient(m_pfc, (LPVOID)msg.c_str(), &resplen, 0);
return (void*)SF_STATUS_REQ_FINISHED;
else
return string(reinterpret_cast<char*>(m_lpECB->lpbData),m_lpECB->cbAvailable);
}
- virtual void* sendPage(const string &msg, const string& content_type,
- const Iterator<header_t>& headers=EMPTY(header_t), int code=200) {
+ virtual void* sendPage(
+ const string &msg,
+ int code=200,
+ const string& content_type="text/html",
+ const Iterator<header_t>& headers=EMPTY(header_t)) {
string hdr = string ("Connection: close\r\nContent-type: ") + content_type + "\r\n";
for (int k = 0; k < headers.size(); k++) {
hdr += headers[k].first + ": " + headers[k].second + "\r\n";
}
hdr += "\r\n";
- // XXX Need to handle "code"
- m_lpECB->ServerSupportFunction(m_lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER,
- "200 OK", 0, (LPDWORD)hdr.c_str());
+ const char* codestr="200 OK";
+ switch (code) {
+ case 403: codestr="403 Forbidden"; break;
+ case 404: codestr="404 Not Found"; break;
+ case 500: codestr="500 Server Error"; break;
+ }
+ m_lpECB->ServerSupportFunction(m_lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER, (void*)codestr, 0, (LPDWORD)hdr.c_str());
DWORD resplen = msg.size();
m_lpECB->WriteClient(m_lpECB->ConnID, (LPVOID)msg.c_str(), &resplen, HSE_IO_SYNC);
return (void*)HSE_STATUS_SUCCESS;
// If there are no headers supplied assume the content-type == text/html
typedef std::pair<std::string, std::string> header_t;
virtual void* sendPage(
- const std::string& msg,
- const std::string& content_type = "text/html",
- const saml::Iterator<header_t>& headers = EMPTY(header_t),
- int code = 200
- )=0;
+ const std::string& msg,
+ int code = 200,
+ const std::string& content_type = "text/html",
+ const saml::Iterator<header_t>& headers = EMPTY(header_t)
+ )=0;
void* sendPage(const char *msg) {
std::string m = msg;
return sendPage(m);