func (j *Jar) newEntry(c *http.Cookie, now time.Time, defPath, host string) (e entry, remove bool, err error) {
	e.Name = c.Name

	if c.Path == "" || c.Path[0] != '/' {
		e.Path = defPath
	} else {
		e.Path = c.Path
	}

	e.Domain, e.HostOnly, err = j.domainAndType(host, c.Domain)
	if err != nil {
		return e, false, err
	}

	// MaxAge takes precedence over Expires.
	if c.MaxAge < 0 {
		return e, true, nil
	} else if c.MaxAge > 0 {
		e.Expires = now.Add(time.Duration(c.MaxAge) * time.Second)
		e.Persistent = true
	} else {
		if c.Expires.IsZero() {
			e.Expires = endOfTime
			e.Persistent = false
		} else {
			if !c.Expires.After(now) {
				return e, true, nil
			}
			e.Expires = c.Expires
			e.Persistent = true
		}
	}

	e.Value = c.Value
	e.Secure = c.Secure
	e.HttpOnly = c.HttpOnly

	return e, false, nil
}
// newEntry creates an entry from a http.Cookie c. now is the current time and
// is compared to c.Expires to determine deletion of c. defPath and host are the
// default-path and the canonical host name of the URL c was received from.
//
// remove records whether the jar should delete this cookie, as it has already
// expired with respect to now. In this case, e may be incomplete, but it will
// be valid to call e.id (which depends on e's Name, Domain and Path).
//
// A malformed c.Domain will result in an error.
newEntry creates an entry from a http.Cookie c. now is the current time and
is compared to c.Expires to determine deletion of c. defPath and host are the
default-path and the canonical host name of the URL c was received from.

remove records whether the jar should delete this cookie, as it has already
expired with respect to now. In this case, e may be incomplete, but it will
be valid to call e.id (which depends on e's Name, Domain and Path).

A malformed c.Domain will result in an error.
// newEntry creates an entry from a http . Cookie c . now is the current time and // is compared to c . Expires to determine deletion of c . defPath and host are the // default - path and the canonical host name of the URL c was received from . // // remove records whether the jar should delete this cookie as it has already // expired with respect to now . In this case e may be incomplete but it will // be valid to call e . id ( which depends on e ' s Name Domain and Path ) . // // A malformed c . Domain will result in an error .
func (j *Jar) newEntry(c *http.Cookie, now time.Time, defPath, host string) (e entry, remove bool, err error) {
	e.Name = c.Name
	if c.Path == "" || c.Path[0] != '/' {
		e.Path = defPath
	} else {
		e.Path = c.Path
	}
	e.Domain, e.HostOnly, err = j.domainAndType(host, c.Domain)
	if err != nil {
		return e, false, err
	}
	if c.MaxAge < 0 {
		return e, true, nil
	} else if c.MaxAge > 0 {
		e.Expires = now.Add(time.Duration(c.MaxAge) * time.Second)
		e.Persistent = true
	} else {
		if c.Expires.IsZero() {
			e.Expires = endOfTime
			e.Persistent = false
		} else {
			if !c.Expires.After(now) {
				return e, true, nil
			}
			e.Expires = c.Expires
			e.Persistent = true
		}
	}
	e.Value = c.Value
	e.Secure = c.Secure
	e.HttpOnly = c.HttpOnly
	return e, false, nil
}
func ( j * Jar ) newEntry ( c * http . Cookie , now time . Time , defPath , host string ) ( e entry , remove bool , err error ) { e . Name = c . Name if c . Path == " " || c . Path [ 0 ] != '/' { e . Path = defPath } else { e . Path = c . Path } e . Domain , e . HostOnly , err = j . domainAndType ( host , c . Domain ) if err != nil { return e , false , err } if c . MaxAge < 0 { return e , true , nil } else if c . MaxAge > 0 { e . Expires = now . Add ( time . Duration ( c . MaxAge ) * time . Second ) e . Persistent = true } else { if c . Expires . IsZero ( ) { e . Expires = endOfTime e . Persistent = false } else { if ! c . Expires . After ( now ) { return e , true , nil } e . Expires = c . Expires e . Persistent = true } } e . Value = c . Value e . Secure = c . Secure e . HttpOnly = c . HttpOnly return e , false , nil }
newEntry creates an entry from a http.Cookie c. now is the current time and
is compared to c.Expires to determine deletion of c. defPath and host are the
default-path and the canonical host name of the URL c was received from.
newEntry creates an entry from a http . Cookie c . now is the current time and is compared to c . Expires to determine deletion of c . defPath and host are the default - path and the canonical host name of the URL c was received from .
// MaxAge takes precedence over Expires.