mod_proxy_ajp.c revision 0f1e6e90cf575408293a9cf4276c2c5ec9171c3d
97a9a944b5887e91042b019776c41d5dd74557aferikabele/* Licensed to the Apache Software Foundation (ASF) under one or more
97a9a944b5887e91042b019776c41d5dd74557aferikabele * contributor license agreements. See the NOTICE file distributed with
97a9a944b5887e91042b019776c41d5dd74557aferikabele * this work for additional information regarding copyright ownership.
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive * The ASF licenses this file to You under the Apache License, Version 2.0
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive * (the "License"); you may not use this file except in compliance with
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive * the License. You may obtain a copy of the License at
b686b6a420bde7f78c416b90be11db94cb789979nd * Unless required by applicable law or agreed to in writing, software
b686b6a420bde7f78c416b90be11db94cb789979nd * distributed under the License is distributed on an "AS IS" BASIS,
b686b6a420bde7f78c416b90be11db94cb789979nd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b686b6a420bde7f78c416b90be11db94cb789979nd * See the License for the specific language governing permissions and
b686b6a420bde7f78c416b90be11db94cb789979nd * limitations under the License.
b686b6a420bde7f78c416b90be11db94cb789979nd/* AJP routines for Apache proxy */
0066eddda7203f6345b56f77d146a759298dc635gryzor * Canonicalise http-like URLs.
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd * scheme is the scheme for the URL
f3ec420152ca921e4c1ce77782f51b53f659018dnd * url is the URL starting with the first '/'
f3ec420152ca921e4c1ce77782f51b53f659018dnd * def_port is the default port for this scheme.
b686b6a420bde7f78c416b90be11db94cb789979nd const char *err;
b686b6a420bde7f78c416b90be11db94cb789979nd /* ap_port_of_scheme() */
b686b6a420bde7f78c416b90be11db94cb789979nd * do syntactic check.
b686b6a420bde7f78c416b90be11db94cb789979nd * We break the URL into host, port, path, search
b686b6a420bde7f78c416b90be11db94cb789979nd err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
b686b6a420bde7f78c416b90be11db94cb789979nd "error parsing URL %s: %s",
b686b6a420bde7f78c416b90be11db94cb789979nd * now parse path/search args, according to rfc1738
b686b6a420bde7f78c416b90be11db94cb789979nd /* process path */
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd path = ap_proxy_canonenc(r->pool, url, strlen(url), enc_path, 0,
b686b6a420bde7f78c416b90be11db94cb789979nd /* if literal IPv6 address */
b686b6a420bde7f78c416b90be11db94cb789979nd r->filename = apr_pstrcat(r->pool, "proxy:ajp://", host, sport,
b686b6a420bde7f78c416b90be11db94cb789979nd * RFC2616 (9.1.2): GET, HEAD, PUT, DELETE, OPTIONS, TRACE are considered
b686b6a420bde7f78c416b90be11db94cb789979nd * idempotent. Hint: HEAD requests use M_GET as method number as well.
b686b6a420bde7f78c416b90be11db94cb789979nd switch (r->method_number) {
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd * If the request has arguments it might have side-effects and thus
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd * it might be undesirable to resent it to a backend again
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd * automatically.
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd /* Everything else is not considered idempotent. */
b686b6a420bde7f78c416b90be11db94cb789979nd * XXX: AJP Auto Flushing
int result;
apr_bucket *e;
char *buff;
const char *tenc;
int output_failed = 0;
int backend_failed = 0;
int data_sent = 0;
int headers_sent = 0;
int rv = 0;
return HTTP_BAD_REQUEST;
return HTTP_SERVICE_UNAVAILABLE;
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
if (bufsiz > 0) {
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_SERVICE_UNAVAILABLE;
return HTTP_INTERNAL_SERVER_ERROR;
switch (result) {
case CMD_AJP13_GET_BODY_CHUNK:
if (havebody) {
bufsiz = 0;
havebody = 0;
r->server,
&bufsiz);
r->server,
case CMD_AJP13_SEND_HEADERS:
if (size == 0) {
if (headers_sent) {
== APR_TIMEUP) ) ) {
case CMD_AJP13_END_RESPONSE:
output_failed = 0;
|| output_failed)
if (data_sent) {
if (backend_failed) {
if (data_sent) {
return rv;
int status;
&proxy_module);
return DECLINED;
r->server);
if (backend) {
return status;
sizeof(server_portstr));
goto cleanup;
goto cleanup;
goto cleanup;
return status;