summaryrefslogtreecommitdiffstats
path: root/library/http
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-09-10 21:31:08 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-09-10 21:31:08 (GMT)
commit483194e14ecdd9a263634d06565c34e6455f31c5 (patch)
tree6d6049275a28940e827a95adab235c1f12b3e7a9 /library/http
parente5f0af55b3990348d218e12f0da8d9b0ec9c69a2 (diff)
downloadtcl-483194e14ecdd9a263634d06565c34e6455f31c5.zip
tcl-483194e14ecdd9a263634d06565c34e6455f31c5.tar.gz
tcl-483194e14ecdd9a263634d06565c34e6455f31c5.tar.bz2
Correct handling of quoted charset names. [Bug 2849860]
Diffstat (limited to 'library/http')
-rw-r--r--library/http/http.tcl12
1 files changed, 9 insertions, 3 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 5dbce3c..105f449 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -8,7 +8,7 @@
# 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.6 2009/04/09 17:05:39 dgp Exp $
+# RCS: @(#) $Id: http.tcl,v 1.67.2.7 2009/09/10 21:31:08 dkf Exp $
package require Tcl 8.4
# Keep this in sync with pkgIndex.tcl and with the install directories in
@@ -1033,8 +1033,14 @@ proc http::Event {sock token} {
content-type {
set state(type) [string trim [string tolower $value]]
# grab the optional charset information
- regexp -nocase {charset\s*=\s*(\S+?);?} \
- $state(type) -> state(charset)
+ if {[regexp -nocase \
+ {charset\s*=\s*\"((?:[^""]|\\\")*)\"} \
+ $state(type) -> cs]} {
+ set state(charset) [string map {{\"} \"} $cs]
+ } else {
+ regexp -nocase {charset\s*=\s*(\S+?);?} \
+ $state(type) -> state(charset)
+ }
}
content-length {
set state(totalsize) [string trim $value]