// parse the request
191378
func (m *Parser) parse() (*Ast, error) {

	comment := m.initialComment()
	u.Debug(comment)
	// Now, find First Keyword
	switch m.curToken.T {
	case lex.TokenSelect:
		m.initialKeyword = m.curToken
		return m.parseSelect(comment)
	default:
		return nil, fmt.Errorf("Unrecognized query, expected [SELECT] influx ql")
	}
}
465099
func (lv *LTSV) Parse(line string) (*Log, error) {
	l := &Log{}
	err := ltsv.Unmarshal([]byte(line), l)
	if err != nil {
		return nil, errors.Wrapf(err, "failed to parse ltsvlog (not a ltsv): %s", line)
	}
	l.Time, _ = time.Parse(clfTimeLayout, strings.Trim(l.TimeStr, "[]"))
	if err := l.breakdownRequest(); err != nil {
		return nil, errors.Wrap(err, "failed to parse ltsvlog (invalid request)")
	}
	return l, nil
}
1258805
func (parser *CorrectionParser) Parse(req *http.Request, params imageserver.Params) error {
	return imageserver_http.ParseQueryBool("gamma_correction", req, params)
}
459749
func Parse(input string) (*UPID, error) {
	upid := new(UPID)

	splits := strings.Split(input, "@")
	if len(splits) != 2 {
		return nil, fmt.Errorf("Expect one `@' in the input")
	}
	upid.ID = splits[0]

	if _, err := net.ResolveTCPAddr("tcp4", splits[1]); err != nil {
		return nil, err
	}
	upid.Host, upid.Port, _ = net.SplitHostPort(splits[1])
	return upid, nil
}
1288037
func ParseParams(params *Params, req *Request) {
	params.Query = req.GetQuery()

	// Parse the body depending on the content type.
	switch req.ContentType {
	case "application/x-www-form-urlencoded":
		// Typical form.
		var err error
		if params.Form, err = req.GetForm(); err != nil {
			paramsLogger.Warn("ParseParams: Error parsing request body", "error", err)
		}

	case "multipart/form-data":
		// Multipart form.
		if mp, err := req.GetMultipartForm(); err != nil {
			paramsLogger.Warn("ParseParams: parsing request body:", "error", err)
		} else {
			params.Form = mp.GetValues()
			params.Files = mp.GetFiles()
		}
	case "application/json":
		fallthrough
	case "text/json":
		if body := req.GetBody(); body != nil {
			if content, err := ioutil.ReadAll(body); err == nil {
				// We wont bind it until we determine what we are binding too
				params.JSON = content
			} else {
				paramsLogger.Error("ParseParams: Failed to ready request body bytes", "error", err)
			}
		} else {
			paramsLogger.Info("ParseParams: Json post received with empty body")
		}
	}

	params.Values = params.calcValues()
}
613069
func (ps *SourcePrefixParser) Parse(req *http.Request, params imageserver.Params) error {
	return parseSourceTransform(ps.Parser, req, params, func(source string) string {
		return ps.Prefix + source
	})
}
401050
func (prs *Parser) Parse(req *http.Request, params imageserver.Params) error {
	crop := req.URL.Query().Get(param)
	if crop == "" {
		return nil
	}
	var minX, minY, maxX, maxY int
	_, err := fmt.Sscanf(crop, "%d,%d|%d,%d", &minX, &minY, &maxX, &maxY)
	if err != nil {
		return &imageserver.ParamError{
			Param:   param,
			Message: fmt.Sprintf("expected format '<int>,<int>|<int>,<int>': %s", err),
		}
	}
	params.Set(param, imageserver.Params{
		"min_x": minX,
		"min_y": minY,
		"max_x": maxX,
		"max_y": maxY,
	})
	return nil
}
48949
func (w *webRequester) Request() error {
	resp, err := http.Get(w.url)
	resp.Body.Close()
	return err
}
172494
func ParseSSECustomerRequest(r *http.Request) (key []byte, err error) {
	return ParseSSECustomerHeader(r.Header)
}
803646
func (p *PAM) Parse() *pam.Config {
	serviceName := p.ServiceName
	if serviceName == "" {
		serviceName = defaults.ServiceName
	}
	enabled, _ := utils.ParseBool(p.Enabled)
	return &pam.Config{
		Enabled:     enabled,
		ServiceName: serviceName,
	}
}
587511
func (t *TokenRenewer) parse(tokenString string) error {
	claims := &kitekey.KiteClaims{}

	_, err := jwt.ParseWithClaims(tokenString, claims, t.localKite.RSAKey)
	if err != nil {
		valErr, ok := err.(*jwt.ValidationError)
		if !ok {
			return err
		}

		// do noy return for ValidationErrorSignatureValid. This is because we
		// might asked for a kite who's public Key is different what we have.
		// We still should be able to send them requests.
		if (valErr.Errors & jwt.ValidationErrorSignatureInvalid) == 0 {
			return fmt.Errorf("Cannot parse token: %s", err)
		}
	}

	t.validUntil = time.Unix(claims.ExpiresAt, 0).UTC()
	return nil
}
1109632
func ParseFromRequest(req *http.Request, format Format, u ...json.Unmarshaler) (JWS, error) {
	token, err := ParseFromHeader(req, format, u...)
	if err == nil {
		return token, nil
	}

	token, err = ParseFromForm(req, format, u...)
	if err == nil {
		return token, nil
	}

	return nil, err
}
238188
func (d DefaultBodyParser) Parse(buf []byte, body interface{}, mediaType, charset string) error {
	if len(buf) == 0 {
		return ErrBadRequest.WithMsg("request entity empty")
	}
	switch true {
	case mediaType == MIMEApplicationJSON, isLikeMediaType(mediaType, "json"):
		err := json.Unmarshal(buf, body)
		if err == nil {
			return nil
		}

		if ute, ok := err.(*json.UnmarshalTypeError); ok {
			if ute.Field == "" { // go1.11
				return fmt.Errorf("Unmarshal type error: expected=%v, got=%v, offset=%v",
					ute.Type, ute.Value, ute.Offset)
			}
			return fmt.Errorf("Unmarshal type error: field=%v, expected=%v, got=%v, offset=%v",
				ute.Field, ute.Type, ute.Value, ute.Offset)
		} else if se, ok := err.(*json.SyntaxError); ok {
			return fmt.Errorf("Syntax error: offset=%v, error=%v", se.Offset, se.Error())
		} else {
			return err
		}
	case mediaType == MIMEApplicationXML, isLikeMediaType(mediaType, "xml"):
		return xml.Unmarshal(buf, body)
	case mediaType == MIMEApplicationForm:
		val, err := url.ParseQuery(string(buf))
		if err == nil {
			err = ValuesToStruct(val, body, "form")
		}
		return err
	}

	return ErrUnsupportedMediaType.WithMsg("unsupported media type")
}
343968
func (parser *SourcePathParser) Parse(req *http.Request, params imageserver.Params) error {
	if len(req.URL.Path) > 0 {
		params.Set(imageserver_source.Param, req.URL.Path)
	}
	return nil
}
682065
func (p StringParser) Parse(field string) (result interface{}, err error) {
	return field, nil
}
339443
func (client *Client) ParseRequest(r *http.Request) ([]*Event, error) {
	return ParseRequest(client.channelSecret, r)
}
390408
func parseBody(resp *http.Response, o interface{}) error {
	err := json.NewDecoder(resp.Body).Decode(&o)
	if err != nil {
		resp.Body.Close()
		return err
	} else {
		return resp.Body.Close()
	}
}