4141def valid_search_headers (headers : CaseInsensitiveDict ) -> bool :
4242 """Validate if this search is usable."""
4343 # pylint: disable=invalid-name
44- udn = headers .get ("_udn" ) # type: Optional[str]
45- st = headers .get ("st" ) # type: Optional[str]
46- location = headers .get ("location" , "" ) # type: str
44+ udn = headers .get_lower ("_udn" ) # type: Optional[str]
45+ st = headers .get_lower ("st" ) # type: Optional[str]
46+ location = headers .get_lower ("location" , "" ) # type: str
4747 return bool (
4848 udn
4949 and st
@@ -60,10 +60,10 @@ def valid_search_headers(headers: CaseInsensitiveDict) -> bool:
6060def valid_advertisement_headers (headers : CaseInsensitiveDict ) -> bool :
6161 """Validate if this advertisement is usable for connecting to a device."""
6262 # pylint: disable=invalid-name
63- udn = headers .get ("_udn" ) # type: Optional[str]
64- nt = headers .get ("nt" ) # type: Optional[str]
65- nts = headers .get ("nts" ) # type: Optional[str]
66- location = headers .get ("location" , "" ) # type: str
63+ udn = headers .get_lower ("_udn" ) # type: Optional[str]
64+ nt = headers .get_lower ("nt" ) # type: Optional[str]
65+ nts = headers .get_lower ("nts" ) # type: Optional[str]
66+ location = headers .get_lower ("location" , "" ) # type: str
6767 return bool (
6868 udn
6969 and nt
@@ -81,15 +81,15 @@ def valid_advertisement_headers(headers: CaseInsensitiveDict) -> bool:
8181def valid_byebye_headers (headers : CaseInsensitiveDict ) -> bool :
8282 """Validate if this advertisement has required headers for byebye."""
8383 # pylint: disable=invalid-name
84- udn = headers .get ("_udn" ) # type: Optional[str]
85- nt = headers .get ("nt" ) # type: Optional[str]
86- nts = headers .get ("nts" ) # type: Optional[str]
84+ udn = headers .get_lower ("_udn" ) # type: Optional[str]
85+ nt = headers .get_lower ("nt" ) # type: Optional[str]
86+ nts = headers .get_lower ("nts" ) # type: Optional[str]
8787 return bool (udn and nt and nts )
8888
8989
9090def extract_valid_to (headers : CaseInsensitiveDict ) -> datetime :
9191 """Extract/create valid to."""
92- cache_control = headers .get ("cache-control" , "" )
92+ cache_control = headers .get_lower ("cache-control" , "" )
9393 match = CACHE_CONTROL_RE .search (cache_control )
9494 if match :
9595 max_age = int (match [1 ])
@@ -247,7 +247,7 @@ def ip_version_from_location(location: str) -> Optional[int]:
247247
248248def location_changed (ssdp_device : SsdpDevice , headers : CaseInsensitiveDict ) -> bool :
249249 """Test if location changed for device."""
250- new_location = headers .get ("location" , "" )
250+ new_location = headers .get_lower ("location" , "" )
251251 if not new_location :
252252 return False
253253
0 commit comments