Commit b28918c247c1958729a719fab28c87896bf8da58

Authored by David RENÉ
2 parents 068d7940 25741a80

Merge branch 'release/ANUBIS_1_17' into release/ANUBIS_1_14

generic/session.anubis
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 */ 7 */
8 8
9 transmit xlib/generic/types/session.anubis 9 transmit xlib/generic/types/session.anubis
  10 +read system/data_io.anubis
10 11
11 public define Var(List(Session_Field)) 12 public define Var(List(Session_Field))
12 empty_fields_list = 13 empty_fields_list =
@@ -32,7 +33,7 @@ public define Var(List(Session_Field)) @@ -32,7 +33,7 @@ public define Var(List(Session_Field))
32 bool(v) then bool(v), 33 bool(v) then bool(v),
33 int(v) then int(v), 34 int(v) then int(v),
34 db_id(v) then db_id(v), 35 db_id(v) then db_id(v),
35 - message(v) then message(v), 36 + message(v) then message(if unflatten_message(make_data_io(v)) is {failure then message(0), success(msg) then msg}),
36 byte_array(v) then byte_array(v), 37 byte_array(v) then byte_array(v),
37 float(v) then float(v), 38 float(v) then float(v),
38 word128(v) then word128(v), 39 word128(v) then word128(v),
@@ -61,7 +62,7 @@ public define List(Session_Field_No_Var) @@ -61,7 +62,7 @@ public define List(Session_Field_No_Var)
61 bool(v) then bool(v), 62 bool(v) then bool(v),
62 int(v) then int(v), 63 int(v) then int(v),
63 db_id(v) then db_id(v), 64 db_id(v) then db_id(v),
64 - message(v) then message(v), 65 + message(v) then message(if flatten_message(v) is {failure then constant_byte_array(0,0), success(ba) then ba}),
65 byte_array(v) then byte_array(v), 66 byte_array(v) then byte_array(v),
66 float(v) then float(v), 67 float(v) then float(v),
67 word128(v) then word128(v), 68 word128(v) then word128(v),
generic/types/session.anubis
@@ -35,7 +35,7 @@ public type Session_Field_Datum_No_Var: @@ -35,7 +35,7 @@ public type Session_Field_Datum_No_Var:
35 bool(Bool), //fully implented 35 bool(Bool), //fully implented
36 int(Int), //fully implemented 36 int(Int), //fully implemented
37 db_id(DB_id), 37 db_id(DB_id),
38 - message(Message), //fully implemented 38 + message(ByteArray), //fully implemented
39 byte_array(ByteArray), 39 byte_array(ByteArray),
40 float(Float), 40 float(Float),
41 word128(Word128), 41 word128(Word128),
mail/lexers/fqa.anubis
@@ -189,6 +189,7 @@ public define (LM_LexerState_FQA,LM_TokenOrError_FQA) @@ -189,6 +189,7 @@ public define (LM_LexerState_FQA,LM_TokenOrError_FQA)
189 then email_tester_state_3(clear_abol(ls)) else 189 then email_tester_state_3(clear_abol(ls)) else
190 if lm_next_char(ls) is (_ls,c) then 190 if lm_next_char(ls) is (_ls,c) then
191 if c = -1 then email_tester_state_1(_ls) else 191 if c = -1 then email_tester_state_1(_ls) else
  192 + if c = 43 then email_tester_state_4(_ls) else
192 if c = 45 then email_tester_state_4(_ls) else 193 if c = 45 then email_tester_state_4(_ls) else
193 if (48 +=< c & c +=< 57) then email_tester_state_4(_ls) else 194 if (48 +=< c & c +=< 57) then email_tester_state_4(_ls) else
194 if (65 +=< c & c +=< 90) then email_tester_state_4(_ls) else 195 if (65 +=< c & c +=< 90) then email_tester_state_4(_ls) else
@@ -232,6 +233,7 @@ define (LM_LexerState_FQA,LM_TokenOrError_FQA) @@ -232,6 +233,7 @@ define (LM_LexerState_FQA,LM_TokenOrError_FQA)
232 LM_LexerState_FQA ls, 233 LM_LexerState_FQA ls,
233 ) = 234 ) =
234 if lm_next_char(ls) is (_ls,c) then 235 if lm_next_char(ls) is (_ls,c) then
  236 + if c = 43 then email_tester_state_4(_ls) else
