@@ -44,9 +44,11 @@ class Message
4444 'k ' => 'supported ' ,
4545 'l ' => 'content-length ' ,
4646 'm ' => 'contact ' ,
47+ 'o ' => 'event ' ,
4748 'r ' => 'refer-to ' ,
4849 's ' => 'subject ' ,
4950 't ' => 'to ' ,
51+ 'u ' => 'allow-events ' ,
5052 'v ' => 'via ' ,
5153 ];
5254
@@ -79,6 +81,8 @@ class Message
7981
8082 /* Single value with parameters header fields */
8183 public SingleValueWithParamsHeader $ contentType ;
84+ public SingleValueWithParamsHeader $ event ;
85+ public SingleValueWithParamsHeader $ subscriptionState ;
8286
8387 /* Multiple value header fields */
8488 public MultiValueHeader $ acceptEncoding ;
@@ -282,6 +286,18 @@ public static function parse(string $text, bool $ignoreBody = false): Message
282286
283287 continue 2 ;
284288
289+ /* https://datatracker.ietf.org/doc/html/rfc6665#section-8.2.1 */
290+ case 'event ' :
291+ $ msg ->event = SingleValueWithParamsHeader::parse ($ hbody );
292+
293+ continue 2 ;
294+
295+ /* https://datatracker.ietf.org/doc/html/rfc6665#section-8.2.3 */
296+ case 'subscription-state ' :
297+ $ msg ->subscriptionState = SingleValueWithParamsHeader::parse ($ hbody );
298+
299+ continue 2 ;
300+
285301 /* https://tools.ietf.org/html/rfc3261#section-20.2 */
286302 case 'accept-encoding ' :
287303 $ msg ->acceptEncoding = MultiValueHeader::parse ($ hbody );
@@ -574,6 +590,14 @@ public function renderHeaders(bool $compact): string
574590 $ ret .= $ this ->contentType ->render ($ compact ? 'c ' : 'Content-Type ' );
575591 }
576592
593+ if (isset ($ this ->event )) {
594+ $ ret .= $ this ->event ->render ($ compact ? 'o ' : 'Event ' );
595+ }
596+
597+ if (isset ($ this ->subscriptionState )) {
598+ $ ret .= $ this ->subscriptionState ->render ('Subscription-State ' );
599+ }
600+
577601 if (isset ($ this ->acceptEncoding )) {
578602 $ ret .= $ this ->acceptEncoding ->render ('Accept-Encoding ' );
579603 }
@@ -583,7 +607,7 @@ public function renderHeaders(bool $compact): string
583607 }
584608
585609 if (isset ($ this ->allowEvents )) {
586- $ ret .= $ this ->allowEvents ->render ('Allow-Events ' );
610+ $ ret .= $ this ->allowEvents ->render ($ compact ? ' u ' : 'Allow-Events ' );
587611 }
588612
589613 if (isset ($ this ->contentEncoding )) {
0 commit comments