mod_proxy_fdpass.c revision 36ef8f77bffe75d1aa327882be1b5bdbe2ff567a
/* 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
*
*
* 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 "mod_proxy.h"
#ifndef CMSG_DATA
#endif
#include "apr_version.h"
#if APR_MAJOR_VERSION < 2
/* for apr_wait_for_io_or_timeout */
#include "apr_support.h"
#endif
#include "mod_proxy_fdpass.h"
{
const char *path;
url += 5;
}
else {
return DECLINED;
}
"proxy: FD: set r->filename to %s", r->filename);
return OK;
}
/* TODO: In APR 2.x: Extend apr_sockaddr_t to possibly be a path !!! */
struct sockaddr_un *sa)
{
if (rv != APR_SUCCESS) {
return rv;
}
if (rv != APR_SUCCESS) {
return rv;
}
do {
&& (t > 0)) {
#if APR_MAJOR_VERSION < 2
#else
#endif
if (rv != APR_SUCCESS) {
return rv;
}
}
return errno;
}
return APR_SUCCESS;
}
const char* path,
{
struct sockaddr_un sa;
apr_socket_t *s;
if (rv != APR_SUCCESS) {
return rv;
}
if (rv != APR_SUCCESS) {
return rv;
}
*out_sock = s;
return APR_SUCCESS;
}
apr_socket_t *s,
{
char b = '\0';
if (rv != APR_SUCCESS) {
return rv;
}
if (rv != APR_SUCCESS) {
return rv;
}
if (rv == -1) {
return errno;
}
return APR_SUCCESS;
}
{
url += 5;
}
else {
return DECLINED;
}
if (rv != APR_SUCCESS) {
"proxy: FD: Failed to connect to '%s'",
url);
return HTTP_INTERNAL_SERVER_ERROR;
}
{
int status;
flush_method, "0");
if (!flush) {
"proxy: FD: Unable to find configured flush "
"provider '%s'", flush_method);
return HTTP_INTERNAL_SERVER_ERROR;
}
if (status) {
return status;
}
}
/* XXXXX: THIS IS AN EVIL HACK */
/* There should really be a (documented) public API for this ! */
if (rv != APR_SUCCESS) {
"proxy: FD: send_socket failed:");
return HTTP_INTERNAL_SERVER_ERROR;
}
{
/* Create a dummy unconnected socket, and set it as the one we were
* connected to, so that when the core closes it, it doesn't close
* the tcp connection to the client.
*/
r->connection->pool);
if (rv != APR_SUCCESS) {
"proxy: FD: failed to create dummy socket");
return HTTP_INTERNAL_SERVER_ERROR;
}
}
return OK;
}
static int standard_flush(request_rec *r)
{
int status;
apr_bucket *e;
"proxy: FD: ap_pass_brigade failed:");
return status;
}
return OK;
}
static const proxy_fdpass_flush builtin_flush =
{
"flush",
};
static void register_hooks(apr_pool_t *p)
{
}
NULL, /* create per-directory config structure */
NULL, /* merge per-directory config structures */
NULL, /* create per-server config structure */
NULL, /* merge per-server config structures */
NULL, /* command apr_table_t */
register_hooks /* register hooks */
};