From 4297d390d8b4680d8a22df9d88f0298301832cfc Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 11 Jan 2006 12:46:29 +0000 Subject: * src/ne_request.c (read_status_line): Handle ICY protocol responses for the time being. git-svn-id: http://svn.webdav.org/repos/projects/neon/branches/0.25.x@843 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845 --- src/ne_request.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ne_request.c b/src/ne_request.c index 1a3d130..fd8f09d 100644 --- a/src/ne_request.c +++ b/src/ne_request.c @@ -1,6 +1,6 @@ /* HTTP request/response handling - Copyright (C) 1999-2005, Joe Orton + Copyright (C) 1999-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -971,8 +971,20 @@ static int read_status_line(ne_request *req, ne_status *status, int retry) if (status->reason_phrase) ne_free(status->reason_phrase); memset(status, 0, sizeof *status); - if (ne_parse_statusline(buffer, status)) + if (strncmp(buffer, "ICY ", 4) == 0 && strlen(buffer) > 8 + && buffer[7] == ' ') { + /* Hack for ShoutCast support; will be conditional in future + * releases. */ + status->code = atoi(buffer + 4); + status->major_version = 1; + status->minor_version = 0; + status->reason_phrase = ne_strclean(ne_strdup(buffer + 8)); + status->klass = buffer[4] - '0'; + NE_DEBUG(NE_DBG_HTTP, "[status-line] ICY protocol; code %d\n", + status->code); + } else if (ne_parse_statusline(buffer, status)) { return aborted(req, _("Could not parse response status line."), 0); + } return 0; } -- cgit v1.2.1