Valentin Lorentz
41c5589bea
utils.str: Rely only on the documented methods of textwrap.TextWrapper.
...
'_split_chunks()' should be fine, but '_wrap_chunks()' is the only one explicitly
documented as overridable, so it's probably safer to use.
2021-04-01 20:10:17 +02:00
Valentin Lorentz
bf90a7c94d
callbacks: Make reply() send multiline batches when supybot.reply.mores.instant > 1
2021-04-01 20:10:17 +02:00
Valentin Lorentz
e54751f9c9
Make the email regexp less strict.
...
The former one disallowed too many valid address, eg. those containing
quotes or square brackets.
2021-01-25 19:49:08 +01:00
Valentin Lorentz
761fc2353e
utils.net: Do not disable TLS certificate check when authorityCertificate is set.
...
It makes sense that manually configuring a CA overrides this
value which defaults to False.
2020-08-01 21:46:26 +02:00
Valentin Lorentz
57da6d04e2
utils.net: always check fingerprints if they are set, even if verifyCertificates is False.
...
It makes sense that manually configuring fingerprints overrides this
value which defaults to False.
2020-08-01 21:45:08 +02:00
Gordon Shumway
a3e6887fc9
Keep closing parenthesis when snarfing URLs
...
Fixes bug when handling URLs with a closing parenthesis ')'. e.g. https://en.wikipedia.org/wiki/Harley_Quinn_(TV_series)
2020-06-27 20:41:56 +02:00
Valentin Lorentz
f9bf75aeee
net: Give more context to TLS errors.
...
They are notoriously hard to read, so let's at least say which
part of ssl_wrap_socket triggered them so the user have some
idea what is going on.
2020-05-26 23:06:39 +02:00
Valentin Lorentz
b4df468b3a
net: remove fallback implementation of ssl_wrap_socket.
...
We no longer support Python < 3.4.
2020-05-26 22:46:28 +02:00
Valentin Lorentz
eead5566e5
utils.gen: set __slots__.
...
We create *a lot* of these structs, so it saves a considerable
amount of space.
2020-05-15 22:57:35 +02:00
Valentin Lorentz
3d1e88cb68
safeEval: Get rid of eval().
...
It should be safe considering the AST sanity checks,
but I don't see any point in keeping it.
2020-05-15 18:31:04 +02:00
Valentin Lorentz
759fca5eba
Switch names of TimeoutDict and ExpiringDict.
...
For consistency, as TimeoutQueue has guaranteed deletion after the timeout,
like the new TimeoutDict (ex-ExpiringDict).
2020-05-10 08:42:25 +02:00
Valentin Lorentz
d205a9b5f8
Fediverse: Use ExpiringDict instead of TimeoutDict for the cache, it guarantees expiry after the timeout.
2020-05-10 08:34:36 +02:00
Valentin Lorentz
da328b4985
Expire batches that never ended to avoid leaking memory.
2020-05-06 20:39:21 +02:00
Valentin Lorentz
3576503e3f
Update links to the documentation.
2020-03-17 19:22:52 +01:00
nyuszika7h
0f3264cf26
Add modulo operator to new math evaluator
...
Closes #1402 .
2020-02-08 16:08:23 +01:00
Valentin Lorentz
a6ae9f51a3
ChannelStats: Use the safe math evaluator.
2020-01-26 20:42:55 +01:00
Valentin Lorentz
99dd6f1506
core/Math: Move the math evaluator to src/utils/.
...
It will be used by ChannelStats.
2020-01-26 20:42:55 +01:00
Valentin Lorentz
c457b52067
Deduplicate setting Accept-Language HTTP header.
...
This adds a new function conf.defaultHttpHeaders that can be used by plugins
to get all the default HTTP headers for a given network/channel.
2020-01-14 19:03:12 +01:00
Valentin Lorentz
0fccea30ce
Import MutableMapping and MutableSet from collections.abc.
...
Aliases in collections itself are removed in 3.8.
2020-01-09 01:11:12 +01:00
Johannes Löthberg
27e7d6a9ac
Aka: Add web UI ( #1373 )
...
* utils.web: Import html escaping functions
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* Aka: Add web interface for browsing Akas
Fixes #1226 .
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* httpserver: Actually handle KeyError in unhook
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* test: FakeHTTPConnection: Don't decode data in send
BaseHTTPRequestHandler expects to get bytes, so we can't decode the sent
data.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* test: HTTPPluginTestCase: Use BytesIO instead of StringIO
BaseHTTPRequestHandler expects bytes, not strings.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* test: HTTPPluginTestCase: Rewind wfile to 0 before reading the response
Otherwise the read pointer is at the end of the file.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* Aka: Add basic web UI tests
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2019-10-10 17:27:34 +02:00
Valentin Lorentz
88524beada
ChannelLogger + Karka + all DB plugins: Sanitize channel names when used in filenames.
2019-09-06 20:42:13 +02:00
Valentin Lorentz
233deee0d3
Fix previous commit for py2 and pypy.
2019-02-07 21:35:39 +01:00
Valentin Lorentz
969b9ed341
Make utils.python.collect_extra_debug_data support objects with __slots__.
2019-02-07 21:00:56 +01:00
Valentin Lorentz
b051537f7f
Add support for Python 3.8/nightly.
2019-01-06 18:08:15 +01:00
Valentin Lorentz
7adc958dd6
Fix SyntaxWarnings on Python 3.8
2019-01-06 18:06:44 +01:00
Valentin Lorentz
0d627c05b7
Do not break UTF-8 characters in long words. Closes GH-1333.
2018-04-14 22:31:30 +02:00
Valentin Lorentz
39dacf6e5b
Fix Python 2 support.
2018-02-01 23:21:18 +01:00
Valentin Lorentz
030ce5e6d4
Fix previous commit.
2018-02-01 22:37:24 +01:00
Valentin Lorentz
63a17f7491
Rewrite text wrapping to count line size in bytes instead of characters.
...
Also, fix shitty comparisons that were done in reverse.
2018-02-01 21:32:14 +01:00
Valentin Lorentz
11bbc89c9d
Properly handle multiple hosts in supybot.servers.http.hosts4.
...
See ebb48a4808
(which I reverted).
2017-10-28 09:50:12 +02:00
Valentin Lorentz
355ff7ffdf
Fix support for Python < 3.4.
2017-02-25 13:24:03 +01:00
Valentin Lorentz
dab026169f
Use ast.literal_eval() instead of eval() when possible.
...
It's unlikely to change anything, but a little more safety
does not hurt.
2017-02-25 13:10:33 +01:00
Valentin Lorentz
8bae847682
Use ast.parse in 'eval' mode instead of 'exec'.
...
This fixes compatibility with Python 3.7; but we should have
been doing this since b8fe420ef3
.
The incompatibility with Python 3.7 was introduced in
cb41b2766d
See also: http://bugs.python.org/issue29646
2017-02-25 11:31:52 +01:00
Valentin Lorentz
95a1f21600
Revert some instances of s/iteritems/items/ in be118c3338
.
2016-11-11 13:04:00 +01:00
Valentin Lorentz
5b29c8c0dd
utils.iter: Allow None argument to filterfalse and all.
...
Fixes bug in the Debian plugin.
2016-10-27 20:51:36 +02:00
Valentin Lorentz
79bcc04d0a
Fix Python 3.6 support of utils.python.glob2re.
2016-09-14 20:09:00 +02:00
Valentin Lorentz
dc4afb45a0
Try to provide Server Name Indication even if Python does not have SSLContext.
2016-07-20 20:42:40 +02:00
Junaid Loonat
3e72aa5da5
New isSocketAddress() method
...
Introduction of the isSocketAddress() method which will use the existing getSocket() method in order to validate whether the provided string is a valid socket address.
2016-04-26 23:12:26 +02:00
Junaid Loonat
c211c60e52
Removed HTTP(S) proxy code
...
The HTTP(S) proxy is now set globally from the configuration logic.
2016-04-25 22:12:52 +02:00
Junaid Loonat
654d98c125
Use proxy for HTTPS requests as well
...
Use proxy handler/opener classes, instead of request.set_proxy, to avoid any potential bugs in older Python versions.
Use the HTTP proxy (if configured) for HTTPS requests as well.
2016-04-25 10:14:49 +02:00
Valentin Lorentz
93feb71b66
Normalize fingerprints to allow more formats.
...
https://github.com/Limnoria/Limnoria-doc/issues/76#issuecomment-198794341
2016-03-20 10:28:33 +01:00
Valentin Lorentz
7f38076e59
Use HTMLParser.unescape instead of chr to decode HTML entities.
...
This adds support for entities encoded in hexadecimal notation.
2016-03-08 22:00:44 +01:00
Valentin Lorentz
f1390b1aec
Improve SSL-related version warnings.
2016-02-24 17:25:51 +01:00
Valentin Lorentz
e1a86665ae
Remove unsupported option verify_mode to ssl.wrap_socket.
2016-02-24 07:43:21 +01:00
Valentin Lorentz
90c565c0c5
Fix name.
...
I thought I fixed that d922af1043
, but I
messed up with Git so hard I had to re-do that commit multiple times,
forgetting a new thing each time; and apparently that one passed through.
2016-02-23 21:56:52 +01:00
Valentin Lorentz
d163d1a1a3
Add support for authority certificates.
2016-02-23 20:52:36 +01:00
Valentin Lorentz
880addf256
Add link to FAQ items on how to upgrade to Python 3.
2016-02-22 20:18:37 +01:00
Valentin Lorentz
8c3946d31c
Actually, 3.2 and 3.3 don't have SSLContext either. Let's recommend only ≥ 3.4.
2016-02-22 18:36:53 +01:00
Valentin Lorentz
ae560dbd2a
Add supybot.protocols.ssl.verifyCertificates.
...
And remove unused variable supybot.protocols.ssl.verifyMode.
2016-02-21 14:42:41 +01:00
Valentin Lorentz
e77e78e79e
Add support for using server certificate fingerprint instead of CA signature.
2016-02-21 14:18:14 +01:00