cocoa - Receive Cached Data after http status code 204 recevied -


I use NSURLConnection this

  - ( void) connection: (NSURLConnection *) connection didReceiveResponse: (NSURLResponse *) response {if ([response isKindOfClass: [NSHTTPURLResponse class]]) {int code = [(NSHTTPURLResponse *) reaction statusCode]; }}  

I send a response that meets statusCode is 204, then I have another request, but 204 will come back after all the responses I received, tcpdump show howerver server Return 200 but after one minute, this 200 will return.

I thought it might be wrong about some cash, Howerver I do and I set cachePolicy the NSURLRequestReloadIgnoringLocalCacheData [[NSURLCahce sharedCache] removeAllCachedResponses] new requests before.

But it does not work. Still I will post 204 before 204, if I send the request after a minute, there will be 200.

Is this a mistake of cash? What can I do next?

PS: After the arrival of a 204, if I send a request immediate reply came, it seems that it has not been sent. Verwer sends TCPDs.

Take a look at the NSURLRequest class method "requestWithURL: cachePolicy: timeoutInterval:". There you can set a cash policy as an NSURLRequestCachePolicy value, for example, NSURLRequestReloadIgnoringLocalCacheData This will not ignore any cache of locally stored requests

  NSURLRequest * theRequest = [NSURLRequest requestWithURL: theURL cachePolicy: NSURLRequestReloadIgnoringLocalCacheData timeoutInterval: 20.0f];  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -