Re: HTTPS streams through a proxy
来源:互联网 发布:网络切换软件 编辑:程序博客网 时间:2024/06/11 18:45
转自: http://lists.apple.com/archives/macnetworkprog/2004/May/msg00040.html
Re: HTTPS streams through a proxy
- Subject: Re: HTTPS streams through a proxy
- From: Becky Willrich <email@hidden>
- Date: Thu, 13 May 2004 17:03:26 -0700
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.
- Re: HTTPS streams through a proxy
- Connect through a Proxy
- Layered connections through a proxy server
- NET: Connecting a TcpClient through an HTTP proxy with authentication
- Subverion (SVN) through proxy
- ssh through http proxy
- A re:
- nginx proxy https
- maven https behind proxy
- RMI Through a Firewall
- getmsg, getpmsg - receive next message from a STREAMS file (STREAMS)
- tian re a !
- STREAMS
- Streams
- Streams
- Streams
- Git push via proxy + https
- nodejs 为HTTPS添加proxy
- Spring AOP原理与生活(二)
- 关于 visual studio(vs2005/vs2008/vs2010)中的Character Set
- 读《企业应用设计模式》2
- The guide to implementing 2D platformers(2D动作游戏开发与实现)
- IOS 5中的strong和weak关键字
- Re: HTTPS streams through a proxy
- CSDN博客存在的一些问题
- css实现强制不换行/自动换行/强制换行
- 两级联动菜单的实现之二 --- 用ajax实现菜单联动
- javabean ireport 做交叉报表
- 企业路由器应用——命令行—管理
- 华为三层混合模式端口配置
- 数据仓库的数据存储和实现(转)
- Sencha Touch入门