You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2002/01/10 17:58:17 UTC
cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Constants.java Http11Connector.java InternalOutputBuffer.java
remm 02/01/10 08:58:17
Modified: http11/src/java/org/apache/coyote/http11 Constants.java
Http11Connector.java InternalOutputBuffer.java
Log:
- Add support for sending acknoledgments.
- Implement reset.
Revision Changes Path
1.6 +8 -1 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Constants.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Constants.java 9 Jan 2002 23:29:29 -0000 1.5
+++ Constants.java 10 Jan 2002 16:58:17 -0000 1.6
@@ -141,7 +141,7 @@
/**
* Default HTTP header buffer size.
*/
- public static final int DEFAULT_HTTP_HEADER_BUFFER_SIZE = 128 * 1024;
+ public static final int DEFAULT_HTTP_HEADER_BUFFER_SIZE = 128 * 1000;
/**
@@ -178,6 +178,13 @@
* HTTP/1.1.
*/
public static final String HTTP_11 = "HTTP/1.1";
+
+
+ /**
+ * Ack string when pipelining HTTP requests.
+ */
+ public static final byte[] ACK =
+ (new String("HTTP/1.1 100 Continue\r\n\r\n")).getBytes();
}
1.11 +17 -3 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Connector.java
Index: Http11Connector.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Connector.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Http11Connector.java 10 Jan 2002 15:23:23 -0000 1.10
+++ Http11Connector.java 10 Jan 2002 16:58:17 -0000 1.11
@@ -163,6 +163,12 @@
/**
+ * HTTP/1.1 flag.
+ */
+ protected boolean http11 = true;
+
+
+ /**
* Content delimitator for the request (if false, the connection will
* be closed at the end of the request).
*/
@@ -360,7 +366,13 @@
// Send a 100 status back if it makes sense (response not committed
// yet, and client specified an expectation for 100-continue)
- // FIXME
+ try {
+ outputBuffer.sendAck();
+ } catch (IOException e) {
+ // Log the error, and set error flag
+ e.printStackTrace();
+ error = true;
+ }
} else if (actionCode == ActionCode.ACTION_CLOSE) {
@@ -383,6 +395,8 @@
// Note: This must be called before the response is committed
+ outputBuffer.reset();
+
} else if (actionCode == ActionCode.ACTION_CUSTOM) {
// Do nothing
@@ -423,7 +437,7 @@
*/
protected void prepareRequest() {
- boolean http11 = true;
+ http11 = true;
contentDelimitation = false;
MessageBytes protocolMB = request.protocol();
@@ -434,6 +448,7 @@
keepAlive = false;
} else {
// Unsupported protocol
+ http11 = false;
error = true;
// Send 505; Unsupported HTTP version
response.setStatus(505);
@@ -541,7 +556,6 @@
*/
protected void prepareResponse() {
- boolean http11 = true;
boolean http09 = false;
contentDelimitation = false;
1.9 +28 -5 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalOutputBuffer.java
Index: InternalOutputBuffer.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalOutputBuffer.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- InternalOutputBuffer.java 10 Jan 2002 12:53:50 -0000 1.8
+++ InternalOutputBuffer.java 10 Jan 2002 16:58:17 -0000 1.9
@@ -226,8 +226,6 @@
*/
public void addFilter(OutputFilter filter) {
- // FIXME: Check for null ?
-
OutputFilter[] newFilterLibrary =
new OutputFilter[filterLibrary.length + 1];
for (int i = 0; i < filterLibrary.length; i++) {
@@ -267,9 +265,6 @@
*/
public void addActiveFilter(OutputFilter filter) {
- // FIXME: Check for null ?
- // FIXME: Check index ?
-
if (lastActiveFilter == -1) {
filter.setBuffer(outputStreamOutputBuffer);
} else {
@@ -287,6 +282,22 @@
/**
+ * Reset current response.
+ *
+ * @throws IllegalStateException if the response has already been committed
+ */
+ public void reset() {
+
+ if (committed)
+ throw new IllegalStateException(/*FIXME:Put an error message*/);
+
+ // Recycle Request object
+ response.recycle();
+
+ }
+
+
+ /**
* Recycle the output buffer. This should be called when closing the
* connection.
*/
@@ -355,6 +366,18 @@
// ------------------------------------------------ HTTP/1.1 Output Methods
+
+
+ /**
+ * Send an acknoledgement.
+ */
+ public void sendAck()
+ throws IOException {
+
+ if (!committed)
+ outputStream.write(Constants.ACK);
+
+ }
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>