tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java
Date Thu, 08 May 2003 16:42:35 GMT
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


Mime
View raw message