This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Fix parsing of IPv6 host:port inside brackets
ClosedPublic

Authored by emrekultursay on Mar 24 2020, 3:20 PM.

Details

Reviewers
labath
Group Reviewers
Restricted Project
Commits
rG57be22fa1797: [LLDB] Fix parsing of IPv6 host:port inside brackets
Summary

When using IPv6 host:port pairs, typically the host is put inside
brackets, such as [2601:1234:...:0213]:5555, and the UriParser
can handle this format.

However, the Android infrastructure in LLDB assumes an additional
brackets around the host:port pair, such that the entire host:port
string can be treated as the host (which is used as an Android Serial
Number), and UriParser cannot handle multiple brackets. Parsing
inputs with such extra backets requires searching the closing bracket
from the right.

Test: BracketedHostnameWithPortIPv6 covers the case mentioned above

Diff Detail

Event Timeline

emrekultursay created this revision.Mar 24 2020, 3:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2020, 3:20 PM
shafik added a subscriber: shafik.

We need tests it looks like UriParserTest.cpp is the right place.

emrekultursay edited the summary of this revision. (Show Details)

Added unit tests.

kwk added a subscriber: kwk.Mar 25 2020, 12:50 AM

LGTM but I haven't tested it.

labath accepted this revision.Mar 25 2020, 1:54 AM

Looks good. You already mention that in the commit message, but it may be nice to also mention somewhere near the test case that these kinds of "URL"s can occur when and connecting to and android device over IP (in which case the port is part of the "hostname"). So one isn't left wondering why are we testing such "nonsensical" hostnames...

Also, do you have commit access?

This revision is now accepted and ready to land.Mar 25 2020, 1:54 AM
  • Added comments to Android-specific test cases, as suggested by labath@.
  • Reformatted lines that exceeded 80 chars.

I don't have commit access.

This revision was automatically updated to reflect the committed changes.