CFReadStreamCreateForHTTPRequest(_:_:)
Creates a read stream for a CFHTTP request message.
Declaration
func CFReadStreamCreateForHTTPRequest(_ alloc: CFAllocator?, _ request: CFHTTPMessage) -> Unmanaged<CFReadStream>Parameters
- alloc:
The allocator to use to allocate memory for the new object. Pass
NULLor kCFAllocatorDefault to use the current default allocator. - request:
A CFHTTP request message whose body and headers have been set.
Return Value
A new read stream, or NULL if there was a problem creating the object. Ownership follows the The Create Rule.
Discussion
This function creates a read stream and associates it with the specified request. Automatic redirection is disabled by default. After creating the read stream, you can call CFReadStreamGetError(_:) at any time to check the status of the stream. You may want to call CFHTTPReadStreamSetRedirectsAutomatically to enable automatic redirection, or CFHTTPReadStreamSetProxy to set the name and port number for a proxy. To serialize the request and send it, call CFReadStreamOpen(_:).
If the body of the request is too long to keep in memory, call CFReadStreamCreateForStreamedHTTPRequest(_:_:_:) instead of this function.
See Also
Streams
CFReadStreamCreateForStreamedHTTPRequest(_:_:_:)kCFStreamPropertyHTTPAttemptPersistentConnectionkCFStreamPropertyHTTPFinalRequestkCFStreamPropertyHTTPFinalURLkCFStreamPropertyHTTPProxykCFStreamPropertyHTTPProxyHostkCFStreamPropertyHTTPProxyPortkCFStreamPropertyHTTPRequestBytesWrittenCountkCFStreamPropertyHTTPResponseHeaderkCFStreamPropertyHTTPSProxyHostkCFStreamPropertyHTTPSProxyPortkCFStreamPropertyHTTPShouldAutoredirectCFWriteStreamCreateWithFTPURL(_:_:)CFReadStreamCreateWithFTPURL(_:_:)kCFStreamPropertyFTPAttemptPersistentConnection