mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[curl] Send username and password in http
This commit is contained in:
parent
008eacef69
commit
9389e2f903
@ -377,6 +377,8 @@ static void
|
||||
do_ftpes(struct connection *conn)
|
||||
{
|
||||
struct ftpes_connection_info *ftp = (struct ftpes_connection_info *)mem_calloc(1, sizeof(*ftp));
|
||||
struct auth_entry *auth = find_auth(conn->uri);
|
||||
char *url;
|
||||
struct string u;
|
||||
CURL *curl;
|
||||
|
||||
@ -392,10 +394,7 @@ do_ftpes(struct connection *conn)
|
||||
}
|
||||
conn->from = 0;
|
||||
conn->unrestartable = 1;
|
||||
|
||||
/// FILE *stream = fopen("/tmp/curl.log", "a");
|
||||
struct auth_entry *auth = find_auth(conn->uri);
|
||||
char *url = get_uri_string(conn->uri, URI_HOST | URI_PORT | URI_DATA);
|
||||
url = get_uri_string(conn->uri, URI_HOST | URI_PORT | URI_DATA);
|
||||
|
||||
if (!url) {
|
||||
abort_connection(conn, connection_state(S_OUT_OF_MEM));
|
||||
|
@ -130,6 +130,8 @@ static void
|
||||
do_http(struct connection *conn)
|
||||
{
|
||||
struct http_curl_connection_info *http = (struct http_curl_connection_info *)mem_calloc(1, sizeof(*http));
|
||||
struct auth_entry *auth = find_auth(conn->uri);
|
||||
|
||||
struct string u;
|
||||
CURL *curl;
|
||||
|
||||
@ -175,7 +177,6 @@ do_http(struct connection *conn)
|
||||
mem_free(url);
|
||||
curl = curl_easy_init();
|
||||
|
||||
|
||||
if (curl) {
|
||||
CURLMcode rc;
|
||||
char *optstr;
|
||||
@ -194,6 +195,11 @@ do_http(struct connection *conn)
|
||||
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);
|
||||
|
||||
if (auth) {
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, auth->user);
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, auth->password);
|
||||
}
|
||||
|
||||
if (conn->uri->post) {
|
||||
char *postend = strchr(conn->uri->post, '\n');
|
||||
char *post = postend ? postend + 1 : conn->uri->post;
|
||||
|
Loading…
Reference in New Issue
Block a user