From e2d24a94231d99011c402b7902f3a25df12ac1a3 Mon Sep 17 00:00:00 2001 From: Sam Bingner Date: Mon, 25 May 2020 15:37:35 -1000 Subject: Hack around nitotv's broken webserver --- methods/http.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/methods/http.cc b/methods/http.cc index e52318055..94c017d2a 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -306,6 +306,18 @@ int HttpMethod::Loop() size_t srLength = CFStringGetLength(sr); if (srLength >= nitoURLLength && CFStringCompareWithOptions(sr, nitoBaseURL, CFRangeMake(0, nitoURLLength), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { isNito = true; + // NitoTV's webserver is broken... hack around it + CFRange range = CFRangeMake(0, CFStringGetLength(CFSTR("https://nito.tv/repo/./"))); + if (CFStringCompareWithOptions(sr, CFSTR("https://nito.tv/repo/./"), range, kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + range = CFRangeMake(CFStringGetLength(CFSTR("https://nito.tv/repo/./")), CFStringGetLength(sr) - CFStringGetLength(CFSTR("https://nito.tv/repo/./"))); + if (range.length>0) { + CFStringRef subsr = CFStringCreateWithSubstring(NULL, sr, range); + CFStringRef newsr = CFStringCreateWithFormat(NULL, NULL, CFSTR("https://nito.tv/repo/%@"), subsr); + CFRelease(subsr); + CFRelease(sr); + sr = newsr; + } + } } } #endif -- cgit v1.2.3