File tree 8 files changed +99
-3
lines changed
main/java/org/owasp/esapi/waf/internal
test/java/org/owasp/esapi/http
8 files changed +99
-3
lines changed Original file line number Diff line number Diff line change 149
149
<dependency >
150
150
<groupId >javax.servlet</groupId >
151
151
<artifactId >javax.servlet-api</artifactId >
152
- <!-- Note: v3.1.0+ causes compilation errors. So would have to fix to upgrade. -->
153
- <version >3.0.1</version >
152
+ <version >3.1.0</version >
154
153
<scope >provided</scope >
155
154
</dependency >
156
155
<dependency >
157
156
<groupId >javax.servlet.jsp</groupId >
158
157
<artifactId >javax.servlet.jsp-api</artifactId >
159
158
<version >2.3.3</version >
160
159
<scope >provided</scope >
160
+ <exclusions >
161
+ <exclusion >
162
+ <groupId >javax.servlet</groupId >
163
+ <artifactId >javax.servlet-api</artifactId >
164
+ </exclusion >
165
+ </exclusions >
161
166
</dependency >
162
167
<dependency >
163
168
<groupId >com.io7m.xom</groupId >
Original file line number Diff line number Diff line change 24
24
import java .util .Enumeration ;
25
25
import java .util .Vector ;
26
26
27
+ import javax .servlet .ReadListener ;
27
28
import javax .servlet .ServletInputStream ;
28
29
import javax .servlet .http .HttpServletRequest ;
29
30
import javax .servlet .http .HttpServletRequestWrapper ;
@@ -171,18 +172,37 @@ public Enumeration getDictionaryParameterNames() {
171
172
private class RAFInputStream extends ServletInputStream {
172
173
173
174
RandomAccessFile raf ;
175
+ boolean isDone = false ;
174
176
175
177
public RAFInputStream (RandomAccessFile raf ) throws IOException {
176
178
this .raf = raf ;
177
179
this .raf .seek (0 );
178
180
}
179
181
180
182
public int read () throws IOException {
181
- return raf .read ();
183
+ int rval = raf .read ();
184
+ isDone = rval == -1 ;
185
+ return rval ;
182
186
}
183
187
184
188
public synchronized void reset () throws IOException {
185
189
raf .seek (0 );
190
+ isDone =false ;
191
+ }
192
+
193
+ @ Override
194
+ public boolean isFinished () {
195
+ return isDone ;
196
+ }
197
+
198
+ @ Override
199
+ public boolean isReady () {
200
+ return false ;
201
+ }
202
+
203
+ @ Override
204
+ public void setReadListener (ReadListener readListener ) {
205
+ //NO-OP. Unused in this scope
186
206
}
187
207
}
188
208
Original file line number Diff line number Diff line change 21
21
import java .io .RandomAccessFile ;
22
22
23
23
import javax .servlet .ServletOutputStream ;
24
+ import javax .servlet .WriteListener ;
24
25
25
26
/**
26
27
* This class was inspired by ModSecurity for Java by Ivan Ristic. We hook
@@ -161,4 +162,14 @@ public void close() throws IOException {
161
162
162
163
}
163
164
165
+ @ Override
166
+ public boolean isReady () {
167
+ return os .isReady ();
168
+ }
169
+
170
+ @ Override
171
+ public void setWriteListener (WriteListener writeListener ) {
172
+ os .setWriteListener (writeListener );
173
+ }
174
+
164
175
}
Original file line number Diff line number Diff line change 46
46
import javax .servlet .http .HttpServletRequest ;
47
47
import javax .servlet .http .HttpServletResponse ;
48
48
import javax .servlet .http .HttpSession ;
49
+ import javax .servlet .http .HttpUpgradeHandler ;
49
50
import javax .servlet .http .Part ;
50
51
51
52
/**
@@ -737,4 +738,19 @@ public DispatcherType getDispatcherType() {
737
738
throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
738
739
}
739
740
741
+ @ Override
742
+ public long getContentLengthLong () {
743
+ throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
744
+ }
745
+
746
+ @ Override
747
+ public String changeSessionId () {
748
+ throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
749
+ }
750
+
751
+ @ Override
752
+ public <T extends HttpUpgradeHandler > T upgrade (Class <T > handlerClass ) throws IOException , ServletException {
753
+ throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
754
+ }
755
+
740
756
}
Original file line number Diff line number Diff line change 24
24
import java .util .Locale ;
25
25
26
26
import javax .servlet .ServletOutputStream ;
27
+ import javax .servlet .WriteListener ;
27
28
import javax .servlet .http .Cookie ;
28
29
import javax .servlet .http .HttpServletResponse ;
29
30
@@ -279,6 +280,16 @@ public ServletOutputStream getOutputStream() throws IOException {
279
280
public void write (int b ) throws IOException {
280
281
body .append ((char )b );
281
282
}
283
+
284
+ @ Override
285
+ public boolean isReady () {
286
+ return false ;
287
+ }
288
+
289
+ @ Override
290
+ public void setWriteListener (WriteListener writeListener ) {
291
+ //NO-OP
292
+ }
282
293
};
283
294
}
284
295
@@ -369,5 +380,10 @@ public void dump() {
369
380
public Collection <String > getHeaders (String string ) {
370
381
throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
371
382
}
383
+
384
+ @ Override
385
+ public void setContentLengthLong (long len ) {
386
+ throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
387
+ }
372
388
373
389
}
Original file line number Diff line number Diff line change @@ -693,4 +693,9 @@ public ClassLoader getClassLoader() {
693
693
public void declareRoles (String ... strings ) {
694
694
throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
695
695
}
696
+
697
+ @ Override
698
+ public String getVirtualServerName () {
699
+ throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
700
+ }
696
701
}
Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .owasp .esapi .http ;
17
17
18
+ import javax .servlet .ReadListener ;
18
19
import javax .servlet .ServletInputStream ;
19
20
import java .io .IOException ;
20
21
@@ -28,6 +29,7 @@ public class MockServletInputStream extends ServletInputStream {
28
29
29
30
private int next ;
30
31
32
+ private boolean isDone = false ;
31
33
/**
32
34
* constructor
33
35
* @param body
@@ -45,7 +47,23 @@ public int read() throws IOException {
45
47
if (next < body .length ) {
46
48
return body [next ++];
47
49
} else {
50
+ isDone = true ;
48
51
return -1 ;
49
52
}
50
53
}
54
+
55
+ @ Override
56
+ public boolean isFinished () {
57
+ return isDone ;
58
+ }
59
+
60
+ @ Override
61
+ public boolean isReady () {
62
+ return false ;
63
+ }
64
+
65
+ @ Override
66
+ public void setReadListener (ReadListener readListener ) {
67
+ //NO_OP
68
+ }
51
69
}
Original file line number Diff line number Diff line change 33
33
<ignoreVersion type =" regex" >^0{0,1}[4-9].*</ignoreVersion >
34
34
</ignoreVersions >
35
35
</rule >
36
+ <rule groupId =" javax.servlet" artifactId =" javax.servlet-api" comparisonMethod =" maven" >
37
+ <ignoreVersions >
38
+ <ignoreVersion type =" regex" >^0{0,1}[4-9].*</ignoreVersion >
39
+ </ignoreVersions >
40
+ </rule >
36
41
</rules >
37
42
</ruleset >
38
43
<!--
You can’t perform that action at this time.
0 commit comments