Last active
December 19, 2021 17:37
-
-
Save svkrclg/36183b2dcbd1f60b599b726ead739f37 to your computer and use it in GitHub Desktop.
Revisions
-
svkrclg revised this gist
Dec 19, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public String[] processData(String request) { } } String body = request.split("\r\n\r\n")[1]; // head and body are seperated through \r\n\r\n. Ref packet format. System.out.println("Got body" + body); if(body.length() == cl) { return new String[] {"true", body}; -
svkrclg created this gist
Dec 19, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ public String[] processData(String request) { String lines[] = request.split("\r\n"); int cl = -1; for(String line : lines) { System.out.println(line); if(line.contains("Content-Length")) { String x = line.substring(16); cl = Integer.parseInt(x); break; } } String body = request.split("\r\n\r\n")[1]; System.out.println("Got body" + body); if(body.length() == cl) { return new String[] {"true", body}; } return new String[] {"false", ""}; }