-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
netrc: Implement .netrc parsing #244
base: master
Are you sure you want to change the base?
Changes from 1 commit
ea153e9
316997e
d5a9df9
87d7320
1a5b638
ba0539d
1fc0dcc
32f53bc
97b22a1
6d2bfa3
d0c858a
24a27fa
f9192ab
5abebdf
802ffcf
c2fc839
e303c11
0103c49
607f701
67eec63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,13 +163,12 @@ main(int argc, char *argv[]) | |
} | ||
break; | ||
case 'R': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's define a negative version, it's necessary for if there's a default in the axel config file. I'm not sure a short version is needed (I've been thinking about removing support for systems not supporting getopt_long anyway). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. About negative version of the option, I don't know whether it is a good idea to make .netrc parsing default, as it may break existing users' assumptions/scripts/workflows, etc. What do you think about it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't mean to make it the default, but if you have the option on the configuration file, then you need a way to disable it from the command line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I'll add it. |
||
conf->use_netrc = 1; | ||
if (optarg) { | ||
if (!strlcpy(conf->netrc_filename, optarg, | ||
sizeof(conf->netrc_filename))) { | ||
print_help(); | ||
goto free_conf; | ||
{ | ||
char *netrc_filename = NULL; | ||
if (optarg) { | ||
netrc_filename = optarg; | ||
} | ||
conf->netrc = netrc_init(netrc_filename); | ||
davidpolverari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
break; | ||
case '6': | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code here shouldn't be conditional, and it should be for all protocols.
We want to support other formats, like authinfo, in the future.
It should be into a separate function, so that refactoring doesn't touch code around it:
Also auto-login should only happen if we didn't got the credentials from somewhere else, so a check for that is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I will move this code to the
conn.c:conn_set()
function, as that is the one that deals with parsing URLs and extracting fields like username, password and hostname from them and copying toconn_t
. But once parsing is entangled with auth code, I'd rather leave this kind of refactoring to another PR.