changeset 30105:31b7d4637b50

Fix crash if http reply contains neither "Accept-Ranges" nor "Server" fields.
author reimar
date Thu, 31 Dec 2009 16:46:44 +0000
parents 8b7ff54da750
children e0d36dce5d85
files stream/http.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stream/http.c	Thu Dec 31 11:29:21 2009 +0000
+++ b/stream/http.c	Thu Dec 31 16:46:44 2009 +0000
@@ -768,9 +768,10 @@
 		// Check if we can make partial content requests and thus seek in http-streams
 		if( http_hdr!=NULL && http_hdr->status_code==200 ) {
 		    char *accept_ranges;
+		    const char *server = http_get_field(http_hdr, "Server");
 		    if( (accept_ranges = http_get_field(http_hdr,"Accept-Ranges")) != NULL )
 			seekable = strncmp(accept_ranges,"bytes",5)==0;
-		    else if (strcmp(http_get_field(http_hdr, "Server"), "gvs 1.0") == 0)
+		    else if (server && strcmp(server, "gvs 1.0") == 0)
 			seekable = 1; // HACK for youtube incorrectly claiming not to support seeking
 		}