Commit f58fea8f737675640681bd56e1ccf40ab497353d

Authored by totoro
1 parent 747d29f6

manage the upload through the ssl_connection

Showing 1 changed file with 33 additions and 14 deletions   Show diff stats
web/CXM_multihost_http_server.anubis
@@ -3220,8 +3220,8 @@ define One @@ -3220,8 +3220,8 @@ define One
3220 3220
3221 if get_socket_from_connection(conn(connection)) is 3221 if get_socket_from_connection(conn(connection)) is
3222 { 3222 {
3223 - failure then println("can't get socket"),  
3224 - success(source) then 3223 + failure then println("can't get socket"),
  3224 + success(socket_type) then
3225 3225
3226 with tmp_body_file = "/temp/" + virtual_machine_id + "-" + now, 3226 with tmp_body_file = "/temp/" + virtual_machine_id + "-" + now,
3227 if (Maybe(RWStream))file(desc.site_directory + tmp_body_file, new) is 3227 if (Maybe(RWStream))file(desc.site_directory + tmp_body_file, new) is
@@ -3238,18 +3238,37 @@ define One @@ -3238,18 +3238,37 @@ define One
3238 { 3238 {
3239 failure then println("Can't flush the buffer"), 3239 failure then println("Can't flush the buffer"),
3240 success(_) then 3240 success(_) then
3241 - if copy_file(weaken(source), weaken(target), body_size - buffer_size) is copy_ok(read_size) then  
3242 -  
3243 - with duration = (UTime) unow - t0,  
3244 - println("Read body "+read_size+" duration: " + __utime_to_string(duration));  
3245 -  
3246 - multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s);  
3247 -  
3248 - //it's HTTP 1.1 keep-alive is default  
3249 - http_https_handler(sites, connection, is_https, dos, s)  
3250 -  
3251 - else  
3252 - println("Can't copy data from stream to temporary file ") 3241 + if socket_type is
  3242 + {
  3243 + tcp_socket(source) then
  3244 +
  3245 + if copy_file(weaken(source), weaken(target), body_size - buffer_size) is copy_ok(read_size) then
  3246 +
  3247 + with duration = (UTime) unow - t0,
  3248 + println("Read body "+read_size+" duration: " + __utime_to_string(duration));
  3249 +
  3250 + multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s);
  3251 +
  3252 + //it's HTTP 1.1 keep-alive is default
  3253 + http_https_handler(sites, connection, is_https, dos, s)
  3254 +
  3255 + else
  3256 + println("Can't copy data from stream to temporary file "),
  3257 +
  3258 + ssl_socket(source) then
  3259 + if copy_file(source, weaken(target), body_size - buffer_size) is copy_ok(read_size) then
  3260 +
  3261 + with duration = (UTime) unow - t0,
  3262 + println("Read body "+read_size+" duration: " + __utime_to_string(duration));
  3263 +
  3264 + multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s);
  3265 +
  3266 + //it's HTTP 1.1 keep-alive is default
  3267 + http_https_handler(sites, connection, is_https, dos, s)
  3268 +
  3269 + else
  3270 + println("Can't copy data from stream to temporary file ")
  3271 + }
3253 }}} 3272 }}}
3254 else 3273 else
3255 println("body_size = 0 !") 3274 println("body_size = 0 !")