aboutsummaryrefslogtreecommitdiff
path: root/uri.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2017-01-09 10:50:56 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2017-01-09 10:50:56 +0200
commit0a7f0a797cd66b89588d0a7fdd670b706579a621 (patch)
tree13dbd645a0d77cdf3681b61d0de5a379be8d0a62 /uri.go
parentAdded RequestCtx.LocalIP() (diff)
downloadfasthttp-0a7f0a797cd66b89588d0a7fdd670b706579a621.tar.gz
fasthttp-0a7f0a797cd66b89588d0a7fdd670b706579a621.tar.bz2
fasthttp-0a7f0a797cd66b89588d0a7fdd670b706579a621.zip
Updated tests and documentation for URI.Parse and URI.Update* regarding uris without scheme
Diffstat (limited to 'uri.go')
-rw-r--r--uri.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/uri.go b/uri.go
index 43060de..0f6bc04 100644
--- a/uri.go
+++ b/uri.go
@@ -213,6 +213,11 @@ func (u *URI) SetHostBytes(host []byte) {
}
// Parse initializes URI from the given host and uri.
+//
+// host may be nil. In this case uri must contain fully qualified uri,
+// i.e. with scheme and host. http is assumed if scheme is omitted.
+//
+// uri may contain e.g. RequestURI without scheme and host if host is non-empty.
func (u *URI) Parse(host, uri []byte) {
u.parse(host, uri, nil)
}
@@ -369,6 +374,8 @@ func (u *URI) LastPathSegment() []byte {
//
// * Absolute, i.e. http://foobar.com/aaa/bb?cc . In this case the original
// uri is replaced by newURI.
+// * Absolute without scheme, i.e. //foobar.com/aaa/bb?cc. In this case
+// the original scheme is preserved.
// * Missing host, i.e. /aaa/bb?cc . In this case only RequestURI part
// of the original uri is replaced.
// * Relative path, i.e. xx?yy=abc . In this case the original RequestURI
@@ -383,6 +390,8 @@ func (u *URI) Update(newURI string) {
//
// * Absolute, i.e. http://foobar.com/aaa/bb?cc . In this case the original
// uri is replaced by newURI.
+// * Absolute without scheme, i.e. //foobar.com/aaa/bb?cc. In this case
+// the original scheme is preserved.
// * Missing host, i.e. /aaa/bb?cc . In this case only RequestURI part
// of the original uri is replaced.
// * Relative path, i.e. xx?yy=abc . In this case the original RequestURI