Skip to content

Commit e8d6c13

Browse files
authored
Merge pull request #246 from sxci/7.3.3
7.3.3
2 parents 67b5729 + 0a2abbb commit e8d6c13

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#Changelog
22

3+
## 7.3.3 (2017-01-18)
4+
5+
### 增加
6+
* 搜集客户端日志信息
7+
8+
### 修正
9+
* Etag 大文件计算数字溢出
10+
* UA 包含非 iso 8859-1 字符异常退出
11+
312
## 7.3.2 (2016-11-21)
413

514
### 增加

library/src/androidTest/java/com/qiniu/android/HttpTest.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.net.URI;
1919
import java.net.URISyntaxException;
20+
import java.nio.charset.Charset;
2021
import java.util.concurrent.CountDownLatch;
2122
import java.util.concurrent.TimeUnit;
2223

@@ -225,4 +226,35 @@ public void complete(ResponseInfo rinfo, JSONObject response) {
225226
Assert.assertTrue(!"".equals(info.reqId));
226227
Assert.assertEquals(400, info.statusCode);
227228
}
229+
230+
@SmallTest
231+
public void testHeader() {
232+
// com.qiniu.android.http.UserAgent#getUa
233+
// return new String((ua + "; " + _part + ")").getBytes(Charset.forName("ISO-8859-1")));
234+
235+
String name = new String(("电话☎️的の").getBytes(Charset.forName("ISO-8859-1")));
236+
String value = new String(("sdf✈️he覆盖😁🆚9837-=/ df").getBytes(Charset.forName("ISO-8859-1")));
237+
checkNameAndValue(name, value);
238+
}
239+
240+
// copy from okhttp3.Headers
241+
private void checkNameAndValue(String name, String value) {
242+
if (name == null) throw new IllegalArgumentException("name == null");
243+
if (name.isEmpty()) throw new IllegalArgumentException("name is empty");
244+
for (int i = 0, length = name.length(); i < length; i++) {
245+
char c = name.charAt(i);
246+
if (c <= '\u001f' || c >= '\u007f') {
247+
throw new IllegalArgumentException(String.format(
248+
"Unexpected char %#04x at %d in header name: %s", (int) c, i, name));
249+
}
250+
}
251+
if (value == null) throw new IllegalArgumentException("value == null");
252+
for (int i = 0, length = value.length(); i < length; i++) {
253+
char c = value.charAt(i);
254+
if (c <= '\u001f' || c >= '\u007f') {
255+
throw new IllegalArgumentException(String.format(
256+
"Unexpected char %#04x at %d in %s value: %s", (int) c, i, name, value));
257+
}
258+
}
259+
}
228260
}

library/src/main/java/com/qiniu/android/common/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
public final class Constants {
5-
public static final String VERSION = "7.3.2";
5+
public static final String VERSION = "7.3.3";
66

77
public static final String UTF_8 = "utf-8";
88
}

0 commit comments

Comments
 (0)