mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
01. Support GB config as StreamCaster. 02. Support disable GB by --gb28181=off. 03. Add utests for SIP examples. 04. Wireshark plugin to decode TCP/9000 as rtp.rfc4571 05. Support MPEGPS program stream codec. 06. Add utest for PS stream codec. 07. Decode MPEGPS packet stream. 08. Carry RTP and PS packet as helper in PS message. 09. Support recover from error mode. 10. Support process by a pack of PS/TS messages. 11. Add statistic for recovered and msgs dropped. 12. Recover from err position fastly. 13. Define state machine for GB session. 14. Bind context to GB session. 15. Re-invite when media disconnected. 16. Update GitHub actions with GB28181. 17. Support parse CANDIDATE by env or pip. 18. Support mux GB28181 to RTMP. 19. Support regression test by srs-bench.
83 lines
2.5 KiB
Go
83 lines
2.5 KiB
Go
package httphead
|
|
|
|
// OctetType desribes character type.
|
|
//
|
|
// From the "Basic Rules" chapter of RFC2616
|
|
// See https://tools.ietf.org/html/rfc2616#section-2.2
|
|
//
|
|
// OCTET = <any 8-bit sequence of data>
|
|
// CHAR = <any US-ASCII character (octets 0 - 127)>
|
|
// UPALPHA = <any US-ASCII uppercase letter "A".."Z">
|
|
// LOALPHA = <any US-ASCII lowercase letter "a".."z">
|
|
// ALPHA = UPALPHA | LOALPHA
|
|
// DIGIT = <any US-ASCII digit "0".."9">
|
|
// CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
|
|
// CR = <US-ASCII CR, carriage return (13)>
|
|
// LF = <US-ASCII LF, linefeed (10)>
|
|
// SP = <US-ASCII SP, space (32)>
|
|
// HT = <US-ASCII HT, horizontal-tab (9)>
|
|
// <"> = <US-ASCII double-quote mark (34)>
|
|
// CRLF = CR LF
|
|
// LWS = [CRLF] 1*( SP | HT )
|
|
//
|
|
// Many HTTP/1.1 header field values consist of words separated by LWS
|
|
// or special characters. These special characters MUST be in a quoted
|
|
// string to be used within a parameter value (as defined in section
|
|
// 3.6).
|
|
//
|
|
// token = 1*<any CHAR except CTLs or separators>
|
|
// separators = "(" | ")" | "<" | ">" | "@"
|
|
// | "," | ";" | ":" | "\" | <">
|
|
// | "/" | "[" | "]" | "?" | "="
|
|
// | "{" | "}" | SP | HT
|
|
type OctetType byte
|
|
|
|
// IsChar reports whether octet is CHAR.
|
|
func (t OctetType) IsChar() bool { return t&octetChar != 0 }
|
|
|
|
// IsControl reports whether octet is CTL.
|
|
func (t OctetType) IsControl() bool { return t&octetControl != 0 }
|
|
|
|
// IsSeparator reports whether octet is separator.
|
|
func (t OctetType) IsSeparator() bool { return t&octetSeparator != 0 }
|
|
|
|
// IsSpace reports whether octet is space (SP or HT).
|
|
func (t OctetType) IsSpace() bool { return t&octetSpace != 0 }
|
|
|
|
// IsToken reports whether octet is token.
|
|
func (t OctetType) IsToken() bool { return t&octetToken != 0 }
|
|
|
|
const (
|
|
octetChar OctetType = 1 << iota
|
|
octetControl
|
|
octetSpace
|
|
octetSeparator
|
|
octetToken
|
|
)
|
|
|
|
// OctetTypes is a table of octets.
|
|
var OctetTypes [256]OctetType
|
|
|
|
func init() {
|
|
for c := 32; c < 256; c++ {
|
|
var t OctetType
|
|
if c <= 127 {
|
|
t |= octetChar
|
|
}
|
|
if 0 <= c && c <= 31 || c == 127 {
|
|
t |= octetControl
|
|
}
|
|
switch c {
|
|
case '(', ')', '<', '>', '@', ',', ';', ':', '"', '/', '[', ']', '?', '=', '{', '}', '\\':
|
|
t |= octetSeparator
|
|
case ' ', '\t':
|
|
t |= octetSpace | octetSeparator
|
|
}
|
|
|
|
if t.IsChar() && !t.IsControl() && !t.IsSeparator() && !t.IsSpace() {
|
|
t |= octetToken
|
|
}
|
|
|
|
OctetTypes[c] = t
|
|
}
|
|
}
|