If you are asking about how to change your installation of Firefox then try this... Type about:config
in the address bar. Click past the "void your warranty" page if one appears. Change network.http.version
to 1.1
Как заставить Firefox использовать HTTP / 1.1
В Python есть этот веб-сервер (код см. В конце поста). Всякий раз, когда Firefox подключается, веб-сервер сообщает HTTP / 1.0.
*.*.*.* - - [17/Feb/2016 15:50:59] "GET /?size=100 HTTP/1.0" 200 -
С wget
HTTP / 1.1 используется:
*.*.*.* - - [17/Feb/2016 15:16:37] "GET /?size=488 HTTP/1.1" 200 -
С netcat
:
$ nc *.*.*.* 8000 GET ?size=10 HTTP/1.1 HTTP/1.1 200 OK Server: BaseHTTP/0.3 Python/2.7.10 Date: Wed, 17 Feb 2016 14:58:48 GMT Content-Length: 10 [content]
а также
$ nc *.*.*.* 8000 GET ?size=20 HTTP/1.0 HTTP/1.1 200 OK Server: BaseHTTP/0.3 Python/2.7.10 Date: Wed, 17 Feb 2016 14:58:59 GMT Content-Length: 20 [content]
Как Firefox можно сказать использовать HTTP / 1.1?
"""HTTP Server which generates pseudo-random traffic.""" import BaseHTTPServer import cgi import random import SocketServer import string class ThreadingSimpleServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): pass class TrafficHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): """Server which only generates traffic.""" def do_POST(self): """Does the same thing as GET.""" try: self._gen_traffic(self._find_size_post()) except (KeyError, ValueError): self._fail() def do_GET(self): """Generate traffic as per size parameter. If no size parameter is given, fail. """ try: self._gen_traffic(self._find_size_get()) except (IndexError, ValueError): self._fail() def _find_size_get(self): """Returns the value of the size parameter.""" paramstring = self.path.split('?')[1] for parampair in paramstring.split('&'): (var, val) = parampair.split('=') if var == 'size': return int(val) raise IndexError('no size parameter') def _find_size_post(self): """Returns the value of the size parameter.""" ctype, pdict = cgi.parse_header(self.headers.getheader('content-type')) if ctype == 'multipart/form-data': postvars = cgi.parse_multipart(self.rfile, pdict) elif ctype == 'application/x-www-form-urlencoded': length = int(self.headers.getheader('content-length')) postvars = cgi.parse_qs(self.rfile.read(length), keep_blank_values=1) else: raise KeyError('wrong input format: ' + ctype) return int(postvars['size']) def _fail(self): """Returns HTTP error message""" self.send_error(400, "Bad Request: could not parse the size parameter") # td: background thread def _gen_traffic(self, size): """Generate size bytes of traffic""" self.send_response(200) self.send_header("Content-Length", size) self.end_headers() self.wfile.write(''.join(random.choice(string.printable) for _ in range(size))) def test(HandlerClass = TrafficHTTPRequestHandler, ServerClass = ThreadingSimpleServer, protocol="HTTP/1.1"): '''starts server with default parameters''' import sys if sys.argv[1:]: port = int(sys.argv[1]) else: port = 8000 server_address = ('', port) HandlerClass.protocol_version = protocol httpd = ServerClass(server_address, HandlerClass) try: while 1: sys.stdout.flush() httpd.handle_request() except KeyboardInterrupt: print "Finished" if __name__ == '__main__': test()
2 ответа на вопрос
It turns out @Porcupine911's link pointed to a solution. It is reported wrongly on the server side (but only for a remote Firefox, weirdly). The solution was to use the Live HTTP Headers addon, which showed that Firefox sends a HTTP/1.1 request,
GET /?size=100 HTTP/1.1
to which the server responds with HTTP/1.1,
HTTP/1.1 200 OK
just reporting it as
"GET /?size=100 HTTP/1.0" 200 -
The error was somewhere in the network, as a Firefox on the server was reported as HTTP/1.1. This was also the cause in @Porcupine911's mozillazine.org link, where
The Mozilla debug logs show that the browser is requesting HTTP/1.1, but somewhere in between me and [the server] it's getting downgraded.
Accept to @Porcupine911, as he showed the way to a solution.
Похожие вопросы
-
3
Установите Silverlight для Mozilla Firefox без прав администратора
-
8
Firefox PDF плагин для просмотра PDF в браузере на Windows
-
2
Ограничить использование процессора для Flash в Firefox?
-
-
6
Почему Firefox в Linux выглядит иначе, чем Windows / Mac?
-
13
Как получить новую сессию браузера при открытии новой вкладки или окна в Firefox / Chrome?
-
2
Firefox печать в PDF-файл
-
4
Firefox 3.5 медленно, чтобы начать выпуск
-
4
Почему нет 64-битной сборки Linux Firefox?
-
3
Как я могу сказать Firefox для доступа к интрасети
-
1
Как мне создать собственную сборку Firefox, которая содержит настройки?