Index: doc/tmpl/gnome-vfs-inet-connection.sgml =================================================================== RCS file: /cvs/gnome/gnome-vfs/doc/tmpl/gnome-vfs-inet-connection.sgml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -r1.4 -r1.5 --- doc/tmpl/gnome-vfs-inet-connection.sgml 16 Aug 2004 08:44:05 -0000 1.4 +++ doc/tmpl/gnome-vfs-inet-connection.sgml 7 Oct 2004 04:36:35 -0000 1.5 @@ -1,11 +1,19 @@ -gnome-vfs-inet-connection +Internet connection - +Simple TCP/IP connection functions. +A #GnomeVFSInetConnection represents a TCP/IP connection. You can either use +#gnome_vfs_inet_connection_create which will use the #gnome_vfs_resolve DNS +resolution functions internally or you can do the name resolution yourself +and use #gnome_vfs_inet_connection_create_from_address to connect to a specific +address. + +After a connection has been established all I/O is done through a GnomeVFSSocket +or a GnomeVFSSocketBuffer. Index: doc/tmpl/gnome-vfs-socket-buffer.sgml =================================================================== RCS file: /cvs/gnome/gnome-vfs/doc/tmpl/gnome-vfs-socket-buffer.sgml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -r1.4 -r1.5 --- doc/tmpl/gnome-vfs-socket-buffer.sgml 16 Aug 2004 08:44:05 -0000 1.4 +++ doc/tmpl/gnome-vfs-socket-buffer.sgml 7 Oct 2004 04:36:35 -0000 1.5 @@ -1,11 +1,22 @@ -gnome-vfs-socket-buffer +Unified bufferd network I/O - +Posix style buffered network input/output. +The GnomeVFSSocketBuffer functions are very similar to the GnomeVFSSocket +ones. The only difference is that all input/output is done through an internally +managed buffer. This might increase I/O performance as well as give you the +possibility to use some convenient functions like #gnome_vfs_socket_buffer_peekc +and #gnome_vfs_socket_buffer_read_until. + + + + +You can manually force all internally buffered data to get written with +#gnome_vfs_socket_buffer_flush. Index: doc/tmpl/gnome-vfs-socket.sgml =================================================================== RCS file: /cvs/gnome/gnome-vfs/doc/tmpl/gnome-vfs-socket.sgml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -p -r1.7 -r1.8 --- doc/tmpl/gnome-vfs-socket.sgml 16 Aug 2004 08:44:06 -0000 1.7 +++ doc/tmpl/gnome-vfs-socket.sgml 7 Oct 2004 04:36:35 -0000 1.8 @@ -1,11 +1,16 @@ -gnome-vfs-socket +Unified network I/O - +Posix style network input/output functions. +The GnomeVFSSocket function family unifies network I/O through functions +similar to the standard POSIX read/write functions. The main difference is +that all operations are cancellable through the standard GnomeVFS cancellation +mechanism and you can specify a maximum amount of time an operation may take +through #gnome_vfs_socket_set_timeout. Index: imported/neon/ne_gnomevfs.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/imported/neon/ne_gnomevfs.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -r1.4 -r1.5 --- imported/neon/ne_gnomevfs.c 21 Sep 2004 08:10:19 -0000 1.4 +++ imported/neon/ne_gnomevfs.c 5 Oct 2004 15:47:10 -0000 1.5 @@ -252,7 +252,7 @@ ne_sock_connect (ne_socket *sock, const return NE_SOCK_ERROR; sock->socket = gnome_vfs_inet_connection_to_socket (sock->connection); - sock->socket_buffer = gnome_vfs_inet_connection_to_socket_buffer (sock->connection); + sock->socket_buffer = gnome_vfs_socket_buffer_new (sock->socket); return 0; } @@ -425,8 +425,6 @@ ne_sock_close (ne_socket *sock) GnomeVFSCancellation *cancellation; peek_cancellation (cancellation); - - gnome_vfs_socket_free (sock->socket); if (sock->socket_buffer) { gnome_vfs_socket_buffer_flush (sock->socket_buffer, Index: libgnomevfs/eggdesktopentries.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/eggdesktopentries.c,v retrieving revision 1.8 retrieving revision 1.10 diff -u -p -r1.8 -r1.10 --- libgnomevfs/eggdesktopentries.c 3 Sep 2004 18:24:00 -0000 1.8 +++ libgnomevfs/eggdesktopentries.c 28 Sep 2004 03:41:12 -0000 1.10 @@ -224,7 +224,7 @@ egg_find_file_in_data_dirs (const gchar g_free (path); if (fd < 0 && file_error == NULL) - g_set_error (&file_error, G_FILE_ERROR, + file_error = g_error_new (G_FILE_ERROR, g_file_error_from_errno (errno), _("File could not be opened: %s"), g_strerror (errno)); @@ -261,10 +261,8 @@ egg_find_file_in_data_dir (const gchar * gint fd; gchar **data_dirs; GError *file_error; - GError *secondary_error; file_error = NULL; - secondary_error = NULL; data_dirs = g_new0 (char *, 2); @@ -275,20 +273,18 @@ egg_find_file_in_data_dir (const gchar * if (fd < 0) { data_dirs = egg_get_secondary_data_dirs (); - fd = egg_find_file_in_data_dirs (file, data_dirs, &secondary_error); + fd = egg_find_file_in_data_dirs (file, data_dirs, NULL); g_strfreev (data_dirs); if (fd >= 0) - { - g_error_free (file_error); - file_error = NULL; - } + { + g_error_free (file_error); + file_error = NULL; + } } if (file_error) g_propagate_error (error, file_error); - else if (secondary_error) - g_propagate_error (error, secondary_error); return fd; } @@ -405,6 +401,7 @@ egg_desktop_entries_free (EggDesktopEntr g_string_free (entries->parse_buffer, TRUE); g_strfreev (entries->legal_start_groups); + g_free (entries->default_group_name); tmp = entries->groups; while (tmp != NULL) @@ -1912,9 +1909,9 @@ egg_desktop_entries_get_locale_country ( q = strstr (p, "@"); if (!q) - country_len = q - p; - else country_len = strlen (p); + else + country_len = q - p; if (country_len <= 0) return NULL; @@ -1972,9 +1969,9 @@ egg_desktop_entries_get_locale_encoding q = strstr (p, "@"); if (!q) - encoding_len = q - p; - else encoding_len = strlen (p); + else + encoding_len = q - p; if (encoding_len <= 0) { Index: libgnomevfs/gnome-vfs-mime-handlers.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-mime-handlers.c,v retrieving revision 1.109 retrieving revision 1.110 diff -u -p -r1.109 -r1.110 --- libgnomevfs/gnome-vfs-mime-handlers.c 7 Sep 2004 15:31:35 -0000 1.109 +++ libgnomevfs/gnome-vfs-mime-handlers.c 5 Oct 2004 09:32:20 -0000 1.110 @@ -98,6 +98,13 @@ gnome_vfs_mime_get_default_action_type ( { const char *action_type_string; + /* TODO: gnome_vfs_mime_get_value below always returns NONE these days. + We need to figure out what to really do here. For now, special case folders. + */ + if (g_str_has_prefix (mime_type, "x-directory/")) { + return GNOME_VFS_MIME_ACTION_TYPE_COMPONENT; + } + action_type_string = gnome_vfs_mime_get_value (mime_type, "default_action_type"); if (action_type_string != NULL && g_ascii_strcasecmp (action_type_string, "application") == 0) { Index: libgnomevfs/gnome-vfs-monitor.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-monitor.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -p -r1.11 -r1.12 --- libgnomevfs/gnome-vfs-monitor.c 20 Jul 2004 21:46:40 -0000 1.11 +++ libgnomevfs/gnome-vfs-monitor.c 7 Oct 2004 15:57:41 -0000 1.12 @@ -331,7 +331,8 @@ send_uri_changes_now (GnomeVFSMonitorHan l = monitor_handle->pending_callbacks; while (l != NULL) { callback_data = l->data; - if (strcmp (callback_data->info_uri, uri) == 0) { + if (callback_data->send_state != CALLBACK_STATE_SENT && + strcmp (callback_data->info_uri, uri) == 0) { callback_data->send_at = now; } l = l->next; Index: libgnomevfs/gnome-vfs-unix-mounts.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-unix-mounts.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -p -r1.16 -r1.17 --- libgnomevfs/gnome-vfs-unix-mounts.c 21 Sep 2004 07:45:25 -0000 1.16 +++ libgnomevfs/gnome-vfs-unix-mounts.c 22 Sep 2004 08:38:38 -0000 1.17 @@ -91,98 +91,111 @@ * to avoid this... * Various ugly workarounds can be tried later. */ -dev_t -_gnome_vfs_unix_mount_get_unix_device (GnomeVFSUnixMount *mount) +GList * +_gnome_vfs_unix_mount_get_unix_device (GList *mounts) { - struct stat statbuf; - dev_t unix_device; - pid_t pid; - int pipes[2]; -#ifdef HAVE_POLL - struct pollfd poll_fd; -#else - struct timeval tv; - fd_set read_fds; -#endif - int res; - int status; + GList *result = NULL; - if (pipe (pipes) == -1) { - return 0; - } + while (mounts) { + dev_t unix_device = 0; + pid_t pid; + int pipes[2]; + int status; - pid = fork (); - - if (pid == -1) { - close (pipes[0]); - close (pipes[1]); - return 0; - } - - unix_device = 0; - - if (pid == 0) { - /* Child */ - close (pipes[0]); + if (pipe (pipes) == -1) + goto error; pid = fork (); + if (pid == -1) { + close (pipes[0]); + close (pipes[1]); + goto error; + } - /* Fork an intermediate child that immediately exits so - * we can waitpid it. This means the final process will get - * owned by init and not go zombie - */ if (pid == 0) { - /* Grandchild */ - if (stat (mount->mount_path, &statbuf) == 0) { - write (pipes[1], (char *)&statbuf.st_dev, sizeof (dev_t)); + /* Child */ + close (pipes[0]); + + /* Fork an intermediate child that immediately exits + * so we can waitpid it. This means the final process + * will get owned by init and not go zombie. + */ + pid = fork (); + + if (pid == 0) { + /* Grandchild */ + struct stat statbuf; + while (mounts) { + GnomeVFSUnixMount *mount = mounts->data; + unix_device = + stat (mount->mount_path, &statbuf) == 0 + ? statbuf.st_dev + : 0; + write (pipes[1], (char *)&unix_device, sizeof (dev_t)); + mounts = mounts->next; + } } - } else { close (pipes[1]); + _exit (0); + g_assert_not_reached (); } - _exit (0); - } else { /* Parent */ close (pipes[1]); - - wait_again: + + retry_waitpid: if (waitpid (pid, &status, 0) < 0) { if (errno == EINTR) - goto wait_again; + goto retry_waitpid; else if (errno == ECHILD) ; /* do nothing, child already reaped */ else g_warning ("waitpid() should not fail in gnome_vfs_unix_mount_get_unix_device"); } + while (mounts) { + int res; - do { + do { #ifdef HAVE_POLL - poll_fd.fd = pipes[0]; - poll_fd.events = POLLIN; - res = poll (&poll_fd, 1, STAT_TIMEOUT_SECONDS*1000); + struct pollfd poll_fd; + poll_fd.fd = pipes[0]; + poll_fd.events = POLLIN; + res = poll (&poll_fd, 1, STAT_TIMEOUT_SECONDS * 1000); #else - tv.tv_sec = STAT_TIMEOUT_SECONDS; - tv.tv_usec = 0; + struct timeval tv; + fd_set read_fds; + + tv.tv_sec = STAT_TIMEOUT_SECONDS; + tv.tv_usec = 0; - FD_ZERO(&read_fds); - FD_SET(pipes[0], &read_fds); + FD_ZERO(&read_fds); + FD_SET(pipes[0], &read_fds); - res = select (pipes[0] + 1, - &read_fds, NULL, NULL, &tv); + res = select (pipes[0] + 1, + &read_fds, NULL, NULL, &tv); #endif - } while (res == -1 && errno == EINTR); - - if (res > 0) { - if (read (pipes[0], (char *)&unix_device, sizeof (dev_t)) != sizeof (dev_t)) { - unix_device = 0; - } + } while (res == -1 && errno == EINTR); + + if (res <= 0 || + read (pipes[0], (char *)&unix_device, sizeof (dev_t)) != sizeof (dev_t)) + break; + + result = g_list_prepend (result, GUINT_TO_POINTER ((gulong)unix_device)); + mounts = mounts->next; } close (pipes[0]); + + error: + if (mounts) { + unix_device = 0; + result = g_list_prepend (result, GUINT_TO_POINTER ((gulong)unix_device)); + mounts = mounts->next; + } } - - return unix_device; + + return g_list_reverse (result); } #ifndef HAVE_SETMNTENT Index: libgnomevfs/gnome-vfs-unix-mounts.h =================================================================== RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-unix-mounts.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- libgnomevfs/gnome-vfs-unix-mounts.h 5 Nov 2003 15:44:53 -0000 1.2 +++ libgnomevfs/gnome-vfs-unix-mounts.h 22 Sep 2004 08:38:38 -0000 1.3 @@ -59,7 +59,7 @@ gint _gnome_vfs_unix_mount_point_com GnomeVFSUnixMountPoint *mount_point2); gboolean _gnome_vfs_get_unix_mount_table (GList **return_list); gboolean _gnome_vfs_get_current_unix_mounts (GList **return_list); -dev_t _gnome_vfs_unix_mount_get_unix_device (GnomeVFSUnixMount *mount); +GList * _gnome_vfs_unix_mount_get_unix_device (GList *mounts); void _gnome_vfs_monitor_unix_mounts (GnomeVFSUnixMountCallback mount_table_changed, gpointer mount_table_changed_user_data, GnomeVFSUnixMountCallback current_mounts_changed, Index: libgnomevfs/gnome-vfs-volume-monitor-daemon.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-monitor-daemon.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -p -r1.14 -r1.15 --- libgnomevfs/gnome-vfs-volume-monitor-daemon.c 2 Sep 2004 15:51:48 -0000 1.14 +++ libgnomevfs/gnome-vfs-volume-monitor-daemon.c 22 Sep 2004 08:38:38 -0000 1.15 @@ -851,7 +851,7 @@ create_vol_from_mount (GnomeVFSVolumeMon vol->priv->volume_type = GNOME_VFS_VOLUME_TYPE_MOUNTPOINT; vol->priv->device_path = g_strdup (mount->device_path); - vol->priv->unix_device = _gnome_vfs_unix_mount_get_unix_device (mount); + vol->priv->unix_device = 0; /* Caller must fill in. */ vol->priv->activation_uri = gnome_vfs_get_uri_from_local_path (mount->mount_path); vol->priv->filesystem_type = g_strdup (mount->filesystem_type); vol->priv->is_read_only = mount->is_read_only; @@ -981,9 +981,8 @@ static void update_mtab_volumes (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon) { GList *new_mtab; - GList *removed, *added; - GList *l; - GnomeVFSUnixMount *mount; + GList *removed, *added, *devices; + GList *l, *ld; char *uri; GnomeVFSVolume *vol; GnomeVFSVolumeMonitor *volume_monitor; @@ -998,7 +997,7 @@ update_mtab_volumes (GnomeVFSVolumeMonit &added, &removed); for (l = removed; l != NULL; l = l->next) { - mount = l->data; + GnomeVFSUnixMount *mount = l->data; uri = gnome_vfs_get_uri_from_local_path (mount->mount_path); vol = _gnome_vfs_volume_monitor_find_mtab_volume_by_activation_uri (volume_monitor, uri); @@ -1011,15 +1010,22 @@ update_mtab_volumes (GnomeVFSVolumeMonit g_free (uri); } - - for (l = added; l != NULL; l = l->next) { - mount = l->data; + + devices = _gnome_vfs_unix_mount_get_unix_device (added); + + for (l = added, ld = devices; + l != NULL; + l = l->next, ld = ld->next) { + GnomeVFSUnixMount *mount = l->data; + dev_t unix_device = GPOINTER_TO_UINT (ld->data); vol = create_vol_from_mount (volume_monitor, mount); + vol->priv->unix_device = unix_device; _gnome_vfs_volume_monitor_mounted (volume_monitor, vol); gnome_vfs_volume_unref (vol); } - + + g_list_free (devices); g_list_free (added); g_list_free (removed); g_list_foreach (volume_monitor_daemon->last_mtab, Index: modules/http-neon-method.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/modules/http-neon-method.c,v retrieving revision 1.14 retrieving revision 1.16 diff -u -p -r1.14 -r1.16 --- modules/http-neon-method.c 21 Sep 2004 13:09:32 -0000 1.14 +++ modules/http-neon-method.c 6 Oct 2004 10:51:45 -0000 1.16 @@ -82,17 +82,17 @@ void vfs_module_shutdown /* ************************************************************************** */ /* DEBUGING stuff */ +#undef DEBUG_HTTP_ENABLE + #ifdef DEBUG_HTTP_ENABLE -void http_debug_printf(char *func, char *fmt, ...) G_GNUC_PRINTF (2,3); +void http_debug_printf(const char *func, const char *fmt, ...) G_GNUC_PRINTF (2,3); -/* #define DEBUG_HTTP_3(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__) */ -/* #define DEBUG_HTTP_2(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__) */ +#define DEBUG_HTTP_3(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__) +#define DEBUG_HTTP_2(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__) #define DEBUG_HTTP(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__) #define DEBUG_HTTP_FUNC(_enter) http_debug_printf (_enter ? "+++" : "---", "%s",__PRETTY_FUNCTION__) -#define DEBUG_HTTP_3(fmt, ...) -#define DEBUG_HTTP_2(fmt, ...) #define DEBUG_HTTP_CONTEXT(c) http_debug_printf (__PRETTY_FUNCTION__, \ @@ -100,7 +100,7 @@ void http_debug_printf(char *func, char c->session, c->path) void -http_debug_printf (char *func, char *fmt, ...) +http_debug_printf (const char *func, const char *fmt, ...) { va_list args; gchar * out; @@ -1385,10 +1385,12 @@ neon_session_pool_lookup (GnomeVFSURI *u DEBUG_HTTP ("[Session Pool] Searching (%d)", g_hash_table_size (neon_session_table)); + session = NULL; pool = g_hash_table_lookup (neon_session_table, uri); /* search in session pool */ if (pool != NULL && pool->unused_sessions) { + session = pool->unused_sessions->data; pool->unused_sessions = g_list_remove (pool->unused_sessions, session); @@ -1396,59 +1398,104 @@ neon_session_pool_lookup (GnomeVFSURI *u g_list_length (pool->unused_sessions)); g_get_current_time (&(pool->last_used)); - - G_UNLOCK (nst_lock); - return session; } G_UNLOCK (nst_lock); - return NULL; + return session; } /* ************************************************************************** */ /* Additional Headers */ -#if 0 -/* Does not work because the neon library doesnt provide as all the headers - working around that is a bigger thing */ +static int +neon_return_headers (ne_request *req, void *userdata, const ne_status *status) +{ + GnomeVFSModuleCallbackReceivedHeadersIn in_args; + GnomeVFSModuleCallbackReceivedHeadersOut out_args; + GList **headers, *iter; + GnomeVFSURI *uri; + ne_session *session; -typedef struct { + DEBUG_HTTP_FUNC (1); - GnomeVFSURI *uri; - gboolean sent; + session = ne_get_session (req); + headers = ne_get_request_private (req, "Headers"); + uri = ne_get_session_private (session, "GnomeVFSURI"); + + memset (&in_args, 0, sizeof (in_args)); + memset (&out_args, 0, sizeof (out_args)); + + in_args.uri = uri; + in_args.headers = *headers; + + gnome_vfs_module_callback_invoke (GNOME_VFS_MODULE_CALLBACK_HTTP_RECEIVED_HEADERS, + &in_args, sizeof (in_args), + &out_args, sizeof (out_args)); -} AddHeadersContext; + for (iter = *headers; iter; iter = iter->next) { + DEBUG_HTTP_3 ("Headers returned %s,", (char *) iter->data); + g_free (iter->data); + } + g_list_free (*headers); + g_free (headers); + + DEBUG_HTTP_FUNC (0); + + return 0; +} static void -neon_handle_additional_headers (ne_request *req, - void *userdata, - const char *method, - const char *requri) +neon_header_catcher (void *userdata, const char *value) { - AddHeadersContext *adhctx = (AddHeadersContext *) userdata; + GList **headers = (GList **) userdata; + + *headers = g_list_prepend (*headers, g_strdup (value)); +} + + +static void +neon_setup_headers (ne_request *req, void *userdata, ne_buffer *header) +{ + GnomeVFSModuleCallbackAdditionalHeadersIn in_args; + GnomeVFSModuleCallbackAdditionalHeadersOut out_args; + GList *iter, **headers; + gboolean ret; + GnomeVFSURI *uri; + ne_session *session; + + DEBUG_HTTP_FUNC (1); - if (! invoke_callback_send_additional_headers (uri, &list)) - return; + headers = g_new0 (GList *, 1); + + ne_set_request_private (req, "Headers", headers); + ne_add_response_header_catcher (req, neon_header_catcher, headers); + + session = ne_get_session (req); + uri = ne_get_session_private (session, "GnomeVFSURI"); + + memset (&in_args, 0, sizeof (in_args)); + memset (&out_args, 0, sizeof (out_args)); + + in_args.uri = uri; + + ret = gnome_vfs_module_callback_invoke (GNOME_VFS_MODULE_CALLBACK_HTTP_SEND_ADDITIONAL_HEADERS, + &in_args, sizeof (in_args), + &out_args, sizeof (out_args)); - GList *iter; - for (iter = list; iter; iter = iter->next) { - char *header = iter->data; - char *colon = g_strrstr (header, ":"); - AcHeaderContext acctx = g_new0 (AcHeaderContext, 1); - - if (colon != NULL) { - colon = '\0'; - ne_add_request_header (req, header, colon + 1); - } + for (iter = out_args.headers; iter; iter = iter->next) { - g_free (header); - iter->data = NULL; + if (ret) { + ne_buffer_zappend (header, iter->data); + DEBUG_HTTP_3 ("Adding header %s,", (char *) iter->data); + } + + g_free (iter->data); } - g_list_free (list); - + g_list_free (out_args.headers); + + DEBUG_HTTP_FUNC (0); } -#endif /* ************************************************************************** */ /* Http context */ @@ -1488,6 +1535,9 @@ http_aquire_connection (HttpContext *con session = neon_session_pool_lookup (context->uri); if (session != NULL) { + + ne_set_session_private (session, "GnomeVFSURI", context->uri); + context->session = session; return GNOME_VFS_OK; } @@ -1521,8 +1571,12 @@ http_aquire_connection (HttpContext *con http_auth_info_free, basic_auth); ne_redirect_register (session); - - + + /* Headers stuff */ + ne_set_session_private (session, "GnomeVFSURI", context->uri); + ne_hook_pre_send (session, neon_setup_headers, NULL); + ne_hook_post_send (session, neon_return_headers, NULL); + if (proxy_for_uri (top_uri, &proxy)) { HttpAuthInfo *proxy_auth; @@ -1669,7 +1723,7 @@ http_follow_redirect (HttpContext *conte } else { http_context_set_uri (context, new_uri); - + ne_set_session_private (context->session, "GnomeVFSURI", context->uri); result = GNOME_VFS_OK; } DEBUG_HTTP ("[Redirec] Redirect result: %s", @@ -2146,6 +2200,7 @@ get_start: if (res != NE_OK && res != NE_REDIRECT) { handle->transfer_state = TRANSFER_ERROR; handle->last_error = result; + ne_request_destroy (req); return result; } Index: modules/network-method.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/modules/network-method.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -p -r1.5 -r1.6 --- modules/network-method.c 24 Jun 2004 14:29:27 -0000 1.5 +++ modules/network-method.c 7 Oct 2004 15:08:38 -0000 1.6 @@ -44,6 +44,7 @@ #define PATH_GCONF_GNOME_VFS_DNS_SD "/system/dns_sd" #define PATH_GCONF_GNOME_VFS_DNS_SD_DISPLAY_LOCAL "/system/dns_sd/display_local" #define PATH_GCONF_GNOME_VFS_DNS_SD_EXTRA_DOMAINS "/system/dns_sd/extra_domains" +#define DEFAULT_WORKGROUP_NAME "X-GNOME-DEFAULT-WORKGROUP" typedef struct { char *display_name; @@ -1219,7 +1220,7 @@ notify_gconf_value_changed (GConfClient current_workgroup = gconf_client_get_string (client, PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL); if (current_workgroup == NULL) { - current_workgroup = g_strdup ("workgroup"); + current_workgroup = g_strdup (DEFAULT_WORKGROUP_NAME); } G_UNLOCK (network); @@ -1345,7 +1346,7 @@ vfs_module_init (const char *method_name current_workgroup = gconf_client_get_string (gconf_client, PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL); if (current_workgroup == NULL) { - current_workgroup = g_strdup ("workgroup"); + current_workgroup = g_strdup (DEFAULT_WORKGROUP_NAME); } setting = gconf_client_get_string (gconf_client, PATH_GCONF_GNOME_VFS_DNS_SD_DISPLAY_LOCAL, NULL); Index: modules/smb-method.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/modules/smb-method.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -r1.9 -r1.10 --- modules/smb-method.c 6 Sep 2004 09:47:37 -0000 1.9 +++ modules/smb-method.c 7 Oct 2004 15:08:38 -0000 1.10 @@ -94,6 +94,9 @@ static GHashTable *server_cache = NULL; #define SERVER_CACHE_REAP_TIMEOUT (30*60) static guint server_cache_reap_timeout = 0; +/* The magic "default workgroup" hostname */ +#define DEFAULT_WORKGROUP_NAME "X-GNOME-DEFAULT-WORKGROUP" + /* 5 minutes before we re-read the workgroup cache again */ #define WORKGROUP_CACHE_TIMEOUT (5*60) @@ -549,7 +552,9 @@ smb_uri_type (GnomeVFSURI *uri) strcmp (uri->text, "/") == 0) { /* smb://foo/ */ update_workgroup_cache (); - if (g_hash_table_lookup (workgroups, toplevel->host_name)) { + if (!g_ascii_strcasecmp(toplevel->host_name, + DEFAULT_WORKGROUP_NAME) || + g_hash_table_lookup (workgroups, toplevel->host_name)) { return SMB_URI_WORKGROUP; } else { return SMB_URI_SERVER; @@ -559,7 +564,9 @@ smb_uri_type (GnomeVFSURI *uri) if (first_slash == NULL) { /* smb://foo/bar */ update_workgroup_cache (); - if (g_hash_table_lookup (workgroups, toplevel->host_name)) { + if (!g_ascii_strcasecmp(toplevel->host_name, + DEFAULT_WORKGROUP_NAME) || + g_hash_table_lookup (workgroups, toplevel->host_name)) { return SMB_URI_SERVER_LINK; } else { return SMB_URI_SHARE; @@ -1547,6 +1554,8 @@ do_open_directory (GnomeVFSMethod *metho { DirectoryHandle *directory_handle; + GnomeVFSURI *new_uri = NULL; + const char *host_name; char *path; SmbUriType type; SMBCFILE *dir; @@ -1574,6 +1583,19 @@ do_open_directory (GnomeVFSMethod *metho type == SMB_URI_SERVER_LINK) { return GNOME_VFS_ERROR_NOT_A_DIRECTORY; } + + /* if it is the magic default workgroup name, map it to the + * SMBCCTX's workgroup, which comes from the smb.conf file. */ + host_name = gnome_vfs_uri_get_host_name (uri); + if (type == SMB_URI_WORKGROUP && host_name != NULL && + !g_ascii_strcasecmp(host_name, DEFAULT_WORKGROUP_NAME)) { + new_uri = gnome_vfs_uri_dup (uri); + gnome_vfs_uri_set_host_name (new_uri, + smb_context->workgroup + ? smb_context->workgroup + : "WORKGROUP"); + uri = new_uri; + } path = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_USER_NAME | GNOME_VFS_URI_HIDE_PASSWORD); @@ -1590,10 +1612,13 @@ do_open_directory (GnomeVFSMethod *metho if (dir == NULL) { UNLOCK_SMB(); g_free (path); + if (new_uri) gnome_vfs_uri_unref (new_uri); return gnome_vfs_result_from_errno (); } UNLOCK_SMB(); + + if (new_uri) gnome_vfs_uri_unref (new_uri); /* Construct the handle */ directory_handle = g_new0 (DirectoryHandle, 1);