Author: toad
Date: 2008-09-11 12:18:41 +0000 (Thu, 11 Sep 2008)
New Revision: 22596

Modified:
   trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
Check to ensure we don't send headers twice, should pick up bugs like the 
recent one more quickly.


Modified: trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java      
2008-09-11 12:15:23 UTC (rev 22595)
+++ trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java      
2008-09-11 12:18:41 UTC (rev 22596)
@@ -44,6 +44,7 @@
        private final BucketFactory bf;
        private final ToadletContainer container;
        private final InetAddress remoteAddr;
+       private boolean sentReplyHeaders;

        /** Is the context closed? If so, don't allow any more writes. This is 
because there
         * may be later requests.
@@ -128,6 +129,10 @@

        public void sendReplyHeaders(int replyCode, String replyDescription, 
MultiValueTable mvt, String mimeType, long contentLength, Date mTime) throws 
ToadletContextClosedException, IOException {
                if(closed) throw new ToadletContextClosedException();
+               if(sentReplyHeaders) {
+                       throw new IllegalStateException("Already sent 
headers!");
+               }
+               sentReplyHeaders = true;
                sendReplyHeaders(sockOutputStream, replyCode, replyDescription, 
mvt, mimeType, contentLength, mTime, shouldDisconnect);
        }


Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-09-11 
12:15:23 UTC (rev 22595)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-09-11 
12:18:41 UTC (rev 22596)
@@ -354,7 +354,7 @@
 FProxyToadlet.plugins=configure and manage plugins
 FProxyToadlet.pluginsTitle=Plugins
 FProxyToadlet.queue=manage queued requests
-FProxyToadlet.queueTitle=Queue
+FProxyToadlet.queueTitle=Downloads and uploads
 FProxyToadlet.retryNow=Retry now
 FProxyToadlet.sizeLabel=Size:
 FProxyToadlet.sizeUnknown=Size: unknown


Reply via email to