Changeset efa72db


Ignore:
Timestamp:
May 15, 2019 10:32:54 AM (18 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6600f37
Parents:
4e267f6
Message:

EepGet?: Don't continue when requested a partial but didn't
get it, and the output is to a stream
Javadocs and log tweaks

File:
1 edited

Legend:

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

    r4e267f6 refa72db  
    142142    }
    143143
     144    /**
     145     *  @param outputFile ignored if outputStream is non-null
     146     *  @param outputStream takes precedence over outputFile
     147     */
    144148    public EepGet(I2PAppContext ctx, boolean shouldProxy, String proxyHost, int proxyPort,
    145149                  int numRetries, long minSize, long maxSize, String outputFile, OutputStream outputStream,
     
    148152    }
    149153
     154    /**
     155     *  @param outputFile ignored if outputStream is non-null
     156     *  @param outputStream takes precedence over outputFile
     157     */
    150158    public EepGet(I2PAppContext ctx, boolean shouldProxy, String proxyHost, int proxyPort,
    151159                  int numRetries, long minSize, long maxSize,
     
    593601     *
    594602     * Header timeout default 45 sec, total timeout default none, inactivity timeout default 60 sec.
     603     *
     604     * @return success
    595605     */
    596606    public boolean fetch() { return fetch(_fetchHeaderTimeout); }
     
    602612     *
    603613     * Total timeout default none, inactivity timeout default 60 sec.
     614     *
     615     * @return success
    604616     */
    605617    public boolean fetch(long fetchHeaderTimeout) {
     
    613625     * @param totalTimeout &lt;= 0 for default none
    614626     * @param inactivityTimeout &lt;= 0 for default 60 sec
     627     * @return success
    615628     */
    616629    public boolean fetch(long fetchHeaderTimeout, long totalTimeout, long inactivityTimeout) {
     
    938951            case 208:
    939952            case 226:
    940                 if (_outputStream != null)
     953                if (_outputStream != null) {
     954                    if (_alreadyTransferred > 0) {
     955                        // asked for partial but didn't get it,
     956                        // can't rewind the stream
     957                        rcOk = true;
     958                        _keepFetching = false;
     959                        _transferFailed = true;
     960                        break;
     961                    }
    941962                    _out = _outputStream;
    942                 else
     963                } else {
    943964                    _out = new FileOutputStream(_outputFile, false);
     965                }
    944966                _alreadyTransferred = 0;
    945967                rcOk = true;
     
    13221344            url = new URI(_actualURL);
    13231345        } catch (URISyntaxException use) {
    1324             IOException ioe = new MalformedURLException("Bad URL");
     1346            IOException ioe = new MalformedURLException("Bad URL: " + _actualURL);
    13251347            ioe.initCause(use);
    13261348            throw ioe;
     
    13281350        String host = url.getHost();
    13291351        if (host == null || host.length() <= 0)
    1330             throw new MalformedURLException("Bad URL, no host");
     1352            throw new MalformedURLException("Bad URL, no host: " + url);
    13311353        int port = url.getPort();
    13321354        String path = url.getRawPath();
Note: See TracChangeset for help on using the changeset viewer.