Skip to content

Commit

Permalink
解决reqeust报文\n和\r\n混合情况下,替换\n为\r\n不完全问题
Browse files Browse the repository at this point in the history
  • Loading branch information
c0ny1 committed Dec 19, 2019
1 parent 165e63d commit 955afaf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/utils/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ public String processLine(String reqraw){

if(method.equals("GET")) {
header = reqraw;
if(header.indexOf("\n")>=0 && header.indexOf("\r\n") <0){
header.replace("\n","\r\n");
}

//将所有\n替换为\r\n,注意\r\n和\n混合情况下的替换。
header.replace("\r\n","\n");
header.replace("\n","\r\n");

request = header;
}

Expand Down

0 comments on commit 955afaf

Please sign in to comment.