Skip to content

Commit

Permalink
Merge 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Mar 18, 2023
2 parents 74c6eeb + 02c1e9c commit 836b156
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions library/http/http.tcl
Expand Up @@ -1746,6 +1746,9 @@ proc http::OpenSocket {token DoLater} {
}
fconfigure $sock -translation {auto crlf} \
-buffersize $state(-blocksize)
if {[package vsatisfies [package provide Tcl] 9.0-]} {
fconfigure $sock -profile tcl8 \
}
##Log socket opened, DONE fconfigure - token $token
}

Expand Down Expand Up @@ -2164,6 +2167,9 @@ proc http::Connected {token proto phost srvurl} {
lassign [fconfigure $sock -translation] trRead trWrite
fconfigure $sock -translation [list $trRead crlf] \
-buffersize $state(-blocksize)
if {[package vsatisfies [package provide Tcl] 9.0-]} {
fconfigure $sock -profile tcl8 \
}

# The following is disallowed in safe interpreters, but the socket is
# already in non-blocking mode in that case.
Expand Down Expand Up @@ -2554,6 +2560,9 @@ proc http::ReceiveResponse {token} {
lassign [fconfigure $sock -translation] trRead trWrite
fconfigure $sock -translation [list auto $trWrite] \
-buffersize $state(-blocksize)
if {[package vsatisfies [package provide Tcl] 9.0-]} {
fconfigure $sock -profile tcl8 \
}
Log ^D$tk begin receiving response - token $token

coroutine ${token}--EventCoroutine http::Event $sock $token
Expand Down Expand Up @@ -4545,7 +4554,11 @@ proc http::Eot {token {reason {}}} {

set enc [CharsetToEncoding $state(charset)]
if {$enc ne "binary"} {
set state(body) [encoding convertfrom $enc $state(body)]
if {[package vsatisfies [package provide Tcl] 9.0-]} {
set state(body) [encoding convertfrom -profile tcl8 $enc $state(body)]
} else {
set state(body) [encoding convertfrom $enc $state(body)]
}
}

# Translate text line endings.
Expand Down Expand Up @@ -4628,7 +4641,11 @@ proc http::GuessType {token} {
if {$enc eq "binary"} {
return 0
}
set state(body) [encoding convertfrom $enc $state(body)]
if {[package vsatisfies [package provide Tcl] 9.0-]} {
set state(body) [encoding convertfrom -profile tcl8 $enc $state(body)]
} else {
set state(body) [encoding convertfrom $enc $state(body)]
}
set state(body) [string map {\r\n \n \r \n} $state(body)]
set state(type) application/xml
set state(binary) 0
Expand Down Expand Up @@ -4709,7 +4726,11 @@ proc http::quoteString {string} {
# a pre-computed map and [string map] to do the conversion (much faster
# than [regsub]/[subst]). [Bug 1020491]

set string [encoding convertto $http(-urlencoding) $string]
if {[package vsatisfies [package provide Tcl] 9.0-]} {
set string [encoding convertto -profile tcl8 $http(-urlencoding) $string]
} else {
set string [encoding convertto $http(-urlencoding) $string]
}
return [string map $formMap $string]
}

Expand Down

0 comments on commit 836b156

Please sign in to comment.