You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by na...@apache.org on 2007/01/24 21:56:59 UTC

svn commit: r499566 - /webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java

Author: nadiramra
Date: Wed Jan 24 12:56:58 2007
New Revision: 499566

URL: http://svn.apache.org/viewvc?view=rev&rev=499566
Log:
Fix problems in mock-server where it was not handling non-chunked
responses correctly.  A 0d in the http header was being converted to 
0d0d0a.  

Modified:
    webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java

Modified: webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java?view=diff&rev=499566&r1=499565&r2=499566
==============================================================================
--- webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java (original)
+++ webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java Wed Jan 24 12:56:58 2007
@@ -22,10 +22,10 @@
     private static final String CONTENT_LENGTH ="Content-Length:";
 
     private char[]              message;
-    private boolean             chunked;
+    private boolean             chunked=false;
 
     // whether the message has a "Connection: Close" http header in it.
-    private boolean             hasCloseConnectionHeader;
+    private boolean             hasCloseConnectionHeader=false;
 
     public boolean hasCloseConnectionHeader( )
     {
@@ -145,28 +145,8 @@
             else
             {
                 String request=new String(getMessage( ));
-
-                // check the last two digits for CRLF - if they
-                // are LFLF
-                // then this is wrong
-                // e.g. 0a 0a converts to 0d0a 0d0a
-                // I'm doing it using a matcher because this
-                // could get
-                // complicated !
-                Pattern pattern=Pattern.compile(""+LF);
-                Matcher matcher=pattern.matcher(request);
-                StringBuffer stringBuffer=new StringBuffer( );
-
-                while (matcher.find( ))
-                {
-                    char[] tmpStr=matcher.group( ).toCharArray( );
-                    matcher.appendReplacement(stringBuffer, CRLF);
-                }
-
-                matcher.appendTail(stringBuffer);
-
-                // Now put it back into the responses
-                message=stringBuffer.toString( ).toCharArray( );
+                modifiedResponse = correctHTTPHeaderSection(request);
+                message=modifiedResponse.toCharArray();
             }
         }
 //
@@ -423,8 +403,7 @@
      * @param iIndex
      * @param iEOL
      */
-    private static String getResponseLine(String sResponse, 
-            int iIndex, int iEOL)
+    private static String getResponseLine(String sResponse, int iIndex, int iEOL)
     {
         String sLine=sResponse.substring(iIndex, iEOL);
 
@@ -460,7 +439,10 @@
         }
         while (iEoL>0&&!sLine.equals(CRLF));
         
-        return returnedResponse;
+        if (chunked)
+            return returnedResponse;
+        else
+            return returnedResponse + response.substring(iIndex);
     }
 
 //    private static boolean isStringAHexNumber(String sValue)



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org