After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 46117 - no error when opening http://www.gnome.org for writing
no error when opening http://www.gnome.org for writing
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: Module: http
cvs (head)
Other All
: High major
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
Depends on:
Blocks:
 
 
Reported: 2001-01-29 07:23 UTC by Paolo Maggi
Modified: 2005-11-07 12:05 UTC
See Also:
GNOME target: 2.14.x
GNOME version: 2.13/2.14


Attachments
Test program to reproduce this bug in gnome2 (2.75 KB, text/plain)
2002-04-22 09:34 UTC, Paolo Maggi
Details

Description Paolo Maggi 2001-09-10 00:57:10 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 -------
Comment 1 Paolo Maggi 2002-04-22 09:34:54 UTC
Created attachment 7855 [details]
Test program to reproduce this bug in gnome2
Comment 2 Paolo Maggi 2002-04-22 09:37:50 UTC
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.
Comment 3 Luis Villa 2003-01-02 19:48:30 UTC
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.
Comment 4 Vincent Noel 2004-07-21 21:35:22 UTC
No answer for more than a year, closing.
Comment 5 Paolo Maggi 2005-09-12 15:24:56 UTC
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.



Comment 6 Christian Neumair 2005-09-12 15:41:21 UTC
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.
Comment 7 Christian Kellner 2005-09-13 22:38:44 UTC
Manny, I cant understand what you are trying to tell me with pointing to some
FIXME in the old http method?
Comment 8 Christian Neumair 2005-09-13 22:46:48 UTC
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.
Comment 9 Christian Kellner 2005-09-13 23:00:47 UTC
I actually I still believe that this bug is in the xfer method ...
Comment 10 Paolo Maggi 2005-09-14 07:25:29 UTC
Note that the test program I attached to comment #1 does not use xfer.
Comment 11 Christian Neumair 2005-09-14 10:22:42 UTC
Paolo: Running your sample method with the http neon method returns a read only
file-system error.
Comment 12 Christian Neumair 2005-09-14 10:23:05 UTC
"sample method" as of "sample application"
Comment 13 Paolo Maggi 2005-11-07 12:05:50 UTC
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.