summaryrefslogtreecommitdiff
path: root/module/mod_auth_singleid.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/mod_auth_singleid.c')
-rw-r--r--module/mod_auth_singleid.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/module/mod_auth_singleid.c b/module/mod_auth_singleid.c
index 203b40f..5847829 100644
--- a/module/mod_auth_singleid.c
+++ b/module/mod_auth_singleid.c
@@ -739,6 +739,7 @@ struct sid_request {
int result;
request_rec *rec;
sid_session_t *sess;
+ apr_bucket_brigade *output;
};
void
@@ -758,6 +759,12 @@ sid_request_qs (sid_request_t *req)
}
const char*
+sid_request_method (sid_request_t *req)
+{
+ return req->rec->method;
+}
+
+const char*
sid_request_url (sid_request_t *req, int with_path)
{
/* function to determine if a connection is using https */
@@ -789,8 +796,8 @@ sid_request_url (sid_request_t *req, int with_path)
}
void
-sid_request_respond (sid_request_t *req, int code, const char *reason,
- const char *header, ...)
+sid_request_respond_headers (sid_request_t *req, int code, const char *reason,
+ const char *header, ...)
{
const char *value;
va_list va;
@@ -810,6 +817,38 @@ sid_request_respond (sid_request_t *req, int code, const char *reason,
}
void
+sid_request_respond_html (sid_request_t *req, int code, const char *reason,
+ const char *data, ...)
+{
+ apr_bucket_brigade *bb;
+ apr_bucket *b;
+ conn_rec *con;
+ va_list va;
+
+ if (reason)
+ req->rec->status_line = apr_pstrdup (req->rec->pool, reason);
+
+ ap_set_content_type (req->rec, "text/html");
+
+ con = req->rec->connection;
+ bb = apr_brigade_create(req->rec->pool, con->bucket_alloc);
+
+ va_start(va, data);
+ while (data) {
+ b = apr_bucket_pool_create (data, strlen (data), req->rec->pool, con->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL (bb, b);
+ data = va_arg (va, const char*);
+ }
+ va_end(va);
+
+ b = apr_bucket_eos_create (con->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL (bb, b);
+
+ req->result = code;
+ req->output = bb;
+}
+
+void
sid_request_authenticated (sid_request_t *req, const char *identifier)
{
sid_session_t *sess;
@@ -959,6 +998,7 @@ hook_authenticate (request_rec* r)
const char* authtype;
request_rec* mainreq;
int authenticated = 0;
+ int res;
/* Make sure it's for us */
if (!(authtype = ap_auth_type (r)) || strcasecmp (SID_AUTHTYPE, authtype) != 0)
@@ -979,6 +1019,7 @@ hook_authenticate (request_rec* r)
req.result = OK;
req.rec = r;
req.sess = NULL;
+ req.output = NULL;
/* Check if we've already authenticated this request */
sess = ap_get_module_config (mainreq->request_config, &auth_singleid_module);
@@ -1011,6 +1052,15 @@ hook_authenticate (request_rec* r)
session_send_info (ctx, r, sess);
}
+ /* If any output, send it */
+ if (req.output) {
+ r->status = req.result;
+ res = ap_pass_brigade (r->output_filters, req.output);
+ if (res != APR_SUCCESS)
+ return res;
+ req.result = DONE;
+ }
+
return req.result;
}