diff --git a/src/apps/relay/netengine.c b/src/apps/relay/netengine.c
index e74d7866..7bd1d602 100644
--- a/src/apps/relay/netengine.c
+++ b/src/apps/relay/netengine.c
@@ -1649,7 +1649,6 @@ static void setup_relay_server(struct relay_server *rs, ioa_engine_handle e, int
&turn_params.secure_stun, turn_params.shatype, &turn_params.mobility,
turn_params.server_relay,
send_turn_session_info,
- send_https_socket,
allocate_bps,
turn_params.oauth, turn_params.oauth_server_name);
diff --git a/src/apps/relay/turncli.c b/src/apps/relay/turncli.c
index c88b509d..e4fe656e 100644
--- a/src/apps/relay/turncli.c
+++ b/src/apps/relay/turncli.c
@@ -1239,18 +1239,6 @@ void setup_cli_thread(void)
bufferevent_enable(cliserver.in_buf, EV_READ);
}
- {
- struct bufferevent *pair[2];
-
- bufferevent_pair_new(cliserver.event_base, TURN_BUFFEREVENTS_OPTIONS, pair);
-
- cliserver.https_in_buf = pair[0];
- cliserver.https_out_buf = pair[1];
-
- bufferevent_setcb(cliserver.https_in_buf, https_cli_server_receive_message, NULL, NULL, &cliserver);
- bufferevent_enable(cliserver.https_in_buf, EV_READ);
- }
-
if(!cli_addr_set) {
if(make_ioa_addr((const u08bits*)CLI_DEFAULT_IP,0,&cli_addr)<0) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR,"Cannot set cli address %s\n",CLI_DEFAULT_IP);
@@ -1355,80 +1343,8 @@ int send_turn_session_info(struct turn_session_info* tsi)
/////////// HTTPS /////////////
-static void write_https_echo(ioa_socket_handle s)
-{
- if(s && !ioa_socket_tobeclosed(s)) {
- SOCKET_APP_TYPE sat = get_ioa_socket_app_type(s);
- if(sat == HTTPS_CLIENT_SOCKET) {
- ioa_network_buffer_handle nbh_http = ioa_network_buffer_allocate(s->e);
- size_t len_http = ioa_network_buffer_get_size(nbh_http);
- u08bits *data = ioa_network_buffer_data(nbh_http);
- char data_http[1025];
- char content_http[1025];
- const char* title = "HTTPS TURN Server";
- snprintf(content_http,sizeof(content_http)-1,"\r\n\r\n
\r\n %s\r\n \r\n \r\n %s\r\n \r\n\r\n",title,title);
- snprintf(data_http,sizeof(data_http)-1,"HTTP/1.1 200 OK\r\nServer: %s\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: %d\r\n\r\n%s",TURN_SOFTWARE,(int)strlen(content_http),content_http);
- len_http = strlen(data_http);
- ns_bcopy(data_http,data,len_http);
- ioa_network_buffer_set_size(nbh_http,len_http);
- send_data_from_ioa_socket_nbh(s, NULL, nbh_http, TTL_IGNORE, TOS_IGNORE);
- }
- }
-}
+//https://github.com/ppelleti/https-example
-static void handle_https(ioa_socket_handle s, ioa_network_buffer_handle nbh) {
- //TODO
-
- if(turn_params.verbose) {
- if(nbh) {
- TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: HTTPS connection input: %s\n", __FUNCTION__, (char*)ioa_network_buffer_data(nbh));
- } else {
- TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: HTTPS connection initial input\n", __FUNCTION__);
- }
- }
-
- write_https_echo(s);
-}
-
-static void https_input_handler(ioa_socket_handle s, int event_type, ioa_net_data *data, void *arg, int can_resume) {
-
- UNUSED_ARG(arg);
- UNUSED_ARG(s);
- UNUSED_ARG(event_type);
- UNUSED_ARG(can_resume);
-
- handle_https(s,data->nbh);
-
- ioa_network_buffer_delete(cliserver.e, data->nbh);
- data->nbh = NULL;
-}
-
-void https_cli_server_receive_message(struct bufferevent *bev, void *ptr)
-{
- UNUSED_ARG(ptr);
-
- ioa_socket_handle s= NULL;
- int n = 0;
- struct evbuffer *input = bufferevent_get_input(bev);
-
- while ((n = evbuffer_remove(input, &s, sizeof(s))) > 0) {
- if (n != sizeof(s)) {
- fprintf(stderr,"%s: Weird HTTPS CLI buffer error: size=%d\n",__FUNCTION__,n);
- continue;
- }
-
- register_callback_on_ioa_socket(cliserver.e, s, IOA_EV_READ, https_input_handler, NULL, 0);
-
- handle_https(s,NULL);
- }
-}
-
-void send_https_socket(ioa_socket_handle s) {
- struct evbuffer *output = bufferevent_get_output(cliserver.https_out_buf);
- if(output) {
- evbuffer_add(output,&s,sizeof(s));
- }
-}
///////////////////////////////
diff --git a/src/apps/relay/turncli.h b/src/apps/relay/turncli.h
index aef0e0c0..8c4490c6 100644
--- a/src/apps/relay/turncli.h
+++ b/src/apps/relay/turncli.h
@@ -59,8 +59,6 @@ struct cli_server {
struct evconnlistener *l;
struct bufferevent *in_buf;
struct bufferevent *out_buf;
- struct bufferevent *https_in_buf;
- struct bufferevent *https_out_buf;
ur_map *sessions;
pthread_t thr;
};
@@ -89,10 +87,8 @@ extern int cli_max_output_sessions;
void setup_cli_thread(void);
void cli_server_receive_message(struct bufferevent *bev, void *ptr);
-void https_cli_server_receive_message(struct bufferevent *bev, void *ptr);
int send_turn_session_info(struct turn_session_info* tsi);
-void send_https_socket(ioa_socket_handle s);
////////////////////////////////////////////
diff --git a/src/server/ns_turn_server.c b/src/server/ns_turn_server.c
index abf2909e..0823c324 100644
--- a/src/server/ns_turn_server.c
+++ b/src/server/ns_turn_server.c
@@ -4164,8 +4164,6 @@ static void client_to_be_allocated_timeout_handler(ioa_engine_handle e,
if(!s || ioa_socket_tobeclosed(s)) {
to_close = 1;
- } else if(get_ioa_socket_app_type(s) == HTTPS_CLIENT_SOCKET) {
- ;
} else {
ioa_socket_handle rs4 = ss->alloc.relay_sessions[ALLOC_IPV4_INDEX].s;
ioa_socket_handle rs6 = ss->alloc.relay_sessions[ALLOC_IPV6_INDEX].s;
@@ -4439,7 +4437,7 @@ static int read_client_connection(turn_turnserver *server,
SOCKET_APP_TYPE sat = get_ioa_socket_app_type(ss->client_socket);
int is_padding_mandatory = ((st == TCP_SOCKET)||(st==TLS_SOCKET)||(st==TENTATIVE_TCP_SOCKET));
- if(sat == HTTP_CLIENT_SOCKET) {
+ if((sat == HTTP_CLIENT_SOCKET)||(sat == HTTPS_CLIENT_SOCKET)) {
if(server->verbose) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: HTTP connection input: %s\n", __FUNCTION__, (char*)ioa_network_buffer_data(in_buffer->nbh));
@@ -4447,10 +4445,6 @@ static int read_client_connection(turn_turnserver *server,
handle_http(ss->client_socket);
- } else if(sat == HTTPS_CLIENT_SOCKET) {
-
- //???
-
} else if (stun_is_channel_message_str(ioa_network_buffer_data(in_buffer->nbh),
&blen,
&chnum,
@@ -4544,19 +4538,13 @@ static int read_client_connection(turn_turnserver *server,
proto = "HTTPS";
set_ioa_socket_app_type(ss->client_socket,HTTPS_CLIENT_SOCKET);
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: %s (%s %s) request: %s\n", __FUNCTION__, proto, get_ioa_socket_cipher(ss->client_socket), get_ioa_socket_ssl_method(ss->client_socket), (char*)ioa_network_buffer_data(in_buffer->nbh));
- if(server->send_https_socket) {
- ioa_socket_handle new_s = detach_ioa_socket(ss->client_socket);
- if(new_s) {
- server->send_https_socket(new_s);
- }
- }
} else {
set_ioa_socket_app_type(ss->client_socket,HTTP_CLIENT_SOCKET);
if(server->verbose) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: %s request: %s\n", __FUNCTION__, proto, (char*)ioa_network_buffer_data(in_buffer->nbh));
}
- handle_http(ss->client_socket);
}
+ handle_http(ss->client_socket);
return 0;
}
}
@@ -4811,7 +4799,6 @@ void init_turn_server(turn_turnserver* server,
send_socket_to_relay_cb send_socket_to_relay,
vintp secure_stun, SHATYPE shatype, vintp mobility, int server_relay,
send_turn_session_info_cb send_turn_session_info,
- send_https_socket_cb send_https_socket,
allocate_bps_cb allocate_bps_func,
int oauth, const char* oauth_server_name) {
@@ -4837,7 +4824,6 @@ void init_turn_server(turn_turnserver* server,
server->mobility = mobility;
server->server_relay = server_relay;
server->send_turn_session_info = send_turn_session_info;
- server->send_https_socket = send_https_socket;
server->oauth = oauth;
if(oauth)
server->oauth_server_name = oauth_server_name;
diff --git a/src/server/ns_turn_server.h b/src/server/ns_turn_server.h
index 75380802..3506e617 100644
--- a/src/server/ns_turn_server.h
+++ b/src/server/ns_turn_server.h
@@ -96,7 +96,6 @@ typedef int (*check_new_allocation_quota_cb)(u08bits *username, int oauth, u08bi
typedef void (*release_allocation_quota_cb)(u08bits *username, int oauth, u08bits *realm);
typedef int (*send_socket_to_relay_cb)(turnserver_id id, u64bits cid, stun_tid *tid, ioa_socket_handle s, int message_integrity, MESSAGE_TO_RELAY_TYPE rmt, ioa_net_data *nd, int can_resume);
typedef int (*send_turn_session_info_cb)(struct turn_session_info *tsi);
-typedef void (*send_https_socket_cb)(ioa_socket_handle s);
typedef band_limit_t (*allocate_bps_cb)(band_limit_t bps, int positive);
@@ -132,7 +131,6 @@ struct _turn_turnserver {
vintp no_loopback_peers;
vintp no_multicast_peers;
send_turn_session_info_cb send_turn_session_info;
- send_https_socket_cb send_https_socket;
/* RFC 6062 ==>> */
vintp no_udp_relay;
@@ -201,7 +199,6 @@ void init_turn_server(turn_turnserver* server,
vintp mobility,
int server_relay,
send_turn_session_info_cb send_turn_session_info,
- send_https_socket_cb send_https_socket,
allocate_bps_cb allocate_bps_func,
int oauth,
const char* oauth_server_name);