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
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

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. ... LHandleFix.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>

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

 

Votes

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.

 

History

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.16-ed84.
Corresponding source code