Index: modules/http-neon-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/http-neon-method.c,v
retrieving revision 1.35
diff -u -p -r1.35 http-neon-method.c
--- modules/http-neon-method.c	14 Feb 2006 06:22:37 -0000	1.35
+++ modules/http-neon-method.c	5 Mar 2006 02:56:48 -0000
@@ -1809,6 +1809,38 @@ http_follow_redirect (HttpContext *conte
 /* ************************************************************************** */
 /* Http operations */
 
+static int fetch_headers (ne_request *req)
+{
+	gboolean must_close = FALSE;
+	char buffer[1];
+	size_t len;
+	int res;
+
+	do {
+		res = ne_begin_request (req);
+
+		if (NE_OK == res) {
+			len = ne_read_response_block (req, buffer, sizeof buffer);
+
+			/* The server sends data we don't want to read. As we are kind 
+			 * gnomes, we make sure to close the connection to give the poor
+			 * server a chance for aborting data transmission. This should
+			 * also work-around for broken icecast server. */
+			must_close = (len > 0);
+		}
+
+		if (NE_OK == res)
+			res = ne_end_request(req);
+	} while (NE_RETRY == res);
+
+	if (must_close) {
+		DEBUG_HTTP ("explictly closing connection");
+		ne_close_connection (ne_get_session (req));
+	}
+
+	return res;
+}
+
 static GnomeVFSResult
 http_get_file_info (HttpContext *context, GnomeVFSFileInfo *info)
 {
@@ -1868,9 +1900,20 @@ http_get_file_info (HttpContext *context
 	DEBUG_HTTP ("!! Fallthrough to head (%s)", gnome_vfs_result_to_string (result));
 	
  head_start:	
-	req  = ne_request_create (context->session, "HEAD", context->path);
+	req = ne_request_create (context->session, "HEAD", context->path);
+	res = fetch_headers (req);
+
+	if (res == NE_OK) {
+		result = resolve_result (res, req);
 
-	res = ne_request_dispatch (req);
+		if (GNOME_VFS_ERROR_NOT_SUPPORTED == result) {
+			DEBUG_HTTP ("falling back to GET method (bug 332816)");
+
+			ne_request_destroy (req);
+			req = ne_request_create (context->session, "GET", context->path);
+			res = fetch_headers (req);
+		}
+	}
 
 	if (res == NE_REDIRECT) {
 		result = http_follow_redirect (context);
@@ -1899,13 +1942,6 @@ http_get_file_info (HttpContext *context
 		info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_TYPE;
 
 		std_headers_to_file_info (req, info);
-		
-		/* work-around for broken icecast server */
-		if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE
-		    && ! g_ascii_strcasecmp (info->mime_type, "audio/mpeg")) {
-			ne_close_connection (ne_get_session (req));
-		}
-		
 	}
 	
 	ne_request_destroy (req);
