semantics of gnome_vfs_get_file_info_from_handle



Is it just me, or does anyone else find the semantics of
gnome_vfs_get_file_info_from_handle not useful?

What I want is for it to retrieve information collected during the
handle creation.  For example, the HTTP method parses the HTTP headers
like Content-Type, and stores that information in
handle->file_info->mime_type.  However, the implementation
do_get_file_info_from_handle makes an entirely new HTTP request!  This
is not what I want.

Here is sample code which should illustrate this:

GnomeVFSHandle *handle;
GnomeVFSInfo *info;
gnome_vfs_open_uri (&handle, "http://blaat.com/";, GNOME_VFS_OPEN_READ);
info = gnome_vfs_file_info_new ();
gnome_vfs_get_file_info_from_handle (src->handle, info, GNOME_VFS_FILE_INFO_DEFAULT);

All I really want to do is extract that Content-Type information
gathered during the HTTP request without wastefully making another.

The file method seems to do much the same thing.  In its "do_open" call,
it does actually run fstat, but throws away all the information gained. 
Its do_get_file_info_from_handle method makes *another* fstat call.

I think we should change the semantics of
gnome_vfs_get_file_info_from_handle to make it conceptually a "fast"
operation; i.e. it will work from whatever information the module handle
currently has.  Applications which want to do a full "stat" type thing
can just use the _uri method.

Alternatively...we could create a new method to do just this.

What do you think?




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]