Subversion Repositories Kolibri OS

Rev

Rev 7009 | Rev 7101 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7009 Rev 7091
Line 881... Line 881...
881
;
881
;
882
; Chunk parsing code begins here
882
; Chunk parsing code begins here
883
;
883
;
Line 884... Line 884...
884
 
884
 
-
 
885
  .chunk_loop:
885
  .chunk_loop:
886
        DEBUGF  1, "chunk_loop write_ptr=0x%x chunk_ptr=0x%x\n", [ebp + http_msg.write_ptr], [ebp + http_msg.chunk_ptr]
886
        mov     ecx, [ebp + http_msg.write_ptr]
887
        mov     ecx, [ebp + http_msg.write_ptr]
887
        sub     ecx, [ebp + http_msg.chunk_ptr]
888
        sub     ecx, [ebp + http_msg.chunk_ptr]
Line 888... Line 889...
888
        jbe     .need_more_data_chunked
889
        jbe     .need_more_data_chunked                 ; amount of available bytes after chunkline start
889
 
890
 
890
; Chunkline starts here, convert the ASCII hex number into ebx
-
 
Line 891... Line 891...
891
        mov     esi, [ebp + http_msg.chunk_ptr]
891
; Chunkline starts here, convert the ASCII hex number into ebx
892
        DEBUGF  1, "Chunkline begins at 0x%x\n", esi
892
        mov     esi, [ebp + http_msg.chunk_ptr]
893
 
893
 
894
        xor     ebx, ebx
894
        xor     ebx, ebx
Line 935... Line 935...
935
  .end_of_chunkline:
935
  .end_of_chunkline:
936
        DEBUGF  1, "Chunk of 0x%x bytes\n", ebx
936
        DEBUGF  1, "Chunk of 0x%x bytes\n", ebx
937
; If chunk size is 0, all chunks have been received.
937
; If chunk size is 0, all chunks have been received.
938
        test    ebx, ebx
938
        test    ebx, ebx
939
        jz      .got_all_data_chunked
939
        jz      .got_all_data_chunked
-
 
940
; Calculate chunkline length
-
 
941
        mov     edx, esi
-
 
942
        sub     edx, [ebp + http_msg.chunk_ptr]         ; edx is now length of chunkline
-
 
943
        DEBUGF  1, "Chunkline is %u bytes long\n", edx
940
; Calculate how many data bytes we have received already
944
; Calculate how many data bytes we have received already
941
        mov     ecx, [ebp + http_msg.write_ptr]
945
        mov     ecx, [ebp + http_msg.write_ptr]
-
 
946
        sub     ecx, [ebp + http_msg.chunk_ptr]
942
        sub     ecx, [ebp + http_msg.chunk_ptr]         ; ecx is now number of received data bytes
947
        sub     ecx, edx                                ; ecx is now number of received data bytes (without chunkline)
943
; Update content_received counter
948
; Update content_received counter
944
        add     [ebp + http_msg.content_received], ecx
949
        add     [ebp + http_msg.content_received], ecx
945
; Calculate new write ptr
950
; Calculate new write ptr
946
        mov     edx, esi
-
 
947
        sub     edx, [ebp + http_msg.chunk_ptr]         ; edx is now length of chunkline
-
 
948
        sub     [ebp + http_msg.write_ptr], edx
951
        sub     [ebp + http_msg.write_ptr], edx
949
        test    [ebp + http_msg.flags], FLAG_STREAM
952
        test    [ebp + http_msg.flags], FLAG_STREAM
950
        jnz     .dont_resize
953
        jnz     .dont_resize
951
; Realloc buffer, make it 'chunksize' bigger.
954
; Realloc buffer, make it 'chunksize' bigger.
952
        lea     edx, [ebx + BUFFERSIZE]
955
        lea     edx, [ebx + BUFFERSIZE]
Line 961... Line 964...
961
        call    recalculate_pointers                    ; Because it's possible that buffer begins on another address now
964
        call    recalculate_pointers                    ; Because it's possible that buffer begins on another address now
962
        add     esi, eax                                ; recalculate esi too!
965
        add     esi, eax                                ; recalculate esi too!
963
  .dont_resize:
966
  .dont_resize:
964
; Remove chunk header (aka chunkline) from the buffer by shifting all received data after chunkt_ptr to the left
967
; Remove chunk header (aka chunkline) from the buffer by shifting all received data after chunkt_ptr to the left
965
        mov     edi, [ebp + http_msg.chunk_ptr]
968
        mov     edi, [ebp + http_msg.chunk_ptr]
-
 
969
        DEBUGF  1, "Removing chunkline esi=0x%x edi=0x%x ecx=%u\n", esi, edi, ecx
966
        rep movsb
970
        rep movsb
967
; Update chunk ptr to point to next chunk
971
; Update chunk ptr to point to next chunk
968
        add     [ebp + http_msg.chunk_ptr], ebx
972
        add     [ebp + http_msg.chunk_ptr], ebx
969
; Set number of received bytes to 0, we already updated content_received
973
; Set number of received bytes to 0, we already updated content_received
970
        xor     eax, eax
974
        xor     eax, eax