forked from KolibriOS/kolibrios
Bugfixes in HTTP_process
git-svn-id: svn://kolibrios.org@4203 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
a3b0093ead
commit
d1b0a4ad6d
@ -410,10 +410,6 @@ proc HTTP_process identifier ;//////////////////////////////////////////////////
|
|||||||
;;------------------------------------------------------------------------------------------------;;
|
;;------------------------------------------------------------------------------------------------;;
|
||||||
;< eax = -1 (not finished) / 0 finished ;;
|
;< eax = -1 (not finished) / 0 finished ;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
locals
|
|
||||||
received dd ?
|
|
||||||
endl
|
|
||||||
|
|
||||||
pusha
|
pusha
|
||||||
mov ebp, [identifier]
|
mov ebp, [identifier]
|
||||||
|
|
||||||
@ -430,8 +426,6 @@ endl
|
|||||||
sub [ebp + http_msg.buffer_length], eax
|
sub [ebp + http_msg.buffer_length], eax
|
||||||
jz .got_all_data
|
jz .got_all_data
|
||||||
|
|
||||||
mov [received], eax
|
|
||||||
|
|
||||||
; If data is chunked, combine chunks into contiguous data.
|
; If data is chunked, combine chunks into contiguous data.
|
||||||
test [ebp + http_msg.flags], FLAG_CHUNKED
|
test [ebp + http_msg.flags], FLAG_CHUNKED
|
||||||
jnz .chunk_loop
|
jnz .chunk_loop
|
||||||
@ -440,9 +434,11 @@ endl
|
|||||||
test [ebp + http_msg.flags], FLAG_GOT_HEADER
|
test [ebp + http_msg.flags], FLAG_GOT_HEADER
|
||||||
jnz .header_parsed
|
jnz .header_parsed
|
||||||
|
|
||||||
|
push eax
|
||||||
|
|
||||||
; We havent found the header yet, search for it..
|
; We havent found the header yet, search for it..
|
||||||
sub eax, 4
|
sub eax, 4
|
||||||
jl .need_more_data
|
jl .need_more_data_pop
|
||||||
.scan:
|
.scan:
|
||||||
; scan for end of header (empty line)
|
; scan for end of header (empty line)
|
||||||
cmp dword[edi], 0x0a0d0a0d ; end of header
|
cmp dword[edi], 0x0a0d0a0d ; end of header
|
||||||
@ -452,6 +448,7 @@ endl
|
|||||||
inc edi
|
inc edi
|
||||||
dec eax
|
dec eax
|
||||||
jnz .scan
|
jnz .scan
|
||||||
|
jmp .need_more_data_pop
|
||||||
|
|
||||||
.end_of_header:
|
.end_of_header:
|
||||||
add edi, 4 - http_msg.data
|
add edi, 4 - http_msg.data
|
||||||
@ -569,8 +566,9 @@ endl
|
|||||||
|
|
||||||
invoke mem.realloc, ebp, edx
|
invoke mem.realloc, ebp, edx
|
||||||
or eax, eax
|
or eax, eax
|
||||||
jz .no_ram
|
jz .no_ram_pop
|
||||||
mov eax, [received]
|
|
||||||
|
pop eax
|
||||||
sub eax, [ebp + http_msg.header_length]
|
sub eax, [ebp + http_msg.header_length]
|
||||||
jmp .header_parsed ; hooray!
|
jmp .header_parsed ; hooray!
|
||||||
|
|
||||||
@ -596,6 +594,8 @@ endl
|
|||||||
or [ebp + http_msg.flags], FLAG_CHUNKED
|
or [ebp + http_msg.flags], FLAG_CHUNKED
|
||||||
DEBUGF 1, "Transfer type is: chunked\n"
|
DEBUGF 1, "Transfer type is: chunked\n"
|
||||||
|
|
||||||
|
pop eax
|
||||||
|
|
||||||
; Set chunk pointer where first chunk should begin.
|
; Set chunk pointer where first chunk should begin.
|
||||||
lea eax, [ebp + http_msg.data]
|
lea eax, [ebp + http_msg.data]
|
||||||
add eax, [ebp + http_msg.header_length]
|
add eax, [ebp + http_msg.header_length]
|
||||||
@ -674,6 +674,9 @@ endl
|
|||||||
mov eax, [ebp + http_msg.content_length]
|
mov eax, [ebp + http_msg.content_length]
|
||||||
cmp eax, [ebp + http_msg.content_received]
|
cmp eax, [ebp + http_msg.content_received]
|
||||||
jae .got_all_data
|
jae .got_all_data
|
||||||
|
jmp .need_more_data
|
||||||
|
.need_more_data_pop:
|
||||||
|
pop eax
|
||||||
.need_more_data:
|
.need_more_data:
|
||||||
popa
|
popa
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@ -713,12 +716,15 @@ endl
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.invalid_header:
|
.invalid_header:
|
||||||
|
pop eax
|
||||||
DEBUGF 1, "ERROR: invalid header\n"
|
DEBUGF 1, "ERROR: invalid header\n"
|
||||||
or [ebp + http_msg.flags], FLAG_INVALID_HEADER
|
or [ebp + http_msg.flags], FLAG_INVALID_HEADER
|
||||||
popa
|
popa
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.no_ram_pop:
|
||||||
|
pop eax
|
||||||
.no_ram:
|
.no_ram:
|
||||||
DEBUGF 1, "ERROR: out of RAM\n"
|
DEBUGF 1, "ERROR: out of RAM\n"
|
||||||
or [ebp + http_msg.flags], FLAG_NO_RAM
|
or [ebp + http_msg.flags], FLAG_NO_RAM
|
||||||
|
Loading…
Reference in New Issue
Block a user