* Build the ajp header message and send it
* @param sock backend socket
* @param r current request
+ * @uri uri requested uri
* @return APR_SUCCESS or error
*/
-apr_status_t ajp_send_header(apr_socket_t *sock, request_rec *r);
+apr_status_t ajp_send_header(apr_socket_t *sock, request_rec *r,
+ apr_uri_t *uri);
/**
* Read the ajp message and return the type of the message.
*/
-static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
- request_rec *r)
+static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
+ request_rec *r,
+ apr_uri_t *uri)
{
int method;
apr_uint32_t i, num_headers = 0;
apr_byte_t is_ssl;
char *remote_host;
- char *uri;
const char *session_route, *envvar;
const apr_array_header_t *arr = apr_table_elts(r->subprocess_env);
const apr_table_entry_t *elts = (const apr_table_entry_t *)arr->elts;
remote_host = (char *)ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_HOST, NULL);
- uri = apr_pstrdup(r->pool, r->uri);
- if (uri != NULL) {
- char *query_str = strchr(uri, '?');
- if (query_str != NULL) {
- *query_str = 0;
- }
- }
-
-
ajp_msg_reset(msg);
if (ajp_msg_append_uint8(msg, CMD_AJP13_FORWARD_REQUEST) ||
ajp_msg_append_uint8(msg, method) ||
ajp_msg_append_string(msg, r->protocol) ||
- ajp_msg_append_string(msg, uri) ||
+ ajp_msg_append_string(msg, uri->path) ||
ajp_msg_append_string(msg, r->connection->remote_ip) ||
ajp_msg_append_string(msg, remote_host) ||
ajp_msg_append_string(msg, ap_get_server_name(r)) ||
}
}
/* XXXX ebcdic (args converted?) */
- if (r->args) {
+ if (uri->query) {
if (ajp_msg_append_uint8(msg, SC_A_QUERY_STRING) ||
- ajp_msg_append_string(msg, r->args)) {
+ ajp_msg_append_string(msg, uri->query)) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"Error ajp_marshal_into_msgb - "
"Error appending the query string");
* Build the ajp header message and send it
*/
apr_status_t ajp_send_header(apr_socket_t *sock,
- request_rec *r)
+ request_rec *r,
+ apr_uri_t *uri)
{
ajp_msg_t *msg;
apr_status_t rc;
return rc;
}
- rc = ajp_marshal_into_msgb(msg, r);
+ rc = ajp_marshal_into_msgb(msg, r, uri);
if (rc != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"ajp_send_header: ajp_marshal_into_msgb failed");
char *buff;
apr_uint16_t size;
const char *tenc;
- int havebody=1;
- int isok=1;
+ int havebody = 1;
+ int isok = 1;
apr_off_t bb_len;
/*
*/
/* send request headers */
- status = ajp_send_header(conn->sock, r);
+ status = ajp_send_header(conn->sock, r, uri);
if (status != APR_SUCCESS) {
conn->close++;
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
}
/*
- * This handles http:// URLs, and other URLs using a remote proxy over http
+ * This handles ajp:// URLs, and other URLs using a remote proxy over http
* If proxyhost is NULL, then contact the server directly, otherwise
* go via the proxy.
* Note that if a proxy is used, then URLs other than http: can be accessed,