You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2003/05/08 18:42:35 UTC
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java
luehe 2003/05/08 09:42:35
Modified: coyote/src/java/org/apache/coyote Response.java
Log:
Fixed Bugtraq 4859833 ("ServletResponse.getCharacterEncoding() doesn't
return the value specified")
Revision Changes Path
1.22 +22 -20 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java
Index: Response.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Response.java 1 May 2003 12:15:50 -0000 1.21
+++ Response.java 8 May 2003 16:42:34 -0000 1.22
@@ -470,30 +470,32 @@
if (isCommitted())
return;
- if (contentType == null)
+ if (charset == null)
return;
+ characterEncoding = charset;
+
String type = this.contentType;
- int start = type.indexOf("charset=");
- if ( start != -1 ) {
- int end = type.indexOf(';', start+8);
- if (end >= 0)
- type = type.substring(0,start+8)
- +charset+type.substring(end-1);
- else
- type = type.substring(0,start+8)
- +charset;
- this.contentType = type;
- } else {
- int end = type.indexOf(';');
- if (end >= 0) {
- type = type.substring(0, end) + ";charset=" + charset;
- } else {
- type = type + ";charset=" + charset;
- }
+ if (type != null) {
+ int start = type.indexOf("charset=");
+ if ( start != -1 ) {
+ int end = type.indexOf(';', start+8);
+ if (end >= 0)
+ type = type.substring(0,start+8)
+ + charset + type.substring(end-1);
+ else
+ type = type.substring(0,start+8) + charset;
+ this.contentType = type;
+ } else {
+ int end = type.indexOf(';');
+ if (end >= 0) {
+ type = type.substring(0, end) + ";charset=" + charset;
+ } else {
+ type = type + ";charset=" + charset;
+ }
+ }
+ setContentType( type );
}
- setContentType( type );
-
}
public String getCharacterEncoding() {
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org