http - Safari render HTML as received -


when load html page have 5 strings written second apart.

<br>1</br> ...... 1 second ...... <br>2</br> ...... 1 second ...... <br>3</br> ...... 1 second ...... <br>4</br> ...... 1 second ...... <br>5</br> ...... 1 second ......  --- end request --- 

chromium , firefox both load , display first br next received. (firefox requires content encoding however). safari refuses display of tags until request ended.

chromium seems it.

firefox first needs determine content encoding https://bugzilla.mozilla.org/show_bug.cgi?id=647203

but safari seems refuse. different response code or header needed? try setting explicitly content type text/html. didn't work.

i have confirmed in wireshark strings being sent second apart, i.e not being cached , sent @ once.

i have confirmed occurs if go through localhost or use public ip address.

i have tried content-length , keep alive, former closes request automatically, latter seems have no effect.

headers , responses wireshark

firefox (working)

get /pe http/1.1 host: 127.0.01:8080 user-agent: mozilla/5.0 (macintosh; intel mac os x 10.10; rv:42.0) gecko/20100101 firefox/42.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip, deflate dnt: 1 connection: keep-alive cache-control: max-age=0  http/1.1 200 ok transfer-encoding: chunked date: tue, 10 nov 2015 17:10:20 gmt connection: keep-alive content-type: text/html; charset=utf-8 server: twistedweb/13.2.0  1f <html> <title>pe</title> <body> 2e  <br> 1th time i've written. </br> 2e  <br> 2th time i've written. </br> 2e  <br> 3th time i've written. </br> 2e  <br> 4th time i've written. </br> 2e  <br> 5th time i've written. </br> 8  </body> 8  </html> 0 

safari (not working)

get /pe http/1.1 host: 127.0.0.01:8080 accept-encoding: gzip, deflate accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 user-agent: mozilla/5.0 (macintosh; intel mac os x 10_10_5) applewebkit/601.1.56 (khtml, gecko) version/9.0 safari/601.1.56 accept-language: en-us dnt: 1 connection: keep-alive  http/1.1 200 ok transfer-encoding: chunked date: tue, 10 nov 2015 17:12:55 gmt connection: keep-alive content-type: text/html; charset=utf-8 server: twistedweb/13.2.0  1f <html> <title>pe</title> <body> 2e  <br> 1th time i've written. </br> 2e  <br> 2th time i've written. </br> 2e  <br> 3th time i've written. </br> 2e  <br> 4th time i've written. </br> 2e  <br> 5th time i've written. </br> 8  </body> 8  </html> 0 

demo

import twisted twisted.python import log import sys  log.startlogging(sys.stdout) twisted.web.server import site, not_done_yet twisted.web.resource import resource twisted.internet import reactor    class persistantexample(resource):     '''gives example of persistant request'''     # not exist on safari until stopping browser / ending connection      isleaf = true     def render_get(self, request):         log.msg("ooooh render request")         # schedule reoccuring thing (this else deferred result)          reactor.calllater(1.1, self.keeps_going, request, 0) # 1.1 seconds show can take floats          # firefox require char set see https://bugzilla.mozilla.org/show_bug.cgi?id=647203         request.responseheaders.addrawheader("content-type",         "text/html; charset=utf-8") # set mime header (charset needed firefox)          # cause connection keep open x length         # (only helpful if length known, not make render right away)         # request.responseheaders.addrawheader("content-length", "150")          request.write("<html>\n<title>pe</title>\n<body>")         return not_done_yet       def keeps_going(self, request, i):         log.msg("i'm going again....")         = + 1         request.write("\n<br> %sth time i've written. <br>" % i) ## not best use <br> tag          if < 5:             reactor.calllater(1.1, self.keeps_going, request, i) # 1.1 seconds show can take floats         if >= 5 , not request.finished:             log.msg("done")             request.write("\n</body>")             request.write("\n</html>")             # safari render when finished             request.finish()   class root(resource):     isleaf = false     def render_get(self, request):         return "<html><body>demo <a href=\"pe\">here</a></body></html>"     class site(site):     pass    root = root() pe = persistantexample() site = site(root)  root.putchild("", root) root.putchild("index", root) root.putchild("pe", pe)  # listen if __name__ == "__main__":     reactor.listentcp(8080, site)     reactor.run() 

use <br /> or <br> instead of </br> not valid tag.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -