diff --git a/web/CXM_multihost_http_server.anubis b/web/CXM_multihost_http_server.anubis index f57cc0f..d869c5a 100644 --- a/web/CXM_multihost_http_server.anubis +++ b/web/CXM_multihost_http_server.anubis @@ -3220,8 +3220,8 @@ define One if get_socket_from_connection(conn(connection)) is { - failure then println("can't get socket"), - success(source) then + failure then println("can't get socket"), + success(socket_type) then with tmp_body_file = "/temp/" + virtual_machine_id + "-" + now, if (Maybe(RWStream))file(desc.site_directory + tmp_body_file, new) is @@ -3238,18 +3238,37 @@ define One { failure then println("Can't flush the buffer"), success(_) then - if copy_file(weaken(source), weaken(target), body_size - buffer_size) is copy_ok(read_size) then - - with duration = (UTime) unow - t0, - println("Read body "+read_size+" duration: " + __utime_to_string(duration)); - - multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s); - - //it's HTTP 1.1 keep-alive is default - http_https_handler(sites, connection, is_https, dos, s) - - else - println("Can't copy data from stream to temporary file ") + if socket_type is + { + tcp_socket(source) then + + if copy_file(weaken(source), weaken(target), body_size - buffer_size) is copy_ok(read_size) then + + with duration = (UTime) unow - t0, + println("Read body "+read_size+" duration: " + __utime_to_string(duration)); + + multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s); + + //it's HTTP 1.1 keep-alive is default + http_https_handler(sites, connection, is_https, dos, s) + + else + println("Can't copy data from stream to temporary file "), + + ssl_socket(source) then + if copy_file(source, weaken(target), body_size - buffer_size) is copy_ok(read_size) then + + with duration = (UTime) unow - t0, + println("Read body "+read_size+" duration: " + __utime_to_string(duration)); + + multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s); + + //it's HTTP 1.1 keep-alive is default + http_https_handler(sites, connection, is_https, dos, s) + + else + println("Can't copy data from stream to temporary file ") + } }}} else println("body_size = 0 !") -- libgit2 0.21.4