bugGNUstep - Bugs: bug #14523, NSURLHandle caching problem

Group
 
 

bug #14523: NSURLHandle caching problem

Submitter:  Sašo Kiselkov <diablos>
Submitted:  Tue 13 Sep 2005 07:39:31 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 23 Oct 2005 12:14:20 PM UTC, comment #2: 

I think this is working in CVS ... and does not require any extension to the API ... but perhaps I'm missing something.

Richard Frith-Macdonald <CaS>
Group Member
Tue 13 Sep 2005 08:30:29 PM UTC, comment #1: 

Problem fixed. A patched version of NSURLHandle.[hm] is available at http://openspace.adlerka.sk/NSURLHandleFix.tar.gz .

In detail, I've added the method -[NSURLHandle hasUpToDateData] which subclasses should override to do any checks on whether the currently loaded version of the data is up-to-date. They can obtain the date the last fetch has been done by looking at the _loadDate ivar - it's automagically set up by NSURLHandle every time a data load is completed successfuly. (The default implementation of -hasUpToDateData always returns YES.)

When NSURLHandle's data is requested by -resourceData and the data load has been successfuly finished, it first asks itself with -hasUpToDateData whether the current version of the data is really up-to-date. If not, it loads the data resource again. The -availableResourceData doesn't perform any such checks.

The default implementation of -[NSURLHandle  always returns YES, i.e. it doesn't do any checking.

GSFileURLHandle overrides -hasUpToDateData and checks the modification date of the file and acts accordingly.

That's it. :-)

Sašo Kiselkov <diablos>
Tue 13 Sep 2005 07:39:31 PM UTC, original submission:  

When implementing an app that reads data from a file by using an NSURL I encountered this problem:
 - I open a file.
 - Edit and save it, close the document.
 - Open the document again (without restarting the app), but it contains the same data as if before the edit - what the???

When investigating at lower levels in GNUstep source I found out that NSURLHandle's caching mechanism doesn't query the underlying scheme-specific subclasses (such as GSFileURLHandle) on whether the cached data is up-to-date.

I propose to fix this problem by adding some machinery to NSURLHandle that would allow it to check whether the cached data is still valid. I'll try to work something out in the mean time.

Sašo Kiselkov <diablos>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-10-23 CaS CategoryNone Base/Foundation
    StatusNone Fixed
    Open/ClosedOpen Closed

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code