Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6921 → Rev 6920

/programs/develop/libraries/http/http.asm
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; HTTP library for KolibriOS ;;
1463,7 → 1463,11
; Resolve the hostname
DEBUGF 1, "Resolving hostname\n"
push esp ; reserve stack place
invoke getaddrinfo, [hostname], 0, 0, esp
push esp ; fourth parameter
push 0 ; third parameter
push 0 ; second parameter
push [hostname]
call [getaddrinfo]
pop esi
test eax, eax
jnz .error1
1485,37 → 1489,27
xchg al, ah
mov [esi + sockaddr_in.sin_port], ax
 
; Open a new TCP socket
; Connect to the server.
mcall socket, AF_INET4, SOCK_STREAM, 0
test eax, eax
jz .error3
jz .error2
mov [socketnum], eax
DEBUGF 1, "Socket: 0x%x\n", eax
 
; Connect to the server
mcall connect, [socketnum], [sockaddr], 18
test eax, eax
jnz .error3
jnz .error2
DEBUGF 1, "Socket is now connected.\n"
 
invoke freeaddrinfo ; Free allocated memory
; free allocated memory
call [freeaddrinfo]
mov eax, [socketnum]
ret
 
.error3:
DEBUGF 2, "Could not connect to the remote server\n"
invoke freeaddrinfo ; Free allocated memory
xor eax, eax
ret
 
.error2:
DEBUGF 2, "Resolving hostname failed\n"
invoke freeaddrinfo ; Free allocated memory
xor eax, eax
ret
 
; free allocated memory
call [freeaddrinfo]
.error1:
DEBUGF 2, "Contacting DNS server failed\n"
xor eax, eax
ret