Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4168 → Rev 4167

/programs/develop/libraries/http/http_en.txt
File deleted
\ No newline at end of file
/programs/develop/libraries/http/http.asm
65,7 → 65,6
mov [eax + http_msg.status], 0
mov [eax + http_msg.header_length], 0
mov [eax + http_msg.content_length], 0
mov [eax + http_msg.content_received], 0
}
 
section '.flat' code readable align 16
293,7 → 292,7
 
 
;;================================================================================================;;
proc HTTP_post URL, content_type, content_length ;////////////////////////////////////////////////;;
proc HTTP_post URL, content, content_type, content_length ;///////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? ;;
;;------------------------------------------------------------------------------------------------;;
384,6 → 383,11
jz .error
DEBUGF 1, "Request has been sent to server.\n"
 
mcall send, [socketnum], [content], [content_length]
test eax, eax
jz .error
DEBUGF 1, "Data has been sent to server.\n"
 
HTTP_init_buffer [buffer], [socketnum]
; mov eax, [buffer]
 
407,10 → 411,6
;;------------------------------------------------------------------------------------------------;;
;< eax = -1 (not finished) / 0 finished ;;
;;================================================================================================;;
locals
received dd ?
endl
 
pusha
mov ebp, [identifier]
 
427,8 → 427,6
sub [ebp + http_msg.buffer_length], eax
jz .got_all_data
 
mov [received], eax
 
; If data is chunked, combine chunks into contiguous data.
test [ebp + http_msg.flags], FLAG_CHUNKED
jnz .chunk_loop
557,18 → 555,17
DEBUGF 1, "Content-length: %u\n", edx
 
; Resize buffer according to content-length.
add edx, [ebp + http_msg.header_length]
add edx, http_msg.data
mov eax, [ebp + http_msg.header_length]
add eax, [ebp + http_msg.content_length]
add eax, http_msg.data
 
mov ecx, edx
mov ecx, eax
sub ecx, [ebp + http_msg.write_ptr]
mov [ebp + http_msg.buffer_length], ecx
 
invoke mem.realloc, ebp, edx
invoke mem.realloc, ebp, eax
or eax, eax
jz .no_ram
mov eax, [received]
sub eax, [ebp + http_msg.header_length]
jmp .header_parsed ; hooray!
 
.no_content:
656,16 → 653,16
; Update content_length accordingly.
mov ecx, [ebp + http_msg.write_ptr]
sub ecx, esi
add [ebp + http_msg.content_received], ecx
add [ebp + http_msg.content_length], ecx
rep movsb
jmp .chunk_loop
 
; Check if we got all the data.
.header_parsed:
add [ebp + http_msg.content_received], eax
mov eax, [ebp + http_msg.content_length]
cmp eax, [ebp + http_msg.content_received]
jae .got_all_data
mov eax, [ebp + http_msg.header_length]
add eax, [ebp + http_msg.content_length]
cmp eax, [ebp + http_msg.buffer_length]
je .got_all_data
.need_more_data:
popa
xor eax, eax
673,7 → 670,7
ret
 
.need_more_data_chunked:
add [ebp + http_msg.content_received], eax
add [ebp + http_msg.content_length], eax
popa
xor eax, eax
dec eax
685,7 → 682,6
sub eax, http_msg.data
sub eax, ebp
mov [ebp + http_msg.content_length], eax
mov [ebp + http_msg.content_received], eax
.got_all_data:
DEBUGF 1, "We got all the data! (%u bytes)\n", [ebp + http_msg.content_length]
or [ebp + http_msg.flags], FLAG_GOT_DATA
974,24 → 970,16
; edi = ptr where to store ascii
ascii_dec:
 
push -'0'
mov ecx, 10
.loop:
xor edx, edx
div ecx
add dl, '0'
push edx
mov byte[edi], dl
inc edi
test eax, eax
jnz .loop
 
.loop2:
pop eax
add al, '0'
jz .done
stosb
jmp .loop2
.done:
 
ret
 
 
/programs/develop/libraries/http/http.inc
34,6 → 34,5
.status dd ?
.header_length dd ?
.content_length dd ?
.content_received dd ?
.data:
}
/programs/cmm/lib/lib.obj/http.h
33,6 → 33,5
dword status;
dword header_length;
dword content_length;
dword content_received;
char data;
};