File tree 2 files changed +16
-4
lines changed
include/opentelemetry/ext/http/common
2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -52,11 +52,16 @@ class UrlParser
52
52
}
53
53
54
54
// credentials
55
- pos = url_.find_first_of (" @" , cpos);
56
- if (pos != std::string::npos)
55
+ size_t pos1 = url_.find_first_of (" @" , cpos);
56
+ size_t pos2 = url_.find_first_of (" /" , cpos);
57
+ if (pos1 != std::string::npos)
57
58
{
58
59
// TODO - handle credentials
59
- cpos = pos + 1 ;
60
+ if (pos2 == std::string::npos || pos1 < pos2)
61
+ {
62
+ pos = pos1;
63
+ cpos = pos1 + 1 ;
64
+ }
60
65
}
61
66
pos = url_.find_first_of (" :" , cpos);
62
67
bool is_port = false ;
@@ -129,4 +134,4 @@ class UrlParser
129
134
130
135
} // namespace http
131
136
} // namespace ext
132
- OPENTELEMETRY_END_NAMESPACE
137
+ OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change @@ -113,6 +113,13 @@ TEST(UrlParserTests, BasicTests)
113
113
{" path" , " /path1/path2" },
114
114
{" query" , " q1=a1&q2=a2" },
115
115
{" success" , " true" }}},
116
+ {" http://www.abc.com/path1@bbb/path2?q1=a1&q2=a2" ,
117
+ {{" host" , " www.abc.com" },
118
+ {" port" , " 80" },
119
+ {" scheme" , " http" },
120
+ {" path" , " /path1@bbb/path2" },
121
+ {" query" , " q1=a1&q2=a2" },
122
+ {" success" , " true" }}},
116
123
117
124
};
118
125
for (auto &url_map : urls_map)
You can’t perform that action at this time.
0 commit comments