OSDN Git Service

Fixed Issue #137: Proxy Authentification fails
authorFrank Li <lznuaa@gmail.com>
Fri, 14 Aug 2009 14:39:19 +0000 (22:39 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 14 Aug 2009 14:39:19 +0000 (22:39 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Git/Git.cpp

index 46fc9bc..344312f 100644 (file)
@@ -839,6 +839,32 @@ BOOL CGit::CheckMsysGitDir()
        CString str;\r
 \r
 #ifndef _TORTOISESHELL\r
+       //set http_proxy\r
+       CString regServeraddress_copy = CRegString(_T("Software\\TortoiseGit\\Servers\\global\\http-proxy-host"), _T(""));\r
+       CString regServerport_copy = CRegString(_T("Software\\TortoiseGit\\Servers\\global\\http-proxy-port"), _T(""));\r
+       CString regUsername_copy = CRegString(_T("Software\\TortoiseGit\\Servers\\global\\http-proxy-username"), _T(""));\r
+       CString regPassword_copy = CRegString(_T("Software\\TortoiseGit\\Servers\\global\\http-proxy-password"), _T(""));\r
+       CString regTimeout_copy = CRegString(_T("Software\\TortoiseGit\\Servers\\global\\http-proxy-timeout"), _T(""));\r
+       CString regExceptions_copy = CRegString(_T("Software\\TortoiseGit\\Servers\\global\\http-proxy-exceptions"), _T(""));\r
+\r
+       CString http_proxy;\r
+       if(!regServeraddress_copy.IsEmpty())\r
+       {\r
+               http_proxy=_T("http://");\r
+               if(!regUsername_copy.IsEmpty())\r
+               {\r
+                       http_proxy += regUsername_copy;\r
+                       http_proxy += _T(":")+regPassword_copy;\r
+                       http_proxy += _T("@");\r
+               }\r
+               http_proxy+=regServeraddress_copy;\r
+               if(!regServerport_copy.IsEmpty())\r
+               {\r
+                       http_proxy +=_T(":")+regServerport_copy;\r
+               }\r
+               _tputenv_s(_T("http_proxy"),http_proxy);\r
+       }\r
+       \r
        //setup ssh client\r
        CString sshclient=CRegString(_T("Software\\TortoiseGit\\SSH"));\r
 \r