summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@noemail.net>2008-10-23 23:17:37 (GMT)
committerpatthoyts <patthoyts@noemail.net>2008-10-23 23:17:37 (GMT)
commitef3d83addbfa27dc2e21a93b42d8cc368998d26a (patch)
tree1b0f765447e5e0034bf99da8e44a56664c0aa9da /library
parent0e7179ffd33f6c8fc2cb9dc6f1b53e5b9e288cbb (diff)
downloadtcl-ef3d83addbfa27dc2e21a93b42d8cc368998d26a.zip
tcl-ef3d83addbfa27dc2e21a93b42d8cc368998d26a.tar.gz
tcl-ef3d83addbfa27dc2e21a93b42d8cc368998d26a.tar.bz2
Fixed a failure to read SHOUTcast streams with the new 2.7
package. Introduced a new intial state as the first response may not be HTTP*. FossilOrigin-Name: 943b6dd8ce78a71414f906e8486998d242c1564b
Diffstat (limited to 'library')
-rw-r--r--library/http/http.tcl17
-rw-r--r--library/http/pkgIndex.tcl2
2 files changed, 11 insertions, 8 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 046329b..fab054f 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -8,12 +8,12 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: http.tcl,v 1.71 2008/08/11 21:58:07 dgp Exp $
+# RCS: @(#) $Id: http.tcl,v 1.72 2008/10/23 23:17:38 patthoyts Exp $
package require Tcl 8.4
# Keep this in sync with pkgIndex.tcl and with the install directories
# in Makefiles
-package provide http 2.7.1
+package provide http 2.7.2
namespace eval http {
# Allow resourcing to not clobber existing data
@@ -319,7 +319,7 @@ proc http::geturl { url args } {
-queryprogress {}
-protocol 1.1
binary 0
- state header
+ state connecting
meta {}
coding {}
currentsize 0
@@ -942,7 +942,12 @@ proc http::Event {sock token} {
CloseSocket $sock
return
}
- if {$state(state) eq "header"} {
+ if {$state(state) eq "connecting"} {
+ set state(state) "header"
+ if {[catch {gets $sock state(http)} n]} {
+ return [Finish $token $n]
+ }
+ } elseif {$state(state) eq "header"} {
if {[catch {gets $sock line} n]} {
return [Finish $token $n]
} elseif {$n == 0} {
@@ -985,7 +990,7 @@ proc http::Event {sock token} {
fconfigure $state(-channel) -translation binary
}
}
- if {[info exists state(-channel)] &&
+ if {[info exists state(-channel)] &&
![info exists state(-handler)]} {
# Initiate a sequence of background fcopies
fileevent $sock readable {}
@@ -1019,8 +1024,6 @@ proc http::Event {sock token} {
}
}
lappend state(meta) $key [string trim $value]
- } elseif {[string match HTTP* $line]} {
- set state(http) $line
}
}
} else {
diff --git a/library/http/pkgIndex.tcl b/library/http/pkgIndex.tcl
index 932017a..6badcea 100644
--- a/library/http/pkgIndex.tcl
+++ b/library/http/pkgIndex.tcl
@@ -1,4 +1,4 @@
# Tcl package index file, version 1.1
if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded http 2.7.1 [list tclPkgSetup $dir http 2.7.1 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]
+package ifneeded http 2.7.2 [list tclPkgSetup $dir http 2.7.2 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]