MCPcopy Index your code
hub / github.com/imroc/req / hasPort

Function hasPort

http_request.go:16–16  ·  view source on GitHub ↗

Given a string of the form "host", "host:port", or "[ipv6::address]:port", return true if the string includes a port.

(s string)

Source from the content-addressed store, hash-verified

14// Given a string of the form "host", "host:port", or "[ipv6::address]:port",
15// return true if the string includes a port.
16func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") }
17
18// removeEmptyPort strips the empty port in ":port" to ""
19// as mandated by RFC 3986 Section 6.2.3.

Callers 2

removeEmptyPortFunction · 0.85
tlsHostMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…