The Trunk: WebClient-Core-topa.107.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: WebClient-Core-topa.107.mcz

commits-2
Tobias Pape uploaded a new version of WebClient-Core to project The Trunk:
http://source.squeak.org/trunk/WebClient-Core-topa.107.mcz

==================== Summary ====================

Name: WebClient-Core-topa.107
Author: topa
Time: 3 July 2017, 5:28:49.566897 pm
UUID: c6babbda-f5e2-4d26-a5f1-c73651519b4a
Ancestors: WebClient-Core-topa.106

Make sure WebMessage>>getContent respects charset.

=============== Diff against WebClient-Core-topa.106 ===============

Item was changed:
  ----- Method: WebMessage>>getContentWithProgress: (in category 'private') -----
  getContentWithProgress: progressBlockOrNil
  "Reads available content and returns it."
 
  | length result |
  length := self contentLength.
  result := (stream isBinary ifTrue:[ ByteArray ] ifFalse: [ ByteString ])
  new: (length ifNil: [ 1000 ])
  streamContents: [ :outputStream |
  self
  streamFrom: stream
  to: outputStream
  size: length
  progress: progressBlockOrNil ].
+ self textConverterForContentType ifNotNil: [:converter |
+ result := result convertFromWithConverter: converter].
  (self headerAt: 'content-encoding') = 'gzip' ifFalse: [ ^result ].
  ^(GZipReadStream on: result) upToEnd
  !

Item was added:
+ ----- Method: WebMessage>>textConverterForContentType (in category 'accessing') -----
+ textConverterForContentType
+
+ | index contentType |
+ contentType := self contentType.
+ contentType size < 8 ifTrue: [ ^nil ].
+ index := contentType findString: 'charset=' startingAt: 1 caseSensitive: false.
+ index = 0 ifTrue: [ ^nil ].
+ ^TextConverter newForEncoding: (contentType allButFirst: index + 7) "'charset=' size - 1"!

Item was removed:
- ----- Method: WebRequest>>textConverterForContentType (in category 'accessing') -----
- textConverterForContentType
-
- | index contentType |
- contentType := self contentType.
- contentType size < 8 ifTrue: [ ^nil ].
- index := contentType findString: 'charset=' startingAt: 1 caseSensitive: false.
- index = 0 ifTrue: [ ^nil ].
- ^TextConverter newForEncoding: (contentType allButFirst: index + 7) "'charset=' size - 1"!