(s *scope, origParams url.Values, q []byte, req *http.Request)
| 540 | } |
| 541 | |
| 542 | func newCacheKey(s *scope, origParams url.Values, q []byte, req *http.Request) *cache.Key { |
| 543 | var userParamsHash uint32 |
| 544 | if s.user.params != nil { |
| 545 | userParamsHash = s.user.params.key |
| 546 | } |
| 547 | |
| 548 | queryParamsHash := calcQueryParamsHash(origParams) |
| 549 | credHash, err := uint32(0), error(nil) |
| 550 | |
| 551 | if !s.user.cache.SharedWithAllUsers { |
| 552 | credHash, err = calcCredentialHash(s.clusterUser.name, s.clusterUser.password) |
| 553 | } |
| 554 | if err != nil { |
| 555 | log.Errorf("fail to calc hash on credentials for user %s", s.user.name) |
| 556 | credHash = 0 |
| 557 | } |
| 558 | |
| 559 | return cache.NewKey( |
| 560 | skipLeadingComments(q), |
| 561 | origParams, |
| 562 | sortHeader(req.Header.Get("Accept-Encoding")), |
| 563 | userParamsHash, |
| 564 | queryParamsHash, |
| 565 | credHash, |
| 566 | ) |
| 567 | } |
| 568 | |
| 569 | func toString(stream io.Reader) (string, error) { |
| 570 | buf := new(bytes.Buffer) |
no test coverage detected