gnome-vfs code freeze break request - shoutcast streaming problems with the neon library



Hi!

There were some people complaining[1,2,3] that the new http method
cannot handle ShoutCast and IceCast streams. The problem here is not the
new http module itself but the neon library because it cannot handle any
response which is not "HTTP/" (Please see [3] for more information).
I think we should fix this before 2.8.0 and I'll also try get this
upstream into the neon library. 

Cheers,
Christian

[1] http://mail.gnome.org/archives/desktop-devel-list/2004-
August/msg00544.html
[2] http://bugzilla.gnome.org/show_bug.cgi?id=150561
[3] http://bugzilla.gnome.org/show_bug.cgi?id=151453

Index: imported/neon/ne_utils.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/imported/neon/ne_utils.c,v
retrieving revision 1.2
diff -u -r1.2 ne_utils.c
--- imported/neon/ne_utils.c	22 Jul 2004 04:28:46 -0000	1.2
+++ imported/neon/ne_utils.c	4 Sep 2004 20:33:25 -0000
@@ -132,26 +132,36 @@
 #endif
 }
 
+
 int ne_parse_statusline(const char *status_line, ne_status *st)
 {
     const char *part;
     int major, minor, status_code, klass;
 
     /* skip leading garbage if any. */
-    part = strstr(status_line, "HTTP/");
-    if (part == NULL) return -1;
-
-    minor = major = 0;
-
-    /* Parse version string, skipping leading zeroes. */
-    for (part += 5; *part != '\0' && isdigit(*part); part++)
-	major = major*10 + (*part-'0');
-
-    if (*part++ != '.') return -1;
-
-    for (;*part != '\0' && isdigit(*part); part++)
-	minor = minor*10 + (*part-'0');
-
+    if ((part = strstr(status_line, "HTTP/")) != NULL) {
+    
+    	minor = major = 0;
+
+    	/* Parse version string, skipping leading zeroes. */
+    	for (part += 5; *part != '\0' && isdigit(*part); part++)
+		major = major*10 + (*part-'0');
+
+    	if (*part++ != '.') return -1;
+
+    	for (;*part != '\0' && isdigit(*part); part++)
+		minor = minor*10 + (*part-'0');
+		
+		/* workaround for broken ShoutCast and IceCast server
+		   which responed with ICY instead of HTTP */
+	} else if ((part = strstr(status_line, "ICY")) != NULL) {
+		major = 1;
+		minor = 0;
+		part += 3;
+	} else {
+		return -1;
+	}		
+		
     if (*part != ' ') return -1;
 
     /* Skip any spaces */


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