diff --git a/http_server/http_server.tbh b/http_server/http_server.tbh index 6726429..a81a516 100644 --- a/http_server/http_server.tbh +++ b/http_server/http_server.tbh @@ -33,6 +33,7 @@ type http_server_state request_header_end as string(4) request_authenticated as boolean request_length as dword + request_read_pos as dword resp_buf as string file_size as dword file_pos as dword @@ -53,6 +54,7 @@ declare sub http_server_response_status(code as word) declare sub http_server_response_header(byref header as string(50), byref value as string) declare sub http_server_response_header_end() declare sub callback_http_server_header_received(byref server as http_server_state, byref header as string, byref value as string) +declare sub callback_http_server_body_received(byref server as http_server_state, byref body as string) declare function callback_http_server_endpoint_called(byref server as http_server_state) as boolean declare function http_server_decode(byref encoded_string as string) as string declare function http_server_find_param(byref http_req_string as string, byref argument as string) as string \ No newline at end of file diff --git a/http_server/http_server.tbs b/http_server/http_server.tbs index 9dca60a..0e1f76f 100644 --- a/http_server/http_server.tbs +++ b/http_server/http_server.tbs @@ -429,11 +429,14 @@ sub http_server_proc_sock_data() http_servers(index).request_header_name="" http_servers(index).request_value_buffer="" http_servers(index).request_header_end="" + http_servers(index).request_read_pos=0 end if case HTTP_SERVER_STATE_RQ_BODY - http_servers(index).request_value_buffer=http_servers(index).request_value_buffer+mid(data,ci,255) + http_servers(index).request_value_buffer=http_servers(index).request_value_buffer+mid(data,ci,len(data)-ci+1) + http_servers(index).request_read_pos=http_servers(index).request_read_pos+len(data)-ci+1 + callback_http_server_body_received(http_servers(index),mid(data,ci,len(data)-ci)) ci=len(data) - if len(http_servers(index).request_value_buffer)>=http_servers(index).request_length then + if http_servers(index).request_read_pos>=http_servers(index).request_length then http_servers(index).state=HTTP_SERVER_STATE_RS_HEADER http_server_send_response_header(index) end if