http code cleaning
This commit is contained in:
parent
d2922f53fc
commit
849e67269e
@ -30,12 +30,12 @@
|
||||
|
||||
#include "ns_ioalib_impl.h"
|
||||
|
||||
void write_http_echo(ts_ur_super_session *ss)
|
||||
void write_http_echo(ioa_socket_handle s)
|
||||
{
|
||||
if(ss && ss->client_socket && !(ss->to_be_closed)) {
|
||||
turn_turnserver *server = (turn_turnserver *)ss->server;
|
||||
if(server) {
|
||||
ioa_network_buffer_handle nbh_http = ioa_network_buffer_allocate(server->e);
|
||||
if(s && !ioa_socket_tobeclosed(s)) {
|
||||
SOCKET_APP_TYPE sat = get_ioa_socket_app_type(s);
|
||||
if((sat == HTTP_CLIENT_SOCKET) || (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];
|
||||
@ -46,13 +46,13 @@ void write_http_echo(ts_ur_super_session *ss)
|
||||
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(ss->client_socket, NULL, nbh_http, TTL_IGNORE, TOS_IGNORE);
|
||||
send_data_from_ioa_socket_nbh(s, NULL, nbh_http, TTL_IGNORE, TOS_IGNORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handle_https(ts_ur_super_session *ss, ioa_network_buffer_handle nbh) {
|
||||
void handle_https(ioa_socket_handle s, ioa_network_buffer_handle nbh) {
|
||||
//TODO
|
||||
UNUSED_ARG(nbh);
|
||||
write_http_echo(ss);
|
||||
write_http_echo(s);
|
||||
}
|
||||
|
||||
@ -278,8 +278,8 @@ int get_default_protocol_port(const char* scheme, size_t slen);
|
||||
|
||||
///////////// HTTP ////////////////////
|
||||
|
||||
void write_http_echo(ts_ur_super_session *ss);
|
||||
void handle_https(ts_ur_super_session *ss, ioa_network_buffer_handle nbh);
|
||||
void write_http_echo(ioa_socket_handle s);
|
||||
void handle_https(ioa_socket_handle s, ioa_network_buffer_handle nbh);
|
||||
|
||||
///////////////////////////////////////
|
||||
|
||||
|
||||
@ -4442,12 +4442,12 @@ static int read_client_connection(turn_turnserver *server,
|
||||
if(sat == HTTP_CLIENT_SOCKET) {
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: HTTP connection input: %s\n", __FUNCTION__, (char*)ioa_network_buffer_data(in_buffer->nbh));
|
||||
write_http_echo(ss);
|
||||
write_http_echo(ss->client_socket);
|
||||
|
||||
} else if(sat == HTTPS_CLIENT_SOCKET) {
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: HTTPS connection input: %s\n", __FUNCTION__, (char*)ioa_network_buffer_data(in_buffer->nbh));
|
||||
handle_https(ss,in_buffer->nbh);
|
||||
handle_https(ss->client_socket,in_buffer->nbh);
|
||||
|
||||
} else if (stun_is_channel_message_str(ioa_network_buffer_data(in_buffer->nbh),
|
||||
&blen,
|
||||
@ -4542,11 +4542,11 @@ 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));
|
||||
handle_https(ss,in_buffer->nbh);
|
||||
handle_https(ss->client_socket,in_buffer->nbh);
|
||||
} else {
|
||||
set_ioa_socket_app_type(ss->client_socket,HTTP_CLIENT_SOCKET);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: %s request: %s\n", __FUNCTION__, proto, (char*)ioa_network_buffer_data(in_buffer->nbh));
|
||||
write_http_echo(ss);
|
||||
write_http_echo(ss->client_socket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user