commit - be20893f819a5320fcf7aae0fd66f48c2e1651ed
commit + f4dc4985003737550d70f56d782cecc2c0e3b192
blob - 5af8e3e5a81c2cd5ecd88534cf731e7c5465055b
blob + bb132cc62006889ebd5ab1628839011082345374
--- docs/httpapiref.md
+++ docs/httpapiref.md
{
"Recipient": "wondering_underbelly71",
"Destination": "test@example.com",
- "Expiry": 1845067777,
+ "Expiry": "2006-01-02T15:04:05Z07:00",
"Note": "newsletters for example.org"
}
```
<dt><code>Destination</code> string</dt>
<dd>Destination contains an email address, with domain suffix,
to which mail will be forwarded.</dd>
-<dt><code>Expiry</code> integer</dt>
-<dd>Expiry specifies a time in seconds since the UNIX epoch
+<dt><code>Expiry</code> string</dt>
+<dd>Expiry specifies a time in RFC3339 format
after which the alias is considered inactive;
that is, mail addressed to Recipient should be bounced.</dd>
<dt><code>Note</code> string</dt>
{
"Recipient": "wondering_underbelly71",
"Destination": "test@example.com",
- "Expiry": 1845067777,
+ "Expiry": "2006-01-02T15:04:05Z07:00",
"Note": "newsletters for example.org"
}
```
### Parameters
<dl>
-<dt><code>Expiry</code> optional integer</dt>
-<dd>Expiry specifies a time in seconds since the UNIX epoch
+<dt><code>expiry</code> optional string</dt>
+<dd>Expiry specifies a time in RFC3339 format
after which the alias is considered inactive;
that is, mail addressed to Recipient should be bounced.
By default, aliases never expire.</dd>
-<dt><code>Note</code> optional string</dt>
+<dt><code>note</code> optional string</dt>
<dd>Note contains user-defined text that can be used to, for example, identify the alias.
By default, aliases have no note.</dd>
</dl>
{
"Recipient": "wondering_underbelly71",
"Destination": "test@example.com",
- "Expiry": 1845067777,
+ "Expiry": "2006-01-02T15:04:05Z07:00",
"Note": "newsletters for example.org"
}
```
{
"Recipient": "wondering_underbelly71",
"Destination": "test@example.com",
- "Expiry": 1845067777,
+ "Expiry": "2006-01-02T15:04:05Z07:00",
"Note": "newsletters for example.org"
},
{
"Recipient": "humble_anteater48",
"Destination": "test@example.com",
- "Expiry": 1845067777,
+ "Expiry": "2006-01-02T15:04:05Z07:00",
"Note": "supermarket rewards card"
}
]
This can be used to, for example, remove an alias' expiry time.
<dl>
-<dt><code>Expiry</code> optional integer</dt>
-<dd>Expiry specifies a time in seconds since the UNIX epoch
+<dt><code>expiry</code> optional string</dt>
+<dd>Expiry specifies a time in RFC3339 format
after which the alias is considered inactive;
that is, mail addressed to Recipient should be bounced.
By default, aliases never expire.</dd>
blob - 0b890f911e3eba88a8ed52c81ccfa8deb4b7489d
blob + 6900c57608e3939ff6ad832989e9042986ddf98b
--- http.go
+++ http.go
"fmt"
"net/http"
"path"
- "strconv"
"strings"
"time"
)
for param := range req.PostForm {
switch param {
case "expiry":
- i, err := strconv.Atoi(req.PostForm.Get(param))
+ alias.Expiry, err = time.Parse(time.RFC3339, req.PostForm.Get(param))
if err != nil {
jerror(w, fmt.Sprintf("parse expiry: %v", err), http.StatusBadRequest)
return
}
- alias.Expiry = time.Unix(int64(i), 0)
case "note":
alias.Note = req.PostForm.Get(param)
default:
- jerror(w, fmt.Sprintf("invalid alias parameter %s", param), http.StatusBadRequest)
+ jerror(w, fmt.Sprintf("bad alias parameter %s", param), http.StatusBadRequest)
return
}
}
json.NewEncoder(w).Encode(alias)
default:
- jerror(w, "not implemented yet", http.StatusMethodNotAllowed)
+ code := http.StatusMethodNotAllowed
+ jerror(w, http.StatusText(code), code)
}
}