mod_serf.c revision 8292ec4228fbb1fe0e6875e68bdc5e2fd095fe6d
447be1550523114f96c7f9eacb9d6a1ff6ca4197Lennart Poettering/* Licensed to the Apache Software Foundation (ASF) under one or more
447be1550523114f96c7f9eacb9d6a1ff6ca4197Lennart Poettering * contributor license agreements. See the NOTICE file distributed with
447be1550523114f96c7f9eacb9d6a1ff6ca4197Lennart Poettering * this work for additional information regarding copyright ownership.
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering * The ASF licenses this file to You under the Apache License, Version 2.0
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering * (the "License"); you may not use this file except in compliance with
447be1550523114f96c7f9eacb9d6a1ff6ca4197Lennart Poettering * the License. You may obtain a copy of the License at
447be1550523114f96c7f9eacb9d6a1ff6ca4197Lennart Poettering * http://www.apache.org/licenses/LICENSE-2.0
a882169a168bef88eb5cc3a9a5437e6e3518260fLennart Poettering * Unless required by applicable law or agreed to in writing, software
efb3e19be9c568974b221990b9e84fb5304c5537Lennart Poettering * distributed under the License is distributed on an "AS IS" BASIS,
447be1550523114f96c7f9eacb9d6a1ff6ca4197Lennart Poettering * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
447be1550523114f96c7f9eacb9d6a1ff6ca4197Lennart Poettering * See the License for the specific language governing permissions and
447be1550523114f96c7f9eacb9d6a1ff6ca4197Lennart Poettering * limitations under the License.
#include "httpd.h"
#include "http_core.h"
#include "http_config.h"
#include "http_protocol.h"
#include "http_request.h"
#include "http_log.h"
#include "serf.h"
#include "apr_uri.h"
#include "apr_strings.h"
#include "apr_version.h"
#include "ap_mpm.h"
static int mpm_supprts_serf = 0;
int on;
int preservehost;
const char *name;
const char *provider;
int rstatus;
int want_ssl;
int done_headers;
int keep_reading;
request_rec *r;
} s_baton_t;
apr_bucket *e;
void *closed_baton,
if (why) {
if (mpm_supprts_serf) {
void *setup_baton,
serf_bucket_t *c;
switch (key[0]) {
int done = 0;
switch (key[0]) {
if (!done) {
void *acceptor_baton,
serf_bucket_t *c;
void *vbaton,
const char *data;
return APR_EGENERAL;
if (rv) {
return APR_SUCCESS;
if (mpm_supprts_serf) {
return rv;
return rv;
if (len > 0) {
if (mpm_supprts_serf) {
return APR_EOF;
return APR_SUCCESS;
void *vbaton,
void **acceptor_baton,
void **handler_baton,
return APR_SUCCESS;
/* XXXXX: make persistent/per-process or something.*/
&serf_module);
int rc;
if (!cluster) {
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
&servers);
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
pool);
pool);
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01128) "Unable to resolve: %s", conf->url.hostname);
return HTTP_INTERNAL_SERVER_ERROR;
if (mpm_supprts_serf) {
if (!serfme) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01129) "mpm lied to us about supporting serf.");
return HTTP_INTERNAL_SERVER_ERROR;
baton->r = r;
if (rv) {
return rv;
if (ap_should_client_block(r)) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01130) "Unable to create temp request body buffer file.");
return HTTP_INTERNAL_SERVER_ERROR;
if (rv > 0) {
if (rv) {
return HTTP_INTERNAL_SERVER_ERROR;
} while(rv > 0);
if (rv < 0) {
return HTTP_INTERNAL_SERVER_ERROR;
pool);
if (mpm_supprts_serf) {
return SUSPENDED;
return HTTP_INTERNAL_SERVER_ERROR;
&serf_module);
return DECLINED;
static int is_true(const char *w)
const char *p = argv[i];
return NULL;
const char *rv;
&serf_module);
return err;
const char *p = argv[i];
if (rv) {
return rv;
return NULL;
return new;
return ctx;
return ctx;
{NULL}
typedef struct hb_table_baton_t {
apr_pool_t *p;
const char *msg;
key);
if (b.msg) {
return b.msg;
return NULL;
typedef struct hb_server_t {
const char *ip;
int busy;
int ready;
int seen;
unsigned int port;
} hb_server_t;
char *key;
char *value;
char *strtok_state;
while (key) {
if (value) {
if (!path) {
return APR_SUCCESS;
if (rv) {
return rv;
if (rv) {
return rv;
int lineno = 0;
const char *ip;
lineno++;
return APR_SUCCESS;
request_rec *r,
if (rv) {
return HTTP_INTERNAL_SERVER_ERROR;
ap_serf_server_t *x;
return OK;
NULL,
NULL,
key);
if (b.msg) {
return b.msg;
return NULL;
request_rec *r,
char *ip;
char *strtok_state;
while (ip) {
char *host_str;
char *scope_id;
if (!rv) {
return OK;
NULL,
NULL,
mpm_supprts_serf = 0;
return OK;
NULL,