summaryrefslogtreecommitdiffstats
path: root/library/http/http.tcl
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2008-10-23 23:34:32 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2008-10-23 23:34:32 (GMT)
commit8def31ff208a95aca8062c71d4dd6a020b417dbe (patch)
tree2153a000764332d440ba836abb476ace92eb9166 /library/http/http.tcl
parent6822a2263c4b65a93826d4a3c8bca50da930e38d (diff)
downloadtcl-8def31ff208a95aca8062c71d4dd6a020b417dbe.zip
tcl-8def31ff208a95aca8062c71d4dd6a020b417dbe.tar.gz
tcl-8def31ff208a95aca8062c71d4dd6a020b417dbe.tar.bz2
Backported a fix for reading HTTP-like protocols that used to work and
were broken with http 2.7. Now http 2.7.2
Diffstat (limited to 'library/http/http.tcl')
-rw-r--r--library/http/http.tcl17
1 files changed, 10 insertions, 7 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 32c5309..06829cd 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.67.2.4 2008/08/11 21:57:14 dgp Exp $
+# RCS: @(#) $Id: http.tcl,v 1.67.2.5 2008/10/23 23:34:32 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 {