Title: [916] trunk/rails-integration/src: Fix for no headers breaking
Revision
916
Author
tantalon
Date
2008-02-27 15:24:29 -0500 (Wed, 27 Feb 2008)

Log Message

Fix for no headers breaking

Modified Paths


Diff

Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/HttpOutput.java (915 => 916)


--- trunk/rails-integration/src/main/java/org/jruby/webapp/HttpOutput.java	2008-02-19 02:29:18 UTC (rev 915)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/HttpOutput.java	2008-02-27 20:24:29 UTC (rev 916)
@@ -37,6 +37,7 @@
 		String[] headerLines = headerBuffer.toString().split("[\r\n]+");
 		for(int i=0; i<headerLines.length; i++) {
 			String headerLine = headerLines[i];
+			if (headerLine.length() == 0) continue;
 			int split = headerLine.indexOf(":");
 			if (split == -1) throw new IOException("Bad header line: " + headerLine);
 

Modified: trunk/rails-integration/src/test/java/org/jruby/webapp/HttpOutputTest.java (915 => 916)


--- trunk/rails-integration/src/test/java/org/jruby/webapp/HttpOutputTest.java	2008-02-19 02:29:18 UTC (rev 915)
+++ trunk/rails-integration/src/test/java/org/jruby/webapp/HttpOutputTest.java	2008-02-27 20:24:29 UTC (rev 916)
@@ -111,4 +111,16 @@
 		control.verify();
 	}
 
+	public void testNoHeaders() throws IOException {
+		// setup expectations
+		control.expectAndReturn(response.getOutputStream(), new BufferServletOutputStream());
+		response.flushBuffer();
+		control.replay();
+		// execute the action
+		HttpOutput httpOutput = new HttpOutput(response);
+		httpOutput.flush();
+		// verify the results
+		control.verify();
+	}
+
 }
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to