go - Escape exclamation mark in http request -
i have url like
http://app.chat.com/avert!callbcak.htm
to request.
i created request golang
req, _ := http.newrequest("get", "http://app.chat.com/avert!callbcak.htm", nil) fmt.printf("%v\n", req.url.string())
result is
http://app.chat.com/avert%21callbcak.htm
which not going work, website needs url exclamation mark not escaped.
how can request url correctly?
from http://tools.ietf.org/html/rfc3986
section 2, on characters, has been rewritten explain what
characters reserved, when reserved, , why are
reserved, when not used delimiters generic
syntax. mark characters typically unsafe decode,
including exclamation mark ("!"), asterisk ("*"), single-quote
("'"), , open , close parentheses ("(" , ")"), have been moved
reserved set in order clarify distinction between
reserved , unreserved and, hopefully, answer common
question of scheme designers. likewise, section on
percent-encoded characters has been rewritten, , uri normalizers
given license decode percent-encoded octets
this means !
unfortunate choice of separator because although grammar allows use in segment
(as part of pchar
non-terminal) part of reserved
non-terminal.
as read rfc ambivalent !
reservedness, depending upon context in used.
escaping character seems safe assumption make since recipient "licenced decode percent-encoded octet". should consider using separator or decoding entity on endpoint.
Comments
Post a Comment