Changeset 74431 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Sep 24, 2018 9:16:17 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r73003 r74431 34 34 #include <iprt/path.h> 35 35 #include <iprt/string.h> 36 #include <iprt/uri.h> 36 37 #include <iprt/cpp/utils.h> 37 38 … … 97 98 i_setDefaultVRDEExtPack(Utf8Str::Empty); 98 99 99 m->u lLogHistoryCount = 3;100 m->uLogHistoryCount = 3; 100 101 101 102 … … 873 874 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 874 875 875 *count = m->u lLogHistoryCount;876 *count = m->uLogHistoryCount; 876 877 877 878 return S_OK; … … 882 883 { 883 884 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 884 m->u lLogHistoryCount = count;885 m->uLogHistoryCount = count; 885 886 alock.release(); 886 887 … … 986 987 } 987 988 989 HRESULT SystemProperties::getProxyMode(ProxyMode_T *pProxyMode) 990 { 991 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 992 ProxyMode_T enmMode = *pProxyMode = (ProxyMode_T)m->uProxyMode; 993 AssertMsgReturn(enmMode == ProxyMode_System || enmMode == ProxyMode_NoProxy || enmMode == ProxyMode_Manual, 994 ("enmMode=%d\n", enmMode), E_UNEXPECTED); 995 return S_OK; 996 } 997 998 HRESULT SystemProperties::setProxyMode(ProxyMode_T aProxyMode) 999 { 1000 /* Validate input. */ 1001 switch (aProxyMode) 1002 { 1003 case ProxyMode_System: 1004 case ProxyMode_NoProxy: 1005 case ProxyMode_Manual: 1006 break; 1007 default: 1008 return setError(E_INVALIDARG, tr("Invalid ProxyMode value: %d"), (int)aProxyMode); 1009 } 1010 1011 /* Set and write out settings. */ 1012 { 1013 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1014 m->uProxyMode = aProxyMode; 1015 } 1016 AutoWriteLock alock(mParent COMMA_LOCKVAL_SRC_POS); /* required for saving. */ 1017 return mParent->i_saveSettings(); 1018 } 1019 1020 HRESULT SystemProperties::getProxyURL(com::Utf8Str &aProxyURL) 1021 { 1022 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1023 aProxyURL = m->strProxyUrl; 1024 return S_OK; 1025 } 1026 1027 HRESULT SystemProperties::setProxyURL(const com::Utf8Str &aProxyURL) 1028 { 1029 /* 1030 * Validate input. 1031 */ 1032 Utf8Str const *pStrProxyUrl = &aProxyURL; 1033 Utf8Str strTmp; 1034 if (pStrProxyUrl->isNotEmpty()) 1035 { 1036 /* RTUriParse requires a scheme, so append 'http://' if none seems present: */ 1037 if (pStrProxyUrl->find("://") == RTCString::npos) 1038 { 1039 strTmp.printf("http://%s", aProxyURL.c_str()); 1040 pStrProxyUrl = &strTmp; 1041 } 1042 1043 /* Use RTUriParse to check the format. There must be a hostname, but nothing 1044 can follow it and the port. */ 1045 RTURIPARSED Parsed; 1046 int vrc = RTUriParse(pStrProxyUrl->c_str(), &Parsed); 1047 if (RT_FAILURE(vrc)) 1048 return setErrorBoth(E_INVALIDARG, vrc, tr("Failed to parse proxy URL: %Rrc"), vrc); 1049 if ( Parsed.cchAuthorityHost == 0 1050 && !RTUriIsSchemeMatch(pStrProxyUrl->c_str(), "direct")) 1051 return setError(E_INVALIDARG, tr("Proxy URL must include a hostname")); 1052 if (Parsed.cchPath > 0) 1053 return setError(E_INVALIDARG, tr("Proxy URL must not include a path component (%.*s)"), 1054 Parsed.cchPath, pStrProxyUrl->c_str() + Parsed.offPath); 1055 if (Parsed.cchQuery > 0) 1056 return setError(E_INVALIDARG, tr("Proxy URL must not include a query component (?%.*s)"), 1057 Parsed.cchQuery, pStrProxyUrl->c_str() + Parsed.offQuery); 1058 if (Parsed.cchFragment > 0) 1059 return setError(E_INVALIDARG, tr("Proxy URL must not include a fragment component (#%.*s)"), 1060 Parsed.cchFragment, pStrProxyUrl->c_str() + Parsed.offFragment); 1061 } 1062 1063 /* 1064 * Set and write out settings. 1065 */ 1066 { 1067 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1068 m->strProxyUrl = *pStrProxyUrl; 1069 } 1070 AutoWriteLock alock(mParent COMMA_LOCKVAL_SRC_POS); /* required for saving. */ 1071 return mParent->i_saveSettings(); 1072 } 1073 988 1074 // public methods only for internal purposes 989 1075 ///////////////////////////////////////////////////////////////////////////// … … 1014 1100 if (FAILED(rc)) return rc; 1015 1101 1016 m->u lLogHistoryCount = data.ulLogHistoryCount;1102 m->uLogHistoryCount = data.uLogHistoryCount; 1017 1103 m->fExclusiveHwVirt = data.fExclusiveHwVirt; 1104 m->uProxyMode = data.uProxyMode; 1105 m->strProxyUrl = data.strProxyUrl; 1018 1106 1019 1107 rc = i_setAutostartDatabasePath(data.strAutostartDatabasePath); … … 1356 1444 return S_OK; 1357 1445 } 1446
Note:
See TracChangeset
for help on using the changeset viewer.