Changeset 47c8389


Ignore:
Timestamp:
Aug 24, 2009 12:08:30 AM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
456ed0a
Parents:
79e3223 (diff), 51fd4d7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

propagate from branch 'i2p.i2p.zzz.test3' (head e19da9b978ed2ec03adb0e326fff6870746cc4fc)

to branch 'i2p.i2p' (head 179b9a7974d64853c0c91924a5ad86e8b04ee7ba)

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java

    r79e3223 r47c8389  
    844844                if (filename.endsWith(".css"))
    845845                    type = "text/css";
     846                else if (filename.endsWith(".ico"))
     847                    type = "image/x-icon";
    846848                else if (filename.endsWith(".png"))
    847849                    type = "image/png";
  • apps/i2ptunnel/jsp/edit.jsp

    r79e3223 r47c8389  
     1<%@page pageEncoding="UTF-8"%>
    12<%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean" %><%
    23String tun = request.getParameter("tunnel");
  • apps/i2ptunnel/jsp/index.jsp

    r79e3223 r47c8389  
     1<%
     2    // http://www.crazysquirrel.com/computing/general/form-encoding.jspx
     3    if (request.getCharacterEncoding() == null)
     4        request.setCharacterEncoding("UTF-8");
     5%>
     6<%@page pageEncoding="UTF-8"%>
    17<%@page contentType="text/html" import="net.i2p.i2ptunnel.web.IndexBean"%><?xml version="1.0" encoding="UTF-8"?>
    28<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     
    713    <title>I2P Tunnel Manager - List</title>
    814   
    9     <meta htt
    10 p-equiv="Content-Type" content="text/html; charset=UTF-8" />
     15    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    1116    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
     17    <link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
    1218   
    1319    <% if (indexBean.allowCSS()) {
    14   %><link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
    15     <link href="<%=indexBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
     20  %><link href="<%=indexBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
    1621    <link href="<%=indexBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
    1722    <% }
  • apps/ministreaming/java/build.xml

    r79e3223 r47c8389  
    2424        <mkdir dir="./build" />
    2525        <mkdir dir="./build/obj" />
    26         <javac srcdir="./src" debug="true" deprecation="on" source="1.5" target="1.5" destdir="./build/obj" classpath="../../../core/java/build/i2p.jar" >
     26        <!-- half of this is deprecated classes so turn deprecation off -->
     27        <javac srcdir="./src" debug="true" deprecation="off" source="1.5" target="1.5" destdir="./build/obj" classpath="../../../core/java/build/i2p.jar" >
    2728            <compilerarg line="${javac.compilerargs}" />
    2829        </javac>
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigTunnelsHelper.java

    r79e3223 r47c8389  
    155155
    156156        // custom options
    157         buf.append("<tr><td align=\"right\" class=\"mediumtags\">Inbound options:</td>\n");
    158         buf.append("<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
    159         buf.append(".inboundOptions\" type=\"text\" size=\"32\" ");
    160         buf.append("value=\"");
     157        // There is no facility to set these, either in ConfigTunnelsHandler or
     158        // TunnelPoolOptions, so make the boxes readonly.
     159        // And let's not display them at all unless they have contents, which should be rare.
    161160        Properties props = in.getUnknownOptions();
    162         for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
    163             String prop = (String)iter.next();
    164             String val = (String)props.getProperty(prop);
    165             buf.append(prop).append("=").append(val).append(" ");
    166         }
    167         buf.append("\"/></td></tr>\n");
    168         buf.append("<tr><td align=\"right\" class=\"mediumtags\">Outbound options:</td>\n");
    169         buf.append("<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
    170         buf.append(".outboundOptions\" type=\"text\" size=\"32\" ");
    171         buf.append("value=\"");
    172         props = in.getUnknownOptions();
    173         for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
    174             String prop = (String)iter.next();
    175             String val = (String)props.getProperty(prop);
    176             buf.append(prop).append("=").append(val).append(" ");
    177         }
    178         buf.append("\"/></td></tr>\n");
     161        if (props.size() > 0) {
     162            buf.append("<tr><td align=\"right\" class=\"mediumtags\">Inbound options:</td>\n" +
     163                       "<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
     164            buf.append(".inboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " +
     165                       "value=\"");
     166            for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
     167                String prop = (String)iter.next();
     168                String val = (String)props.getProperty(prop);
     169                buf.append(prop).append('=').append(val).append(' ');
     170            }
     171            buf.append("\"></td></tr>\n");
     172        }
     173        props = out.getUnknownOptions();
     174        if (props.size() > 0) {
     175            buf.append("<tr><td align=\"right\" class=\"mediumtags\">Outbound options:</td>\n" +
     176                       "<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
     177            buf.append(".outboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " +
     178                       "value=\"");
     179            for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
     180                String prop = (String)iter.next();
     181                String val = (String)props.getProperty(prop);
     182                buf.append(prop).append('=').append(val).append(' ');
     183            }
     184            buf.append("\"></td></tr>\n");
     185        }
    179186//        buf.append("<tr><td colspan=\"3\"><br></td></tr>\n");
    180187    }
  • apps/routerconsole/jsp/css.jsp

    r79e3223 r47c8389  
    33    * This should be included inside <head>...</head>,
    44    * as it sets the stylesheet.
     5    *
     6    * This is included almost 30 times, so keep whitespace etc. to a minimum.
    57    */
     8
     9   // http://www.crazysquirrel.com/computing/general/form-encoding.jspx
     10   if (request.getCharacterEncoding() == null)
     11       request.setCharacterEncoding("UTF-8");
    612
    713   response.setHeader("Pragma", "no-cache");
     
    1622   }
    1723%>
     24<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     25<link rel="shortcut icon" href="favicon.ico">
    1826<jsp:useBean class="net.i2p.router.web.CSSHelper" id="cssHelper" scope="request" />
    1927<jsp:setProperty name="cssHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
  • apps/routerconsole/jsp/error.jsp

    r79e3223 r47c8389  
    1414%>
    1515<html><head><title>I2P Router Console - Page Not Found</title>
    16 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    1716<%@include file="css.jsp" %>
    1817<link rel="shortcut icon" href="favicon.ico" /></head><body>
  • apps/routerconsole/jsp/flags.jsp

    r79e3223 r47c8389  
    2626        cout.close();
    2727}
     28/*
     29 *  Send a 403 instead of a 404, because the server sends error.jsp
     30 *  for 404 errors, complete with the summary bar, which would be
     31 *  a huge load for a page full of flags if the user didn't have the
     32 *  flags directory for some reason.
     33 */
    2834if (!rendered)
    29     response.sendError(404, "Not found");
     35    response.sendError(403, "Flag not found");
    3036%>
  • apps/routerconsole/jsp/index.jsp

    r79e3223 r47c8389  
    66<%@include file="css.jsp" %>
    77<title>I2P Router Console - home</title>
    8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    9 <link rel="shortcut icon" href="/themes/console/images/favicon.ico" />
    108</head><body>
    119<%
  • apps/routerconsole/jsp/summaryframe.jsp

    r79e3223 r47c8389  
    1111<%@include file="css.jsp" %>
    1212<title>Summary Bar</title>
    13 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    1413<%
    1514    // try hard to avoid an error page in the iframe after shutdown
  • apps/routerconsole/jsp/viewstat.jsp

    r79e3223 r47c8389  
    6464  } catch (NumberFormatException nfe) {}
    6565}
     66/*
     67 *  Send a 403 instead of a 404, because the server sends error.jsp
     68 *  for 404 errors, complete with the summary bar, which would be
     69 *  a huge load for a page full of graphs if there's a problem
     70 */
    6671if (!rendered) {
    67   response.sendError(404, "That stat is not available");
     72  response.sendError(403, "That stat is not available");
    6873}
    6974%>
  • core/java/src/net/i2p/data/DataHelper.java

    r79e3223 r47c8389  
    106106    public static void writeProperties(OutputStream rawStream, Properties props)
    107107            throws DataFormatException, IOException {
     108        writeProperties(rawStream, props, false);
     109    }
     110
     111    /**
     112     * jrandom disabled UTF-8 in mid-2004, for performance reasons,
     113     * i.e. slow foo.getBytes("UTF-8")
     114     * Re-enable it so we can pass UTF-8 tunnel names through the I2CP SessionConfig.
     115     *
     116     * Use utf8 = false for RouterAddress (fast, non UTF-8)
     117     * Use utf8 = true for SessionConfig (slow, UTF-8)
     118     */
     119    public static void writeProperties(OutputStream rawStream, Properties props, boolean utf8)
     120            throws DataFormatException, IOException {
    108121        if (props != null) {
    109122            OrderedProperties p = new OrderedProperties();
     
    113126                String key = (String) iter.next();
    114127                String val = p.getProperty(key);
    115                 // now make sure they're in UTF-8
    116                 //key = new String(key.getBytes(), "UTF-8");
    117                 //val = new String(val.getBytes(), "UTF-8");
    118                 writeString(baos, key);
     128                if (utf8)
     129                    writeStringUTF8(baos, key);
     130                else
     131                    writeString(baos, key);
    119132                baos.write(_equalBytes);
    120                 writeString(baos, val);
     133                if (utf8)
     134                    writeStringUTF8(baos, val);
     135                else
     136                    writeString(baos, val);
    121137                baos.write(_semicolonBytes);
    122138            }
     
    487503     * A string is 1 or more bytes where the first byte is the number of bytes (not characters!)
    488504     * in the string and the remaining 0-255 bytes are the non-null terminated UTF-8 encoded character array.
     505     *
    489506     * @param in stream to read from
    490507     * @throws DataFormatException if the stream doesn't contain a validly formatted string
     
    497514        int read = read(in, raw);
    498515        if (read != size) throw new DataFormatException("Not enough bytes to read the string");
    499         return new String(raw);
     516        // the following constructor throws an UnsupportedEncodingException which is an IOException,
     517        // but that's only if UTF-8 is not supported. Other encoding errors are not thrown.
     518        return new String(raw, "UTF-8");
    500519    }
    501520
    502521    /** Write out a string to the stream as specified by the I2P data structure spec.  Note that the max
    503522     * size for a string allowed by the spec is 255 bytes.
     523     *
     524     * WARNING - this method destroys the encoding, and therefore violates
     525     * the data structure spec.
    504526     *
    505527     * @param out stream to write string
     
    517539            if (len > 255)
    518540                throw new DataFormatException("The I2P data spec limits strings to 255 bytes or less, but this is "
    519                                               + string.length() + " [" + string + "]");
     541                                              + len + " [" + string + "]");
    520542            writeLong(out, 1, len);
    521543            for (int i = 0; i < len; i++)
    522544                out.write((byte)(string.charAt(i) & 0xFF));
     545        }
     546    }
     547
     548    /** Write out a string to the stream as specified by the I2P data structure spec.  Note that the max
     549     * size for a string allowed by the spec is 255 bytes.
     550     *
     551     * This method correctly uses UTF-8
     552     *
     553     * @param out stream to write string
     554     * @param string UTF-8 string to write out: null strings are perfectly valid, but strings of excess length will
     555     *               cause a DataFormatException to be thrown
     556     * @throws DataFormatException if the string is not valid
     557     * @throws IOException if there is an IO error writing the string
     558     */
     559    private static void writeStringUTF8(OutputStream out, String string)
     560        throws DataFormatException, IOException {
     561        if (string == null) {
     562            writeLong(out, 1, 0);
     563        } else {
     564            // the following method throws an UnsupportedEncodingException which is an IOException,
     565            // but that's only if UTF-8 is not supported. Other encoding errors are not thrown.
     566            byte[] raw = string.getBytes("UTF-8");
     567            int len = raw.length;
     568            if (len > 255)
     569                throw new DataFormatException("The I2P data spec limits strings to 255 bytes or less, but this is "
     570                                              + len + " [" + string + "]");
     571            writeLong(out, 1, len);
     572            out.write(raw);
    523573        }
    524574    }
  • core/java/src/net/i2p/data/i2cp/SessionConfig.java

    r79e3223 r47c8389  
    174174            _log.debug("SigningKey size for destination: " + _destination.getSigningPublicKey().getData().length);
    175175            _destination.writeBytes(out);
    176             DataHelper.writeProperties(out, _options);
     176            DataHelper.writeProperties(out, _options, true);  // UTF-8
    177177            DataHelper.writeDate(out, _creationDate);
    178178        } catch (IOException ioe) {
     
    199199            throw new DataFormatException("Not enough data to create the session config");
    200200        _destination.writeBytes(out);
    201         DataHelper.writeProperties(out, _options);
     201        DataHelper.writeProperties(out, _options, true);  // UTF-8
    202202        DataHelper.writeDate(out, _creationDate);
    203203        _signature.writeBytes(out);
  • installer/resources/wrapper.config

    r79e3223 r47c8389  
    118118#wrapper.logfile=$INSTALL_PATH/wrapper.log
    119119
    120 # Format of output for the log file.  (See docs for formats)
    121 wrapper.logfile.format=LPTM
     120# Format of output for the log file.
     121# The format consists of the tokens 'L' for log level, 'P' for prefix, 'D' for thread,
     122# 'T' for time, 'Z' for millisecond time, and 'M' for message
     123# Unfortunately the log timezone cannot be changed, see
     124# http://www.nabble.com/Log-message-timezone-td23651317.html
     125wrapper.logfile.format=TM
    122126
    123127# Log Level for log file output.  (See docs for log levels)
  • router/java/src/net/i2p/router/Router.java

    r79e3223 r47c8389  
    11101110            }
    11111111            System.out.println("INFO: Update file exists [" + UPDATE_FILE + "] - installing");
    1112             boolean ok = FileUtil.extractZip(updateFile, _context.getBaseDir());
     1112            // verify the whole thing first
     1113            // we could remember this fails, and not bother restarting, but who cares...
     1114            boolean ok = FileUtil.verifyZip(updateFile);
     1115            if (ok)
     1116                ok = FileUtil.extractZip(updateFile, _context.getBaseDir());
    11131117            if (ok)
    11141118                System.out.println("INFO: Update installed");
     
    11331137                }
    11341138            }
     1139            // exit whether ok or not
    11351140            if (System.getProperty("wrapper.version") != null)
    11361141                System.out.println("INFO: Restarting after update");
  • router/java/src/net/i2p/router/peermanager/ProfileOrganizerRenderer.java

    r79e3223 r47c8389  
    112112            RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
    113113            if (info != null) {
    114                 buf.append(" (").append(info.getCapabilities());
     114                // prevent HTML injection in the caps and version
     115                buf.append(" (").append(DataHelper.stripHTML(info.getCapabilities()));
    115116                String v = info.getOption("router.version");
    116117                if (v != null)
    117                     buf.append(' ').append(v);
     118                    buf.append(' ').append(DataHelper.stripHTML(v));
    118119                buf.append(')');
    119120            }
     
    154155            buf.append("&nbsp;<a href=\"configpeer.jsp?peer=").append(peer.toBase64()).append("\">+-</a></td>\n");
    155156            buf.append("</tr>");
     157            // let's not build the whole page in memory (~500 bytes per peer)
     158            out.write(buf.toString());
     159            buf.setLength(0);
    156160        }
    157161        buf.append("</table>");
     
    190194            RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
    191195            if (info != null)
    192                 buf.append("<td align=\"center\">" + info.getCapabilities() + "</td>");
     196                buf.append("<td align=\"center\">").append(DataHelper.stripHTML(info.getCapabilities())).append("</td>");
    193197            else
    194198                buf.append("<td>&nbsp;</td>");
  • router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java

    r79e3223 r47c8389  
    646646        buf.append(". Limit: ").append(getMaxConnections());
    647647        buf.append(". Timeout: ").append(DataHelper.formatDuration(_pumper.getIdleTimeout()));
    648         buf.append(".</b></h3>\n");
    649         buf.append("<div class=\"wideload\"><table>\n");
    650         buf.append("<tr><th><a href=\"#def.peer\">Peer</a></th>");
    651         buf.append("<th>Dir</th>");
    652         buf.append("<th align=\"right\"><a href=\"#def.idle\">Idle</a></th>");
    653         buf.append("<th align=\"right\"><a href=\"#def.rate\">In/Out</a></th>");
    654         buf.append("<th align=\"right\"><a href=\"#def.up\">Up</a></th>");
    655         buf.append("<th align=\"right\"><a href=\"#def.skew\">Skew</a></th>");
    656         buf.append("<th align=\"right\"><a href=\"#def.send\">TX</a></th>");
    657         buf.append("<th align=\"right\"><a href=\"#def.recv\">RX</a></th>");
    658         buf.append("<th>Out queue</th>");
    659         buf.append("<th>Backlogged?</th>");
    660         buf.append("<th>Reading?</th>");
    661         buf.append(" </tr>\n");
     648        buf.append(".</b></h3>\n" +
     649                   "<div class=\"wideload\"><table>\n" +
     650                   "<tr><th><a href=\"#def.peer\">Peer</a></th>" +
     651                   "<th>Dir</th>" +
     652                   "<th align=\"right\"><a href=\"#def.idle\">Idle</a></th>" +
     653                   "<th align=\"right\"><a href=\"#def.rate\">In/Out</a></th>" +
     654                   "<th align=\"right\"><a href=\"#def.up\">Up</a></th>" +
     655                   "<th align=\"right\"><a href=\"#def.skew\">Skew</a></th>" +
     656                   "<th align=\"right\"><a href=\"#def.send\">TX</a></th>" +
     657                   "<th align=\"right\"><a href=\"#def.recv\">RX</a></th>" +
     658                   "<th>Out queue</th>" +
     659                   "<th>Backlogged?</th>" +
     660                   "<th>Reading?</th>" +
     661                   " </tr>\n");
    662662        out.write(buf.toString());
    663663        buf.setLength(0);
     
    727727            buf.append("</b></td> <td align=\"center\"><b>").append(peers.size() > 0 ? DataHelper.formatDuration(offsetTotal*1000/peers.size()) : "0ms");
    728728            buf.append("</b></td> <td align=\"center\"><b>").append(totalSend).append("</b></td> <td align=\"center\"><b>").append(totalRecv);
    729             buf.append("</b></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;");
    730             buf.append("</td></tr>\n");
     729            buf.append("</b></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;" +
     730                       "</td></tr>\n");
    731731        }
    732732
Note: See TracChangeset for help on using the changeset viewer.