0

I'm investigating cache hits and misses on my own subclass of NSURLProtocol. I have a request that looks like this (from a UIWebView)

https://www.my.server/?myqueryParams

For now, I am using simple string comparisons on the URLs:

+ (BOOL)requestIsCacheEquivalent:(NSURLRequest *)a toRequest:(NSURLRequest *)b
{
    bool equal = [a.URL.absoluteString isEqualToString:b.URL.absoluteString];
    NSLog(@"A: %@, B: %@", a.URL.absoluteString, b.URL.absoluteString);
    return equal;
}

What I see in the logs is that "a" has a trailing slash. It looks like this:

a -> https://www.my.server/?myqueryParams/
b -> https://www.my.server/?myqueryParams

I'm trying to debug where this trailing slash could be coming from. I realize that I don't even know what is responsible for calling this method -- it has a very limited backtrace.

Where do "a" and "b" come from? And where might that slash have come from?

Ben Flynn
  • 18,524
  • 20
  • 97
  • 142
  • 1
    maybe this helps: http://stackoverflow.com/questions/12310258/reliable-way-to-compare-two-nsurl-or-one-nsurl-and-an-nsstring – kabarga Oct 13 '14 at 22:56
  • @karbarga A helpful read, in general. Still confused at the slash after the query params (as opposed to the path). – Ben Flynn Oct 14 '14 at 14:20

0 Answers0