libapreq2
view release on metacpan or search on metacpan
module/apache2/handle.c view on Meta::CPAN
/*
** Licensed to the Apache Software Foundation (ASF) under one or more
** contributor license agreements. See the NOTICE file distributed with
** this work for additional information regarding copyright ownership.
** The ASF licenses this file to You under the Apache License, Version 2.0
** (the "License"); you may not use this file except in compliance with
** the License. You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "util_filter.h"
#include "apr_tables.h"
#include "apr_buckets.h"
#include "http_request.h"
#include "apr_strings.h"
#include "apreq_module_apache2.h"
#include "apreq_private_apache2.h"
#include "apreq_error.h"
APR_INLINE
static ap_filter_t *get_apreq_filter(apreq_handle_t *handle)
{
struct apache2_handle *req = (struct apache2_handle *)handle;
if (req->f == NULL) {
req->f = ap_add_input_filter(APREQ_FILTER_NAME, NULL,
req->r,
req->r->connection);
/* ap_add_input_filter does not guarantee cfg->f == r->input_filters,
* so we reposition the new filter there as necessary.
*/
apreq_filter_relocate(req->f);
}
return req->f;
}
static apr_status_t apache2_jar(apreq_handle_t *handle, const apr_table_t **t)
{
struct apache2_handle *req = (struct apache2_handle*)handle;
request_rec *r = req->r;
if (req->jar_status == APR_EINIT) {
const char *cookies = apr_table_get(r->headers_in, "Cookie");
if (cookies != NULL) {
req->jar = apr_table_make(handle->pool, APREQ_DEFAULT_NELTS);
req->jar_status =
apreq_parse_cookie_header(handle->pool, req->jar, cookies);
}
else
req->jar_status = APREQ_ERROR_NODATA;
}
*t = req->jar;
return req->jar_status;
}
static apr_status_t apache2_args(apreq_handle_t *handle, const apr_table_t **t)
{
struct apache2_handle *req = (struct apache2_handle*)handle;
request_rec *r = req->r;
if (req->args_status == APR_EINIT) {
if (r->args != NULL) {
req->args = apr_table_make(handle->pool, APREQ_DEFAULT_NELTS);
req->args_status =
apreq_parse_query_string(handle->pool, req->args, r->args);
}
else
req->args_status = APREQ_ERROR_NODATA;
}
*t = req->args;
return req->args_status;
}
static apreq_cookie_t *apache2_jar_get(apreq_handle_t *handle, const char *name)
{
struct apache2_handle *req = (struct apache2_handle *)handle;
const apr_table_t *t;
const char *val;
if (req->jar_status == APR_EINIT)
apache2_jar(handle, &t);
else
t = req->jar;
if (t == NULL)
( run in 0.634 second using v1.01-cache-2.11-cpan-5b529ec07f3 )