Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7512 → Rev 7511

/programs/develop/libraries/http/http.asm
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; HTTP library for KolibriOS ;;
19,7 → 19,7
 
 
URLMAXLEN = 65535
BUFFERSIZE = 512*1024
BUFFERSIZE = 8192
TIMEOUT = 500 ; in 1/100 s
 
__DEBUG__ = 1
64,10 → 64,7
pop [eax + http_msg.flags]
or [eax + http_msg.flags], FLAG_CONNECTED
mov [eax + http_msg.write_ptr], esi
 
mov ebx, [buffersize]
sub ebx, http_msg.http_header
mov [eax + http_msg.buffer_length], ebx
mov [eax + http_msg.buffer_length], BUFFERSIZE - http_msg.http_header
mov [eax + http_msg.chunk_ptr], 0
 
mov [eax + http_msg.status], 0
127,33 → 124,6
 
 
;;================================================================================================;;
proc HTTP_buffersize_get ;////////////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? Get HTTP buffer size ;;
;;------------------------------------------------------------------------------------------------;;
;< eax = buffer size in bytes ;;
;;================================================================================================;;
 
mov eax, [BUFFERSIZE]
ret
 
endp
 
;;================================================================================================;;
proc HTTP_buffersize_set ;////////////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? Set HTTP buffer size ;;
;;------------------------------------------------------------------------------------------------;;
;> eax = buffer size in bytes ;;
;;================================================================================================;;
 
mov [BUFFERSIZE], eax
ret
 
endp
 
 
;;================================================================================================;;
proc HTTP_disconnect identifier ;/////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? Stops the open connection ;;
260,7 → 230,7
 
; Create the HTTP request.
.send_request:
invoke mem.alloc, [buffersize]
invoke mem.alloc, BUFFERSIZE
test eax, eax
jz .error
mov [buffer], eax
399,7 → 369,7
 
; Create the HTTP request.
.send_request:
invoke mem.alloc, [buffersize]
invoke mem.alloc, BUFFERSIZE
test eax, eax
jz .error
mov [buffer], eax
542,7 → 512,7
 
; Create the HTTP request.
.send_request:
invoke mem.alloc, [buffersize]
invoke mem.alloc, BUFFERSIZE
test eax, eax
jz .error
mov [buffer], eax
676,18 → 646,16
 
mov eax, [ebp + http_msg.content_ptr]
mov [ebp + http_msg.write_ptr], eax
push [buffersize]
pop [ebp + http_msg.buffer_length]
mov [ebp + http_msg.buffer_length], BUFFERSIZE
jmp .receive
 
.new_buffer:
invoke mem.alloc, [buffersize]
invoke mem.alloc, BUFFERSIZE
test eax, eax
jz .err_no_ram
mov [ebp + http_msg.content_ptr], eax
mov [ebp + http_msg.write_ptr], eax
push [buffersize]
pop [ebp + http_msg.buffer_length]
mov [ebp + http_msg.buffer_length], BUFFERSIZE
DEBUGF 1, "New buffer: 0x%x\n", eax
 
; Receive some data
883,7 → 851,7
jnz .ct_hdr_found
 
.not_chunked:
mov edx, [buffersize]
mov edx, BUFFERSIZE
call alloc_contentbuff
test eax, eax
jz .err_no_ram
904,7 → 872,7
or [ebp + http_msg.flags], FLAG_CHUNKED
DEBUGF 1, "Transfer type is: chunked\n"
 
mov edx, [buffersize]
mov edx, BUFFERSIZE
call alloc_contentbuff
test eax, eax
jz .err_no_ram
988,8 → 956,7
test [ebp + http_msg.flags], FLAG_STREAM
jnz .dont_resize
; Realloc buffer, make it 'chunksize' bigger.
mov edx, ebx
add edx, [buffersize]
lea edx, [ebx + BUFFERSIZE]
mov [ebp + http_msg.buffer_length], edx ; remaining space in new buffer
add edx, [ebp + http_msg.write_ptr]
sub edx, [ebp + http_msg.content_ptr]
1039,14 → 1006,13
test [ebp + http_msg.flags], FLAG_STREAM
jnz .multibuff
mov eax, [ebp + http_msg.write_ptr]
add eax, [buffersize]
add eax, BUFFERSIZE
sub eax, [ebp + http_msg.content_ptr]
invoke mem.realloc, [ebp + http_msg.content_ptr], eax
or eax, eax
jz .err_no_ram
call recalculate_pointers
push [buffersize]
pop [ebp + http_msg.buffer_length]
mov [ebp + http_msg.buffer_length], BUFFERSIZE
; Need more data
popa
xor eax, eax
1158,7 → 1124,7
 
test [ebp + http_msg.flags], FLAG_STREAM
jz @f
mov edx, [buffersize]
mov edx, BUFFERSIZE
@@:
 
; Allocate content buffer
1914,8 → 1880,6
export \
lib_init , 'lib_init' , \
0x00010001 , 'version' , \
HTTP_buffersize_get , 'buffersize_get' , \
HTTP_buffersize_set , 'buffersize_set' , \
HTTP_get , 'get' , \
HTTP_head , 'head' , \
HTTP_post , 'post' , \
1984,8 → 1948,6
str_hex:
db '0123456789ABCDEF'
 
buffersize dd BUFFERSIZE
 
include_debug_strings
 
; uninitialized data