CFHTTPMessageCreateResponse(_:_:_:_:)
Creates and returns a CFHTTPMessage object for an HTTP response.
Declaration
func CFHTTPMessageCreateResponse(_ alloc: CFAllocator?, _ statusCode: CFIndex, _ statusDescription: CFString?, _ httpVersion: CFString) -> Unmanaged<CFHTTPMessage>Parameters
- statusCode:
The status code for this message response. The status code can be any of the status codes defined in section 6.1.1 of RFC 2616.
- statusDescription:
The description that corresponds to the status code. Pass NULL to use the standard description for the given status code, as found in RFC 2616.
- httpVersion:
The HTTP version for this message response. 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 response. Continue building the response by callingCFHTTPMessageSetBody(_:_:) to set the message’s body. Call CFHTTPMessageSetHeaderFieldValue(_:_:_:) to set the message’s headers. Then 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(_:_:)