@@ -44,9 +44,11 @@ class Message
44
44
'k ' => 'supported ' ,
45
45
'l ' => 'content-length ' ,
46
46
'm ' => 'contact ' ,
47
+ 'o ' => 'event ' ,
47
48
'r ' => 'refer-to ' ,
48
49
's ' => 'subject ' ,
49
50
't ' => 'to ' ,
51
+ 'u ' => 'allow-events ' ,
50
52
'v ' => 'via ' ,
51
53
];
52
54
@@ -79,6 +81,8 @@ class Message
79
81
80
82
/* Single value with parameters header fields */
81
83
public SingleValueWithParamsHeader $ contentType ;
84
+ public SingleValueWithParamsHeader $ event ;
85
+ public SingleValueWithParamsHeader $ subscriptionState ;
82
86
83
87
/* Multiple value header fields */
84
88
public MultiValueHeader $ acceptEncoding ;
@@ -282,6 +286,18 @@ public static function parse(string $text, bool $ignoreBody = false): Message
282
286
283
287
continue 2 ;
284
288
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
+
285
301
/* https://tools.ietf.org/html/rfc3261#section-20.2 */
286
302
case 'accept-encoding ' :
287
303
$ msg ->acceptEncoding = MultiValueHeader::parse ($ hbody );
@@ -574,6 +590,14 @@ public function renderHeaders(bool $compact): string
574
590
$ ret .= $ this ->contentType ->render ($ compact ? 'c ' : 'Content-Type ' );
575
591
}
576
592
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
+
577
601
if (isset ($ this ->acceptEncoding )) {
578
602
$ ret .= $ this ->acceptEncoding ->render ('Accept-Encoding ' );
579
603
}
@@ -583,7 +607,7 @@ public function renderHeaders(bool $compact): string
583
607
}
584
608
585
609
if (isset ($ this ->allowEvents )) {
586
- $ ret .= $ this ->allowEvents ->render ('Allow-Events ' );
610
+ $ ret .= $ this ->allowEvents ->render ($ compact ? ' u ' : 'Allow-Events ' );
587
611
}
588
612
589
613
if (isset ($ this ->contentEncoding )) {
0 commit comments