Opened 5 years ago

Closed 5 years ago

#1173 closed enhancement (fixed)

make eepget pass proxy auth

Reported by: user Owned by: zzz
Priority: minor Milestone: 0.9.12
Component: apps/other Version: 0.9.9
Keywords: easy eepget, password, authorization, error message Cc:
Parent Tickets: Sensitive: no

Description

currently we can require a user and a password in the eepProxy yet this feature is, afaict, not supported by eepget.
also the error handling should be improved:
eepget -u user -p 123 http://example.i2p
did download the data (with eepProxy not requiring auth), despite 123 not being the port of my eepProyx, but according to man -p is for specifying where the eepProxy is listening.
Returning an error rather than falling back to default would be expected.

Subtickets

Change History (13)

comment:1 Changed 5 years ago by zzz

Keywords: easy added

Reasonable suggestions

The arg processing is primitive. The Scanner class used by tuna in MultiRouter? may be helpful. Or build on top of Scanner. Or perhaps bundle one from list here:

http://stackoverflow.com/questions/367706/is-there-a-good-command-line-argument-parser-for-java

comment:2 Changed 5 years ago by zzz

Proposal: bundle http://www.urbanophile.com/arenn/hacking/getopt/
Less than 10 KB for two classes, LGPLv2

<zzz> zab you have any preferred command-line arg-processing class or small lib? ticket #1173
<zzz> it's ad hoc throughout our code base now
<zab> zzz: GNU gettext has a java implementation
<zab> it's the standard - and — stuff
<zab> er
<zab> s/gettext/getopt/
<zab> http://www.urbanophile.com/arenn/hacking/getopt/gnu.getopt.Getopt.html#_top_
<zzz> zab is that your preference, or just one from the list?
<zab> We used that at work. Don't know about any others tbh
<zzz> ok I'll take that as a +1 :)
<zab> it's supposed to be 100% compatible with the C implementation which is a +1 :)
<meeh> getopt from other languages works well imo, should be the same for java
<zab> taking care of things like '-h' and '—help' being equivalent, etc.
<meeh> yes great that way, as well as making the "help command list" etc
<meeh> the output of -h
<zzz> looks reasonable. the jar is 56 KB and it includes the source and translations
<zzz> > ls -l *.class
<zzz> -rw-r—r— 1 zzz zzz 7474 Jan 16 2002 Getopt.class
<zzz> -rw-r—r— 1 zzz zzz 2529 Jan 16 2002 GetoptDemo?.class
<zzz> -rw-r—r— 1 zzz zzz 1600 Jan 16 2002 LongOpt?.class
<meeh> yes it shouldn't take much space, it's more or less just a command line parser with some fancy options

  • zzz pastes into ticket

comment:3 Changed 5 years ago by zzz

Possible additional uses: SU3File, TrustedUpdate?, I2PTunnel, Storage, PrivateKeyFile?, …

Look for others in net.i2p.util

comment:4 Changed 5 years ago by zzz

Owner: set to zzz
Status: newaccepted

Targeting 0.9.12 for the libs. After propped, will be looking for help for the various main() methods.

comment:5 Changed 5 years ago by zzz

In i2p.i2p.zzz.test2, to be propped for 0.9.12:
1e921b60c5365fa4b6390cb50e1884dd52a45d39 getopt libs
fc51e1a054d39f31f027570b2cd6defcef035f4a SU3File

In progress: I2Ping

comment:6 Changed 5 years ago by zzz

I2Ping converted to getopt in 39fdadaee7eb0409587b3606e10783a359d887fc

EepGet? has had support for username/password since Sept. 2011 with -u username password but that option is not documented in the man page. It is documented in the help (type 'eepget' to see).

In your example above eepget -u user -p 123 would be parsed with '-p' as the password. The way we do it nowwon't work with getopt (two parameters after -u) Probably better is to enter the password on the command line.

Why it downloaded something without the right password I have no idea. Maybe a proxy bug.

comment:7 Changed 5 years ago by zzz

EepGet? converted to getopt, man page updated in 93ed2093c69fbbe7434c11b2f054f86caba09580

  • New option -c for clearnet (no proxy), same as -p:0
  • Proxy option -p with host name arg only (no ':') now allowed
  • Proxy password option is now -x, not the second arg to -u
  • Prompt for proxy password if not supplied in options
  • Line length option is now -l, not the second arg to -m

comment:8 Changed 5 years ago by zzz

So, the next problem is that the HTTP proxy went to Digest authentication by default a while back (you can set Basic in custom options but how to do that isn't documented anywhere), but EepGet? only supports Basic authentication.

comment:9 Changed 5 years ago by zzz

Digest auth support added to EepGet? in f2785decdd60136edc4b55900f0d7e85a414d17e

comment:12 Changed 5 years ago by zzz

Status: acceptedtesting

Propped in 0.9.11-2, please test

comment:13 Changed 5 years ago by zzz

Resolution: fixed
Status: testingclosed
Note: See TracTickets for help on using tickets.