diff --git a/darwin_test.go b/darwin_test.go index 1776ae9..ac69a4c 100644 --- a/darwin_test.go +++ b/darwin_test.go @@ -47,6 +47,11 @@ func TestPacfile(t *testing.T) { "http://google.com", "127.0.0.1:8", }, + { + serverBase + "simple.pac", + "https://google.com", + "127.0.0.1:8", + }, { serverBase + "multiple.pac", "http://google.com", diff --git a/pac_darwin.go b/pac_darwin.go index a8bf90e..6c993f3 100644 --- a/pac_darwin.go +++ b/pac_darwin.go @@ -64,6 +64,20 @@ char* _getProxyUrlFromPac(char* pac, char* reqCs) { CFNumberGetValue(port, kCFNumberIntType, &port_int); } + sprintf(retCString, "%s:%d", host_str, port_int); + } + if (CFEqual(pxyType, kCFProxyTypeHTTPS)) { + CFStringRef host = (CFStringRef)CFDictionaryGetValue(pxy, kCFProxyHostNameKey); + CFNumberRef port = (CFNumberRef)CFDictionaryGetValue(pxy, kCFProxyPortNumberKey); + + char host_str[STR_LEN - 16]; + CFStringGetCString(host, host_str, STR_LEN - 16, kCFStringEncodingUTF8); + + int port_int = 443; + if (port) { + CFNumberGetValue(port, kCFNumberIntType, &port_int); + } + sprintf(retCString, "%s:%d", host_str, port_int); } }