File tree Expand file tree Collapse file tree
include/opentelemetry/ext/http/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,11 +52,16 @@ class UrlParser
5252 }
5353
5454 // 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)
5758 {
5859 // TODO - handle credentials
59- cpos = pos + 1 ;
60+ if (pos2 == std::string::npos || pos1 < pos2)
61+ {
62+ pos = pos1;
63+ cpos = pos1 + 1 ;
64+ }
6065 }
6166 pos = url_.find_first_of (" :" , cpos);
6267 bool is_port = false ;
@@ -129,4 +134,4 @@ class UrlParser
129134
130135} // namespace http
131136} // 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)
113113 {" path" , " /path1/path2" },
114114 {" query" , " q1=a1&q2=a2" },
115115 {" 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" }}},
116123
117124 };
118125 for (auto &url_map : urls_map)
You can’t perform that action at this time.
0 commit comments