-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit b0e8b57
fix the test for HTTP protocol upgrade
If the HTTP client wants to request protocol upgrade, it must
send the `Upgrade` header. It should also set the `Connection`
header. This test didn't do that, so conforming implementations
could reject the `request.upgrade()` call. The fix is simple:
add the 2 headers on the client side (i.e., in the test).
To be able to set `Connection` and `Upgrade` headers on the
`java.net.HttpURLConnection`, restricted headers must be allowed
by setting a special system property.
See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism
and the Servlet specification 4.0, section 2.3.3.5.1 parent 278bf76 commit b0e8b57
File tree
3 files changed
+31
-8
lines changed- servlet/protocol-handler
- src
- main/java/org/javaee7/servlet/protocolhandler
- test/java/org/javaee7/servlet/protocolhandler
3 files changed
+31
-8
lines changedLines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
15 | 30 |
|
Lines changed: 12 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
42 | + | ||
42 | 43 |
| |
43 | 44 |
| |
44 | 45 |
| |
| |||
66 | 67 |
| |
67 | 68 |
| |
68 | 69 |
| |
69 | - | ||
70 | - | ||
71 | - | ||
72 | - | ||
73 | - | ||
74 | - | ||
70 | + | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | ||
80 | + | ||
75 | 81 |
| |
76 | 82 |
|
servlet/protocol-handler/src/test/java/org/javaee7/servlet/protocolhandler/ProtocolHandlerTest.java
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | - | ||
3 | + | ||
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
47 | + | ||
48 | + | ||
47 | 49 |
| |
48 | 50 |
| |
49 | 51 |
| |
| |||
71 | 73 |
| |
72 | 74 |
| |
73 | 75 |
| |
74 | - | ||
76 | + | ||
75 | 77 |
| |
76 | 78 |
| |
77 | 79 |
|
0 commit comments