From 6a0595bc46c3751090d5d24e2ab94647c9573915 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 14 Oct 2015 16:15:55 +0100 Subject: [PATCH 1/2] Add in size limits as per SPEC-222 --- .../v1/core-event-schema/state_event.json | 2 +- event-schemas/schema/v1/m.room.name | 2 +- specification/0-events.rst | 17 +++++++++++++++++ specification/0-intro.rst | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/event-schemas/schema/v1/core-event-schema/state_event.json b/event-schemas/schema/v1/core-event-schema/state_event.json index f70118f4..88b4900a 100644 --- a/event-schemas/schema/v1/core-event-schema/state_event.json +++ b/event-schemas/schema/v1/core-event-schema/state_event.json @@ -8,7 +8,7 @@ "properties": { "state_key": { "type": "string", - "description": "A unique key which defines the overwriting semantics for this piece of room state. This value is often a zero-length string. The presence of this key makes this event a State Event." + "description": "A unique key which defines the overwriting semantics for this piece of room state. This value is often a zero-length string. The presence of this key makes this event a State Event. The key MUST NOT start with '_'." }, "prev_content": { "type": "object", diff --git a/event-schemas/schema/v1/m.room.name b/event-schemas/schema/v1/m.room.name index b43f02cc..0e0b25be 100644 --- a/event-schemas/schema/v1/m.room.name +++ b/event-schemas/schema/v1/m.room.name @@ -11,7 +11,7 @@ "properties": { "name": { "type": "string", - "description": "The name of the room." + "description": "The name of the room. This MUST NOT exceed 255 bytes." } }, "required": ["name"] diff --git a/specification/0-events.rst b/specification/0-events.rst index 16948462..ae5a698a 100644 --- a/specification/0-events.rst +++ b/specification/0-events.rst @@ -12,6 +12,23 @@ server-server and application-service APIs, and are described below. {{common_state_event_fields}} +Size limits +----------- + +The total size of any event MUST NOT exceed 65 KB. There are additional +restrictions on sizes per key: + + - ``user_id`` MUST NOT exceed 255 bytes (including domain). + - ``room_id`` MUST NOT exceed 255 bytes. + - ``state_key`` MUST NOT exceed 255 bytes. + - ``type`` MUST NOT exceed 255 bytes. + - ``event_id`` MUST NOT exceed 255 bytes. + - ``user_id`` MUST NOT exceed 255 bytes. + +Some event types have additional sizes restrictions which are specified in +the description of the event. Additional keys have no limit other than that +implied by the total 65 KB limit on events. + Room Events ----------- .. NOTE:: diff --git a/specification/0-intro.rst b/specification/0-intro.rst index 445b32ef..e5cf1ac8 100644 --- a/specification/0-intro.rst +++ b/specification/0-intro.rst @@ -296,7 +296,7 @@ be obtained by visiting the domain specified. They are case-insensitive. Note that the mapping from a room alias to a room ID is not fixed, and may change over time to point to a different room ID. For this reason, Clients SHOULD resolve the room alias to a room ID once and then use that ID on subsequent -requests. +requests. Room aliases MUST NOT exceed 255 bytes. When resolving a room alias the server will also respond with a list of servers that are in the room that can be used to join via. From c82c07ddd26055cb832d00e8df920a571ead9074 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 15 Oct 2015 09:58:39 +0100 Subject: [PATCH 2/2] Review comments --- specification/0-events.rst | 3 +-- specification/0-intro.rst | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/specification/0-events.rst b/specification/0-events.rst index ae5a698a..f24ad984 100644 --- a/specification/0-events.rst +++ b/specification/0-events.rst @@ -23,9 +23,8 @@ restrictions on sizes per key: - ``state_key`` MUST NOT exceed 255 bytes. - ``type`` MUST NOT exceed 255 bytes. - ``event_id`` MUST NOT exceed 255 bytes. - - ``user_id`` MUST NOT exceed 255 bytes. -Some event types have additional sizes restrictions which are specified in +Some event types have additional size restrictions which are specified in the description of the event. Additional keys have no limit other than that implied by the total 65 KB limit on events. diff --git a/specification/0-intro.rst b/specification/0-intro.rst index e5cf1ac8..90ec94ef 100644 --- a/specification/0-intro.rst +++ b/specification/0-intro.rst @@ -296,7 +296,7 @@ be obtained by visiting the domain specified. They are case-insensitive. Note that the mapping from a room alias to a room ID is not fixed, and may change over time to point to a different room ID. For this reason, Clients SHOULD resolve the room alias to a room ID once and then use that ID on subsequent -requests. Room aliases MUST NOT exceed 255 bytes. +requests. Room aliases MUST NOT exceed 255 bytes (including the domain). When resolving a room alias the server will also respond with a list of servers that are in the room that can be used to join via.