diff --git a/src/add-ons/print/transports/ipp/HttpURLConnection.cpp b/src/add-ons/print/transports/ipp/HttpURLConnection.cpp index eb68393c4d..b4c699b4dd 100644 --- a/src/add-ons/print/transports/ipp/HttpURLConnection.cpp +++ b/src/add-ons/print/transports/ipp/HttpURLConnection.cpp @@ -287,7 +287,7 @@ void HttpURLConnection::getResponse() { const char *p = getHeaderField("Location"); if (p) { - BUrl trueUrl(p); + BUrl trueUrl(p, true); url = trueUrl; delete __response; __response = NULL; diff --git a/src/add-ons/print/transports/ipp/IppSetupDlg.cpp b/src/add-ons/print/transports/ipp/IppSetupDlg.cpp index 5285fe3a96..38a32a0fb3 100644 --- a/src/add-ons/print/transports/ipp/IppSetupDlg.cpp +++ b/src/add-ons/print/transports/ipp/IppSetupDlg.cpp @@ -114,7 +114,7 @@ bool IppSetupView::UpdateViewData() request->setURI("printer-uri", url->Text()); request->setDelimiter(IPP_END_OF_ATTRIBUTES_TAG); - IppURLConnection conn(BUrl(url->Text())); + IppURLConnection conn(BUrl(url->Text(), true)); conn.setIppRequest(request); conn.setRequestProperty("Connection", "close"); diff --git a/src/add-ons/print/transports/ipp/IppTransport.cpp b/src/add-ons/print/transports/ipp/IppTransport.cpp index a70638734a..0bd3c5daa5 100644 --- a/src/add-ons/print/transports/ipp/IppTransport.cpp +++ b/src/add-ons/print/transports/ipp/IppTransport.cpp @@ -97,7 +97,7 @@ IppTransport::~IppTransport() __fs.seekg(0, ios::beg); request->setRawData(__fs, fssize); - BUrl url(__url); + BUrl url(__url, true); IppURLConnection conn(url); conn.setIppRequest(request); conn.setRequestProperty("Connection", "close"); diff --git a/src/apps/haikudepot/server/ServerSettings.cpp b/src/apps/haikudepot/server/ServerSettings.cpp index 8382c6f5ec..21ab6b79c8 100644 --- a/src/apps/haikudepot/server/ServerSettings.cpp +++ b/src/apps/haikudepot/server/ServerSettings.cpp @@ -23,7 +23,7 @@ #define USERAGENT_FALLBACK_VERSION "0.0.0" -BUrl ServerSettings::sBaseUrl = BUrl(BASEURL_DEFAULT); +BUrl ServerSettings::sBaseUrl = BUrl(BASEURL_DEFAULT, true); BString ServerSettings::sUserAgent = BString(); pthread_once_t ServerSettings::sUserAgentInitOnce = PTHREAD_ONCE_INIT; bool ServerSettings::sPreferCache = false; diff --git a/src/apps/haikudepot/ui/App.cpp b/src/apps/haikudepot/ui/App.cpp index 5dd7a7677d..5286b9712a 100644 --- a/src/apps/haikudepot/ui/App.cpp +++ b/src/apps/haikudepot/ui/App.cpp @@ -277,7 +277,7 @@ App::ArgvReceived(int32 argc, char* argv[]) break; case WEB_APP_BASE_URL_SWITCH: - if (ServerSettings::SetBaseUrl(BUrl(argv[i + 1])) != B_OK) { + if (ServerSettings::SetBaseUrl(BUrl(argv[i + 1], true)) != B_OK) { HDERROR("malformed web app base url; %s", argv[i + 1]); Quit(); } else { diff --git a/src/apps/haikudepot/ui/PackageInfoView.cpp b/src/apps/haikudepot/ui/PackageInfoView.cpp index a959a008f7..31dadb1058 100644 --- a/src/apps/haikudepot/ui/PackageInfoView.cpp +++ b/src/apps/haikudepot/ui/PackageInfoView.cpp @@ -777,7 +777,7 @@ public: case MSG_VISIT_PUBLISHER_WEBSITE: { - BUrl url(fWebsiteLinkView->Text()); + BUrl url(fWebsiteLinkView->Text(), true); url.OpenWithPreferredApplication(); break; } diff --git a/src/apps/mediaplayer/MainApp.cpp b/src/apps/mediaplayer/MainApp.cpp index c454d8b996..e0a45e4d72 100644 --- a/src/apps/mediaplayer/MainApp.cpp +++ b/src/apps/mediaplayer/MainApp.cpp @@ -218,7 +218,7 @@ MainApp::ArgvReceived(int32 argc, char** argv) getcwd(cwd, sizeof(cwd)); for (int i = 1; i < argc; i++) { - BUrl url(argv[i]); + BUrl url(argv[i], true); if (url.IsValid()) { BMessage archivedUrl; url.Archive(&archivedUrl); diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index f420ee3c5c..2de857a85d 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -654,7 +654,7 @@ MainWin::MessageReceived(BMessage* msg) BString urlString; entry_ref fileRef; for (int32 j = 0; msg->FindString("data", j, &urlString) == B_OK; j++) { - BUrl url(urlString); + BUrl url(urlString, true); if (url.IsValid() && url.Protocol() != "file") { UrlPlaylistItem* item = new UrlPlaylistItem(url); if (!fPlaylist->AddItem(item, i + j)) { diff --git a/src/apps/mediaplayer/NetworkStreamWin.cpp b/src/apps/mediaplayer/NetworkStreamWin.cpp index 714a81e3d1..d465e1a79b 100644 --- a/src/apps/mediaplayer/NetworkStreamWin.cpp +++ b/src/apps/mediaplayer/NetworkStreamWin.cpp @@ -62,7 +62,7 @@ NetworkStreamWin::MessageReceived(BMessage* message) switch(message->what) { case M_OPEN_URL: { - BUrl url(fTextControl->Text()); + BUrl url(fTextControl->Text(), true); if (!url.IsValid()) { BAlert* alert = new BAlert(B_TRANSLATE("Bad URL"), B_TRANSLATE("Invalid URL inserted!"), @@ -137,7 +137,7 @@ NetworkStreamWin::_LookIntoClipboardForUrl() // Before to set the text let's see if it's really // a valid URL. - BUrl url(text); + BUrl url(text, true); if (url.IsValid()) fTextControl->SetText(text); } diff --git a/src/apps/mediaplayer/playlist/PlaylistFileReader.cpp b/src/apps/mediaplayer/playlist/PlaylistFileReader.cpp index 2cd06676ad..15d17d03a2 100644 --- a/src/apps/mediaplayer/playlist/PlaylistFileReader.cpp +++ b/src/apps/mediaplayer/playlist/PlaylistFileReader.cpp @@ -52,7 +52,7 @@ PlaylistFileReader::_AppendItemToPlaylist(const BString& entry, Playlist* playli if (err == B_OK) item = new (nothrow) FilePlaylistItem(refPath); else { - BUrl url(entry); + BUrl url(entry, true); if (url.IsValid()) item = new (nothrow) UrlPlaylistItem(url); else { diff --git a/src/apps/mediaplayer/playlist/UrlPlaylistItem.cpp b/src/apps/mediaplayer/playlist/UrlPlaylistItem.cpp index ec778e8e4c..15a5057f2a 100644 --- a/src/apps/mediaplayer/playlist/UrlPlaylistItem.cpp +++ b/src/apps/mediaplayer/playlist/UrlPlaylistItem.cpp @@ -30,7 +30,7 @@ UrlPlaylistItem::UrlPlaylistItem(const BMessage* archive) { const char* url = NULL; if (archive->FindString("mediaplayer:url", &url) == B_OK) - fUrl = BUrl(url); + fUrl = BUrl(url, true); } diff --git a/src/bin/checkitout.cpp b/src/bin/checkitout.cpp index bc38a93afc..5b2d90fa3a 100644 --- a/src/bin/checkitout.cpp +++ b/src/bin/checkitout.cpp @@ -119,7 +119,7 @@ CheckItOut::ArgvReceived(int32 argc, char** argv) return; } - BUrl url(argv[1]); + BUrl url(argv[1], true); fUrlString = url; BString full = BUrl(url).SetProtocol(BString()).UrlString(); @@ -158,7 +158,7 @@ CheckItOut::_DoCheckItOut(entry_ref *ref, const char *name) const char* pausec = " ; read -p 'Press any key'"; char* args[] = { (char *)"/bin/sh", (char *)"-c", NULL, NULL}; - BUrl url(fUrlString); + BUrl url(fUrlString, true); BString full = BUrl(url).SetProtocol(BString()).UrlString(); BString proto = url.Protocol(); BString host = url.Host(); diff --git a/src/bin/media_client/MediaPlay.cpp b/src/bin/media_client/MediaPlay.cpp index 84234c6ce3..368823e976 100644 --- a/src/bin/media_client/MediaPlay.cpp +++ b/src/bin/media_client/MediaPlay.cpp @@ -58,7 +58,7 @@ int media_play(const char* uri) BMediaFile* playFile; if (get_ref_for_path(uri, &ref) != B_OK) { - url.SetUrlString(uri); + url.SetUrlString(uri, true); if (url.IsValid()) { playFile = new BMediaFile(url); } else diff --git a/src/bin/open.cpp b/src/bin/open.cpp index 6b5284a490..e07c5ff96f 100644 --- a/src/bin/open.cpp +++ b/src/bin/open.cpp @@ -96,7 +96,7 @@ main(int argc, char** argv) result = B_OK; } else if (strchr(*argv, ':')) { // try to open it as an URI - BUrl url(*argv); + BUrl url(*argv, true); result = url.OpenWithPreferredApplication(); if (result == B_OK || result == B_ALREADY_RUNNING) continue; diff --git a/src/bin/pkgman/command_add_repo.cpp b/src/bin/pkgman/command_add_repo.cpp index 536af6265b..7437422243 100644 --- a/src/bin/pkgman/command_add_repo.cpp +++ b/src/bin/pkgman/command_add_repo.cpp @@ -89,7 +89,7 @@ AddRepoCommand::Execute(int argc, const char* const* argv) status_t result; for (int i = 0; i < urlCount; ++i) { // Test if a valid URL has been supplied before attempting to add - BUrl repoURL(repoURLs[i]); + BUrl repoURL(repoURLs[i], true); if (!repoURL.IsValid()) { result = B_BAD_VALUE; DIE(result, "request for adding repository \"%s\" failed", diff --git a/src/bin/urlwrapper.cpp b/src/bin/urlwrapper.cpp index d62400e555..6450200e30 100644 --- a/src/bin/urlwrapper.cpp +++ b/src/bin/urlwrapper.cpp @@ -117,7 +117,7 @@ UrlWrapper::RefsReceived(BMessage* msg) } } if (url.Length()) { - BUrl u(url.String()); + BUrl u(url.String(), true); args[1] = (char*)u.UrlString().String(); mimetype = kURLHandlerSigBase; mimetype += u.Protocol(); @@ -196,7 +196,7 @@ UrlWrapper::RefsReceived(BMessage* msg) } } if (url.Length()) { - BUrl u(url.String()); + BUrl u(url.String(), true); args[1] = (char*)u.UrlString().String(); mimetype = kURLHandlerSigBase; mimetype += u.Protocol(); @@ -210,7 +210,7 @@ UrlWrapper::RefsReceived(BMessage* msg) // NetPositive Bookmark or any file with a META:url attribute if (f.ReadAttr("META:url", B_STRING_TYPE, 0LL, buff, B_PATH_NAME_LENGTH) > 0) { - BUrl u(buff); + BUrl u(buff, true); args[1] = (char*)u.UrlString().String(); mimetype = kURLHandlerSigBase; mimetype += u.Protocol(); @@ -235,7 +235,7 @@ UrlWrapper::ArgvReceived(int32 argc, char** argv) char* args[] = { (char *)"/bin/sh", (char *)"-c", NULL, NULL}; status_t err; - BUrl url(argv[1]); + BUrl url(argv[1], true); BString full = BUrl(url).SetProtocol(BString()).UrlString(); BString proto = url.Protocol(); @@ -520,7 +520,7 @@ UrlWrapper::ArgvReceived(int32 argc, char** argv) BString mimetype; url << full; - BUrl u(url.String()); + BUrl u(url.String(), true); args[0] = const_cast("urlwrapper"); //XXX args[1] = (char*)u.UrlString().String(); args[2] = NULL; diff --git a/src/kits/network/libnetservices/Geolocation.cpp b/src/kits/network/libnetservices/Geolocation.cpp index 340578983d..0f173b7245 100644 --- a/src/kits/network/libnetservices/Geolocation.cpp +++ b/src/kits/network/libnetservices/Geolocation.cpp @@ -51,8 +51,8 @@ class GeolocationListener: public BUrlProtocolListener BGeolocation::BGeolocation() - : fGeolocationService(kDefaultGeolocationService), - fGeocodingService(kDefaultGeocodingService) + : fGeolocationService(kDefaultGeolocationService, true), + fGeocodingService(kDefaultGeocodingService, true) { } @@ -63,9 +63,9 @@ BGeolocation::BGeolocation(const BUrl& geolocationService, fGeocodingService(geocodingService) { if (!fGeolocationService.IsValid()) - fGeolocationService.SetUrlString(kDefaultGeolocationService); + fGeolocationService.SetUrlString(kDefaultGeolocationService, true); if (!fGeocodingService.IsValid()) - fGeocodingService.SetUrlString(kDefaultGeocodingService); + fGeocodingService.SetUrlString(kDefaultGeocodingService, true); } diff --git a/src/kits/package/PackageInfoParser.cpp b/src/kits/package/PackageInfoParser.cpp index a7ea2e2302..31c051f494 100644 --- a/src/kits/package/PackageInfoParser.cpp +++ b/src/kits/package/PackageInfoParser.cpp @@ -1204,7 +1204,7 @@ void BPackageInfo::Parser::UrlStringValidator::Validate(const BString& urlString, const char* pos) { - BUrl url(urlString); + BUrl url(urlString, true); if (!url.IsValid()) throw ParseError("invalid url", pos); diff --git a/src/preferences/repositories/AddRepoWindow.cpp b/src/preferences/repositories/AddRepoWindow.cpp index b163ce57b1..c222015694 100644 --- a/src/preferences/repositories/AddRepoWindow.cpp +++ b/src/preferences/repositories/AddRepoWindow.cpp @@ -82,7 +82,7 @@ AddRepoWindow::MessageReceived(BMessage* message) BString url(fText->Text()); if (url != "") { // URL must have a protocol - BUrl newRepoUrl(url); + BUrl newRepoUrl(url, true); if (!newRepoUrl.IsValid()) { BAlert* alert = new BAlert("error", B_TRANSLATE_COMMENT("This is not a valid URL.", @@ -129,7 +129,7 @@ AddRepoWindow::_GetClipboardData() // The string must be a valid url BString clipString(string, stringLen); - BUrl testUrl(clipString.String()); + BUrl testUrl(clipString.String(), true); if (!testUrl.IsValid()) return B_ERROR; else diff --git a/src/preferences/repositories/RepositoriesView.cpp b/src/preferences/repositories/RepositoriesView.cpp index aa586b8668..289394f722 100644 --- a/src/preferences/repositories/RepositoriesView.cpp +++ b/src/preferences/repositories/RepositoriesView.cpp @@ -505,7 +505,7 @@ RepositoriesView::_UpdateFromRepoConfig(RepoRow* rowItem) void RepositoriesView::AddManualRepository(BString url) { - BUrl newRepoUrl(url); + BUrl newRepoUrl(url, true); if (!newRepoUrl.IsValid()) return; @@ -514,7 +514,7 @@ RepositoriesView::AddManualRepository(BString url) int32 listCount = fListView->CountRows(); for (index = 0; index < listCount; index++) { RepoRow* repoItem = dynamic_cast(fListView->RowAt(index)); - BUrl rowRepoUrl(repoItem->Url()); + BUrl rowRepoUrl(repoItem->Url(), true); // Find an already existing URL if (newRepoUrl == rowRepoUrl) { (new BAlert("duplicate", @@ -637,7 +637,7 @@ RepoRow* RepositoriesView::_AddRepo(BString name, BString url, bool enabled) { // URL must be valid - BUrl repoUrl(url); + BUrl repoUrl(url, true); if (!repoUrl.IsValid()) return NULL; int32 index; @@ -645,7 +645,7 @@ RepositoriesView::_AddRepo(BString name, BString url, bool enabled) // Find if the repo already exists in list for (index = 0; index < listCount; index++) { RepoRow* repoItem = dynamic_cast(fListView->RowAt(index)); - BUrl itemUrl(repoItem->Url()); + BUrl itemUrl(repoItem->Url(), true); if (repoUrl == itemUrl) { // update name and enabled values if (name != repoItem->Name())