aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/uri
diff options
context:
space:
mode:
authorstanly <stanly@yandex-team.ru>2022-02-10 16:46:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:49 +0300
commit6170310e8721e225f64ddabf7a7358253d7a1249 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/uri
parentcde218e65dfef5ce03a48d641fd8f7913cf17b2d (diff)
downloadydb-6170310e8721e225f64ddabf7a7358253d7a1249.tar.gz
Restoring authorship annotation for <stanly@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/uri')
-rw-r--r--library/cpp/uri/location.cpp18
-rw-r--r--library/cpp/uri/location.h22
-rw-r--r--library/cpp/uri/location_ut.cpp42
-rw-r--r--library/cpp/uri/ut/ya.make2
-rw-r--r--library/cpp/uri/ya.make2
5 files changed, 43 insertions, 43 deletions
diff --git a/library/cpp/uri/location.cpp b/library/cpp/uri/location.cpp
index e5df7a3858..a6a4d11ffa 100644
--- a/library/cpp/uri/location.cpp
+++ b/library/cpp/uri/location.cpp
@@ -1,15 +1,15 @@
-#include "location.h"
-#include "uri.h"
-
-namespace NUri {
+#include "location.h"
+#include "uri.h"
+
+namespace NUri {
static const int URI_PARSE_FLAGS =
(TFeature::FeaturesRecommended | TFeature::FeatureConvertHostIDN | TFeature::FeatureEncodeExtendedDelim | TFeature::FeatureEncodePercent) & ~TFeature::FeatureHashBangToEscapedFragment;
-
+
TString ResolveRedirectLocation(const TStringBuf& baseUrl,
const TStringBuf& location) {
TUri baseUri;
TUri locationUri;
-
+
// Parse base URL.
if (baseUri.Parse(baseUrl, URI_PARSE_FLAGS) != NUri::TState::ParsedOK) {
return "";
@@ -26,6 +26,6 @@ namespace NUri {
TString res;
locationUri.Print(res, NUri::TField::FlagAllFields);
return res;
- }
-
-}
+ }
+
+}
diff --git a/library/cpp/uri/location.h b/library/cpp/uri/location.h
index ece4def07a..0f533fe0b5 100644
--- a/library/cpp/uri/location.h
+++ b/library/cpp/uri/location.h
@@ -1,13 +1,13 @@
-#pragma once
-
-#include <util/generic/string.h>
-
-namespace NUri {
+#pragma once
+
+#include <util/generic/string.h>
+
+namespace NUri {
/**
- * Resolve Location header according to https://tools.ietf.org/html/rfc7231#section-7.1.2
- *
- * @return Resolved location's url or empty string in case of any error.
- */
+ * Resolve Location header according to https://tools.ietf.org/html/rfc7231#section-7.1.2
+ *
+ * @return Resolved location's url or empty string in case of any error.
+ */
TString ResolveRedirectLocation(const TStringBuf& baseUrl, const TStringBuf& location);
-
-}
+
+}
diff --git a/library/cpp/uri/location_ut.cpp b/library/cpp/uri/location_ut.cpp
index 58d1578a7d..26a0f64471 100644
--- a/library/cpp/uri/location_ut.cpp
+++ b/library/cpp/uri/location_ut.cpp
@@ -1,40 +1,40 @@
-#include "location.h"
-
+#include "location.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TResolveRedirectTests) {
Y_UNIT_TEST(Absolute) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "http://redir-example.com/sub"), "http://redir-example.com/sub");
- }
+ }
Y_UNIT_TEST(AbsWithFragment) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "http://redir-example.com/sub#Hello"), "http://redir-example.com/sub#Hello");
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com/#Hello", "http://redir-example.com/sub"), "http://redir-example.com/sub#Hello");
- }
+ }
Y_UNIT_TEST(Rel) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "/sub"), "http://example.com/sub");
- }
+ }
Y_UNIT_TEST(RelWithFragment) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "/sub#Hello"), "http://example.com/sub#Hello");
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com/#Hello", "/sub"), "http://example.com/sub#Hello");
- }
+ }
Y_UNIT_TEST(WrongLocation) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", ""), "");
- }
+ }
Y_UNIT_TEST(WrongBase) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("", "http://example.com"), "");
- }
+ }
Y_UNIT_TEST(HashBangIsNothingSpecial) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "http://redir-example.com/sub#!Hello"), "http://redir-example.com/sub#!Hello");
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com/#!Hello", "http://redir-example.com/sub"), "http://redir-example.com/sub#!Hello");
- }
-}
+ }
+}
diff --git a/library/cpp/uri/ut/ya.make b/library/cpp/uri/ut/ya.make
index 9f61239ab4..b2b2c1291a 100644
--- a/library/cpp/uri/ut/ya.make
+++ b/library/cpp/uri/ut/ya.make
@@ -11,7 +11,7 @@ PEERDIR(
)
SRCS(
- location_ut.cpp
+ location_ut.cpp
uri-ru_ut.cpp
uri_ut.cpp
)
diff --git a/library/cpp/uri/ya.make b/library/cpp/uri/ya.make
index ec2daed7c0..8fc808a6af 100644
--- a/library/cpp/uri/ya.make
+++ b/library/cpp/uri/ya.make
@@ -10,7 +10,7 @@ SRCS(
common.cpp
encode.cpp
http_url.h
- location.cpp
+ location.cpp
other.cpp
parse.cpp
qargs.cpp