MCPcopy Create free account
hub / github.com/apache/brpc / PrintWithoutHost

Method PrintWithoutHost

src/brpc/uri.cpp:315–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315void URI::PrintWithoutHost(std::ostream& os) const {
316 if (_path.empty()) {
317 // According to rfc2616#section-5.1.2, the absolute path
318 // cannot be empty; if none is present in the original URI, it MUST
319 // be given as "/" (the server root).
320 os << '/';
321 } else {
322 os << _path;
323 }
324 if (_initialized_query_map && _query_was_modified) {
325 bool is_first = true;
326 for (QueryIterator it = QueryBegin(); it != QueryEnd(); ++it) {
327 if (is_first) {
328 is_first = false;
329 os << '?';
330 } else {
331 os << '&';
332 }
333 os << it->first;
334 if (!it->second.empty()) {
335 os << '=' << it->second;
336 }
337 }
338 } else if (!_query.empty()) {
339 os << '?' << _query;
340 }
341 if (!_fragment.empty()) {
342 os << '#' << _fragment;
343 }
344}
345
346void URI::InitializeQueryMap() const {
347 ParseQueries(_query_map, _query);

Callers 3

MakeHttpRequestHeadersFunction · 0.80
TESTFunction · 0.80
MakeRawHttpRequestFunction · 0.80

Calls 1

emptyMethod · 0.45

Tested by 2

MakeHttpRequestHeadersFunction · 0.64
TESTFunction · 0.64