diff options
-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 |