Changeset 393d813


Ignore:
Timestamp:
May 27, 2011 9:41:49 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
e0dd52a4
Parents:
0000e4f
Message:

Don't re-append the query string to the redirect URL,
which caused eepget to repeatedly retry the new redirect
of an i2paddresshelper query by the HTTP proxy.

This was clearly non-compliant (the Location: header requires
an absolute URI including any query string).

This was part of the original redirect handling added by
jrandom to eepget back when it was in syndie;
appending that changelog just in case this hackery was
required by Freenet USKs, which I doubt.

Also, reset the redirect counter when retrying.

==============

Revision: 62a8cac8565958d111d0a47a443c964918d2e3ef
Parent: 277fe109ea4416f7d8a6dba6e09cd4f605a8ce1a
Author: jrandom@…
Date: 10/22/2006 15:06:30
Branch: i2p.syndie

Changelog:


  • add support for HTTP 301 redirects to EepGet? (so freenet USKs work as intended)
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/EepGet.java

    r0000e4f r393d813  
    475475                !_keepFetching)
    476476                break;
     477            _redirects = 0;
    477478            try {
    478479                long delay = _context.random().nextInt(60*1000);
     
    513514        if (_redirectLocation != null) {
    514515            //try {
    515                 URL oldURL = new URL(_actualURL);
    516                 String query = oldURL.getQuery();
    517                 if (query == null) query = "";
    518516                if (_redirectLocation.startsWith("http://")) {
    519                     if ( (_redirectLocation.indexOf('?') < 0) && (query.length() > 0) )
    520                         _actualURL = _redirectLocation + "?" + query;
    521                     else
    522                         _actualURL = _redirectLocation;
     517                    _actualURL = _redirectLocation;
    523518                } else {
     519                    // the Location: field has been required to be an absolute URI at least since
     520                    // RFC 1945 (HTTP/1.0 1996), so it isn't clear what the point of this is.
     521                    // This oddly adds a ":" even if no port, but that seems to work.
    524522                    URL url = new URL(_actualURL);
    525523                    if (_redirectLocation.startsWith("/"))
    526524                        _actualURL = "http://" + url.getHost() + ":" + url.getPort() + _redirectLocation;
    527525                    else
     526                        // this blows up completely on a redirect to https://, for example
    528527                        _actualURL = "http://" + url.getHost() + ":" + url.getPort() + "/" + _redirectLocation;
    529                     if ( (_actualURL.indexOf('?') < 0) && (query.length() > 0) )
    530                         _actualURL = _actualURL + "?" + query;
    531528                }
    532529            // an MUE is an IOE
  • core/java/src/net/i2p/util/EepHead.java

    r0000e4f r393d813  
    122122        if (_redirectLocation != null) {
    123123            //try {
    124                 URL oldURL = new URL(_actualURL);
    125                 String query = oldURL.getQuery();
    126                 if (query == null) query = "";
    127124                if (_redirectLocation.startsWith("http://")) {
    128                     if ( (_redirectLocation.indexOf('?') < 0) && (query.length() > 0) )
    129                         _actualURL = _redirectLocation + "?" + query;
    130                     else
    131                         _actualURL = _redirectLocation;
     125                    _actualURL = _redirectLocation;
    132126                } else {
     127                    // the Location: field has been required to be an absolute URI at least since
     128                    // RFC 1945 (HTTP/1.0 1996), so it isn't clear what the point of this is.
     129                    // This oddly adds a ":" even if no port, but that seems to work.
    133130                    URL url = new URL(_actualURL);
    134131                    if (_redirectLocation.startsWith("/"))
    135132                        _actualURL = "http://" + url.getHost() + ":" + url.getPort() + _redirectLocation;
    136133                    else
     134                        // this blows up completely on a redirect to https://, for example
    137135                        _actualURL = "http://" + url.getHost() + ":" + url.getPort() + "/" + _redirectLocation;
    138                     if ( (_actualURL.indexOf('?') < 0) && (query.length() > 0) )
    139                         _actualURL = _actualURL + "?" + query;
    140136                }
    141137            // an MUE is an IOE
  • history.txt

    r0000e4f r393d813  
    33               change on /configupdate when install dir is read-only.
    44               (ticket #466)
     5    * EepGet:
     6      - Fix redirect loop (thx kytv)
     7      - Reset redirect counter when retrying
    58    * JBigI:
    69      - Refactor to handle 64 bit libs and a list of fallback libs
  • router/java/src/net/i2p/router/RouterVersion.java

    r0000e4f r393d813  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 9;
     21    public final static long BUILD = 10;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.