Skip to content

Messages showing host names that are IP addresses are ugly #43

@DrDaveD

Description

@DrDaveD

Messages showing host names that are passed in as IP addresses show the IP address twice, which is ugly. It's especially ugly with IPv6 addresses because of the extra square brackets around the address which is already in square brackets for the message. Reproduce with the following (using the IP addresses from cvmfs.fnal.gov):

$ echo 'select 1 from dual'| FRONTIER_SERVER="(failovertoserver=no)(proxyurl=http://$(host cvmfs.fnal.gov|sed -n 's/.* has address //p'):8000)(serverurl=http://cmsfrontier.cern.ch:8000/FrontierProd)" LD_LIBRARY_PATH=. ./fn-req
Entered:
select 1 from dual
Param [eNorTs1JTS5RMFRIK8rPVUgpTcwBAD0rBmw_]
Frontier exception caught: Can not get data (Additional Information: [frontier.c:1210]: No more proxies. Last error was: Request 1 on chan 1 failed at Wed Nov  1 17:06:20 2023: -8 [fn-htclient.c:444]: server error (HTTP/1.1 404 Not Found) proxy=131.225.189.138[131.225.189.138:8000] server=cmsfrontier.cern.ch)
$ echo 'select 1 from dual'| FRONTIER_SERVER="(failovertoserver=no)(proxyurl=http://[$(host cvmfs.fnal.gov|sed -n 's/.* has IPv6 address //p')]:8000)(serverurl=http://cmsfrontier.cern.ch:8000/FrontierProd)" LD_LIBRARY_PATH=. ./fn-req
Entered:
select 1 from dual
Param [eNorTs1JTS5RMFRIK8rPVUgpTcwBAD0rBmw_]
Frontier exception caught: Can not get data (Additional Information: [frontier.c:1210]: No more proxies. Last error was: Request 1 on chan 1 failed at Wed Nov  1 17:05:12 2023: -8 [fn-htclient.c:444]: server error (HTTP/1.1 404 Not Found) proxy=2620:6a:0:8421::244[[2620:6a:0:8421::244]:8000] server=cmsfrontier.cern.ch)

It is trying to show the host name followed by the address in square brackets, but it's confusing when the host name is already an IP address. Change it so that if the name of the host is already an IP address, only print out the address and port piece. That is, an IPv4 address would show up like 131.225.189.138:8000 and an IPv6 address would show up like [2620:6a:0:8421::244]:8000.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions