headerAddDate method

void headerAddDate(
  1. String name,
  2. DateTime date
)

Adds a HTTP header containing a RFC1123 formatted date.

Adds a HTTP header with the name and whose value is the date formatted according to rfc1123-date as defined by section 3.3.1 of RFC 2616 tools.ietf.org/html/rfc2616#section-3.3. This is the date format that is preferred as an Internet standard and required by HTTP 1.1. For example, "Sun, 06 Nov 1994 08:49:37 GMT".

The name is case-insensitive. The name is considered the same, whether it is represented using uppercase or lowercase letters.

The date can either be in localtime or UTC. (The rfc1123-date is always encoded as GMT. This implementation assumes the GMT value is the same as UTC, even though in reality they are different.)

HTTP allows for multiple headers with the same name: the new header is added after any existing headers with the same name.

Implementation

void headerAddDate(String name, DateTime date) {
  headerAdd(name, _rfc1123DateFormat(date));
}