HelloZeroNet / ZeroNet

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network
https://zeronet.io
Other
18.37k stars 2.27k forks source link

Can't GET any of ZeroSites #752

Closed kavamaken closed 7 years ago

kavamaken commented 7 years ago

For some time, i've noticed that any of my tries to GET any of Zeronet pages causes to 500 server error. I've noticed it only after 1800 build, but it could start before.

Server error

Err: KeyError: 'HTTP_ACCEPT' in UiServer.py line 81 > UiRequest.py line 82 > UiRequest.py line 199

Please report it if you think this an error.

Details:

{ "GATEWAY_INTERFACE": "CGI/1.1", "HTTP_CONNECTION": "TE, close", "HTTP_HOST": "127.0.0.1:43110", "HTTP_TE": "deflate,gzip;q=0.3", "HTTP_USER_AGENT": "Qzja-bot/0.1", "PATH_INFO": "/Stats", "QUERY_STRING": "", "REMOTE_ADDR": "127.0.0.1", "REMOTE_PORT": "33056", "REQUEST_METHOD": "GET", "SCRIPT_NAME": "", "SERVER_NAME": "kontur3", "SERVER_PORT": "43110", "SERVER_PROTOCOL": "HTTP/1.1", "SERVER_SOFTWARE": "gevent/1.1 Python/2.7", "arguments": { "action": "main", "batch": false, "bit_resolver": "1Name2NXVi1RDPDgf5617UoW7xA6YrhM9F", "coffeescript_compiler": "type %s | tools\coffee\coffee.cmd", "config_file": "zeronet.conf", "connected_limit": 6, "data_dir": "data", "debug": false, "debug_gevent": false, "debug_socket": false, "disable_db": false, "disable_encryption": false, "disable_sslcompression": true, "disable_udp": false, "fileserver_ip": "*", "fileserver_port": 15441, "fix_float_decimals": false, "homepage": "1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D", "ip_external": null, "keep_ssl_cert": false, "language": "ru", "log_dir": "log", "max_files_opened": 2048, "msgpack_purepython": true, "open_browser": "default_browser", "optional_limit": "10%", "proxy": null, "size_limit": 10, "stream_downloads": false, "tor": "enable", "tor_controller": "127.0.0.1:9051", "tor_proxy": "127.0.0.1:9050", "trackers": [ "zero://boot3rdez4rzn36x.onion:15441", "zero://boot.zeronet.io#f36ca555bee6ba216b14d10f38c16f7769ff064e0e37d887603548cc2e64191d:15441", "udp://tracker.coppersurfer.tk:6969", "udp://tracker.leechers-paradise.org:6969", "udp://9.rarbg.com:2710", "http://tracker.tordb.ml:6881/announce", "http://explodie.org:6969/announce", "http://tracker1.wasabii.com.tw:6969/announce" ], "trackers_file": false, "ui_ip": "127.0.0.1", "ui_port": 43110, "ui_restrict": false, "updatesite": "1UPDatEDxnvHDo7TXvq6AEBARfNkyfxsp", "use_openssl": true, "use_tempfiles": false, "verbose": false }, "plugins": [ "AnnounceZero", "CryptMessage", "MergerSite", "Newsfeed", "OptionalManager", "PeerDb", "Sidebar", "Stats", "TranslateSite", "Trayicon", "Zeroname" ], "version_gevent": "1.1.2", "version_python": "2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)]", "version_zeronet": "0.5.1 r1806", "wsgi.url_scheme": "http" }

MuxZeroNet commented 7 years ago

You need to add an Accept header:

curl -H "Accept: text/html" http://127.0.0.1:43110/Stats
requests.get('http://127.0.0.1:43110/Stats', headers = {"Accept": "text/html"}).text

ZeroNet now needs this header to check for XSS requests. You can refer to #728.

kavamaken commented 7 years ago

My bad, thanks for pointing me. Must do more searching...