RE: HTTPS streams through a proxy
RE: HTTPS streams through a proxy
- Subject: RE: HTTPS streams through a proxy
- From: "Francois Cournoyer" <email@hidden>
- Date: Fri, 14 May 2004 08:47:00 -0400
- Thread-topic: HTTPS streams through a proxy
Thanks, I'll try that.
In the end though we may have different settings for both HTTP and
HTTPS,
Can I guess that I can put 4 keys/values instead of 2, and put the
kCFStreamPropertyHTTPProxyHost/port as well?
Also, by doing so, am I sure that it will absolutely use the proxy,
isn't there another property to change, like ProxyEnabled or something?
-----Original Message-----
From: Becky Willrich [
mailto:email@hidden]
Sent: Thursday, May 13, 2004 8:03 PM
To: Francois Cournoyer
Cc: email@hidden
Subject: Re: HTTPS streams through a proxy
>
We could use:
>
CFDictionaryRef proxyDict = SCDynamicStoreCopyProxies(NULL);
>
>
CFReadStreamSetProperty(readStream, kCFStreamPropertyHTTPProxy,
>
proxyDict);
>
>
But we need to be able to use specific proxy settings, independently
>
from the settings in the panel.
>
>
I am yet unsure on how to modify the proxyDict(if possible) so that it
>
would use the right settings for the proxy, or is there another way to
>
do this?
You are on the right track - CFReadStreamSetProperty(readStream,
kCFStreamPropertyHTTPProxy, proxyDict) is the right call for
configuring the HTTP(S) proxy; you just have to figure out what the
right content for proxyDict is. If you just pass through
SCDynamicStoreCopyProxies(NULL) as above, you get the default proxies
as the user has configured them on the system. To create custom proxy
settings, you can either make a mutable copy of the proxy dict returned
by SCDynamicStoreCopyProxies() then change the settings you want, or
you can create a new dictionary from scratch. To create a new
dictionary from scratch, just use the keys given in CFHTTPStream.h.
That will look something like this:
CFTypeRef keys[2], values[2];
keys[0] = kCFStreamPropertyHTTPSProxyHost;
values[0] = myHTTPSProxyHost;
keys[1] = kCFStreamPropertyHTTPSProxyPort;
values[1] = CFNumberCreate(NULL, kCFNumberSInt32Type,
&myHTTPSProxyPortNumber);
proxyDict = CFDictionaryCreate(NULL, keys, values, 2,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFReadStreamSetProperty(readStream, kCFStreamPropertyHTTPProxy,
proxyDict);
This sets the HTTPS proxy to be whatever host is in myHTTPSProxyHost
(should be a CFString) and whatever port is in myHTTPSProxyPortNumber.
Hope that helps,
REW
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.