From 5a6e90c59531d0de0bb1a203987bf1e8972b4ddc Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 10 Sep 2009 21:20:00 +0000 Subject: Correct handling of quoted charset names. [Bug 2849860] --- ChangeLog | 23 ++++++++++++++--------- library/http/http.tcl | 12 +++++++++--- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index ead2f52..4620b9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,28 +1,33 @@ +2009-09-10 Donal K. Fellows + + * library/http/http.tcl (http::Event): [Bug 2849860]: Handle charset + names in double quotes; some servers like generating them like that. + 2009-09-07 Don Porter - * generic/tclParse.c Corrected line counting error in multi-command - * tests/into.test: script substitutions. [Bug 2850901]. + * generic/tclParse.c: [Bug 2850901]: Corrected line counting error + * tests/into.test: in multi-command script substitutions. 2009-09-07 Daniel Steffen - * generic/tclExecute.c: fix potential uninitialized variable use and + * generic/tclExecute.c: Fix potential uninitialized variable use and * generic/tclFCmd.c: null dereference flagged by clang static * generic/tclProc.c: analyzer. * generic/tclTimer.c: * generic/tclUtf.c: - * generic/tclExecute.c: silence false positives from clang static + * generic/tclExecute.c: Silence false positives from clang static * generic/tclIO.c: analyzer about potential null dereference. * generic/tclScan.c: * generic/tclCompExpr.c: 2009-09-04 Don Porter - * generic/tclCompCmds.c (TclCompileSubstCmd): Added a bytecode - * generic/tclBasic.c: compiler routine for the [subst] command. - * generic/tclCmdMZ.c: This is a partial solution to the need to - * generic/tclCompile.c: NR-enable [subst] since bytecode execution is - * generic/tclCompile.h: already NR-enabled. [Bug 2314561] Two new + * generic/tclCompCmds.c (TclCompileSubstCmd): [Bug 2314561]: + * generic/tclBasic.c: Added a bytecode compiler routine for the + * generic/tclCmdMZ.c: [subst] command. This is a partial solution to + * generic/tclCompile.c: the need to NR-enable [subst] since bytecode + * generic/tclCompile.h: execution is already NR-enabled. Two new * generic/tclExecute.c: bytecode instructions, INST_NOP and * generic/tclInt.h: INST_RETURN_CODE_BRANCH were added to support * generic/tclParse.c: the new routine. INST_RETURN_CODE_BRANCH is diff --git a/library/http/http.tcl b/library/http/http.tcl index 654d8b0..18487fb 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.76 2009/04/19 18:27:59 patthoyts Exp $ +# RCS: @(#) $Id: http.tcl,v 1.77 2009/09/10 21:20:01 dkf Exp $ package require Tcl 8.6 # Keep this in sync with pkgIndex.tcl and with the install directories in @@ -1030,8 +1030,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] -- cgit v0.12