235 if c = 45 then email_tester_state_4(_ls) else 237 if c = 45 then email_tester_state_4(_ls) else
236 if c = 46 then email_tester_state_5(_ls) else 238 if c = 46 then email_tester_state_5(_ls) else
237 if (48 +=< c & c +=< 57) then email_tester_state_4(_ls) else 239 if (48 +=< c & c +=< 57) then email_tester_state_4(_ls) else
@@ -248,6 +250,7 @@ define (LM_LexerState_FQA,LM_TokenOrError_FQA) @@ -248,6 +250,7 @@ define (LM_LexerState_FQA,LM_TokenOrError_FQA)
248 LM_LexerState_FQA ls, 250 LM_LexerState_FQA ls,
249 ) = 251 ) =
250 if lm_next_char(ls) is (_ls,c) then 252 if lm_next_char(ls) is (_ls,c) then
  253 + if c = 43 then email_tester_state_6(_ls) else
251 if c = 45 then email_tester_state_6(_ls) else 254 if c = 45 then email_tester_state_6(_ls) else
252 if (48 +=< c & c +=< 57) then email_tester_state_6(_ls) else 255 if (48 +=< c & c +=< 57) then email_tester_state_6(_ls) else
253 if (65 +=< c & c +=< 90) then email_tester_state_6(_ls) else 256 if (65 +=< c & c +=< 90) then email_tester_state_6(_ls) else
@@ -262,6 +265,7 @@ define (LM_LexerState_FQA,LM_TokenOrError_FQA) @@ -262,6 +265,7 @@ define (LM_LexerState_FQA,LM_TokenOrError_FQA)
262 LM_LexerState_FQA ls, 265 LM_LexerState_FQA ls,
263 ) = 266 ) =
264 if lm_next_char(ls) is (_ls,c) then 267 if lm_next_char(ls) is (_ls,c) then
  268 + if c = 43 then email_tester_state_6(_ls) else
265 if c = 45 then email_tester_state_6(_ls) else 269 if c = 45 then email_tester_state_6(_ls) else
266 if c = 46 then email_tester_state_5(_ls) else 270 if c = 46 then email_tester_state_5(_ls) else
267 if (48 +=< c & c +=< 57) then email_tester_state_6(_ls) else 271 if (48 +=< c & c +=< 57) then email_tester_state_6(_ls) else
web/CXM_making_a_web_site.anubis
@@ -3006,13 +3006,12 @@ public define Start_Web_Sites_Result @@ -3006,13 +3006,12 @@ public define Start_Web_Sites_Result
3006 with http_server_r = 3006 with http_server_r =
3007 start_http_server(ip_address,http_port, 3007 start_http_server(ip_address,http_port,
3008 map(get_description,web_sites), 3008 map(get_description,web_sites),
3009 - load_denial_of_service_info, 3009 + //load_denial_of_service_info,
3010 shutdown_required), 3010 shutdown_required),
3011 with https_server_r = 3011 with https_server_r =
3012 start_https_server(ip_address,https_port, 3012 start_https_server(ip_address,https_port,
3013 ssl_certificate_common_name, 3013 ssl_certificate_common_name,
3014 map(get_description,web_sites), 3014 map(get_description,web_sites),
3015 - load_denial_of_service_info,  
3016 shutdown_required), 3015 shutdown_required),
3017 if http_server_r is ok(http_server) 3016 if http_server_r is ok(http_server)
3018 then 3017 then
web/CXM_multihost_http_server.anubis
@@ -351,8 +351,8 @@ public define StartServerResult @@ -351,8 +351,8 @@ public define StartServerResult
351 ( 351 (
352 Word32 ip_address, 352 Word32 ip_address,
353 Word32 http_port, 353 Word32 http_port,
354 - List(Web_Site_Description) web_sites,  
355 - DenialOfService dos 354 + List(Web_Site_Description) web_sites
  355 + //DenialOfService dos
356 ). 356 ).
357 357
358 public define StartServerResult 358 public define StartServerResult
@@ -361,8 +361,8 @@ public define StartServerResult @@ -361,8 +361,8 @@ public define StartServerResult
361 Word32 ip_address, 361 Word32 ip_address,
362 Word32 https_port, 362 Word32 https_port,
363 String certificate_common_name, 363 String certificate_common_name,
364 - List(Web_Site_Description) web_sites,  
365 - DenialOfService dos 364 + List(Web_Site_Description) web_sites
  365 + //DenialOfService dos
