Changeset 68951 in webkit


Ignore:
Timestamp:
Oct 1, 2010 4:28:17 PM (14 years ago)
Author:
andersca@apple.com
Message:

Add proxy server query function proxyServersForURL and change the Mac plug-in code to use it
https://bugs.webkit.org/show_bug.cgi?id=47022
<rdar://problem/8504712>

Reviewed by Dan Bernstein.

WebCore:

  • WebCore.exp.in:

Export proxyServersForURL and toString.

  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:

Add new files.

  • platform/network/ProxyServer.cpp: Added.

(WebCore::appendProxyServerString):
(WebCore::toString):
New function that converts a vector of ProxyServers into a PAC style string.

  • platform/network/ProxyServer.h: Added.

(WebCore::ProxyServer::ProxyServer):
(WebCore::ProxyServer::type):
(WebCore::ProxyServer::hostName):
(WebCore::ProxyServer::port):
Add ProxyServer class.

  • platform/network/cf/ProxyServerCFNet.cpp: Added.

(WebCore::proxyServersForURL):
(WebCore::addProxyServersForURL):
Query CFNetwork for the proxy servers given a URL.

WebKit/mac:

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm:

(WebKit::NetscapePluginInstanceProxy::getProxy):

  • Plugins/WebBaseNetscapePluginView.h:
  • Plugins/WebBaseNetscapePluginView.mm:
  • Plugins/WebNetscapePluginView.mm:

(-[WebNetscapePluginView getVariable:forURL:value:length:]):

