|
|
| version 1.2, 2026/10/16 15:16:21 | version 1.3, 2026/10/27 23:05:00 |
|---|---|
| Line 53 static WebSocket& get_accepted_websocket | Line 53 static WebSocket& get_accepted_websocket |
| return result; | return result; |
| } | } |
| /// the timer is stopped while waiting for the message (not response time) and then started from scratch | |
| class Temp_disable_response_timeout { | |
| Request& r; | |
| public: | |
| Temp_disable_response_timeout(Request& ar) : r(ar) { SAPI::set_response_timeout(r.sapi_info, 0); } | |
| ~Temp_disable_response_timeout() { SAPI::set_response_timeout(r.sapi_info, r.response.timeout); } | |
| }; | |
| // text goes in UTF-8 and the string is in the source charset, tainted data is untainted as in the response | // text goes in UTF-8 and the string is in the source charset, tainted data is untainted as in the response |
| static String::C to_utf8(Request& r, const String& string) { | static String::C to_utf8(Request& r, const String& string) { |
| String::Body body=string.cstr_to_string_body_untaint(r.response.lang, r.connection(false), &r.charsets); | String::Body body=string.cstr_to_string_body_untaint(r.response.lang, r.connection(false), &r.charsets); |
| Line 92 static void _receive(Request& r, MethodP | Line 100 static void _receive(Request& r, MethodP |
| throw Exception(PARSER_RUNTIME, 0, "timeout must not be negative"); | throw Exception(PARSER_RUNTIME, 0, "timeout must not be negative"); |
| WebSocket::Message message; | WebSocket::Message message; |
| if(!websocket.receive(timeout*1000 < INT_MAX ? (int)(timeout*1000) : INT_MAX, message)) { | bool received; |
| { | |
| Temp_disable_response_timeout temp(r); | |
| received=websocket.receive(timeout*1000 < INT_MAX ? (int)(timeout*1000) : INT_MAX, message); | |
| } | |
| if(!received) { | |
| r.write(*VVoid::get()); | r.write(*VVoid::get()); |
| return; | return; |
| } | } |