Commit Graph

54 Commits

Author SHA1 Message Date
Valentin Lorentz
9bfa1458ef httpserver: improve error handling when binding ports
1. better error messages
2. try binding other ports even if one fails
2021-03-09 23:14:23 +01:00
Valentin Lorentz
5c5cad5851 httpserver: Fix circular dependency when servers.http.keepAlive is true. 2020-05-09 22:17:28 +02:00
Valentin Lorentz
e87a14826e Fediverse: First draft. 2020-05-09 19:27:34 +02: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
40837dbda0 Don't mutate server list while iterating on it.
It causes hanging at bot/test stops.
2019-09-15 08:02:10 +02: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
4576874128 httpserver: Respond to HEAD requests. Closes GH-1203. 2016-01-05 18:25:35 +01:00
Valentin Lorentz
1d162dd048 httpserver: Fix Content-Length computation. 2016-01-05 18:05:36 +01:00
Valentin Lorentz
058e4100f2 httpserver: Use appropriate HTTP status code for unsupported methods. 2016-01-05 18:01:39 +01:00
Valentin Lorentz
b163dc7566 httpserver: Fix Python 2 compatibility. 2015-09-24 15:38:42 +02:00
Valentin Lorentz
912d2e1538 core: Apply some suggestions of pyflakes. 2015-08-31 18:19:22 +02:00
Valentin Lorentz
a39238aba9 HTTP server: use two single-stack servers instead of a dual-stack one, and add a config variable to disable this behavior. Closes GH-945. 2015-08-22 13:10:03 +02:00
Valentin Lorentz
543732af3a Fix f8328be5cb so it actually does what it is supposed to do (lstrip removes characters). 2015-08-22 11:18:07 +02:00
Valentin Lorentz
21da27a846 Merge pull request #1155 from nyuszika7h/ipv4-mapped-addr-fix
httpserver: Strip IPv4-mapped IPv6 addresses
2015-08-21 22:41:33 +02:00
nyuszika7h
f8328be5cb httpserver: Strip IPv4-mapped IPv6 addresses 2015-08-21 22:39:49 +02:00
Valentin Lorentz
f45e2904f5 Merge remote-tracking branch 'mlq/fix/httpserver-read-content-length' into testing 2015-08-17 22:35:40 +02:00
Moritz Lipp
52bebde9df httpserver.py: Pass Content-Length to read call
If a POST request is sent to the built-in http server the handling function does
not terminate because the rfile.read() function blocks.

This patch passes the Content-Length value to the self.rfile.read() function
that is required for it to do not block the method.

Regarding RFC 2616
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4) the
Content-Length header is expected to be sent otherwise this patch assumes a zero
length.
2015-08-17 22:30:21 +02:00
Valentin Lorentz
c3a2c800f1 Remove need for 2to3. 2015-08-11 16:50:23 +02:00
Valentin Lorentz
c0ac84bb53 Remove need for fix_import, fix_types, and fix_urllib. 2015-08-10 17:55:25 +02:00
Valentin Lorentz
216c5d213f Replace sys.version_info[0] usages with minisix.PY{2,3}. 2015-08-09 00:23:03 +02:00
Valentin Lorentz
4470805b5f core: Remove useless imports. 2015-03-03 09:02:29 +01:00
Valentin Lorentz
1650860032 RSS: Do no block commands calling while loading a feed. 2014-10-14 20:59:00 +00:00
Valentin Lorentz
d431c2992b Factoids: Fix compatibility of web server with Python 3. Closes GH-784. 2014-08-04 13:21:40 +00:00
Mikaela Suomalainen
cedae0244c src/httpserver.py: use HTML5. 2014-05-25 13:50:39 +03:00
Valentin Lorentz
90a1208e9e httpserver: Fix crash if supybot.servers.http.favicon has not been set. 2014-04-15 18:39:44 +00:00
Valentin Lorentz
4d9a8a1408 httpserver: Open icon in binary mode. 2014-04-02 17:34:04 +00:00
Valentin Lorentz
048c1e77f4 httpserver: Fix favicon handling. 2014-04-02 17:18:45 +00:00
nyuszika7h
0934f1075b Merge branch 'testing' into fix/fd-leak 2014-01-03 17:45:53 +01:00
nyuszika7h
0e480b4e52 Fix file descriptor leaks 2014-01-03 17:44:01 +01:00
Valentin Lorentz
38d78a4213 httpserver: add method 'doHook' to callbacks. 2014-01-02 17:20:15 +00:00
Valentin Lorentz
4fffdbccd2 httpserver: Firewall do* methods. 2013-07-07 13:26:13 +02:00
Valentin Lorentz
eff7d5e671 Fix httpserver for Python 3. 2013-07-07 13:24:26 +02:00
Valentin Lorentz
74db03177f httpserver: Explicitely define the charset. 2013-06-01 10:32:36 +02:00
Valentin Lorentz
1a71fa2d81 httpserver: Fix Content-type of default.css which caused the stylesheet not to be applied. 2013-06-01 10:11:54 +02:00
Valentin Lorentz
792df99688 httpserver: Fix design. 2013-05-31 17:55:56 +02:00
Valentin Lorentz
b2d5544ccf httpserver: Fix restarting the server once a plugin has been unloaded and loaded back. 2013-05-31 17:55:35 +02:00
Valentin Lorentz
9ea1019970 httpserver: Fix issue with Python 2 if no favicon is set. 2013-05-31 16:12:49 +02:00
Valentin Lorentz
6493be1f13 httpserver: Add doctype. 2013-05-17 20:13:46 +02:00
Valentin Lorentz
916a85c965 core: Various Python 3 compatibility fixes. 2013-03-25 19:15:08 +01:00
Valentin Lorentz
5209cbc402 Prevent crash of httpserver in some requests. (Why? No idea.) 2013-03-21 17:31:53 +00:00
Valentin Lorentz
24252bc69f httpserver: Enhance design + customable CSS. Closes GH-404. 2013-03-11 19:44:26 +01:00
Valentin Lorentz
c4b9c80198 httpserver: Use new algorithm to load default templates. 2013-03-11 16:38:21 +01:00
Valentin Lorentz
83dd3a2fe8 Create config variable supybot.directories.data.web, and move robots.txt to this directory. 2013-03-09 20:52:35 +01:00
Valentin Lorentz
39b534246f Fix http server's tests. 2013-02-01 20:38:01 +01:00
Valentin Lorentz
784b8c37f8 httpserver: Add support for multiple hosts and IPv6. Closes GH-387. 2012-09-30 18:54:30 +02:00
Valentin Lorentz
c77c513e24 httpserver.py: Replace weird space by regular one. 2012-09-19 18:59:44 +00:00
Valentin Lorentz
eaf6877700 httpserver: Add favicon support. 2012-09-03 10:35:54 +02:00
Valentin Lorentz
be438b45c2 Add configuration variable supybot.servers.http.robots. 2011-10-29 12:13:09 +02:00
Valentin Lorentz
a87c096d69 Allow plugins to take over a subdirectory of the HTTP server. 2011-10-27 10:47:59 +02:00
Valentin Lorentz
a46176e3b1 Fix URL to plugins and default page charset in HTTP server. 2011-10-02 12:11:30 +02:00