Changeset 94807 in vbox
- Timestamp:
- May 4, 2022 8:13:06 AM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/UpdateAgentImpl.h
r94756 r94807 75 75 * @{ */ 76 76 static Utf8Str i_getPlatformInfo(void); 77 const char *i_proxyModeToStr(ProxyMode_T enmMode); 77 const char *i_proxyModeToStr(ProxyMode_T enmMode); 78 bool i_urlSchemeIsSupported(const Utf8Str &strUrl) const; 78 79 /** @} */ 79 80 -
trunk/src/VBox/Main/src-server/UpdateAgentImpl.cpp
r94756 r94807 287 287 } 288 288 289 /** 290 * Returns whether a given URL's scheme is supported or not. 291 * 292 * @returns \c true if scheme is supported, or \c false if not. 293 * @param strUrl URL to check scheme for. 294 * 295 * @note Empty URL are considered as being supported for convenience. 296 */ 297 bool UpdateAgentBase::i_urlSchemeIsSupported(const Utf8Str &strUrl) const 298 { 299 if (strUrl.isEmpty()) 300 return true; 301 return strUrl.startsWith("https://", com::Utf8Str::CaseInsensitive); 302 } 303 289 304 290 305 /********************************************************************************************************************************* … … 534 549 HRESULT UpdateAgent::setRepositoryURL(const com::Utf8Str &aRepo) 535 550 { 536 if (! aRepo.startsWith("https://", com::Utf8Str::CaseInsensitive))537 return setError(E_INVALIDARG, tr("Invalid URL scheme specified ; only https:// is supported."));551 if (!i_urlSchemeIsSupported(aRepo)) 552 return setError(E_INVALIDARG, tr("Invalid URL scheme specified!")); 538 553 539 554 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 664 679 * 665 680 * @returns HRESULT 681 * @retval E_INVALIDARG if to-load settings are invalid / not supported. 666 682 * @param data Where to load the settings from. 667 683 */ … … 679 695 m->strRepoUrl = data.strRepoUrl; 680 696 m->enmProxyMode = data.enmProxyMode; 681 m->strProxyUrl = data.strProxyUrl; 697 if (data.strProxyUrl.isNotEmpty()) /* Explicitly set (and mark) an own proxy? */ 698 { 699 m->strProxyUrl = data.strProxyUrl; 700 mData.m_fUseOwnProxy = true; 701 } 682 702 m->strLastCheckDate = data.strLastCheckDate; 683 703 m->uCheckCount = data.uCheckCount; 704 705 /* Sanity checks. */ 706 if (!i_urlSchemeIsSupported(data.strRepoUrl)) 707 return setError(E_INVALIDARG, tr("Invalid URL scheme specified!")); 684 708 685 709 return S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.