Skip to content

Commit

Permalink
bug: Do not return status 200 for router messages (#801)
Browse files Browse the repository at this point in the history
Closes #800
  • Loading branch information
jrconlin authored Nov 19, 2024
1 parent 6141a90 commit a3d2301
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 3 additions & 2 deletions autoendpoint/src/routers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ pub struct RouterResponse {
}

impl RouterResponse {
/// Build a successful (200 OK) router response
/// Build a successful (201 CREATED) router response
/// (Note, we return a 201 here for [RFC](https://datatracker.ietf.org/doc/html/rfc8030#section-5) compliance)
pub fn success(location: String, ttl: usize) -> Self {
RouterResponse {
status: StatusCode::OK,
status: StatusCode::CREATED,
headers: {
let mut map = HashMap::new();
map.insert("Location", location);
Expand Down
16 changes: 12 additions & 4 deletions docs/src/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,22 @@ spec](https://tools.ietf.org/html/draft-thomson-webpush-http2-02#section-5).

**Return Codes:**

_**Note**_
The [Push RFC](https://datatracker.ietf.org/doc/html/rfc8030#section-5) notes the HTTP response codes that should be returned.
Autopush cannot support the [Push Message Receipt](https://datatracker.ietf.org/doc/html/rfc8030#section-5.1) at this time, so
Autopush should only return a 201 response. (Previously, Autopush would return a 202 indicating that the message was stored for
later retrieval.) Autopush cannot guarantee end-to-end delivery of a message due to the nature of how it handles subscription
updates to mobile devices. The "Bridge" protocols do not support this feature, and if possible, Autopush should not disclose
the type of UserAgent to the Subscription provider.

- statuscode 404
Push subscription is invalid.

- statuscode 202
Message stored for delivery to client at a later time.
- statuscode 410
Push subscription is no longer available.

- statuscode 200
Message delivered to node client is connected to.
- statuscode 201
Message delivered to node or bridge the client is connected to.

### Message Topics

Expand Down

0 comments on commit a3d2301

Please sign in to comment.