Location:
trunk
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r68942 r68951  
     12010-10-01  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Add proxy server query function proxyServersForURL and change the Mac plug-in code to use it
     6        https://bugs.webkit.org/show_bug.cgi?id=47022
     7        <rdar://problem/8504712>
     8
     9        * WebCore.exp.in:
     10        Export proxyServersForURL and toString.
     11
     12        * WebCore.vcproj/WebCore.vcproj:
     13        * WebCore.xcodeproj/project.pbxproj:
     14        Add new files.
     15
     16        * platform/network/ProxyServer.cpp: Added.
     17        (WebCore::appendProxyServerString):
     18        (WebCore::toString):
     19        New function that converts a vector of ProxyServers into a PAC style string.
     20
     21        * platform/network/ProxyServer.h: Added.
     22        (WebCore::ProxyServer::ProxyServer):
     23        (WebCore::ProxyServer::type):
     24        (WebCore::ProxyServer::hostName):
     25        (WebCore::ProxyServer::port):
     26        Add ProxyServer class.
     27
     28        * platform/network/cf/ProxyServerCFNet.cpp: Added.
     29        (WebCore::proxyServersForURL):
     30        (WebCore::addProxyServersForURL):
     31        Query CFNetwork for the proxy servers given a URL.
     32
    1332010-09-30  Zhenyao Mo  <zmo@google.com>
    234
  • trunk/WebCore/WebCore.exp.in

    r68854 r68951  
    415415__ZN7WebCore18isStartOfParagraphERKNS_15VisiblePositionE
    416416__ZN7WebCore18pluginScriptObjectEPN3JSC9ExecStateEPNS_13JSHTMLElementE
     417__ZN7WebCore18proxyServersForURLERKNS_4KURLE
    417418__ZN7WebCore19AnimationController16resumeAnimationsEPNS_8DocumentE
    418419__ZN7WebCore19AnimationController17suspendAnimationsEPNS_8DocumentE
     
    760761__ZN7WebCore8blankURLEv
    761762__ZN7WebCore8makeRGBAEiiii
     763__ZN7WebCore8toStringERKN3WTF6VectorINS_11ProxyServerELm0EEE
    762764__ZN7WebCore9DOMWindow30dispatchAllPendingUnloadEventsEv
    763765__ZN7WebCore9DOMWindow36dispatchAllPendingBeforeUnloadEventsEv
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r68905 r68951  
    2738527385                                </File>
    2738627386                                <File
     27387                                        RelativePath="..\platform\network\ProxyServer.cpp"
     27388                                        >
     27389                                </File>
     27390                                <File
     27391                                        RelativePath="..\platform\network\ProxyServer.h"
     27392                                        >
     27393                                </File>
     27394                                <File
    2738727395                                        RelativePath="..\platform\network\ResourceErrorBase.cpp"
    2738827396                                        >
     
    2760227610                                                RelativePath="..\platform\network\cf\LoaderRunLoopCF.h"
    2760327611                                                >
     27612                                        </File>
     27613                                        <File
     27614                                                RelativePath="..\platform\network\cf\ProxyServerCFNet.cpp"
     27615                                                >
     27616                                                <FileConfiguration
     27617                                                        Name="Debug_Cairo|Win32"
     27618                                                        ExcludedFromBuild="true"
     27619                                                        >
     27620                                                        <Tool
     27621                                                                Name="VCCLCompilerTool"
     27622                                                        />
     27623                                                </FileConfiguration>
     27624                                                <FileConfiguration
     27625                                                        Name="Release_Cairo|Win32"
     27626                                                        ExcludedFromBuild="true"
     27627                                                        >
     27628                                                        <Tool
     27629                                                                Name="VCCLCompilerTool"
     27630                                                        />
     27631                                                </FileConfiguration>
    2760427632                                        </File>
    2760527633                                        <File
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r68878 r68951  
    595595                1AE82FED0CAB07EE002237AE /* JSSQLResultSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE82FEB0CAB07EE002237AE /* JSSQLResultSet.h */; };
    596596                1AF326790D78B9440068F0C4 /* EditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF326770D78B9440068F0C4 /* EditorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
     597                1AF8E11A1256592600230FF7 /* ProxyServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF8E1191256592600230FF7 /* ProxyServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
     598                1AF8E13312565A4400230FF7 /* ProxyServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF8E13212565A4400230FF7 /* ProxyServer.cpp */; };
     599                1AF8E1C3125673E000230FF7 /* ProxyServerCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF8E1C1125673E000230FF7 /* ProxyServerCFNet.cpp */; };
    597600                1AFE117D0CBFFB36003017FA /* SQLResultSetRowList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFE117B0CBFFB36003017FA /* SQLResultSetRowList.cpp */; };
    598601                1AFE117E0CBFFB36003017FA /* SQLResultSetRowList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFE117C0CBFFB36003017FA /* SQLResultSetRowList.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    65826585                1AE82FEB0CAB07EE002237AE /* JSSQLResultSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLResultSet.h; sourceTree = "<group>"; };
    65836586                1AF326770D78B9440068F0C4 /* EditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorClient.h; sourceTree = "<group>"; };
     6587                1AF8E1191256592600230FF7 /* ProxyServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyServer.h; sourceTree = "<group>"; };
     6588                1AF8E13212565A4400230FF7 /* ProxyServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyServer.cpp; sourceTree = "<group>"; };
     6589                1AF8E1C1125673E000230FF7 /* ProxyServerCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyServerCFNet.cpp; sourceTree = "<group>"; };
    65846590                1AFE117B0CBFFB36003017FA /* SQLResultSetRowList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLResultSetRowList.cpp; sourceTree = "<group>"; };
    65856591                1AFE117C0CBFFB36003017FA /* SQLResultSetRowList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLResultSetRowList.h; sourceTree = "<group>"; };
     
    72867292                51A9267B0D53F0570063ECC2 /* OriginUsageRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OriginUsageRecord.h; sourceTree = "<group>"; };
    72877293                51AA3F6E0BD5AA9E00892971 /* ResourceLoaderMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceLoaderMac.mm; sourceTree = "<group>"; };
    7288                 51ABAE1A103C18FF008C5260 /* SocketStreamError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocketStreamError.h; path = cf/SocketStreamError.h; sourceTree = "<group>"; };
    7289                 51ABAE1C103C1913008C5260 /* SocketStreamHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocketStreamHandle.h; path = cf/SocketStreamHandle.h; sourceTree = "<group>"; };
    7290                 51ABAE1D103C1913008C5260 /* SocketStreamHandleCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocketStreamHandleCFNet.cpp; path = cf/SocketStreamHandleCFNet.cpp; sourceTree = "<group>"; };
     7294                51ABAE1A103C18FF008C5260 /* SocketStreamError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamError.h; sourceTree = "<group>"; };
     7295                51ABAE1C103C1913008C5260 /* SocketStreamHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocketStreamHandle.h; path = ../qt/SocketStreamHandle.h; sourceTree = "<group>"; };
     7296                51ABAE1D103C1913008C5260 /* SocketStreamHandleCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SocketStreamHandleCFNet.cpp; sourceTree = "<group>"; };
    72917297                51ABAE421043AB4A008C5260 /* WebSocketHandshake.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketHandshake.cpp; sourceTree = "<group>"; };
    72927298                51ABAE431043AB4A008C5260 /* WebSocketHandshake.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketHandshake.h; sourceTree = "<group>"; };
     
    1020610212                B2ED97700B1F55CE00257D0F /* GraphicsContextCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextCG.cpp; sourceTree = "<group>"; };
    1020710213                B2F34FE50E82F81400F627CD /* DNS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNS.h; sourceTree = "<group>"; };
    10208                 B2F34FE80E82F82700F627CD /* DNSCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DNSCFNet.cpp; path = cf/DNSCFNet.cpp; sourceTree = "<group>"; };
     10214                B2F34FE80E82F82700F627CD /* DNSCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DNSCFNet.cpp; sourceTree = "<group>"; };
    1020910215                B2FA3C4E0AB75A6E000E5AC4 /* JSSVGAnimateColorElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGAnimateColorElement.cpp; sourceTree = "<group>"; };
    1021010216                B2FA3C4F0AB75A6E000E5AC4 /* JSSVGAnimateColorElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSSVGAnimateColorElement.h; sourceTree = "<group>"; };
     
    1283912845                                514C765F0CE923A1007EF3CD /* ProtectionSpace.cpp */,
    1284012846                                514C76600CE923A1007EF3CD /* ProtectionSpace.h */,
     12847                                1AF8E13212565A4400230FF7 /* ProxyServer.cpp */,
     12848                                1AF8E1191256592600230FF7 /* ProxyServer.h */,
    1284112849                                51A052551058874000CC9E95 /* ProtectionSpaceHash.h */,
    1284212850                                934F713D0D5A6F2800018D69 /* ResourceErrorBase.cpp */,
     
    1649816506                        children = (
    1649916507                                B2F34FE80E82F82700F627CD /* DNSCFNet.cpp */,
     16508                                1AF8E1C1125673E000230FF7 /* ProxyServerCFNet.cpp */,
    1650016509                                51ABAE1A103C18FF008C5260 /* SocketStreamError.h */,
    1650116510                                51ABAE1C103C1913008C5260 /* SocketStreamHandle.h */,
    1650216511                                51ABAE1D103C1913008C5260 /* SocketStreamHandleCFNet.cpp */,
    1650316512                        );
    16504                         name = cf;
     16513                        path = cf;
    1650516514                        sourceTree = "<group>";
    1650616515                };
     
    2095220961                                080E49261255F3BD00EFCA27 /* SVGTextLayoutEngineBaseline.h in Headers */,
    2095320962                                080E49281255F3BD00EFCA27 /* SVGTextLayoutEngineSpacing.h in Headers */,
     20963                                1AF8E11A1256592600230FF7 /* ProxyServer.h in Headers */,
    2095420964                        );
    2095520965                        runOnlyForDeploymentPostprocessing = 0;
     
    2101121021                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
    2101221022                        compatibilityVersion = "Xcode 2.4";
     21023                        developmentRegion = English;
    2101321024                        hasScannedForEncodings = 1;
    2101421025                        knownRegions = (
     
    2348023491                                080E49251255F3BD00EFCA27 /* SVGTextLayoutEngineBaseline.cpp in Sources */,
    2348123492                                080E49271255F3BD00EFCA27 /* SVGTextLayoutEngineSpacing.cpp in Sources */,
     23493                                1AF8E13312565A4400230FF7 /* ProxyServer.cpp in Sources */,
     23494                                1AF8E1C3125673E000230FF7 /* ProxyServerCFNet.cpp in Sources */,
    2348223495                        );
    2348323496                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit/mac/ChangeLog

    r68854 r68951  
     12010-10-01  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Add proxy server query function proxyServersForURL and change the Mac plug-in code to use it
     6        https://bugs.webkit.org/show_bug.cgi?id=47022
     7        <rdar://problem/8504712>
     8
     9        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
     10        (WebKit::NetscapePluginInstanceProxy::getProxy):
     11        * Plugins/WebBaseNetscapePluginView.h:
     12        * Plugins/WebBaseNetscapePluginView.mm:
     13        * Plugins/WebNetscapePluginView.mm:
     14        (-[WebNetscapePluginView getVariable:forURL:value:length:]):
     15
    1162010-09-30  Darin Adler  <darin@apple.com>
    217
  • trunk/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm

    r68160 r68951  
    5151#import <WebCore/FrameTree.h>
    5252#import <WebCore/KURL.h>
     53#import <WebCore/ProxyServer.h>
    5354#import <WebCore/SecurityOrigin.h>
    5455#import <WebCore/ScriptController.h>
     
    15581559        return false;
    15591560
    1560     WTF::CString proxyStringUTF8 = proxiesForURL(url);
     1561    Vector<ProxyServer> proxyServers = proxyServersForURL(URL);
     1562    WTF::CString proxyStringUTF8 = toString(proxyServers).utf8();
    15611563
    15621564    proxyLength = proxyStringUTF8.length();
  • trunk/WebKit/mac/Plugins/WebBaseNetscapePluginView.h

    r65021 r68951  
    146146
    147147namespace WebKit {
    148 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
    149 WTF::CString proxiesForURL(NSURL *);
    150 #endif
    151    
    152148bool getAuthenticationInfo(const char* protocolStr, const char* hostStr, int32_t port, const char* schemeStr, const char* realmStr,
    153149                           WTF::CString& username, WTF::CString& password);
  • trunk/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm

    r65904 r68951  
    961961namespace WebKit {
    962962
    963 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
    964 CString proxiesForURL(NSURL *url)
    965 {
    966     RetainPtr<CFDictionaryRef> systemProxies(AdoptCF, CFNetworkCopySystemProxySettings());
    967     if (!systemProxies)
    968         return "DIRECT";
    969    
    970     RetainPtr<CFArrayRef> proxiesForURL(AdoptCF, CFNetworkCopyProxiesForURL((CFURLRef)url, systemProxies.get()));
    971     CFIndex proxyCount = proxiesForURL ? CFArrayGetCount(proxiesForURL.get()) : 0;
    972     if (!proxyCount)
    973         return "DIRECT";
    974  
    975     // proxiesForURL is a CFArray of CFDictionaries. Each dictionary represents a proxy.
    976     // The format of the result should be:
    977     // "PROXY host[:port]" (for HTTP proxy) or
    978     // "SOCKS host[:port]" (for SOCKS proxy) or
    979     // A combination of the above, separated by semicolon, in the order that they should be tried.
    980     String proxies;
    981     for (CFIndex i = 0; i < proxyCount; ++i) {
    982         CFDictionaryRef proxy = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(proxiesForURL.get(), i));
    983         if (!proxy)
    984             continue;
    985 
    986         CFStringRef type = static_cast<CFStringRef>(CFDictionaryGetValue(proxy, kCFProxyTypeKey));
    987         bool isHTTP = type == kCFProxyTypeHTTP || type == kCFProxyTypeHTTPS;
    988         bool isSOCKS = type == kCFProxyTypeSOCKS;
    989        
    990         // We can only report HTTP and SOCKS proxies.
    991         if (!isHTTP && !isSOCKS)
    992             continue;
    993        
    994         CFStringRef host = static_cast<CFStringRef>(CFDictionaryGetValue(proxy, kCFProxyHostNameKey));
    995         CFNumberRef port = static_cast<CFNumberRef>(CFDictionaryGetValue(proxy, kCFProxyPortNumberKey));
    996        
    997         // If we are inserting multiple entries, add a separator
    998         if (!proxies.isEmpty())
    999             proxies += ";";
    1000        
    1001         if (isHTTP)
    1002             proxies += "PROXY ";
    1003         else if (isSOCKS)
    1004             proxies += "SOCKS ";
    1005        
    1006         proxies += host;
    1007 
    1008         if (port) {
    1009             SInt32 intPort;
    1010             CFNumberGetValue(port, kCFNumberSInt32Type, &intPort);
    1011            
    1012             proxies += ":" + String::number(intPort);
    1013         }
    1014     }
    1015    
    1016     if (proxies.isEmpty())
    1017         return "DIRECT";
    1018    
    1019     return proxies.utf8();
    1020 }
    1021 #endif
    1022 
    1023963bool getAuthenticationInfo(const char* protocolStr, const char* hostStr, int32_t port, const char* schemeStr, const char* realmStr,
    1024964                           CString& username, CString& password)
  • trunk/WebKit/mac/Plugins/WebNetscapePluginView.mm

    r68630 r68951  
    6767#import <WebCore/Page.h>
    6868#import <WebCore/PluginMainThreadScheduler.h>
     69#import <WebCore/ProxyServer.h>
    6970#import <WebCore/ScriptController.h>
    7071#import <WebCore/SecurityOrigin.h>
     
    22402241                break;
    22412242
    2242             CString proxiesUTF8 = proxiesForURL(URL);
     2243            Vector<ProxyServer> proxyServers = proxyServersForURL(URL);
     2244            CString proxiesUTF8 = toString(proxyServers).utf8();
    22432245           
    22442246            *value = static_cast<char*>(NPN_MemAlloc(proxiesUTF8.length()));
Note: See TracChangeset for help on using the changeset viewer.