366 ). 366 ).
367 367
368 The first argument 'ip_address' is the IP address on which the servers listen. If you 368 The first argument 'ip_address' is the IP address on which the servers listen. If you
@@ -2509,8 +2509,8 @@ define One @@ -2509,8 +2509,8 @@ define One
2509 Word32 ip_addr, // of the client 2509 Word32 ip_addr, // of the client
2510 HTTP_Request_Line request_line, 2510 HTTP_Request_Line request_line,
2511 List(HTTP_header) headers, 2511 List(HTTP_header) headers,
2512 - ByteArray body,  
2513 - One -> String generate_tt // trust ticket generation 2512 + ByteArray body
  2513 + //One -> String generate_tt // trust ticket generation
2514 ) = 2514 ) =
2515 with all_web_args = query_string(request_line) + 2515 with all_web_args = query_string(request_line) +
2516 read_www_url_encoded_web_args(to_string(body),0), 2516 read_www_url_encoded_web_args(to_string(body),0),
@@ -3014,7 +3014,6 @@ define One @@ -3014,7 +3014,6 @@ define One
3014 HTTP_Request_Line request_line, 3014 HTTP_Request_Line request_line,
3015 List(HTTP_header) headers, 3015 List(HTTP_header) headers,
3016 String body_temp_file, 3016 String body_temp_file,
3017 - One -> String generate_tt,  
3018 SState s 3017 SState s
3019 ) = 3018 ) =
3020 if get_boundary(headers) is 3019 if get_boundary(headers) is
@@ -3285,7 +3284,7 @@ define Maybe((String,Web_Site_Description)) @@ -3285,7 +3284,7 @@ define Maybe((String,Web_Site_Description))
3285 3284
3286 3285
3287 3286
3288 -define One -> String make_generate_trust_ticket(DenialOfService dos). 3287 + define One -> String make_generate_trust_ticket(DenialOfService dos).
3289 3288
3290 define One 3289 define One
3291 http_https_handler 3290 http_https_handler
@@ -3293,7 +3292,6 @@ define One @@ -3293,7 +3292,6 @@ define One
3293 List(Web_Site_Description) sites, 3292 List(Web_Site_Description) sites,
3294 HTTP_Buffered_Connection connection, 3293 HTTP_Buffered_Connection connection,
3295 Bool is_https, 3294 Bool is_https,
3296 - DenialOfService dos,  
3297 SState s, 3295 SState s,
3298 (One) -> Bool shutdown_required 3296 (One) -> Bool shutdown_required
3299 ) = 3297 ) =
@@ -3305,7 +3303,7 @@ define One @@ -3305,7 +3303,7 @@ define One
3305 println("shutdown required on http_https_handler"); 3303 println("shutdown required on http_https_handler");
3306 unique 3304 unique
3307 else 3305 else
3308 - if dos is denial_of_service(mc_v,rld_v,hd_v,ad_v,ld_v,ra_v) then 3306 + //if dos is denial_of_service(mc_v,rld_v,hd_v,ad_v,ld_v,ra_v) then
3309 if remote_IP_address_and_port(connection.conn) is (ip_addr,port) then 3307 if remote_IP_address_and_port(connection.conn) is (ip_addr,port) then
3310 if read_request_line(connection) is 3308 if read_request_line(connection) is
3311 { 3309 {
@@ -3330,7 +3328,7 @@ define One @@ -3330,7 +3328,7 @@ define One
3330 3328
3331 //Get the type of encoding which decide if we read the content in ByteArray for www_url or in 3329 //Get the type of encoding which decide if we read the content in ByteArray for www_url or in
3332 //temporary file for multipart. 3330 //temporary file for multipart.
3333 - with generate_tt = make_generate_trust_ticket(dos), 3331 + //with generate_tt = make_generate_trust_ticket(dos),
3334 if get_encoding_type(headers) is 3332 if get_encoding_type(headers) is
3335 { 3333 {
3336 //WWW_URL 3334 //WWW_URL
@@ -3340,9 +3338,9 @@ define One @@ -3340,9 +3338,9 @@ define One
3340 error(msg) then log_journal_msg(desc,format(msg)), 3338 error(msg) then log_journal_msg(desc,format(msg)),
3341 ok(body) then 3339 ok(body) then
3342 //HERE produce the answer of the server 3340 //HERE produce the answer of the server
3343 - www_url_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, body, generate_tt); 3341 + www_url_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, body);
3344 //it's HTTP 1.1 keep-alive is default 3342 //it's HTTP 1.1 keep-alive is default
3345 - http_https_handler(sites, connection, is_https, dos, s, shutdown_required) 3343 + http_https_handler(sites, connection, is_https, s, shutdown_required)
3346 } 3344 }
3347 3345
3348 //MULTIPART_FORM_DATA 3346 //MULTIPART_FORM_DATA
@@ -3380,10 +3378,10 @@ define One @@ -3380,10 +3378,10 @@ define One
3380 with duration = (UTime) unow - t0, 3378 with duration = (UTime) unow - t0,
3381 println("Read body "+read_size+" duration: " + __utime_to_string(duration)); 3379 println("Read body "+read_size+" duration: " + __utime_to_string(duration));
3382 3380
3383 - multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s); 3381 + multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, s);
3384 3382
3385 //it's HTTP 1.1 keep-alive is default 3383 //it's HTTP 1.1 keep-alive is default
3386 - http_https_handler(sites, connection, is_https, dos, s, shutdown_required) 3384 + http_https_handler(sites, connection, is_https, s, shutdown_required)
3387 3385
3388 else 3386 else
3389 println("Can't copy data from stream to temporary file "), 3387 println("Can't copy data from stream to temporary file "),
@@ -3394,10 +3392,10 @@ define One @@ -3394,10 +3392,10 @@ define One
3394 with duration = (UTime) unow - t0, 3392 with duration = (UTime) unow - t0,
3395 println("Read body "+read_size+" duration: " + __utime_to_string(duration)); 3393 println("Read body "+read_size+" duration: " + __utime_to_string(duration));
3396 3394
3397 - multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s); 3395 + multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, s);
3398 3396
3399 //it's HTTP 1.1 keep-alive is default 3397 //it's HTTP 1.1 keep-alive is default
3400 - http_https_handler(sites, connection, is_https, dos, s, shutdown_required) 3398 + http_https_handler(sites, connection, is_https, s, shutdown_required)
3401 3399
3402 else 3400 else
3403 println("Can't copy data from stream to temporary file ") 3401 println("Can't copy data from stream to temporary file ")
@@ -3427,48 +3425,46 @@ define One @@ -3427,48 +3425,46 @@ define One
3427 Below are the two tools for constructing the handlers required by 'start_server' and 3425 Below are the two tools for constructing the handlers required by 'start_server' and
3428 'start_ssl_server' (see 'predefined.anubis'). 3426 'start_ssl_server' (see 'predefined.anubis').
3429 3427
3430 -define Bool is_dubious_IP(Word32 ip, DenialOfService dos). 3428 + define Bool is_dubious_IP(Word32 ip, DenialOfService dos).
3431 3429
3432 define Server -> ((RWStream) -> One) 3430 define Server -> ((RWStream) -> One)
3433 make_http_handler 3431 make_http_handler
3434 ( 3432 (
3435 List(Web_Site_Description) sites, 3433 List(Web_Site_Description) sites,
3436 - DenialOfService dos,  
3437 (One) -> Bool shutdown_required 3434 (One) -> Bool shutdown_required
3438 ) = 3435 ) =
3439 (Server server) |-> (RWStream conn) |-> 3436 (Server server) |-> (RWStream conn) |->
3440 if remote_IP_address_and_port(conn) is (addr,_) then 3437 if remote_IP_address_and_port(conn) is (addr,_) then
3441 - if is_dubious_IP(addr,dos)  
3442 - then print("Rejecting dubious IP address "+ip_addr_to_string(addr)+"\n")  
3443 - else 3438 +// if is_dubious_IP(addr,dos)
  3439 +// then print("Rejecting dubious IP address "+ip_addr_to_string(addr)+"\n")
  3440 +// else
