mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-14 20:03:40 +00:00
rtl8720dn: add support for http.Get(), http.Post() and cookie
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package net
|
||||
|
||||
import "strings"
|
||||
|
||||
// SplitHostPort splits a network address of the form "host:port",
|
||||
// "host%zone:port", "[host]:port" or "[host%zone]:port" into host or
|
||||
// host%zone and port.
|
||||
//
|
||||
// A literal IPv6 address in hostport must be enclosed in square
|
||||
// brackets, as in "[::1]:80", "[::1%lo0]:80".
|
||||
//
|
||||
// See func Dial for a description of the hostport parameter, and host
|
||||
// and port results.
|
||||
func SplitHostPort(hostport string) (host, port string, err error) {
|
||||
|
||||
if strings.Contains(hostport, ":") {
|
||||
spl := strings.Split(hostport, ":")
|
||||
host = spl[0]
|
||||
port = spl[1]
|
||||
} else {
|
||||
host = hostport
|
||||
port = "80"
|
||||
}
|
||||
|
||||
return host, port, nil
|
||||
}
|
||||
Reference in New Issue
Block a user