urlesc

package module
Version: v0.0.0-...-de5bf2a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2017 License: BSD-3-Clause Imports: 3 Imported by: 9

README

urlesc Build Status GoDoc

Package urlesc implements query escaping as per RFC 3986.

It contains some parts of the net/url package, modified so as to allow some reserved characters incorrectly escaped by net/url (see issue 5684).

Install

go get github.com/PuerkitoBio/urlesc

License

Go license (BSD-3-Clause)

Documentation

Overview

Package urlesc implements query escaping as per RFC 3986. It contains some parts of the net/url package, modified so as to allow some reserved characters incorrectly escaped by net/url. See https://github.com/golang/go/issues/5684

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape

func Escape(u *url.URL) string

Escape reassembles the URL into a valid URL string. The general form of the result is one of:

scheme:opaque
scheme://userinfo@host/path?query#fragment

If u.Opaque is non-empty, String uses the first form; otherwise it uses the second form.

In the second form, the following rules apply:

- if u.Scheme is empty, scheme: is omitted.
- if u.User is nil, userinfo@ is omitted.
- if u.Host is empty, host/ is omitted.
- if u.Scheme and u.Host are empty and u.User is nil,
   the entire scheme://userinfo@host/ is omitted.
- if u.Host is non-empty and u.Path begins with a /,
   the form host/path does not add its own /.
- if u.RawQuery is empty, ?query is omitted.
- if u.Fragment is empty, #fragment is omitted.

func QueryEscape

func QueryEscape(s string) string

QueryEscape escapes the string so it can be safely placed inside a URL query.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL