0)
+ {
+ String key = line.substring(0,c).trim().toLowerCase();
+ String value = line.substring(c+1,line.length()).trim();
+ String ev = (String) part._headers.get(key);
+ part._headers.put(key,(ev!=null)?(ev+';'+value):value);
+ //if(log.isDebugEnabled())log.debug(key+": "+value);
+ if (key.equals("content-disposition"))
+ content_disposition=value;
+ }
+ }
+
+ // Extract content-disposition
+ boolean form_data=false;
+ if (content_disposition==null)
+ {
+ throw new IOException("Missing content-disposition");
+ }
+
+ StringTokenizer tok =
+ new StringTokenizer(content_disposition,";");
+ while (tok.hasMoreTokens())
+ {
+ String t = tok.nextToken().trim();
+ String tl = t.toLowerCase();
+ if (t.startsWith("form-data"))
+ form_data=true;
+ else if (tl.startsWith("name="))
+ part._name=value(t);
+ else if (tl.startsWith("filename="))
+ part._filename=value(t);
+ }
+
+ // Check disposition
+ if (!form_data)
+ {
+ //log.warn("Non form-data part in multipart/form-data");
+ continue;
+ }
+ if (part._name==null || part._name.length()==0)
+ {
+ //log.warn("Part with no name in multipart/form-data");
+ continue;
+ }
+ //if(log.isDebugEnabled())log.debug("name="+part._name);
+ //if(log.isDebugEnabled())log.debug("filename="+part._filename);
+ _partMap.add(part._name,part);
+ part._data=readBytes();
+ }
+ }
+
+ /* ------------------------------------------------------------ */
+ private byte[] readBytes()
+ throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ int c;
+ boolean cr=false;
+ boolean lf=false;
+
+ // loop for all lines`
+ while (true)
+ {
+ int b=0;
+ while ((c=(_char!=-2)?_char:_in.read())!=-1)
+ {
+ _char=-2;
+
+ // look for CR and/or LF
+ if (c==13 || c==10)
+ {
+ if (c==13) _char=_in.read();
+ break;
+ }
+
+ // look for boundary
+ if (b>=0 && b<_byteBoundary.length && c==_byteBoundary[b])
+ b++;
+ else
+ {
+ // this is not a boundary
+ if (cr) baos.write(13);
+ if (lf) baos.write(10);
+ cr=lf=false;
+
+ if (b>0)
+ baos.write(_byteBoundary,0,b);
+ b=-1;
+
+ baos.write(c);
+ }
+ }
+
+ // check partial boundary
+ if ((b>0 && b<_byteBoundary.length-2) ||
+ (b==_byteBoundary.length-1))
+ {
+ if (cr) baos.write(13);
+ if (lf) baos.write(10);
+ cr=lf=false;
+ baos.write(_byteBoundary,0,b);
+ b=-1;
+ }
+
+ // boundary match
+ if (b>0 || c==-1)
+ {
+ if (b==_byteBoundary.length)
+ _lastPart=true;
+ if (_char==10) _char=-2;
+ break;
+ }
+
+ // handle CR LF
+ if (cr) baos.write(13);
+ if (lf) baos.write(10);
+ cr=(c==13);
+ lf=(c==10 || _char==10);
+ if (_char==10) _char=-2;
+ }
+ //if(log.isTraceEnabled())log.trace(baos.toString());
+ return baos.toByteArray();
+ }
+
+
+ /* ------------------------------------------------------------ */
+ private String value(String nameEqualsValue)
+ {
+ String value =
+ nameEqualsValue.substring(nameEqualsValue.indexOf('=')+1).trim();
+
+ int i=value.indexOf(';');
+ if (i>0)
+ value=value.substring(0,i);
+ if (value.startsWith("\""))
+ {
+ value=value.substring(1,value.indexOf('"',1));
+ }
+
+ else
+ {
+ i=value.indexOf(' ');
+ if (i>0)
+ value=value.substring(0,i);
+ }
+ return value;
+ }
+
+ /* ------------------------------------------------------------ */
+ private class Part
+ {
+ String _name=null;
+ String _filename=null;
+ Hashtable _headers= new Hashtable(10);
+ byte[] _data=null;
+ }
+};
diff --git a/apps/syndie/java/src/net/i2p/syndie/web/PostServlet.java b/apps/syndie/java/src/net/i2p/syndie/web/PostServlet.java
index 3298e77028..a7cc3d7e85 100644
--- a/apps/syndie/java/src/net/i2p/syndie/web/PostServlet.java
+++ b/apps/syndie/java/src/net/i2p/syndie/web/PostServlet.java
@@ -8,7 +8,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
-import org.mortbay.servlet.MultiPartRequest;
+// temporarily, we use our overwride, until jetty applies our patches
+//import org.mortbay.servlet.MultiPartRequest;
import net.i2p.I2PAppContext;
import net.i2p.client.naming.*;
diff --git a/apps/syndie/java/src/net/i2p/syndie/web/ViewThreadedServlet.java b/apps/syndie/java/src/net/i2p/syndie/web/ViewThreadedServlet.java
index 7b47223a5c..d7414411e5 100644
--- a/apps/syndie/java/src/net/i2p/syndie/web/ViewThreadedServlet.java
+++ b/apps/syndie/java/src/net/i2p/syndie/web/ViewThreadedServlet.java
@@ -247,12 +247,34 @@ public class ViewThreadedServlet extends BaseServlet {
}
}
- out.write(" @ ");
+ out.write(": ");
out.write("");
+ EntryContainer entry = archive.getEntry(node.getEntry());
+ if (entry == null) throw new RuntimeException("Unable to fetch the entry " + node.getEntry());
+
+ HeaderReceiver rec = new HeaderReceiver();
+ parser.parse(entry.getEntry().getText(), rec);
+ String subject = rec.getHeader(HTMLRenderer.HEADER_SUBJECT);
+ if (subject == null)
+ subject = "(no subject)";
+ out.write(trim(subject, 40));
+ //out.write("\n| \n");
+ out.write("");
+
+ out.write(" (full thread)\n");
+
+ out.write("");
+
+ out.write(" latest - ");
+
long dayBegin = BlogManager.instance().getDayBegin();
- long postId = node.getEntry().getEntryId();
+ long postId = node.getMostRecentPostDate();
if (postId >= dayBegin) {
out.write("today");
} else if (postId >= dayBegin - 24*60*60*1000) {
@@ -261,39 +283,13 @@ public class ViewThreadedServlet extends BaseServlet {
int daysAgo = (int)((dayBegin - postId + 24*60*60*1000-1)/(24*60*60*1000));
out.write(daysAgo + " days ago");
}
-
- out.write(": ");
- EntryContainer entry = archive.getEntry(node.getEntry());
- if (entry == null) throw new RuntimeException("Unable to fetch the entry " + node.getEntry());
- HeaderReceiver rec = new HeaderReceiver();
- parser.parse(entry.getEntry().getText(), rec);
- String subject = rec.getHeader(HTMLRenderer.HEADER_SUBJECT);
- if (subject == null)
- subject = "";
- out.write(trim(subject, 40));
- //out.write("\n | \n");
- out.write("");
- if (childCount > 0) {
- out.write(" latest - ");
-
- postId = node.getMostRecentPostDate();
- if (postId >= dayBegin) {
- out.write("today");
- } else if (postId >= dayBegin - 24*60*60*1000) {
- out.write("yesterday");
- } else {
- int daysAgo = (int)((dayBegin - postId + 24*60*60*1000-1)/(24*60*60*1000));
- out.write(daysAgo + " days ago");
- }
-
- out.write("\n");
- }
+ out.write("\n");
+ /*
out.write(" full thread\n");
+ */
out.write("");
out.write(" | \n");
diff --git a/history.txt b/history.txt
index 308e945e41..d6782919c8 100644
--- a/history.txt
+++ b/history.txt
@@ -1,4 +1,16 @@
-$Id: history.txt,v 1.335 2005/11/28 11:02:41 jrandom Exp $
+$Id: history.txt,v 1.336 2005/11/29 07:46:34 jrandom Exp $
+
+2005-11-29 jrandom
+ * Further Syndie UI cleanup
+ * Bundled our patched MultiPartRequest code from jetty (APL2 licensed),
+ since it hasn't been applied to the jetty CVS yet [1]. Its packaged
+ into syndie.jar and renamed to net.i2p.syndie.web.MultiPartRequest, but
+ will be removed as soon as its integrated into Jetty. This patch allows
+ posting content in various character sets.
+ [1] http://article.gmane.org/gmane.comp.java.jetty.general/6031
+ * Upgraded new installs to the latest stable jetty (5.1.6), though this
+ isn't pushed as part of the update yet, as there aren't any critical
+ bugs.
2005-11-29 jrandom
* Added back in the OSX jbigi, which was accidentally removed a few revs
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index 04310a4b7c..b1a1fef509 100644
--- a/router/java/src/net/i2p/router/RouterVersion.java
+++ b/router/java/src/net/i2p/router/RouterVersion.java
@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
- public final static String ID = "$Revision: 1.302 $ $Date: 2005/11/26 13:26:23 $";
+ public final static String ID = "$Revision: 1.303 $ $Date: 2005/11/28 11:02:40 $";
public final static String VERSION = "0.6.1.6";
- public final static long BUILD = 1;
+ public final static long BUILD = 3;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);