Re: GVFS and http:// schemes



On Fri, 2008-03-21 at 20:52 +0000, Neil Williams wrote:
> I'm porting a Debian native app (deb-gview) from GnomeVFS to GIO and
> GVfs. It's mostly done but it used to be able to view remote files but I
> can't get that working anymore under GIO/GVfs.
> 
> http://dpkg-view.alioth.debian.org/
> 
> http://alioth.debian.org/plugins/scmcvs/cvsweb.php/dpkg-view/?cvsroot=dpkg-view
> 
> I'm a bit lost in the gvfs documentation - should gio and gvfs be able
> to open a file like:
> http://ftp.debian.org/debian/pool/main/g/gpe-tetris/gpe-tetris_0.6.4-1.dsc
> without having to parse the scheme, mount the FTP and stream the file
> with individual function calls?
> 
> I want the app to be able to open files like:
> http://ftp.debian.org/debian/pool/main/g/gpe-tetris/gpe-tetris_0.6.4-1_i386.deb
> from the command line - as GnomeVFS did. (deb-gview is a GNOME viewer
> for .deb files, it reads the archives, decompresses the files within the
> package and allows the user to view any .deb and any file within
> the .deb without worrying about the architecture of the file. It's
> useful for cross-builders and architecture porters.) So the process
> involves passing data from a GInputStream to libarchive. It works for
> local files.
> 
> What am I missing?

In what way does it fail? Generally you should only need to call
g_file_new_from_commandline() and then g_file_read() to read the file.
Try gvfs-cat and looking at the source of that for hints:

$ gvfs-cat http://ftp.debian.org/debian/pool/main/g/gpe-tetris/gpe-tetris_0.6.4-1.dsc  | head -n 2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There is however one small detail that is not the same as in gnome-vfs,
if the uri specifies something on a remote share that share must be
mounted. So, if opening the file fails with G_IO_ERROR_NOT_MOUNTED you
need to use g_file_mount_enclosing_volume() and pass in a
GMountOperation object to handle authentication callbacks. There will be
a ui GtkMountOperation implementation in the next gtk+ release (which
you can temporarily cut and paste if you need it now) and there is a
command line implementation on in you can steal from gvfs-mount.

However, http is automounting, so that should work as is.




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