Browse code

pv: added missing WS and WSS to $K(key) variable

(cherry picked from commit a8c9d0ae4fbafba89ef12737419037d141eed1d3)
(cherry picked from commit 7b89c5e6abe5f4ae3ee55d9c938c865806f29dec)

Daniel-Constantin Mierla authored on 09/06/2021 10:15:38
Showing 1 changed files
... ...
@@ -3303,6 +3303,10 @@ int pv_parse_K_name(pv_spec_p sp, str *in)
3303 3303
 
3304 3304
 	switch(in->len)
3305 3305
 	{
3306
+		case 2:
3307
+			if(strncmp(in->s, "WS", 2)==0)
3308
+				sp->pvp.pvn.u.isname.name.n = 6;
3309
+			else goto error;
3306 3310
 		case 3:
3307 3311
 			if(strncmp(in->s, "UDP", 3)==0)
3308 3312
 				sp->pvp.pvn.u.isname.name.n = 2;
... ...
@@ -3310,6 +3314,8 @@ int pv_parse_K_name(pv_spec_p sp, str *in)
3310 3314
 				sp->pvp.pvn.u.isname.name.n = 3;
3311 3315
 			else if(strncmp(in->s, "TLS", 3)==0)
3312 3316
 				sp->pvp.pvn.u.isname.name.n = 4;
3317
+			else if(strncmp(in->s, "WSS", 3)==0)
3318
+				sp->pvp.pvn.u.isname.name.n = 7;
3313 3319
 			else goto error;
3314 3320
 		break;
3315 3321
 		case 4:
... ...
@@ -3381,6 +3387,10 @@ int pv_get_K(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
3381 3387
 			return pv_get_uintval(msg, param, res, PROTO_TLS);
3382 3388
 		case 5:
3383 3389
 			return pv_get_uintval(msg, param, res, PROTO_SCTP);
3390
+		case 6:
3391
+			return pv_get_uintval(msg, param, res, PROTO_WS);
3392
+		case 7:
3393
+			return pv_get_uintval(msg, param, res, PROTO_WSS);
3384 3394
 		default:
3385 3395
 			return pv_get_uintval(msg, param, res, AF_INET);
3386 3396
 	}