3444 with connection = http_buffered_connection(tcp(conn), var(constant_byte_array(0, 0)), var(0), var([])), 3441 with connection = http_buffered_connection(tcp(conn), var(constant_byte_array(0, 0)), var(0), var([])),
3445 - http_https_handler(sites, connection, false, dos, sstate(var(0),var(0)), shutdown_required). 3442 + http_https_handler(sites, connection, false, sstate(var(0),var(0)), shutdown_required).
  3443 +
3446 public define One 3444 public define One
3447 http_direct_handler 3445 http_direct_handler
3448 ( 3446 (
3449 List(Web_Site_Description) sites, 3447 List(Web_Site_Description) sites,
3450 RWStream conn, 3448 RWStream conn,
3451 - DenialOfService dos,  
3452 (One) -> Bool shutdown_required 3449 (One) -> Bool shutdown_required
3453 ) = 3450 ) =
3454 if remote_IP_address_and_port(conn) is (addr,_) then 3451 if remote_IP_address_and_port(conn) is (addr,_) then
3455 - if is_dubious_IP(addr,dos)  
3456 - then print("Rejecting dubious IP address "+ip_addr_to_string(addr)+"\n")  
3457 - else 3452 +// if is_dubious_IP(addr,dos)
  3453 +// then print("Rejecting dubious IP address "+ip_addr_to_string(addr)+"\n")
  3454 +// else
