CFStream Proxy Properties Depend on the Stream Type
Choose the HTTP or SOCKS property according to the stream's protocol support in an existing CFStream application.
In an application maintaining CFStream code, choose the proxy property according to the kind of stream being configured. An HTTP request stream has protocol handling that a plain socket stream does not acquire merely from its property dictionary.
| Connection being built | Documented configuration |
|---|---|
| HTTP CFStream through an HTTP proxy | kCFStreamPropertyHTTPProxy |
| CFStream through a SOCKS proxy | kCFStreamPropertySOCKSProxy |
Apple describes the HTTP property specifically as configuring an HTTP CFStream. Such a stream can be created from a CFHTTPMessage request with CFReadStreamCreateForHTTPRequest. Opening that stream serializes and sends the HTTP request.
The SOCKS property accepts a CFDictionary containing at least the SOCKS proxy host and port keys. It is the corresponding public property for SOCKS handling on a CFStream. For an allowed public TCP test without proxy credentials, the SOCKS proxy list offers candidate host/port values for that dictionary. Match the stream’s supported protocol and verify access to the actual destination and port.
Apply the chosen property before opening the stream and check the Boolean result from the property-setting call. A rejected property can indicate that the stream or value does not support the requested configuration.
For arbitrary TCP traffic through an HTTP proxy, use a connector that performs the required CONNECT negotiation. That negotiation is protocol work; creating a raw stream to the proxy's address alone has not performed it.