File tree Expand file tree Collapse file tree 4 files changed +27
-0
lines changed
src/io/github/explodingbottle/jmagicproxy/proxy Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ private Integer handleLineRead(int readLength) throws IOException {
8686 lastReadBlock = new StringBuilder ();
8787 if (lastReadLine == null )
8888 lastReadLine = new StringBuilder ();
89+ boolean gotItOnce = false ;
8990 for (int it = 0 ; it < readLength ; it ++) {
9091 byte r = transferBuffer [it ];
9192 lastReadBlock .append ((char ) r );
@@ -94,6 +95,7 @@ private Integer handleLineRead(int readLength) throws IOException {
9495 String readLine = lastReadLine .toString ();
9596 try {
9697 HttpResponse .createFromHeaderBlock (lastReadBlock );
98+ gotItOnce = true ;
9799 } catch (MalformedParsableContent e1 ) {
98100 lastReadBlock = new StringBuilder ();
99101 lastReadLine = new StringBuilder ();
@@ -136,6 +138,11 @@ private Integer handleLineRead(int readLength) throws IOException {
136138 lastReadLine = new StringBuilder ();
137139 }
138140 }
141+
142+ if (!gotItOnce ) {
143+ lastReadBlock = new StringBuilder ();
144+ lastReadLine = new StringBuilder ();
145+ }
139146 return toRet ;
140147 }
141148
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ private Integer handleLineRead(int readLength) {
127127 lastReadBlock = new StringBuilder ();
128128 if (lastReadLine == null )
129129 lastReadLine = new StringBuilder ();
130+ boolean gotItOnce = false ;
130131 for (int it = 0 ; it < readLength ; it ++) {
131132 byte r = buffer [it ];
132133 lastReadBlock .append ((char ) r );
@@ -135,6 +136,7 @@ private Integer handleLineRead(int readLength) {
135136 String readLine = lastReadLine .toString ();
136137 try {
137138 HttpRequestHeader .createFromHeaderBlock (lastReadBlock );
139+ gotItOnce = true ;
138140 } catch (MalformedParsableContent e1 ) {
139141 lastReadBlock = new StringBuilder ();
140142 lastReadLine = new StringBuilder ();
@@ -180,6 +182,11 @@ private Integer handleLineRead(int readLength) {
180182 lastReadLine = new StringBuilder ();
181183 }
182184 }
185+
186+ if (!gotItOnce ) {
187+ lastReadBlock = new StringBuilder ();
188+ lastReadLine = new StringBuilder ();
189+ }
183190 return toRet ;
184191 }
185192
Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ private Integer handleLineRead(int readLength) {
147147 lastReadBlock = new StringBuilder ();
148148 if (lastReadLine == null )
149149 lastReadLine = new StringBuilder ();
150+ boolean gotItOnce = false ;
150151 for (int it = 0 ; it < readLength ; it ++) {
151152 byte r = buffer [it ];
152153 lastReadBlock .append ((char ) r );
@@ -155,6 +156,7 @@ private Integer handleLineRead(int readLength) {
155156 String readLine = lastReadLine .toString ();
156157 try {
157158 HttpRequestHeader .createFromHeaderBlock (lastReadBlock );
159+ gotItOnce = true ;
158160 } catch (MalformedParsableContent e1 ) {
159161 lastReadBlock = new StringBuilder ();
160162 lastReadLine = new StringBuilder ();
@@ -185,6 +187,10 @@ private Integer handleLineRead(int readLength) {
185187 lastReadLine = new StringBuilder ();
186188 }
187189 }
190+ if (!gotItOnce ) {
191+ lastReadBlock = new StringBuilder ();
192+ lastReadLine = new StringBuilder ();
193+ }
188194 return toRet ;
189195 }
190196
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ private Integer handleLineRead(int readLength) throws IOException {
8484 lastReadBlock = new StringBuilder ();
8585 if (lastReadLine == null )
8686 lastReadLine = new StringBuilder ();
87+ boolean gotItOnce = false ;
8788 for (int it = 0 ; it < readLength ; it ++) {
8889 byte r = transferBuffer [it ];
8990 lastReadBlock .append ((char ) r );
@@ -92,6 +93,7 @@ private Integer handleLineRead(int readLength) throws IOException {
9293 String readLine = lastReadLine .toString ();
9394 try {
9495 HttpResponse .createFromHeaderBlock (lastReadBlock );
96+ gotItOnce = true ;
9597 } catch (MalformedParsableContent e1 ) {
9698 lastReadBlock = new StringBuilder ();
9799 lastReadLine = new StringBuilder ();
@@ -129,6 +131,11 @@ private Integer handleLineRead(int readLength) throws IOException {
129131 lastReadLine = new StringBuilder ();
130132 }
131133 }
134+
135+ if (!gotItOnce ) {
136+ lastReadBlock = new StringBuilder ();
137+ lastReadLine = new StringBuilder ();
138+ }
132139 return toRet ;
133140 }
134141
You can’t perform that action at this time.
0 commit comments