3458 with connection = http_buffered_connection(tcp(conn), var(constant_byte_array(0, 0)), var(0), var([])), 3455 with connection = http_buffered_connection(tcp(conn), var(constant_byte_array(0, 0)), var(0), var([])),
3459 - http_https_handler(sites, connection, false, dos, sstate(var(0),var(0)), shutdown_required). 3456 + http_https_handler(sites, connection, false, sstate(var(0),var(0)), shutdown_required).
3460 3457
3461 3458
3462 define Server -> (SSL_Connection -> One) 3459 define Server -> (SSL_Connection -> One)
3463 make_https_handler 3460 make_https_handler
3464 ( 3461 (
3465 List(Web_Site_Description) sites, 3462 List(Web_Site_Description) sites,
3466 - DenialOfService dos,  
3467 (One) -> Bool shutdown_required 3463 (One) -> Bool shutdown_required
3468 ) = 3464 ) =
3469 (Server server) |-> (SSL_Connection conn) |-> 3465 (Server server) |-> (SSL_Connection conn) |->
3470 with connection = http_buffered_connection(ssl(conn), var(constant_byte_array(0, 0)), var(0), var([])), 3466 with connection = http_buffered_connection(ssl(conn), var(constant_byte_array(0, 0)), var(0), var([])),
3471 - http_https_handler(sites, connection, true, dos, sstate(var(0),var(0)), shutdown_required). 3467 + http_https_handler(sites, connection, true, sstate(var(0),var(0)), shutdown_required).
3472 3468
3473 3469
3474 3470
@@ -3599,7 +3595,7 @@ define One @@ -3599,7 +3595,7 @@ define One
3599 record_dubious_IP(addr,list_of_dubious(dos)). 3595 record_dubious_IP(addr,list_of_dubious(dos)).
3600 3596
3601 3597
3602 -public define DenialOfService 3598 + public define DenialOfService
3603 load_denial_of_service_info 3599 load_denial_of_service_info
3604 = 3600 =
3605 if (RetrieveResult(DenialOfService))retrieve(my_anubis_directory+"/web_sites/dos_info") is 3601 if (RetrieveResult(DenialOfService))retrieve(my_anubis_directory+"/web_sites/dos_info") is
@@ -3732,8 +3728,8 @@ define StartServerResult @@ -3732,8 +3728,8 @@ define StartServerResult
3732 Word32 ip_address, 3728 Word32 ip_address,
3733 Word32 port, 3729 Word32 port,
3734 Server -> ((RWStream) -> One) handler, 3730 Server -> ((RWStream) -> One) handler,
3735 - Int retries,  
3736 - DenialOfService dos 3731 + Int retries
  3732 + //DenialOfService dos
