GNOME Bugzilla – Bug 46117
no error when opening http://www.gnome.org for writing
Last modified: 2005-11-07 12:05:50 UTC
I'm using gnome-vfs 0.42. The following program runs without errors, but IMO it should produce an error when I try to open the URL http://www.gnome.org in write mode. Regards Paolo ---- #include <gnome.h> #include <libgnomevfs/gnome-vfs.h> static gboolean show_if_error (GnomeVFSResult result, const char *what, const char *what2) { if (result != GNOME_VFS_OK) { g_print ("%s%s `%s'\n", what, what2, gnome_vfs_result_to_string (result)); return TRUE; } else return FALSE; } int main (int argc, char **argv) { GnomeVFSHandle *from_handle = NULL; GnomeVFSHandle *to_handle = NULL; GnomeVFSResult result; gchar* from = "file:///opt/prova/v.c.gz#gzip:"; gchar* to = "http://www.gnome.org"; gnome_init ("test-vfs", "0.0", argc, argv); if (!gnome_vfs_init ()) { g_print ("Cannot initialize gnome-vfs.\n"); return 1; } result = gnome_vfs_open (&from_handle, from, GNOME_VFS_OPEN_READ); if (show_if_error (result, "open ", from)) goto out; result = gnome_vfs_open (&to_handle, to, GNOME_VFS_OPEN_WRITE); if (result == GNOME_VFS_ERROR_NOT_FOUND) { result = gnome_vfs_create (&to_handle, to, GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL); if (show_if_error (result, "create ", to)) goto out; } else { if (show_if_error (result, "open ", to)) goto out; } while (1) { GnomeVFSFileSize bytes_read; GnomeVFSFileSize bytes_written; guint8 data [1024]; result = gnome_vfs_read (from_handle, data, 1024, &bytes_read); if (show_if_error (result, "read ", from)) goto out; if (bytes_read == 0) break; result = gnome_vfs_write (to_handle, data, bytes_read, &bytes_written); if (show_if_error (result, "write ", to)) goto out; g_print("."); if (bytes_read != bytes_written) g_print("Didn't write it all"); } out: g_print("\n"); if (to_handle) { result = gnome_vfs_close (to_handle); if (show_if_error (result, "close ", to)) /* Nothing */; } if (from_handle) { result = gnome_vfs_close (from_handle); if (show_if_error (result, "close ", from)) /* Nothing */; } } ------- Additional Comments From mikef@praxis.etla.net 2001-01-29 16:47:32 ---- I believe this. The HTTP method has no way of telling in advance whether or not the target URI is a DAV site. The problems here are 1) gnome-vfs could make another round-trip to ascertain the likelyhood f being able to do a PUT, but still can't know for sure whether the PUT is allowed until the response from the PUT itself comes back 2) You do end up getting an error, but it comes from close, not from open or write! We'll be able to solve this in special cases, but not in the general case, I fear. ------- Additional Comments From mikef@praxis.etla.net 2001-03-05 11:49:03 ---- This may be closed as WONTFIX. ------- Bug moved to this database by unknown@bugzilla.gnome.org 2001-09-09 20:57 -------
Created attachment 7855 [details] Test program to reproduce this bug in gnome2
I can reproduce it using libgnomevfs 1.9.11 I think this bug should be fixed to let apps use gnome-vfs to save files in a reliable way.
Hrm... paolo, I take it you're arguing we should solve the special case even if we can't solve the general case? I suppose you should confirm/mark new, then; otherwise it sounds like WONTFIX is appropriate.
No answer for more than a year, closing.
I still can reproduce it with current CVS HEAD. For example: gnomevfs-copy file:///gnome/gedit-new-mdi/Makefile http://www.gnome.org/index.html paolo@elilix:/gnome/gedit-new-mdi$ terminates without errors.
From do_create in http-method.c: /* the PUT failed */ /* FIXME bugzilla.gnome.org 45131 * If you PUT a file with an invalid name to Xythos, it * returns a 403 Forbidden, which is different from the behaviour * in MKCOL or MOVE. Unfortunately, it is not possible to discern whether * that 403 Forbidden is being returned because of invalid characters in the name * or because of permissions problems */ Milestoning to 2.14 since this is critical for the new-mdi branch of gedit.
Manny, I cant understand what you are trying to tell me with pointing to some FIXME in the old http method?
Christian: I don't know the HTTP protocol very well. I didn't know whether the problem was inherent to HTTP or whether this comment actually referred to a Xythos problem.
I actually I still believe that this bug is in the xfer method ...
Note that the test program I attached to comment #1 does not use xfer.
Paolo: Running your sample method with the http neon method returns a read only file-system error.
"sample method" as of "sample application"
Confirm that my same application now returns a `Read-only file system` error. The problem reported in comment #5 seems due to xfer. pbor is working on it. He will create a new bug report with the patch. Closing this bug as fixed.