CFHTTPMessageCreateRequest(_:_:_:_:)
Creates and returns a CFHTTPMessage object for an HTTP request.
Declaration
func CFHTTPMessageCreateRequest(_ alloc: CFAllocator?, _ requestMethod: CFString, _ url: CFURL, _ httpVersion: CFString) -> Unmanaged<CFHTTPMessage>Parameters
- requestMethod:
The request method for the request. Use any of the request methods allowed by the HTTP version specified by
httpVersion. - url:
The URL to which the request will be sent.
- httpVersion:
The HTTP version for this message. Pass
kCFHTTPVersion1_0orkCFHTTPVersion1_1.
Return Value
A new CFHTTPMessage object, or NULL if there was a problem creating the object. Ownership follows the The Create Rule.
Discussion
This function returns a CFHTTPMessage object that you can use to build an HTTP request. Continue building the request by callingCFHTTPMessageSetBody(_:_:) to set the message’s body. Call CFHTTPMessageCopyHeaderFieldValue(_:_:) to set the message’s headers.
If you are using a CFReadStream object to send the message, call CFReadStreamCreateForHTTPRequest(_:_:) to create a read stream for the request. If you are not using CFReadStream, call CFHTTPMessageCopySerializedMessage(_:) to make the message ready for transmission by serializing it.
See Also
HTTP Messages
CFHTTPMessageCFHTTPMessageAddAuthentication(_:_:_:_:_:_:)CFHTTPMessageAppendBytes(_:_:_:)CFHTTPMessageApplyCredentialDictionary(_:_:_:_:)CFHTTPMessageApplyCredentials(_:_:_:_:_:)CFHTTPMessageCopyAllHeaderFields(_:)CFHTTPMessageCopyBody(_:)CFHTTPMessageCopyHeaderFieldValue(_:_:)CFHTTPMessageCopyRequestMethod(_:)CFHTTPMessageCopyRequestURL(_:)CFHTTPMessageCopyResponseStatusLine(_:)CFHTTPMessageCopySerializedMessage(_:)CFHTTPMessageCopyVersion(_:)CFHTTPMessageCreateCopy(_:_:)CFHTTPMessageCreateEmpty(_:_:)