rkd77 / elinks

Fork of elinks
Other
335 stars 35 forks source link

tls-max and ciphers info in elinks user agent or header #244

Open overrride opened 1 year ago

overrride commented 1 year ago

How can elinks be configured such that what is sent is equivalent to this command using curl:

curl --tls-max 1.2 --ciphers ECDHE-ECDSA-AES128-GCM-SHA256

?

Just putting the tls-max and ciphers information in the user agent field does not seem to work. (Update: I see now it has nothing to do with user agent, just that there was nowhere else to put the info, probably because the libcurl support is not compiled).

If it is not currently possible, consider it a feature request, as it seemingly avoids innumerable Cloudflare blocks.

rkd77 commented 1 year ago

Did you enable libcurl and set "protocol.http.use_curl" = 1 ? In src/protocol/curl/http.c you can add some curl_easy_setopt, but I'm afraid that some javascript captcha will appear. User agent can be changed in Options manager.

overrride commented 1 year ago

That may be the answer. How is libcurl enabled? I've tried to look for the option, but I'm not seeing the flag for it. Presumably I don't have it compiled because if I did there would be a curl section in the protocol menu of the manager?

This specific issue is not to do with javascript or captcha. Pages downloaded through curl with those specific details and then piped to elinks work fine.

Am aware of the user agent option, it's really just about curl-type options, which I was not very aware of. I don't think I've ever seen curl in the protocol section. Presumably, one enters the details there. Once I've compiled that version of elinks, that is.

rkd77 commented 1 year ago

elinks on master branch built with libcurl and libevent enabled. With meson it is: -Dlibcurl=true -Dlibevent=true Then switch "protocol.http.use_curl" in options. I have no idea yet how to implement options for ciphers, but now it can be easily modified in code. Documentation for libcurl is available.

rkd77 commented 1 year ago

meson is preferred. autotools scripts are kept, only because users still run ./configure. They might be a bit behind. I'm going to remove ./configure scripts in 0.20.

overrride commented 1 year ago

Can get it to compile with: meson setup --wipe -Dlibcurl=true -Dlibevent=true -Dlibcss=false -Didn=false -Dgpm=false -Dterminfo=true -Dtrue-color=true (those 3 libraries false because they are just not happening)

To http.c added:
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_MAX_TLSv1_2); curl_easy_setopt(curl, CURLOPT_SSL_CIPHER_LIST, "ECDHE-ECDSA-AES128-GCM-SHA256");

Compiles but doesn't connect to anything (with libcurl enabled). Doesn't connect to anything when I comment out the cipher lines either. Either way in the features list it says "libevent (disabled)(2.1.12-stable)".

With libcurl disabled, it connects.

rkd77 commented 1 year ago

In src/main/select.c there is function enable_libevent: In this function there is many return statements. Could you change them to something like: fprintf(stderr, "return 1\n"): return;

fprintf(stderr, "return 2\n"); return;

and so on.

Where there is only single statement after if add braces. I hope it is obvious. I guess you have some "original" system, not "mainstream".

And then redirect errors to file, and share which return statement occurred.

rkd77 commented 1 year ago

@overrride what distro is it?