Skip to content

Conversation

@buchi-busireddy
Copy link
Contributor

@buchi-busireddy buchi-busireddy commented Dec 11, 2020

Due to this, the host header was being set as :port, which isn't right.
Fixing the bug to ignore such host header so that the span will be resolved
based on the servicename that comes in the span.

Due to this, the host header was being set as :<port>, which isn't right.
Fixing the bug to ignore such host header so that the span will be resolved
based on the servicename that comes in the span.
@buchi-busireddy buchi-busireddy requested a review from a team December 11, 2020 23:01
@tim-mwangi
Copy link
Contributor

snyk scan failing

@codecov
Copy link

codecov bot commented Dec 14, 2020

Codecov Report

Merging #87 (09536db) into main (a85a77a) will increase coverage by 0.08%.
The diff coverage is 85.71%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main      #87      +/-   ##
============================================
+ Coverage     68.72%   68.80%   +0.08%     
- Complexity      814      816       +2     
============================================
  Files            83       83              
  Lines          3440     3440              
  Branches        367      367              
============================================
+ Hits           2364     2367       +3     
+ Misses          931      929       -2     
+ Partials        145      144       -1     
Flag Coverage Δ Complexity Δ
unit 68.80% <85.71%> (+0.08%) 0.00 <0.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...nt/enrichers/ApiBoundaryTypeAttributeEnricher.java 86.48% <85.71%> (+4.05%) 22.00 <0.00> (+2.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a85a77a...09536db. Read the comment docs.

@buchi-busireddy
Copy link
Contributor Author

snyk scan failing

Fixed

private Optional<String> sanitizeHostValue(String host) {
if (host.contains(COLON) && !host.startsWith(COLON)) {
return COLON_SPLITTER.splitToList(host).get(0);
return Optional.ofNullable(COLON_SPLITTER.splitToList(host).get(0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here host is coming as null or as an empty string "", will that handle an empty string case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If host is empty, it shouldn't even match host.contains(COLON) right?

if (!LOCALHOST.equalsIgnoreCase(host)) {
return Optional.of(host);
Optional<String> host = sanitizeHostValue(value);
if (host.isPresent() && !LOCALHOST.equalsIgnoreCase(host.get())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need conditon - StringUtils.isEmpty(host.get()) - for case where host is not null but an empty "" string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

equalsIgnoreCase() will take care of those.

@buchi-busireddy buchi-busireddy merged commit fb3c315 into main Dec 14, 2020
@buchi-busireddy buchi-busireddy deleted the bugfix/authority_header_fix branch December 14, 2020 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants