Initial Websocket and Bugfix for prototype support

This commit is contained in:
René Linder 2023-03-31 10:40:32 +02:00
parent 194245d3b6
commit 8574b29021
1 changed files with 154 additions and 122 deletions

View File

@ -677,6 +677,36 @@ Module lhs_web
;{
ldl::Logging(#http_method_get)
;*
;* Detect websocket upgrade request
;*
If LCase(Header(lhs_web_helper::#http_head_connection)) = lhs_web_helper::#http_connection_upgrade
;Whe have a Upgrade Request.
;Current Disconnect it with not supported
response_status = lhs_web_helper::#http_state_501
thread_type = lhs_web_helper::mimetype("html")
thread_temp_cache_memory = AllocateMemory(StringByteLength("Unsuported"))
PokeS(thread_temp_cache_memory, "Unsuported")
thread_data_size = StringByteLength("Unsuported")
If response_status = "" ;Remove if finished...
;detect a route to there.
If Left(Header(#http_head_request),2) = "ws"
;Whe have a websocket request.
;Detect if whe have a library who react to there:
ToCallType = call_request(Host_call + thread_requested, #get_handler_prototype)
If ToCallType = #handler_proto_i_get Or ToCallType = #handler_proto_get
EndIf
EndIf
EndIf
Else
If Header(#http_head_request) = "/"
thread_requested = default_file
Else
@ -685,7 +715,7 @@ Module lhs_web
ldl::Logging("Requested:"+thread_requested)
ToCallType = call_request(Host_call + thread_requested, #get_handler_prototype)
If ToCallType = #handler_proto_universal Or ToCallType = #handler_proto_get
If ToCallType = #handler_proto_universal Or ToCallType = #handler_proto_get Or ToCallType = #handler_proto_i_universal Or ToCallType = #handler_proto_i_get
ToCall = call_request(Host_call + thread_requested)
If call_request(Host_call + thread_requested, #get_handler_library_perm) = 0
LibraryToCall = call_request_string(Host_call + thread_requested, #get_handler_library_perm)
@ -812,6 +842,8 @@ Module lhs_web
;}
EndIf
EndIf
;}
Case #http_method_post
@ -859,7 +891,7 @@ Module lhs_web
EndIf
ldl::Logging("Requested:"+thread_requested)
ToCallType = call_request(Host_call+thread_requested, #get_handler_prototype)
If ToCallType = #handler_proto_universal Or ToCallType = #handler_proto_post
If ToCallType = #handler_proto_universal Or ToCallType = #handler_proto_post Or ToCallType = #handler_proto_i_universal Or ToCallType = #handler_proto_i_post
ToCall = call_request(Host_call + thread_requested)
ldl::Logging("A To Call is found:"+Str(ToCall))
If call_request(Host_call + thread_requested, #get_handler_library_perm) = 0