Always set connection closed flag after server closed connection and close from our end as well.

git-svn-id: svn://kolibrios.org@8023 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2020-06-05 21:03:35 +00:00
parent bccb06a966
commit dc181a9b21

View File

@ -134,7 +134,7 @@ proc HTTP_buffersize_get ;//////////////////////////////////////////////////////
;< eax = buffer size in bytes ;; ;< eax = buffer size in bytes ;;
;;================================================================================================;; ;;================================================================================================;;
mov eax, BUFFERSIZE mov eax, [buffersize]
ret ret
endp endp
@ -147,7 +147,7 @@ proc HTTP_buffersize_set ;//////////////////////////////////////////////////////
;> eax = buffer size in bytes ;; ;> eax = buffer size in bytes ;;
;;================================================================================================;; ;;================================================================================================;;
; mov [BUFFERSIZE], eax mov [buffersize], eax
ret ret
endp endp
@ -1025,11 +1025,12 @@ proc HTTP_receive identifier ;//////////////////////////////////////////////////
test [ebp + http_msg.flags], FLAG_RING test [ebp + http_msg.flags], FLAG_RING
jz @f jz @f
mov ebx, [ebp + http_msg.content_ptr] mov ebx, [ebp + http_msg.content_ptr]
add ebx, BUFFERSIZE add ebx, [buffersize]
cmp [ebp + http_msg.write_ptr], ebx cmp [ebp + http_msg.write_ptr], ebx
jb @f jb @f
DEBUGF 1, "Restarting at beginning of ring buffer\n" DEBUGF 1, "Restarting at beginning of ring buffer\n"
sub [ebp + http_msg.write_ptr], BUFFERSIZE mov ebx, [buffersize]
sub [ebp + http_msg.write_ptr], ebx
@@: @@:
; Header was already parsed and connection isnt chunked. ; Header was already parsed and connection isnt chunked.
; Update content_received ; Update content_received
@ -1087,11 +1088,12 @@ proc HTTP_receive identifier ;//////////////////////////////////////////////////
test [ebp + http_msg.flags], FLAG_RING test [ebp + http_msg.flags], FLAG_RING
jz @f jz @f
mov ebx, [ebp + http_msg.content_ptr] mov ebx, [ebp + http_msg.content_ptr]
add ebx, BUFFERSIZE add ebx, [buffersize]
cmp [ebp + http_msg.write_ptr], ebx cmp [ebp + http_msg.write_ptr], ebx
jb @f jb @f
DEBUGF 1, "Restarting at beginning of ring buffer\n" DEBUGF 1, "Restarting at beginning of ring buffer\n"
sub [ebp + http_msg.write_ptr], BUFFERSIZE mov ebx, [buffersize]
sub [ebp + http_msg.write_ptr], ebx
@@: @@:
; We only got a partial chunk, or need more chunks, update content_received and request more data ; We only got a partial chunk, or need more chunks, update content_received and request more data
add [ebp + http_msg.content_received], eax add [ebp + http_msg.content_received], eax
@ -1138,6 +1140,8 @@ proc HTTP_receive identifier ;//////////////////////////////////////////////////
.server_closed: .server_closed:
DEBUGF 1, "server closed connection, transfer complete?\n" DEBUGF 1, "server closed connection, transfer complete?\n"
mcall close, [ebp + http_msg.socket]
and [ebp + http_msg.flags], not FLAG_CONNECTED
test [ebp + http_msg.flags], FLAG_GOT_HEADER test [ebp + http_msg.flags], FLAG_GOT_HEADER
jz .err_server_closed jz .err_server_closed
test [ebp + http_msg.flags], FLAG_CONTENT_LENGTH test [ebp + http_msg.flags], FLAG_CONTENT_LENGTH