add vendor data
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m49s
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m49s
This commit is contained in:
41
vendor/github.com/dunglas/httpsfv/date.go
generated
vendored
Normal file
41
vendor/github.com/dunglas/httpsfv/date.go
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
package httpsfv
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ErrInvalidDateFormat = errors.New("invalid date format")
|
||||
|
||||
// marshalDate serializes as defined in
|
||||
// https://httpwg.org/specs/rfc9651.html#ser-date.
|
||||
func marshalDate(b io.StringWriter, i time.Time) error {
|
||||
_, err := b.WriteString("@")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return marshalInteger(b, i.Unix())
|
||||
}
|
||||
|
||||
// parseDate parses as defined in
|
||||
// https://httpwg.org/specs/rfc9651.html#parse-date.
|
||||
func parseDate(s *scanner) (time.Time, error) {
|
||||
if s.eof() || s.data[s.off] != '@' {
|
||||
return time.Time{}, &UnmarshalError{s.off, ErrInvalidDateFormat}
|
||||
}
|
||||
s.off++
|
||||
|
||||
n, err := parseNumber(s)
|
||||
if err != nil {
|
||||
return time.Time{}, &UnmarshalError{s.off, ErrInvalidDateFormat}
|
||||
}
|
||||
|
||||
i, ok := n.(int64)
|
||||
if !ok {
|
||||
return time.Time{}, &UnmarshalError{s.off, ErrInvalidDateFormat}
|
||||
}
|
||||
|
||||
return time.Unix(i, 0), nil
|
||||
}
|
||||
Reference in New Issue
Block a user