在我将Spring Boot从版本1.2.6.RELEASE
更新为版本1.3.0.RELEASE
后,我遇到了一个有趣的问题。
我目前无法正确下载任何资源。首先,我意识到我正在服务的GIF有问题:它们都有很好的内容长度,但内容肯定是不同的。我将原始的gif和一个用curl下载的内容重叠,然后将它们分开,这是一个例子:
original: 000002f0: 38 FE 20 F5 81 57 00 04 - 23 03 09 12 80 C0 9B 1D |8 W # | 00000300: 37 38 00 83 02 DD 81 20 - 01 09 B6 AC 20 C6 0C C7 |78 | curl'ed: 000002f0: 38 FE 20 F5 3F 57 00 04 - 23 03 09 12 80 C0 9B 1D |8 ?W # | 00000300: 37 38 00 3F 02 DD 3F 20 - 01 09 B6 AC 20 C6 0C C7 |78 ? ? |
正如我们所看到的,在这种情况下,有些字节(0x81
和0x83
,但它也会出现像0x98
,0x88
,0x90
这样的字节)被读作0x3F
,我们可以在上面将其视为字符?
。我以前没见过这样的东西。我在升级之前和之后检查了标题,只有与先前版本不同的是Accept-Ranges
标题。我上次尝试时添加了Content-Transfer-Encoding: binary
标题,无论是否存在都无关紧要。
"method": "GET",
"path": "/assets/clock.gif",
"headers": {
"request": {
"host": "localhost:8080",
"pragma": "no-cache",
"accept-encoding": "gzip, deflate, sdch",
"accept-language": "pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4",
"upgrade-insecure-requests": "1",
"user-agent": some agent,
"accept": "image/webp,image/*,*/*;q=0.8",
"cache-control": "no-cache",
"cookie": some cookies,
"connection": "keep-alive",
"content-transfer-encoding": "binary"
},
"response": {
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Cache-Control": "max-age=86400",
"Pragma": "",
"Expires": "0",
"X-Frame-Options": "DENY",
"Access-Control-Allow-Origin": "http://localhost:3000",
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Methods": "PUT,POST,GET,DELETE",
"Access-Control-Max-Age": "3600",
"Access-Control-Allow-Headers": "Content-Type",
"X-Application-Context": "IMHS",
"Last-Modified": "Fri, 04 Dec 2015 14:37:36 GMT",
"Accept-Ranges": "none",
"Content-Type": "image/gif;charset=UTF-8",
"Content-Length": "20811",
"Date": "Fri, 04 Dec 2015 15:38:56 GMT",
"status": "200"
}
}
我正在使用Spring Boot 1.3.0.RELEASE
与Tomcat 8.0.28
(我检查8.0.21
,Boot 1.2.6.RELEASE
就像一个魅力,效果相同)。