TLS Bugfixes
Now a SpiderBasic App could be run.
This commit is contained in:
parent
843ab8a433
commit
fc41d38004
1 changed files with 34 additions and 7 deletions
41
lweb.pbi
41
lweb.pbi
|
@ -39,7 +39,7 @@ Module lhs_web
|
||||||
Global.i conf_cache_time = 120 ;120Sekunden
|
Global.i conf_cache_time = 120 ;120Sekunden
|
||||||
Global.i conf_cache_maxsize = 1 ;1 Mbyte
|
Global.i conf_cache_maxsize = 1 ;1 Mbyte
|
||||||
Global.i conf_cache_current = 0
|
Global.i conf_cache_current = 0
|
||||||
Global.i conf_cache_enable = 1
|
Global.i conf_cache_enable = 0
|
||||||
Global.i conf_TLS_Port = 8443
|
Global.i conf_TLS_Port = 8443
|
||||||
Global.s conf_TLS_binding = "127.0.0.1"
|
Global.s conf_TLS_binding = "127.0.0.1"
|
||||||
Global.i conf_TLS_enable = 0 ;SSL Server
|
Global.i conf_TLS_enable = 0 ;SSL Server
|
||||||
|
@ -431,6 +431,7 @@ Module lhs_web
|
||||||
Protected thread_data_size, thread_file_handle
|
Protected thread_data_size, thread_file_handle
|
||||||
Protected.s thread_requested, thread_type, thread_date, thread_header, thread_work, JSONStringToMap, Handler_Response, response_status, PostMapString
|
Protected.s thread_requested, thread_type, thread_date, thread_header, thread_work, JSONStringToMap, Handler_Response, response_status, PostMapString
|
||||||
Protected thread_buffer, thread_buffer_offset, thread_buffer_length, buffer_sent
|
Protected thread_buffer, thread_buffer_offset, thread_buffer_length, buffer_sent
|
||||||
|
Protected sent_length, sent_buffer_address, sent_total
|
||||||
Protected.b thread_alive = #True, error_message = #False
|
Protected.b thread_alive = #True, error_message = #False
|
||||||
Define NewMap Header.s()
|
Define NewMap Header.s()
|
||||||
Define NewMap Response.s()
|
Define NewMap Response.s()
|
||||||
|
@ -527,7 +528,7 @@ Module lhs_web
|
||||||
|
|
||||||
thread_work = PeekS(m_clients(Str(thread_cli_id))\datenbuffer()\Buffer, m_clients(Str(thread_cli_id))\datenbuffer()\Size, #PB_Ascii)
|
thread_work = PeekS(m_clients(Str(thread_cli_id))\datenbuffer()\Buffer, m_clients(Str(thread_cli_id))\datenbuffer()\Size, #PB_Ascii)
|
||||||
;Header to Map
|
;Header to Map
|
||||||
Debug "Datenbuffer:"+ Mid(thread_work,1,256)
|
;Debug "Datenbuffer:"+ Mid(thread_work,1,256)
|
||||||
JSONStringToMap = Work_Header_to_JSONMap(thread_work)
|
JSONStringToMap = Work_Header_to_JSONMap(thread_work)
|
||||||
If JSONStringToMap <> #error_string
|
If JSONStringToMap <> #error_string
|
||||||
MyThreadJSON = ParseJSON(#PB_Any, JSONStringToMap)
|
MyThreadJSON = ParseJSON(#PB_Any, JSONStringToMap)
|
||||||
|
@ -545,7 +546,7 @@ Module lhs_web
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Debug "JSONString:"+ JSONStringToMap
|
;Debug "JSONString:"+ JSONStringToMap
|
||||||
thread_type = ""
|
thread_type = ""
|
||||||
Select Header(#http_head_method)
|
Select Header(#http_head_method)
|
||||||
Case #http_method_get
|
Case #http_method_get
|
||||||
|
@ -841,8 +842,13 @@ Module lhs_web
|
||||||
thread_buffer_length = PokeS(thread_buffer_offset, thread_header,-1, #PB_UTF8|#PB_String_NoZero) : thread_buffer_offset + thread_buffer_length
|
thread_buffer_length = PokeS(thread_buffer_offset, thread_header,-1, #PB_UTF8|#PB_String_NoZero) : thread_buffer_offset + thread_buffer_length
|
||||||
Debug "Header Finished"
|
Debug "Header Finished"
|
||||||
EndIf
|
EndIf
|
||||||
CopyMemory(thread_temp_cache_memory, thread_buffer_offset, thread_data_size)
|
If thread_temp_cache_memory <> 0 And thread_buffer_offset <> 0 And thread_data_size <> 0
|
||||||
FreeMemory(thread_temp_cache_memory)
|
CopyMemory(thread_temp_cache_memory, thread_buffer_offset, thread_data_size)
|
||||||
|
FreeMemory(thread_temp_cache_memory)
|
||||||
|
Else
|
||||||
|
Debug "File Buffer Troubles."
|
||||||
|
EndIf
|
||||||
|
|
||||||
; EndIf
|
; EndIf
|
||||||
|
|
||||||
Debug "HTTP File Buffer Cleaned."
|
Debug "HTTP File Buffer Cleaned."
|
||||||
|
@ -853,8 +859,26 @@ Module lhs_web
|
||||||
DeleteElement(m_clients(Str(thread_cli_id))\datenbuffer())
|
DeleteElement(m_clients(Str(thread_cli_id))\datenbuffer())
|
||||||
;Daten Senden...
|
;Daten Senden...
|
||||||
;TODO: SSL Send
|
;TODO: SSL Send
|
||||||
|
sent_total = thread_data_size+(thread_buffer_offset-thread_buffer)
|
||||||
If m_clients(Str(thread_cli_id))\client_ssl = 1
|
If m_clients(Str(thread_cli_id))\client_ssl = 1
|
||||||
sent = ltls::WriteTLSSocket(thread_cli_id, thread_buffer , thread_data_size+(thread_buffer_offset-thread_buffer))
|
sent_length = sent_total
|
||||||
|
sent_buffer_address = thread_buffer
|
||||||
|
sent_total = 0
|
||||||
|
Repeat
|
||||||
|
sent = ltls::WriteTLSSocket(thread_cli_id, sent_buffer_address , sent_length)
|
||||||
|
If sent <> -1
|
||||||
|
Debug "TLS Sent:"+Str(sent)+" bytes"
|
||||||
|
sent_length - sent
|
||||||
|
sent_buffer_address + sent
|
||||||
|
sent_total + sent
|
||||||
|
Else
|
||||||
|
Debug "TLS Sent error:"+ltls::ErrorTLSCli(thread_cli_id)
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Until sent_length <= 0
|
||||||
|
sent = sent_total
|
||||||
|
thread_alive = #False
|
||||||
|
|
||||||
Else
|
Else
|
||||||
sent = SendNetworkData(thread_cli_id, thread_buffer , thread_data_size+(thread_buffer_offset-thread_buffer))
|
sent = SendNetworkData(thread_cli_id, thread_buffer , thread_data_size+(thread_buffer_offset-thread_buffer))
|
||||||
EndIf
|
EndIf
|
||||||
|
@ -867,7 +891,7 @@ Module lhs_web
|
||||||
m_clients(Str(thread_cli_id))\client_do_srv = #SRV_DO_NOP
|
m_clients(Str(thread_cli_id))\client_do_srv = #SRV_DO_NOP
|
||||||
Else
|
Else
|
||||||
;Fehler beim Senden ... Thread beenden.
|
;Fehler beim Senden ... Thread beenden.
|
||||||
Debug "Fehler"
|
Debug "Fehler:" + Str(Sent)
|
||||||
thread_alive = #False
|
thread_alive = #False
|
||||||
|
|
||||||
EndIf
|
EndIf
|
||||||
|
@ -892,6 +916,9 @@ Module lhs_web
|
||||||
DeleteElement(m_clients(Str(thread_cli_id))\datenbuffer())
|
DeleteElement(m_clients(Str(thread_cli_id))\datenbuffer())
|
||||||
EndIf
|
EndIf
|
||||||
Wend
|
Wend
|
||||||
|
If m_clients(Str(thread_cli_id))\client_ssl = 1
|
||||||
|
ltls::CloseTLSSocket(thread_cli_id)
|
||||||
|
EndIf
|
||||||
|
|
||||||
DeleteMapElement(m_clients(), Str(thread_cli_id))
|
DeleteMapElement(m_clients(), Str(thread_cli_id))
|
||||||
Debug "Thread Beendet."
|
Debug "Thread Beendet."
|
||||||
|
|
Loading…
Reference in a new issue