MCPcopy Create free account
hub / github.com/AandStep/ResultV / subscriptionEmptyBodyError

Function subscriptionEmptyBodyError

app.go:1578–1606  ·  view source on GitHub ↗
(h http.Header)

Source from the content-addressed store, hash-verified

1576}
1577
1578func subscriptionEmptyBodyError(h http.Header) error {
1579 title := parseSubscriptionHeaderText(h.Get("Profile-Title"))
1580 announce := parseSubscriptionHeaderText(h.Get("Announce"))
1581 supportURL := strings.TrimSpace(h.Get("Support-Url"))
1582 hwidLimit := headerIsTruthy(h, "X-Hwid-Limit") || headerIsTruthy(h, "X-Hwid-Max-Devices-Reached")
1583 hwidNotSupported := headerIsTruthy(h, "X-Hwid-Not-Supported")
1584
1585 reason := "подписка вернула пустой ответ"
1586 if hwidLimit {
1587 reason = "достигнут лимит устройств для подписки"
1588 } else if hwidNotSupported {
1589 reason = "провайдер требует передачу HWID"
1590 }
1591
1592 details := make([]string, 0, 3)
1593 if title != "" {
1594 details = append(details, title)
1595 }
1596 if announce != "" {
1597 details = append(details, announce)
1598 }
1599 if supportURL != "" {
1600 details = append(details, "Поддержка: "+supportURL)
1601 }
1602 if len(details) == 0 {
1603 return errors.New(reason)
1604 }
1605 return fmt.Errorf("%s. %s", reason, strings.Join(details, " | "))
1606}
1607
1608// subscriptionHWID returns the HWID header value for a subscription fetch.
1609// The raw machine-wide HWID is hashed together with the subscription host

Callers 1

Calls 2

headerIsTruthyFunction · 0.85

Tested by

no test coverage detected