Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5768 → Rev 5769

/programs/develop/libraries/http/http.asm
145,7 → 145,7
ret
 
.error:
DEBUGF 2, "Cant close already closed connection!\n"
DEBUGF 1, "Cant close already closed connection!\n"
popa
ret
 
299,19 → 299,16
DEBUGF 1, "Request has been sent to server.\n"
 
cmp [identifier], 0
jne .old_connection
je .new_connection
invoke mem.free, [buffer]
mov eax, [identifier]
mov [buffer], eax
.new_connection:
HTTP_init_buffer [buffer], [socketnum], [flags]
 
popa
mov eax, [buffer] ; return buffer ptr
ret
 
.old_connection:
invoke mem.free, [buffer]
popa
mov eax, [identifier]
ret
 
.error:
DEBUGF 2, "HTTP GET error!\n"
popa
441,19 → 438,16
DEBUGF 1, "Request has been sent to server.\n"
 
cmp [identifier], 0
jne .old_connection
je .new_connection
invoke mem.free, [buffer]
mov eax, [identifier]
mov [buffer], eax
.new_connection:
HTTP_init_buffer [buffer], [socketnum], [flags]
 
popa
mov eax, [buffer] ; return buffer ptr
ret
 
.old_connection:
invoke mem.free, [buffer]
popa
mov eax, [identifier]
ret
 
.error:
DEBUGF 2, "HTTP HEAD error!\n"
popa
598,22 → 592,16
DEBUGF 1, "Request has been sent to server.\n"
 
cmp [identifier], 0
jne .old_connection
je .new_connection
invoke mem.free, [buffer]
mov eax, [identifier]
mov [buffer], eax
.new_connection:
HTTP_init_buffer [buffer], [socketnum], [flags]
 
popa
mov eax, [buffer] ; return buffer ptr
ret
 
.old_connection:
invoke mem.free, [buffer]
mov ebx, [flags]
mov eax, [identifier]
or [eax + http_msg.flags], ebx
popa
mov eax, [identifier]
ret
 
.error:
DEBUGF 1, "HTTP POST error!\n"
popa
1055,8 → 1043,11
.got_all_data:
DEBUGF 1, "We got all the data! (%u bytes)\n", [ebp + http_msg.content_received]
or [ebp + http_msg.flags], FLAG_GOT_ALL_DATA
test [ebp + http_msg.flags], FLAG_KEEPALIVE
jnz @f
mcall close, [ebp + http_msg.socket]
and [ebp + http_msg.flags], not FLAG_CONNECTED
mcall close, [ebp + http_msg.socket]
@@:
popa
xor eax, eax
ret
1901,7 → 1892,7
str_close db 'User-Agent: KolibriOS libHTTP/1.1', 13, 10, 'Connection: Close', 13, 10, 13, 10
.length = $ - str_close
str_keep db 'User-Agent: KolibriOS libHTTP/1.1', 13, 10, 'Connection: Keepalive', 13, 10, 13, 10
.length = $ - str_close
.length = $ - str_keep
 
str_http db 'http://', 0
 
/programs/develop/libraries/http/http_en.txt
1,8 → 1,8
 
get(*url, identifier, flags, *add_header);
*url = pointer to ASCIIZ URL
identifier = identified of previously opened connection, or 0 to open a new one
flags = bit flags (see http.inc user flags and the end of this document)
identifier = identifier of previously opened connection (keep-alive), or 0 to open a new one.
flags = bit flags (see end of this document).
*add_header = pointer to ASCIIZ additional header parameters, or null for none.
Every additional parameter must end with CR LF bytes, including the last line.
Initiates a HTTP connection, using 'GET' method.
10,8 → 10,8
 
head(*url, identifier, flags, *add_header);
*url = pointer to ASCIIZ URL
identifier = identified of previously opened connection, or 0 to open a new one
flags = bit flags (see http.inc user flags and the end of this document)
identifier = identifier of previously opened connection (keep-alive), or 0 to open a new one.
flags = bit flags (see end of this document).
*add_header = pointer to ASCIIZ additional header parameters, or null for none.
Every additional parameter must end with CR LF bytes, including the last line.
Initiate a HTTP connection, using 'HEAD' method.
19,8 → 19,8
 
post(*url, identifier, flags, *add_header, *content-type, content-length);
*url = pointer to ASCIIZ URL
identifier = identified of previously opened connection, or 0 to open a new one
flags = bit flags (see http.inc user flags and the end of this document)
identifier = identifier of previously opened connection (keep-alive), or 0 to open a new one.
flags = bit flags (see end of this document).
*add_header = pointer to ASCIIZ additional header parameters, or null for none.
Every additional parameter must end with CR LF bytes, including the last line.
*content-type = pointer to ASCIIZ string containing content type.
59,6 → 59,8
User flags:
 
For the flag codes themselves, see http.inc file.
 
FLAG_KEEPALIVE will keep the connection open after first GET/POST/.. so you can send a second request on the same TCP session.
In this case, the session must be closed manually when done by using the exported disconnect() function.