@@ -65,7 +65,7 @@ public void handleRequest(WebSession s)
65
65
// Setting a special action to be able to submit to redirect.jsp
66
66
Form form = new Form (s .getRequest ().getContextPath () + "/lessons/General/redirect.jsp?" + "Screen=" + String .valueOf (getScreenId ())
67
67
+ "&menu=" + getDefaultCategory ().getRanking ().toString (), Form .POST ).setName ("form" ).setEncType ("" );
68
-
68
+
69
69
form .addElement (createContent (s ));
70
70
71
71
setContent (form );
@@ -86,25 +86,15 @@ protected Element doHTTPSplitting(WebSession s)
86
86
87
87
if (lang .length () != 0 && fromRedirect .length () != 0 )
88
88
{
89
- // Split by the line separator line.separator is platform independant
90
- String lineSep = System .getProperty ("line.separator" );
91
- String [] arrTokens = lang .toString ().toUpperCase ().split (lineSep );
92
-
93
- // Check if the user ended the first request and wrote the second malacious reply
89
+
90
+
91
+ String [] arrTokens = lang .toString ().toUpperCase ().split ("\r \n " );
94
92
95
- if ( Arrays . binarySearch ( arrTokens , "CONTENT-LENGTH: 0" ) >= 0
96
- && Arrays . binarySearch (arrTokens , "HTTP/1.1 200 OK" ) >= 0 )
93
+ // Check if the user ended the first request and wrote the second malicious reply
94
+ if (arrTokens . length > 1 )
97
95
{
98
96
HttpServletResponse res = s .getResponse ();
99
97
res .setContentType ("text/html" );
100
- PrintWriter out = new PrintWriter (res .getOutputStream ());
101
- String message = lang .substring (lang .indexOf ("<html>" ));
102
-
103
- out .print (message );
104
- out .flush ();
105
- out .close ();
106
-
107
- getLessonTracker (s ).setStage (2 );
108
98
109
99
StringBuffer msg = new StringBuffer ();
110
100
@@ -115,6 +105,10 @@ protected Element doHTTPSplitting(WebSession s)
115
105
msg .append ("the reply and replace it with a 304 reply." );
116
106
117
107
s .setMessage (msg .toString ());
108
+ getLessonTracker (s ).setStage (2 );
109
+
110
+
111
+ //makeSuccess(s);
118
112
119
113
}
120
114
}
@@ -189,11 +183,11 @@ protected Element doCachePoisining(WebSession s) throws Exception
189
183
String fromRedirect = s .getParser ().getStringParameter (REDIRECT , "" );
190
184
191
185
if (lang .length () != 0 && fromRedirect .length () != 0 )
192
- {
193
- String lineSep = System . getProperty ( "line.separator" ) ;
186
+ {
187
+ String lineSep = " \r \n " ;
194
188
String dateStr = lang .substring (lang .indexOf ("Last-Modified:" ) + "Last-Modified:" .length (), lang
195
189
.indexOf (lineSep , lang .indexOf ("Last-Modified:" )));
196
- if (dateStr .length () != 0 )
190
+ if (dateStr .length () > 0 )
197
191
{
198
192
Calendar cal = Calendar .getInstance ();
199
193
0 commit comments