diff options
author | Sam Bingner <sam@bingner.com> | 2020-05-25 15:37:35 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2020-05-25 17:21:24 -1000 |
commit | ff830d9cbbc43cc48649089211907c9916eacf69 (patch) | |
tree | 35659c46d7de6878aa135ae80011327d4db69d41 | |
parent | 4fb24a493f22558f637b2cb92059458e104354e7 (diff) |
Hack around nitotv's broken webserver
-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 |