Data Update
This commit is contained in:
parent
015c2add84
commit
e50b5c3114
206 changed files with 6337 additions and 523 deletions
25
Task/HTTP/FutureBasic/http.basic
Normal file
25
Task/HTTP/FutureBasic/http.basic
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
#plist NSAppTransportSecurity @{NSAllowsArbitraryLoads:YES}
|
||||
|
||||
local fn URLSessionHandler( session as URLSessionRef, dta as CFDataRef, response as URLResponseRef, err as ErrorRef, userData as ptr )
|
||||
if ( fn HTTPURLResponseStatusCode( (HTTPURLResponseRef)response ) == 200 )
|
||||
NSLog( @"%@", fn StringWithData( dta, NSUTF8StringEncoding ) )
|
||||
else
|
||||
NSLog( @"%@", fn ErrorLocalizedDescription( err ) )
|
||||
end if
|
||||
NSLogScrollToTop
|
||||
end fn
|
||||
|
||||
local fn URLSessionWithGetRequest( path as CFStringRef )
|
||||
CFURLRef url = fn URLWithString( path )
|
||||
MutableURLRequestRef urlRequest = fn MutableURLRequestWithURL( url )
|
||||
MutableURLRequestSetHTTPMethod( urlRequest, @"HTTP" )
|
||||
URLSessionRef session = fn URLSessionSharedSession
|
||||
URLSessionDataTaskRef task = fn URLSessionDataTaskWithRequestCompletionHandler( session, urlRequest, @fn URLSessionHandler, NULL )
|
||||
URLSessionTaskResume( task )
|
||||
end fn
|
||||
|
||||
fn URLSessionWithGetRequest( @"http://rosettacode.org" )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue