id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c16300 |
if err != nil {
return nil, err
}
copyHeaders(upstreamReq.Header, &originalReq.Header)
if len(originalReq.Host) > 0 && upstreamReq.Header.Get("X-Forwarded-Host") == "" {
upstreamReq.Header["X-Forwarded-Host"] = []string{originalReq.Host}
}
if upstreamReq.Header.Get("X-Forwarded-For") == "" {
upstreamReq.H... | |
c16301 | make([]string, len(v))
copy(vClone, v)
destination[k] = vClone
}
} | |
c16302 |
if len(responseHeader) > 0 {
headerContentType = responseHeader
} else if len(requestHeader) > 0 {
headerContentType = requestHeader
} else {
headerContentType = defaultContentType
}
return headerContentType
} | |
c16303 | w.WriteHeader(statusCode)
w.Write([]byte(fmt.Sprintf(msg, args...)))
} | |
c16304 |
r.HandleFunc("/function/{name:[-a-zA-Z_0-9]+}", handlers.FunctionProxy)
r.HandleFunc("/function/{name:[-a-zA-Z_0-9]+}/", handlers.FunctionProxy)
r.HandleFunc("/function/{name:[-a-zA-Z_0-9]+}/{params:.*}", handlers.FunctionProxy)
if config.EnableHealth {
r.HandleFunc("/healthz", handlers.HealthHandler).Methods("... | |
c16305 | defaultReader
}
if i.bReader == nil {
i.bReader = bufio.NewReader(i.Reader)
}
} | |
c16306 | return defaultValidateFunc
}
return o.ValidateFunc
} | |
c16307 | defaultMaskVal
}
// Mask input and prompt custom maskVal.
if o.MaskVal != "" {
maskVal = o.MaskVal
}
return &readOptions{
mask: mask,
maskVal: maskVal,
}
} | |
c16308 | !ok {
resultErr = fmt.Errorf("reader must be a file")
return
}
i.mask, i.maskVal = opts.mask, opts.maskVal
resultStr, resultErr = i.rawRead(f)
} else {
line, err := i.bReader.ReadString('\n')
if err != nil && err != io.EOF {
resultErr = fmt.Errorf("failed to read the input: %s", err)
}... | |
c16309 | data}
item.touch(cache.ttl)
cache.items[key] = item
cache.mutex.Unlock()
} | |
c16310 | else {
item.touch(cache.ttl)
data = item.data
found = true
}
cache.mutex.Unlock()
return
} | |
c16311 | map[string]*Item{},
}
cache.startCleanupTimer()
return cache
} | |
c16312 |
switch op {
case Onerep, Notonerep, Oneloop, Notoneloop, Onelazy, Notonelazy, Setrep, Setloop, Setlazy:
buf.WriteString(", Rep = ")
if c.Codes[offset+2] == math.MaxInt32 {
buf.WriteString("inf")
} else {
fmt.Fprintf(buf, "%d", c.Codes[offset+2])
}
case Branchcount, Lazybranchcount:
buf.WriteString(... | |
c16313 | string(c.text[c.Index : c.Index+c.Length])
} | |
c16314 | {
return c.text[c.Index : c.Index+c.Length]
} | |
c16315 | && m.matches[cap][m.matchcount[cap]*2-1] != (-3+1)
} | |
c16316 |
if i >= 0 {
return i
}
return m.matches[cap][-3-i]
} | |
c16317 |
if i >= 0 {
return i
}
return m.matches[cap][-3-i]
} | |
c16318 |
if num < 0 {
return nil
}
return m.GroupByNumber(num)
} | |
c16319 | || num < 0 {
return nil
}
if num == 0 {
return &m.Group
}
m.populateOtherGroups()
return &m.otherGroups[num-1]
} | |
c16320 | opt,
caps: code.Caps,
capnames: tree.Capnames,
capslist: tree.Caplist,
capsize: code.Capsize,
code: code,
MatchTimeout: DefaultMatchTimeout,
}, nil
} | |
c16321 | panic(`regexp2: Compile(` + quote(str) + `): ` + error.Error())
}
return regexp
} | |
c16322 | return re.run(false, -1, getRunes(s))
} | |
c16323 | return re.run(false, -1, r)
} | |
c16324 | didn't find our start index in the string -- that's a problem
return nil, errors.New("startAt must align to the start of a valid rune in the input string")
}
return re.run(false, startAt, r)
} | |
c16325 | {
return re.run(false, startAt, r)
} | |
c16326 | if m.textpos == len(m.text) {
return nil, nil
}
if re.RightToLeft() {
startAt--
} else {
startAt++
}
}
return re.run(false, startAt, m.text)
} | |
c16327 | re.run(true, -1, getRunes(s))
if err != nil {
return false, err
}
return m != nil, nil
} | |
c16328 | {
return false, err
}
return m != nil, nil
} | |
c16329 |
}
} else {
result = make([]string, len(re.capslist))
copy(result, re.capslist)
}
return result
} | |
c16330 |
}
} else {
result = make([]int, len(re.caps))
for k, v := range re.caps {
result[v] = k
}
}
return result
} | |
c16331 | }
return ""
}
if re.caps != nil {
var ok bool
if i, ok = re.caps[i]; !ok {
return ""
}
}
if i >= 0 && i < len(re.capslist) {
return re.capslist[i]
}
return ""
} | |
c16332 | || ch < '0' {
return -1
}
result *= 10
result += int(ch - '0')
}
// return int if it's in range
if result >= 0 && result < re.capsize {
return result
}
return -1
} | |
c16333 | = curNode.children[curChild]
w.pushInt(curChild)
curChild = 0
continue
}
if w.emptyStack() {
break
}
curChild = w.popInt()
curNode = curNode.next
w.emitFragment(curNode.t|afterChild, curNode, curChild)
curChild++
}
w.patchJump(0, w.curPos())
w.emit(Stop)
if !w.countin... | |
c16334 | w.emitted[offset+1] = jumpDest
} | |
c16335 | hash := buf.String()
i, ok := w.sethash[hash]
if !ok {
i = len(w.sethash)
w.sethash[hash] = i
w.settable = append(w.settable, set)
}
return i
} | |
c16336 | i, ok := w.stringhash[hash]
if !ok {
i = len(w.stringhash)
w.stringhash[hash] = i
w.stringtable = append(w.stringtable, str)
}
return i
} | |
c16337 | {
return -1
}
if w.caps != nil {
return w.caps[capnum]
}
return capnum
} | |
c16338 | return
}
w.emitted[w.curpos] = int(op)
w.curpos++
w.emitted[w.curpos] = opd1
w.curpos++
} | |
c16339 | &r.runstackpos)
}
if r.runtrackpos < r.runtrackcount*4 {
doubleIntSlice(&r.runtrack, &r.runtrackpos)
}
} | |
c16340 | r.runcrawlpos--
r.runcrawl[r.runcrawlpos] = i
} | |
c16341 | r.runcrawlpos++
return val
} | |
c16342 | r.runtrack[r.runtrackpos-i-1]
} | |
c16343 | r.runstack[r.runstackpos] = I1
} | |
c16344 | r.runstack[r.runstackpos-i-1]
} | |
c16345 | := r.popcrawl()
r.runmatch.removeMatch(capnum)
} | |
c16346 | !=
(index < endpos && syntax.IsWordChar(r.runtext[index]))
} | |
c16347 | re.runner = re.runner[:n-1]
re.muRun.Unlock()
return z
}
re.muRun.Unlock()
z := &runner{
re: re,
code: re.code,
}
return z
} | |
c16348 | = append(ret.ranges, c.ranges...)
ret.categories = append(ret.categories, c.categories...)
if c.sub != nil {
sub := c.sub.Copy()
ret.sub = &sub
}
return ret
} | |
c16349 |
for _, c := range c.categories {
buf.WriteString(c.String())
}
if c.sub != nil {
buf.WriteRune('-')
buf.WriteString(c.sub.String())
}
buf.WriteRune(']')
return buf.String()
} | |
c16350 | for _, ct := range c.categories {
buf.WriteString(ct.cat)
if ct.negate {
buf.WriteByte(1)
} else {
buf.WriteByte(0)
}
}
if c.sub != nil {
c.sub.mapHashFill(buf)
}
} | |
c16351 | ' ' {
return "\\ "
}*/
b := &bytes.Buffer{}
escape(b, ch, false) //fmt.Sprintf("%U", ch)
return b.String()
} | |
c16352 | append(c.ranges, ranges...)
c.canonicalize()
} | |
c16353 | }
}
c.ranges[j] = singleRange{first: c.ranges[j].first, last: last}
j++
if done {
break
}
if j < i {
c.ranges[j] = c.ranges[i]
}
}
c.ranges = append(c.ranges[:j], c.ranges[len(c.ranges):]...)
}
} | |
c16354 | } else {
toAdd = append(toAdd, r)
}
}
for _, r := range toAdd {
c.addLowercaseRange(r.first, r.last)
}
c.canonicalize()
} | |
c16355 | p.caps,
capnumlist: p.capnumlist,
captop: p.captop,
Capnames: p.capnames,
Caplist: p.capnamelist,
options: op,
}
if tree.options&Debug > 0 {
os.Stdout.WriteString(tree.Dump())
}
return tree, nil
} | |
c16356 | }
} else {
// (?...
// get the options if it's an option construct (?cimsx-cimsx...)
p.scanOptions()
if p.charsRight() > 0 {
if p.rightChar(0) == ')' {
// (?cimsx-cimsx)
p.moveRight(1)
p.popKeepOptions()
} else if p.rightChar(0) == '(' {
... | |
c16357 | return newRegexNodeSet(ntSet, p.options, DigitClass()), nil
case 'D':
p.moveRight(1)
if p.useOptionE() {
return newRegexNodeSet(ntSet, p.options, NotECMADigitClass()), nil
}
return newRegexNodeSet(ntSet, p.options, NotDigitClass()), nil
case 'p', 'P':
p.moveRight(1)
prop, err := p.parseProperty()
... | |
c16358 | case 'A':
return ntBeginning
case 'G':
return ntStart
case 'Z':
return ntEndZ
case 'z':
return ntEnd
default:
return ntNothing
}
} | |
c16359 |
} else {
for {
if p.charsRight() < 3 || p.rightChar(2) != '#' ||
p.rightChar(1) != '?' || p.rightChar(0) != '(' {
return nil
}
for p.charsRight() > 0 && p.rightChar(0) != ')' {
p.moveRight(1)
}
if p.charsRight() == 0 {
return p.getErr(ErrUnterminatedComment)
}
p.moveRight(1)
... | |
c16360 | option := optionFromCode(ch)
if option == 0 || isOnlyTopOption(option) {
return
}
if off {
p.options &= ^option
} else {
p.options |= option
}
}
}
} | |
c16361 | '\u001B', nil
case 'f':
return '\f', nil
case 'n':
return '\n', nil
case 'r':
return '\r', nil
case 't':
return '\t', nil
case 'v':
return '\u000B', nil
case 'c':
return p.scanControl()
default:
if !p.useOptionE() && IsWordChar(ch) {
return 0, p.getErr(ErrUnrecognizedEscape, string(ch))
}
r... | |
c16362 | // \ca interpreted as \cA
if ch >= 'a' && ch <= 'z' {
ch = (ch - ('a' - 'A'))
}
ch = (ch - '@')
if ch >= 0 && ch < ' ' {
return ch, nil
}
return 0, p.getErr(ErrUnrecognizedControl)
} | |
c16363 | // prevent \x{}
if !hasContent {
return 0, p.getErr(ErrTooFewHex)
}
return rune(i), nil
}
hasContent = true
// no brace needs to be hex digit
d := hexDigit(ch)
if d < 0 {
return 0, p.getErr(ErrMissingBrace)
}
i *= 0x10
i += d
if i > unicode.MaxRune {
return 0, p.getErr(ErrInvalid... | |
c16364 |
if d := uint(ch - 'A'); d <= 5 {
return int(d + 0xa)
}
return -1
} | |
c16365 | p.pattern[p.currentPos]
p.currentPos++
return ch
} | |
c16366 |
// default would be 0
return p.pattern[p.currentPos+i]
} | |
c16367 |
return ok
}
return (i >= 0 && i < p.capsize)
} | |
c16368 | }
_, ok := p.capnames[capname]
return ok
} | |
c16369 |
p.unit = newRegexNodeCh(ntOne, p.options, ch)
} | |
c16370 |
p.unit = newRegexNodeCh(ntNotone, p.options, ch)
} | |
c16371 | newRegexNodeSet(ntSet, p.options, set)
} | |
c16372 | newRegexNode(t, p.options)
} | |
c16373 | p.optionsStack = p.optionsStack[:lastIdx]
} | |
c16374 |
p.options = p.optionsStack[lastIdx]
p.optionsStack = p.optionsStack[:lastIdx]
} | |
c16375 | = append(p.optionsStack, p.options)
} | |
c16376 | i := 0; i < len(str); i++ {
str[i] = unicode.ToLower(str[i])
}
}
node = newRegexNodeStr(ntMulti, p.options, str)
} else {
ch := p.charAt(pos)
if p.useOptionI() && !isReplacement {
ch = unicode.ToLower(ch)
}
node = newRegexNodeCh(ntOne, p.options, ch)
}
p.concatenation.addChild(node)
} | |
c16377 | = append(n.children[:startIndex], n.children[endIndex:]...)
} | |
c16378 | ntOne)
n.m = min
n.n = max
} | |
c16379 | child
if u.m > 0 {
if (math.MaxInt32-1)/u.m < min {
u.m = math.MaxInt32
} else {
u.m = u.m * min
}
}
if u.n > 0 {
if (math.MaxInt32-1)/u.n < max {
u.n = math.MaxInt32
} else {
u.n = u.n * max
}
}
}
if math.MaxInt32 == min {
return newRegexNode(ntNothing, n.options)
}
re... | |
c16380 | {
case 0:
return newRegexNode(emptyType, n.options)
case 1:
return n.children[0]
default:
return n
}
} | |
c16381 | ntSet)
} else if n.set.IsSingletonInverse() {
n.ch = n.set.SingletonChar()
n.set = nil
n.t += (ntNotone - ntSet)
}
return n
} | |
c16382 | }
fcSet := fc.getFirstChars()
return &Prefix{PrefixSet: fcSet, CaseInsensitive: fc.caseInsensitive}
} | |
c16383 | make([]regexFc, s.fcDepth*2)
copy(expanded, s.fcStack)
s.fcStack = expanded
}
s.fcStack[s.fcDepth] = fc
s.fcDepth++
} | |
c16384 |
for bp < len(ret) {
copy(ret[bp:], ret[:bp])
bp *= 2
}
return ret
} | |
c16385 | buf.WriteRune(' ')
}
buf.WriteRune('\n')
if b.negativeASCII != nil {
buf.WriteString(indent)
buf.WriteString("Negative table\n")
for i := 0; i < len(b.negativeASCII); i++ {
if b.negativeASCII[i] != len(b.pattern) {
fmt.Fprintf(buf, "%s %s %s\n", indent, Escape(string(rune(i))), strconv.Itoa(b.negativ... | |
c16386 | }
}
match -= bump
test2 -= bump
chTest = text[test2]
if b.caseInsensitive {
chTest = unicode.ToLower(chTest)
}
if chTest != b.pattern[match] {
advance = b.positive[match]
if (chTest & 0xFF80) == 0 {
test2 = (match - startmatch) + b.negativeASCII[chTest]
} else... | |
c16387 | {
if index > endlimit || index-beglimit < len(b.pattern) {
return false
}
return b.matchPattern(text, index-len(b.pattern))
}
} | |
c16388 |
}
if 0 != (anchors & AnchorEnd) {
buf.WriteString(", End")
}
if 0 != (anchors & AnchorEndZ) {
buf.WriteString(", EndZ")
}
// trim off comma
if buf.Len() >= 2 {
return buf.String()[2:]
}
return "None"
} | |
c16389 | slot := child.m
if len(caps) > 0 && slot >= 0 {
slot = caps[slot]
}
rules = append(rules, -replaceSpecials-1-slot)
default:
panic(ErrReplacementError)
}
}
if sb.Len() > 0 {
rules = append(rules, len(strings))
strings = append(strings, sb.String())
}
return &ReplacerData{
Rep: r... | |
c16390 | }
case replaceRightPortion:
for i := m.Index + m.Length; i < len(m.text); i++ {
buf.WriteRune(m.text[i])
}
case replaceLastGroup:
m.groupValueAppendToBuf(m.GroupCount()-1, buf)
case replaceWholeString:
for i := 0; i < len(m.text); i++ {
buf.WriteRune(m.text[i])
}
}
}
}
} | |
c16391 | code
_, err = Write(tree)
if err != nil {
panic(err)
}
return 1
} | |
c16392 | conn, err := ln.Accept()
if err != nil {
log.Printf("Accept failed: %v\n", err)
continue
}
go s.handleConnection(textproto.NewConn(conn))
}
} | |
c16393 | names
w.consume()
w.conn.noIdle()
} | |
c16394 | At this point, watch goroutine has ended,
// so it's safe to close connection.
return w.conn.Close()
} | |
c16395 | {
c.printfLine("close")
err = c.text.Close()
c.text = nil
}
return
} | |
c16396 |
return c.Command("playid").OK()
}
return c.Command("playid %d", id).OK()
} | |
c16397 | c.Command("seek %d %f", pos, d.Seconds()).OK()
} | |
c16398 | c.Command("seekid %d %f", id, d.Seconds()).OK()
} | |
c16399 | c.Command("seekcur %+f", d.Seconds()).OK()
}
return c.Command("seekcur %f", d.Seconds()).OK()
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.