Author: remy.maucherat(a)jboss.com
Date: 2010-06-29 06:33:01 -0400 (Tue, 29 Jun 2010)
New Revision: 1498
Modified:
trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
trunk/java/org/apache/coyote/ajp/AjpProcessor.java
trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java
Log:
- Filter out invalid headers (after some hesitation ...).
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2010-06-29 10:31:15 UTC (rev
1497)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2010-06-29 10:33:01 UTC (rev
1498)
@@ -1044,17 +1044,19 @@
// Other headers
int numHeaders = headers.size();
responseHeaderMessage.appendInt(numHeaders);
- for (int i = 0; i < numHeaders; i++) {
+ for (int i = 0; i < numHeaders; i++) {
MessageBytes hN = headers.getName(i);
- int hC = Constants.getResponseAjpIndex(hN.toString());
- if (hC > 0) {
- responseHeaderMessage.appendInt(hC);
+ MessageBytes hV=headers.getValue(i);
+ if (hN.getLength() > 0 && !hV.isNull()) {
+ int hC = Constants.getResponseAjpIndex(hN.toString());
+ if (hC > 0) {
+ responseHeaderMessage.appendInt(hC);
+ }
+ else {
+ responseHeaderMessage.appendBytes(hN);
+ }
+ responseHeaderMessage.appendBytes(hV);
}
- else {
- responseHeaderMessage.appendBytes(hN);
- }
- MessageBytes hV=headers.getValue(i);
- responseHeaderMessage.appendBytes(hV);
}
// Write to buffer
Modified: trunk/java/org/apache/coyote/ajp/AjpProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2010-06-29 10:31:15 UTC (rev 1497)
+++ trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2010-06-29 10:33:01 UTC (rev 1498)
@@ -1060,15 +1060,17 @@
responseHeaderMessage.appendInt(numHeaders);
for (int i = 0; i < numHeaders; i++) {
MessageBytes hN = headers.getName(i);
- int hC = Constants.getResponseAjpIndex(hN.toString());
- if (hC > 0) {
- responseHeaderMessage.appendInt(hC);
+ MessageBytes hV=headers.getValue(i);
+ if (hN.getLength() > 0 && !hV.isNull()) {
+ int hC = Constants.getResponseAjpIndex(hN.toString());
+ if (hC > 0) {
+ responseHeaderMessage.appendInt(hC);
+ }
+ else {
+ responseHeaderMessage.appendBytes(hN);
+ }
+ responseHeaderMessage.appendBytes(hV);
}
- else {
- responseHeaderMessage.appendBytes(hN);
- }
- MessageBytes hV=headers.getValue(i);
- responseHeaderMessage.appendBytes(hV);
}
// Write to buffer
Modified: trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2010-06-29 10:31:15
UTC (rev 1497)
+++ trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2010-06-29 10:33:01
UTC (rev 1498)
@@ -455,12 +455,14 @@
*/
public void sendHeader(MessageBytes name, MessageBytes value) {
- write(name);
- buf[pos++] = Constants.COLON;
- buf[pos++] = Constants.SP;
- write(value);
- buf[pos++] = Constants.CR;
- buf[pos++] = Constants.LF;
+ if (name.getLength() > 0 && !value.isNull()) {
+ write(name);
+ buf[pos++] = Constants.COLON;
+ buf[pos++] = Constants.SP;
+ write(value);
+ buf[pos++] = Constants.CR;
+ buf[pos++] = Constants.LF;
+ }
}
Modified: trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java 2010-06-29 10:31:15 UTC
(rev 1497)
+++ trunk/java/org/apache/coyote/http11/InternalOutputBuffer.java 2010-06-29 10:33:01 UTC
(rev 1498)
@@ -472,12 +472,14 @@
*/
public void sendHeader(MessageBytes name, MessageBytes value) {
- write(name);
- buf[pos++] = Constants.COLON;
- buf[pos++] = Constants.SP;
- write(value);
- buf[pos++] = Constants.CR;
- buf[pos++] = Constants.LF;
+ if (name.getLength() > 0 && !value.isNull()) {
+ write(name);
+ buf[pos++] = Constants.COLON;
+ buf[pos++] = Constants.SP;
+ write(value);
+ buf[pos++] = Constants.CR;
+ buf[pos++] = Constants.LF;
+ }
}
Show replies by date