Fixed bug in escape function, return data length in ebx.

git-svn-id: svn://kolibrios.org@4831 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-04-14 14:39:53 +00:00
parent f5f92c1d66
commit 66ebe18f55

View File

@ -1118,15 +1118,19 @@ endp
;;================================================================================================;;
proc URI_escape URI ;/////////////////////////////////////////////////////////////////////////////;;
proc HTTP_escape URI ;////////////////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? ;;
;;------------------------------------------------------------------------------------------------;;
;> URI = ptr to ASCIIZ URI ;;
;;------------------------------------------------------------------------------------------------;;
;< eax = 0 (error) / ptr to ASCIIZ URI ;;
;< eax = 0 (error) / ptr to ASCIIZ URI/data ;;
;< ebx = length of escaped URI/data ;;
;;================================================================================================;;
; TODO: instead of static buffer allocation, make it 4096 bytes and larger only if needed
pusha
invoke mem.alloc, URLMAXLEN
@ -1145,7 +1149,8 @@ proc URI_escape URI ;///////////////////////////////////////////////////////////
mov cl, al
and cl, 0x1f
mov bl, al
shr bl, 5
shr bl, 3
and bl, not 3
bt dword[bits_must_escape + ebx], ecx
jc .escape
@ -1168,6 +1173,9 @@ proc URI_escape URI ;///////////////////////////////////////////////////////////
.done:
stosb
sub edi, [esp + 7 * 4]
dec edi
mov [esp + 4 * 4], edi
popa
ret
@ -1182,7 +1190,7 @@ endp
;;================================================================================================;;
proc URI_unescape URI ;///////////////////////////////////////////////////////////////////////////;;
proc HTTP_unescape URI ;//////////////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
;? ;;
;;------------------------------------------------------------------------------------------------;;
@ -1687,8 +1695,8 @@ export \
HTTP_process , 'process' , \
HTTP_free , 'free' , \
HTTP_stop , 'stop' , \
URI_escape , 'escape' , \
URI_unescape , 'unescape'
HTTP_escape , 'escape' , \
HTTP_unescape , 'unescape'
; HTTP_put , 'put' , \
; HTTP_delete , 'delete' , \