Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ben Copsey
2010-10-10 14:53:42 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1c457df1062b3fdc4be7ae79e83608a8d58e5f42
1c457df1
1 parent
afa77363
Fix removing cached headers (Thanks to Taggart Gorman for catching this!)
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletions
Classes/ASICacheDelegate.h
Classes/ASIDownloadCache.m
Classes/ASICacheDelegate.h
View file @
1c457df
...
...
@@ -49,6 +49,7 @@ typedef enum _ASICacheStoragePolicy {
// Same as the above, but returns a path to the cached response body instead
-
(
NSString
*
)
pathToCachedResponseDataForRequest
:(
ASIHTTPRequest
*
)
request
;
-
(
NSString
*
)
pathToCachedResponseHeadersForRequest
:(
ASIHTTPRequest
*
)
request
;
// Clear cached data stored for the passed storage policy
-
(
void
)
clearCachedResponsesForStoragePolicy
:(
ASICacheStoragePolicy
)
cachePolicy
;
...
...
Classes/ASIDownloadCache.m
View file @
1c457df
...
...
@@ -195,6 +195,32 @@ static NSString *permanentCacheFolder = @"PermanentStore";
return
nil
;
}
-
(
NSString
*
)
pathToCachedResponseHeadersForRequest
:
(
ASIHTTPRequest
*
)
request
{
[[
self
accessLock
]
lock
];
if
(
!
[
self
storagePath
])
{
[[
self
accessLock
]
unlock
];
return
nil
;
}
// Look in the session store
NSString
*
path
=
[[
self
storagePath
]
stringByAppendingPathComponent
:
sessionCacheFolder
];
NSString
*
dataPath
=
[
path
stringByAppendingPathComponent
:[[[
self
class
]
keyForRequest
:
request
]
stringByAppendingPathExtension
:
@"cachedheaders"
]];
if
([[
NSFileManager
defaultManager
]
fileExistsAtPath
:
dataPath
])
{
[[
self
accessLock
]
unlock
];
return
dataPath
;
}
// Look in the permanent store
path
=
[[
self
storagePath
]
stringByAppendingPathComponent
:
permanentCacheFolder
];
dataPath
=
[
path
stringByAppendingPathComponent
:[[[
self
class
]
keyForRequest
:
request
]
stringByAppendingPathExtension
:
@"cachedheaders"
]];
if
([[
NSFileManager
defaultManager
]
fileExistsAtPath
:
dataPath
])
{
[[
self
accessLock
]
unlock
];
return
dataPath
;
}
[[
self
accessLock
]
unlock
];
return
nil
;
}
-
(
void
)
removeCachedDataForRequest
:
(
ASIHTTPRequest
*
)
request
{
[[
self
accessLock
]
lock
];
...
...
@@ -202,7 +228,7 @@ static NSString *permanentCacheFolder = @"PermanentStore";
[[
self
accessLock
]
unlock
];
return
;
}
NSString
*
cachedHeadersPath
=
[
[
self
storagePath
]
stringByAppendingPathComponent
:[[[
self
class
]
keyForRequest
:
request
]
stringByAppendingPathExtension
:
@"cachedheaders"
]
];
NSString
*
cachedHeadersPath
=
[
self
pathToCachedResponseHeadersForRequest
:
request
];
if
(
!
cachedHeadersPath
)
{
[[
self
accessLock
]
unlock
];
return
;
...
...
Please
register
or
login
to post a comment