forked from KolibriOS/kolibrios
Fixed bug in URL parsing.
git-svn-id: svn://kolibrios.org@4983 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
8d3369acb0
commit
1974f465e8
@ -1388,32 +1388,35 @@ endl
|
|||||||
DEBUGF 1, "parsing URL: %s\n", [URL]
|
DEBUGF 1, "parsing URL: %s\n", [URL]
|
||||||
|
|
||||||
; remove any leading protocol text
|
; remove any leading protocol text
|
||||||
mov esi, [URL]
|
mov edi, [URL]
|
||||||
mov ecx, URLMAXLEN
|
mov ecx, URLMAXLEN
|
||||||
mov ax, '//'
|
mov ax, '//'
|
||||||
.loop1:
|
.loop1:
|
||||||
cmp byte[esi], 0 ; end of URL?
|
cmp byte[edi], 0 ; end of URL?
|
||||||
je .url_ok ; yep, so not found
|
je .url_ok ; yep, so not found
|
||||||
cmp [esi], ax
|
cmp [edi], ax
|
||||||
je .skip_proto
|
je .skip_proto
|
||||||
inc esi
|
inc edi
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .loop1
|
jnz .loop1
|
||||||
jmp .invalid
|
jmp .invalid
|
||||||
|
|
||||||
.skip_proto:
|
.skip_proto:
|
||||||
inc esi ; skip the two '/'
|
inc edi ; skip the two '/'
|
||||||
inc esi
|
inc edi
|
||||||
mov [URL], esi ; update pointer so it skips protocol
|
mov [URL], edi ; update pointer so it skips protocol
|
||||||
jmp .loop1 ; we still need to find the length of the URL
|
|
||||||
|
; Find the trailing 0 byte
|
||||||
|
xor al, al
|
||||||
|
repne scasb
|
||||||
|
jne .invalid ; ecx reached 0 before we reached end of string
|
||||||
|
|
||||||
.url_ok:
|
.url_ok:
|
||||||
sub esi, [URL] ; calculate total length of URL
|
sub edi, [URL] ; calculate total length of URL
|
||||||
mov [urlsize], esi
|
mov [urlsize], edi
|
||||||
|
|
||||||
|
|
||||||
; now look for page delimiter - it's a '/' character
|
; now look for page delimiter - it's a '/' character
|
||||||
mov ecx, esi ; URL length
|
mov ecx, edi ; URL length
|
||||||
mov edi, [URL]
|
mov edi, [URL]
|
||||||
mov al, '/'
|
mov al, '/'
|
||||||
repne scasb
|
repne scasb
|
||||||
|
Loading…
Reference in New Issue
Block a user