Changeset 04cbcf2


Ignore:
Timestamp:
Dec 23, 2011 12:58:13 AM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
56901e5
Parents:
99ad70e
Message:

reapply I2P mods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/jetty/java/src/org/mortbay/http/I2PRequestLog.java

    r99ad70e r04cbcf2  
    1313//========================================================================
    1414
    15 package org.mortbay.jetty;
     15package org.mortbay.http;
    1616
    1717import java.io.IOException;
     
    2626
    2727import org.mortbay.component.AbstractLifeCycle;
     28import org.mortbay.jetty.HttpHeaders;
     29import org.mortbay.jetty.Request;
     30import org.mortbay.jetty.RequestLog;
     31import org.mortbay.jetty.Response;
    2832import org.mortbay.jetty.servlet.PathMap;
    2933import org.mortbay.log.Log;
     
    4044 * This log format can be output by most web servers, and almost all web log analysis software can understand
    4145 *  these formats.
     46 *
     47 * ** I2P Mods **
     48 *
     49 * For Jetty 5, this extended NCSARequestLog to
     50 * override log() to put in the requestor's destination hash,
     51 * instead of 127.0.0.1,
     52 * which is placed in the X-I2P-DestHash field in the request headers
     53 * by I2PTunnelHTTPServer.
     54 * But we also had to modify NCSARequestLog to do so, to change private
     55 * fields to protected.
     56 *
     57 * So that we will work with system Jetty 6 packages, we just copy the whole thing
     58 * and modify log() as required.
     59 * We leave the package as org.mortbay.http for compatibility with old
     60 * jetty.xml files.
     61 *
    4262 * @author Greg Wilkins
    4363 * @author Nigel Canonizado
    4464 *
    45  * @org.apache.xbean.XBean element="ncsaLog"
    4665 */
    47 public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
     66public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
    4867{
    4968    private String _filename;
     
    7190
    7291   
    73     public NCSARequestLog()
     92    public I2PRequestLog()
    7493    {
    7594        _extended = true;
     
    82101     * @param filename The filename for the request log. This may be in the format expected by {@link RolloverFileOutputStream}
    83102     */
    84     public NCSARequestLog(String filename)
     103    public I2PRequestLog(String filename)
    85104    {
    86105        _extended = true;
     
    264283                }
    265284
    266                 if (addr == null)
    267                     addr = request.getRemoteAddr();
     285                if (addr == null) {
     286                    // TODO offer B32 option
     287                    addr = request.getHeader("X-I2P-DestHash");
     288                    if(addr != null)
     289                        addr += ".i2p";
     290                    else
     291                        addr = request.getRemoteAddr();
     292                }
    268293
    269294                buf.append(addr);
Note: See TracChangeset for help on using the changeset viewer.