Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4220 → Rev 4221

/programs/develop/libraries/http/examples/downloader.asm
61,7 → 61,7
 
DEBUGF 1, "Starting download\n"
 
invoke HTTP_get, params
invoke HTTP_get, params, 0
test eax, eax
jz fail
mov [identifier], eax
/programs/develop/libraries/http/http.asm
124,11 → 124,12
 
 
;;================================================================================================;;
proc HTTP_get URL ;///////////////////////////////////////////////////////////////////////////////;;
proc HTTP_get URL, add_header ;///////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? Initiates a HTTP connection, using 'GET' method. ;;
;;------------------------------------------------------------------------------------------------;;
;> URL = pointer to ASCIIZ URL ;;
;> add_header = pointer to additional header parameters (ASCIIZ), or null for none. ;;
;;------------------------------------------------------------------------------------------------;;
;< eax = 0 (error) / buffer ptr ;;
;;================================================================================================;;
149,6 → 150,7
jz .error
mov [hostname], eax
mov [pageaddr], ebx
mov [port], ecx
 
; Do we need to use a proxy?
cmp [proxyAddr], 0
157,7 → 159,6
.proxy_done:
 
;;;;
mov [port], 80 ;;;; FIXME
 
; Connect to the other side.
stdcall open_connection, [hostname], [port]
186,6 → 187,12
mov esi, [hostname]
copy_till_zero
 
mov esi, [add_header]
test esi, esi
jz @f
copy_till_zero
@@:
 
mov esi, str_close
mov ecx, str_close.length
rep movsb
220,11 → 227,12
 
 
;;================================================================================================;;
proc HTTP_head URL ;//////////////////////////////////////////////////////////////////////////////;;
proc HTTP_head URL, add_header ;//////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? Initiates a HTTP connection, using 'HEAD' method. ;;
;;------------------------------------------------------------------------------------------------;;
;> URL = pointer to ASCIIZ URL ;;
;> add_header = pointer to additional header parameters (ASCIIZ), or null for none. ;;
;;------------------------------------------------------------------------------------------------;;
;< eax = 0 (error) / buffer ptr ;;
;;================================================================================================;;
244,6 → 252,7
jz .error
mov [hostname], eax
mov [pageaddr], ebx
mov [port], ecx
 
; Do we need to use a proxy?
cmp [proxyAddr], 0
253,7 → 262,6
.proxy_done:
 
;;;;
mov [port], 80 ;;;; FIXME
 
; Connect to the other side.
stdcall open_connection, [hostname], [port]
282,6 → 290,12
mov esi, [hostname]
copy_till_zero
 
mov esi, [add_header]
test esi, esi
jz @f
copy_till_zero
@@:
 
mov esi, str_close
mov ecx, str_close.length
rep movsb
315,11 → 329,12
 
 
;;================================================================================================;;
proc HTTP_post URL, content_type, content_length ;////////////////////////////////////////////////;;
proc HTTP_post URL, add_header, content_type, content_length ;////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? Initiates a HTTP connection, using 'GET' method. ;;
;;------------------------------------------------------------------------------------------------;;
;> URL = pointer to ASCIIZ URL ;;
;> add_header = pointer to additional header parameters (ASCIIZ), or null for none. ;;
;> content_type = pointer to ASCIIZ string containing content type ;;
;> content_length = length of content (in bytes) ;;
;;------------------------------------------------------------------------------------------------;;
341,6 → 356,7
jz .error
mov [hostname], eax
mov [pageaddr], ebx
mov [port], ecx
 
; Do we need to use a proxy?
cmp [proxyAddr], 0
350,7 → 366,6
.proxy_done:
 
;;;;
mov [port], 80 ;;;; FIXME
 
; Connect to the other side.
stdcall open_connection, [hostname], [port]
391,8 → 406,14
rep movsb
 
mov esi, [content_type]
rep movsb
copy_till_zero
 
mov esi, [add_header]
test esi, esi
jz @f
copy_till_zero
@@:
 
mov esi, str_close
mov ecx, str_close.length
rep movsb
1264,9 → 1285,11
 
mov eax, [hostname]
mov ebx, [pageaddr]
mov ecx, 80 ;;;; FIXME
 
DEBUGF 1, "hostname: %s\n", eax
DEBUGF 1, "pageaddr: %s\n", ebx
DEBUGF 1, "port: %u\n", ecx
 
ret
 
/programs/develop/libraries/http/http_en.txt
1,16 → 1,19
 
get(*url);
get(*url, *add_header);
*url = pointer to ASCIIZ URL
*add_header = pointer to ASCIIZ additional header parameters, or null for none.
Initiates a HTTP connection, using 'GET' method.
- returns 0 on error, identifier otherwise.
 
head(*url);
head(*url, *add_header);
*url = pointer to ASCIIZ URL
*add_header = pointer to ASCIIZ additional header parameters, or null for none.
Initiate a HTTP connection, using 'HEAD' method.
- returns 0 on error, identifier otherwise
 
post(*url, *content-type, content-length);
post(*url, *add_header, *content-type, content-length);
*url = pointer to ASCIIZ URL
*add_header = pointer to ASCIIZ additional header parameters, or null for none.
*content-type = pointer to ASCIIZ string containing content type.
content-length = length of the content (in bytes).
Initiate a HTTP connection, using 'POST' method.