diff options
author | Sam Bingner <sam@bingner.com> | 2020-05-25 15:37:35 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2020-07-17 00:22:23 -1000 |
commit | e2d24a94231d99011c402b7902f3a25df12ac1a3 (patch) | |
tree | 7cb22f224b4f39bb1314524a066299f3ba7ea489 /methods | |
parent | bafc29f02ad6397c42b19ab7f97c5bf8072b6d7a (diff) |
Hack around nitotv's broken webserver
Diffstat (limited to 'methods')
-rw-r--r-- | methods/http.cc | 12 |
1 files changed, 12 insertions, 0 deletions
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 |