mod_proxy_websocket.c revision 27774671fd435737640c3631e23db369500ca66a
/* 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"
/*
* Canonicalise http-like URLs.
* scheme is the scheme for the URL
* url is the URL starting with the first '/'
* def_port is the default port for this scheme.
*/
{
const char *err;
char *scheme;
/* ap_port_of_scheme() */
url += 3;
scheme = "ws:";
}
url += 4;
scheme = "wss:";
}
else {
return DECLINED;
}
/*
* do syntactic check.
* We break the URL into host, port, path, search
*/
if (err) {
return HTTP_BAD_REQUEST;
}
/*
* process the path. With proxy-nocanon set (by
* mod_proxy) we use the raw, unparsed uri
*/
}
else {
r->proxyreq);
}
return HTTP_BAD_REQUEST;
/* if literal IPv6 address */
}
return OK;
}
{
int rv;
#ifdef DEBUGGING
#endif
do {
if (rv == APR_SUCCESS) {
return APR_EPIPE;
if (APR_BRIGADE_EMPTY(bb))
break;
#ifdef DEBUGGING
len = -1;
"read %" APR_OFF_T_FMT
#endif
if (rv == APR_SUCCESS) {
}
else {
"error on %s - ap_pass_brigade",
name);
}
"error on %s - ap_get_brigade",
name);
}
} while (rv == APR_SUCCESS);
if (APR_STATUS_IS_EAGAIN(rv)) {
rv = APR_SUCCESS;
}
return rv;
}
/*
* process the request and write the response.
*/
char *url, char *server_portstr)
{
const apr_pollfd_t *signalled;
conn_rec *c = r->connection;
int client_error = 0;
char *buf;
apr_bucket *e;
char *old_cl_val = NULL;
char *old_te_val = NULL;
&old_cl_val, &old_te_val);
return rv;
}
return rv;
"error apr_pollset_create()");
return HTTP_INTERNAL_SERVER_ERROR;
}
#if 0
#endif
pollfd.p = p;
r->output_filters = c->output_filters;
r->proto_output_filters = c->output_filters;
r->input_filters = c->input_filters;
r->proto_input_filters = c->input_filters;
while (1) { /* Infinite loop until error (one side closes the connection) */
!= APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(rv)) {
continue;
}
return HTTP_INTERNAL_SERVER_ERROR;
}
"woke from poll(), i=%d", pollcnt);
if (pollevent & APR_POLLIN) {
"sock was readable");
}
else if ((pollevent & APR_POLLERR)
|| (pollevent & APR_POLLHUP)) {
}
if (rv != APR_SUCCESS)
client_error = 1;
}
if (pollevent & APR_POLLIN) {
"client was readable");
}
}
else {
"unknown socket in pollset");
}
}
if (rv != APR_SUCCESS) {
break;
}
}
"finished with poll() - cleaning up");
if (client_error) {
return HTTP_INTERNAL_SERVER_ERROR;
}
return OK;
}
/*
*/
{
int status;
char server_portstr[32];
char *scheme;
int retry;
conn_rec *c = r->connection;
apr_pool_t *p = r->pool;
scheme = "WSS";
}
scheme = "WS";
}
else {
return DECLINED;
}
/* create space for state information */
r->server);
if (backend) {
}
return status;
}
retry = 0;
while (retry < 2) {
/* Step One: Determine Who To Connect To */
sizeof(server_portstr));
break;
/* Step Two: Make the Connection */
"failed to make connection to backend: %s",
break;
}
/* Step Three: Create conn_rec */
if (!backend->connection) {
break;
}
/* Step Three: Process the Request */
break;
}
/* Do not close the socket */
return status;
}
static void ap_proxy_http_register_hook(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 */
ap_proxy_http_register_hook /* register hooks */
};