Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -10,13 +10,25 @@ PROC test uri parser = ( STRING uri )VOID:
print( ( " ", error OF result, newline ) )
ELSE
# parsed OK #
print( ( " scheme: ", scheme OF result, newline ) );
IF userinfo OF result /= "" THEN print( ( " userinfo: ", userinfo OF result, newline ) ) FI;
IF host OF result /= "" THEN print( ( " host: ", host OF result, newline ) ) FI;
IF port OF result /= "" THEN print( ( " port: ", port OF result, newline ) ) FI;
IF path OF result /= "" THEN print( ( " path: ", path OF result, newline ) ) FI;
IF query OF result /= "" THEN print( ( " query: ", query OF result, newline ) ) FI;
IF fragment id OF result /= "" THEN print( ( " fragment id: ", fragment id OF result, newline ) ) FI
print( ( " scheme: ", scheme OF result, newline ) );
IF userinfo OF result /= "" THEN
print( ( " userinfo: ", userinfo OF result, newline ) )
FI;
IF host OF result /= "" THEN
print( ( " host: ", host OF result, newline ) )
FI;
IF port OF result /= "" THEN
print( ( " port: ", port OF result, newline ) )
FI;
IF path OF result /= "" THEN
print( ( " path: ", path OF result, newline ) )
FI;
IF query OF result /= "" THEN
print( ( " query: ", query OF result, newline ) )
FI;
IF fragment id OF result /= "" THEN
print( ( " fragment id: ", fragment id OF result, newline ) )
FI
FI;
print( ( newline ) )
END # test uri parser # ;

View file

@ -0,0 +1,44 @@
local fn ParseURL( urlStr as CFStringRef ) as CFStringRef
CFMutableStringRef mutStr = fn MutableStringNew
URLQueryItemRef queryItem
URLComponentsRef components = fn URLComponentsWithString( urlStr )
CFStringRef scheme = fn URLComponentsScheme( components )
CFStringRef domain = fn URLComponentsHost( components )
CFNumberRef port = fn URLPort( fn URLWithString( urlStr ) )
CFStringRef path = fn URLComponentsPath( components )
CFStringRef user = fn URLComponentsUser( components )
CFStringRef query = fn URLComponentsQuery( components )
CFStringRef fragment = fn URLComponentsFragment( components )
CFStringRef password = fn URLComponentsPassword( components )
CFArrayRef queryItems = fn URLComponentsQueryItems( components )
if urlStr then MutableStringAppendString( mutStr, fn StringWithFormat( @"url: %@\n", urlStr ) )
if scheme then MutableStringAppendString( mutStr, fn StringWithFormat( @"scheme: %@\n", scheme ) )
if domain then MutableStringAppendString( mutStr, fn StringWithFormat( @"domain: %@\n", domain ) )
if port then MutableStringAppendString( mutStr, fn StringWithFormat( @"port: :%@\n", port ) )
if path then MutableStringAppendString( mutStr, fn StringWithFormat( @"path: %@\n", path ) )
if user then MutableStringAppendString( mutStr, fn StringWithFormat( @"user: %@\n", user ) )
if password then MutableStringAppendString( mutStr, fn StringWithFormat( @"password: %@\n", password ) )
if query then MutableStringAppendString( mutStr, fn StringWithFormat( @"query: %@\n", query ) )
if fragment then MutableStringAppendString( mutStr, fn StringWithFormat( @"fragment: %@\n", fragment ) )
for queryItem in queryItems
CFStringRef name = fn URLQueryItemName( queryItem )
CFStringRef value = fn URLQueryItemValue( queryItem )
MutableStringAppendFormat( mutStr, @"%@: %@\n", name, value )
next
end fn = fn StringWithString( mutStr )
print fn ParseURL( @"foo://example.com:8042/over/there?name=ferret#nose" )
print fn ParseURL( @"urn:example:animal:ferret:nose" )
print fn ParseURL( @"ftp://ftp.is.co.za/rfc/rfc1808.txt" )
print fn ParseURL( @"http://www.ietf.org/rfc/rfc2396.txt#header1" )
print fn ParseURL( @"ldap://[2001:db8::7]/c=GB?objectClass=one&objectClass=two" )
print fn ParseURL( @"mailto:John.Doe@example.com" )
print fn ParseURL( @"news:comp.infosystems.www.servers.unix" )
print fn ParseURL( @"tel:+1-816-555-1212" )
print fn ParseURL( @"telnet://192.0.2.16:80/" )
print fn ParseURL( @"urn:oasis:names:specification:docbook:dtd:xml:4.1.2" )
HandleEvents