blob: dce8acb21fc68faf675b6f52e8fe31368b8789e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package sliderule
import (
"crypto/tls"
"net"
"net/url"
)
// Request represents a request over any small web protocol.
//
// Because protocols have so many differences, this type represents a
// greatest common denominator of request/response-oriented protocols.
type Request struct {
// URL is the specific URL being fetched by the request.
*url.URL
// Server is the server which received the request.
//
// This is only populated in servers.
// It is unused on the client end.
Server Server
// Meta is a place for opaque data.
//
// Look for helper methods in protocol packages to use it appropriately
// for the protocol.
Meta any
// RemoteAddr is the address of the other side of the connection.
//
// This will be the server address for clients, or the connecting
// client's address in servers.
//
// Be aware though that proxies (and reverse proxies) can confuse this.
RemoteAddr net.Addr
// TLSState contains information about the TLS encryption over the connection.
//
// This includes peer certificates and version information.
TLSState *tls.ConnectionState
}
// UnescapedQuery performs %XX unescaping on the URL query segment.
//
// Like URL.Query(), it silently drops malformed %-encoded sequences.
func (req Request) UnescapedQuery() string {
unescaped, _ := url.QueryUnescape(req.RawQuery)
return unescaped
}
|