3737 ) = 3733 ) =
3738 if start_server(ip_address, 3734 if start_server(ip_address,
3739 port, 3735 port,
@@ -3743,7 +3739,7 @@ define StartServerResult @@ -3743,7 +3739,7 @@ define StartServerResult
3743 ok(server) 3739 ok(server)
3744 else print("Port "+port+": retry number "+retries+"\r"); 3740 else print("Port "+port+": retry number "+retries+"\r");
3745 sleep(1000); 3741 sleep(1000);
3746 - start_http_server(ip_address,port,handler,retries+1,dos). 3742 + start_http_server(ip_address,port,handler,retries+1).
3747 3743
3748 public define StartServerResult 3744 public define StartServerResult
3749 start_http_server 3745 start_http_server
@@ -3751,14 +3747,12 @@ public define StartServerResult @@ -3751,14 +3747,12 @@ public define StartServerResult
3751 Word32 ip_address, 3747 Word32 ip_address,
3752 Word32 port, 3748 Word32 port,
3753 List(Web_Site_Description) sites, 3749 List(Web_Site_Description) sites,
3754 - DenialOfService dos,  
3755 (One) -> Bool shutdown_required 3750 (One) -> Bool shutdown_required
3756 ) = 3751 ) =
3757 create_directories(sites); 3752 create_directories(sites);
3758 start_http_server(ip_address,port, 3753 start_http_server(ip_address,port,
3759 - make_http_handler(sites, dos, shutdown_required),  
3760 - 0,  
3761 - dos). 3754 + make_http_handler(sites, shutdown_required),
  3755 + 0).
3762 3756
3763 3757
3764 For the HTTPS server, we have a problem which is due to the fact that 'anbexec' is not 3758 For the HTTPS server, we have a problem which is due to the fact that 'anbexec' is not
@@ -3775,8 +3769,7 @@ define StartServerResult @@ -3775,8 +3769,7 @@ define StartServerResult
3775 Word32 port, 3769 Word32 port,
3776 String certificate_common_name, 3770 String certificate_common_name,
3777 Server -> (SSL_Connection -> One) handler, 3771 Server -> (SSL_Connection -> One) handler,
3778 - Int retries,  
3779 - DenialOfService dos 3772 + Int retries
3780 ) = 3773 ) =
3781 if start_ssl_server(ip_address, 3774 if start_ssl_server(ip_address,
3782 port, 3775 port,
@@ -3789,8 +3782,7 @@ define StartServerResult @@ -3789,8 +3782,7 @@ define StartServerResult
3789 sleep(1000); 3782 sleep(1000);
3790 start_https_server(ip_address,port, 3783 start_https_server(ip_address,port,
3791 certificate_common_name, 3784 certificate_common_name,
3792 - handler,retries+1,  
3793 - dos). 3785 + handler,retries+1).
3794 3786
3795 3787
3796 public define StartServerResult 3788 public define StartServerResult
@@ -3800,13 +3792,12 @@ public define StartServerResult @@ -3800,13 +3792,12 @@ public define StartServerResult
3800 Word32 port, 3792 Word32 port,
3801 String certificate_common_name, // of SSL server certificate 3793 String certificate_common_name, // of SSL server certificate
3802 List(Web_Site_Description) sites, 3794 List(Web_Site_Description) sites,
3803 - DenialOfService dos,  
3804 (One) -> Bool shutdown_required 3795 (One) -> Bool shutdown_required
3805 ) = 3796 ) =
3806 create_directories(sites); 3797 create_directories(sites);
3807 start_https_server(ip_address,port,certificate_common_name, 3798 start_https_server(ip_address,port,certificate_common_name,
3808 - make_https_handler(sites, dos, shutdown_required),  
3809 - 0,dos). 3799 + make_https_handler(sites, shutdown_required),
  3800 + 0).
3810 3801
3811 3802
3812 3803