jow- / luci-ng

LuCI on Angular
84 stars 26 forks source link

backup page with chromium #10

Closed feckert closed 8 years ago

feckert commented 8 years ago

Hello Jow,

i have some problem with the backup page you recently merged from my PR. If i press the download in Chromium i don't get an respond. But the page works in Firefox/IE. Do you have any suggestion what the problem might be?

Regards

Flo

feckert commented 8 years ago

Hello Jow,

I think the problem is the missing Content-Length. Chromium is there a bit picky. I think ther are 2 opinions:

  1. Add Content-Length header to the output, but for this the backup could not generated on the fly with "-".
  2. Add "Transfer-Encoding: chuncked" to the header. Backup could be as it is now.

I have played around with the second method. But if i use wireshark there are some strange behavior in the output?

I have added the changed code to my github: https://github.com/feckert/luci-ng/tree/transfer-encode

This is the output from wireshark

POST /cgi-bin/luci-backup HTTP/1.1 Host: 192.168.0.1:8080 Connection: keep-alive Content-Length: 42 Pragma: no-cache Cache-Control: no-cache Accept: / Origin: http://192.168.0.1:8080 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Content-Type: application/x-www-form-urlencoded Referer: http://192.168.0.1:8080/ Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.8 Cookie: l2-session=5defcc5f089147aafdf479467a861b00

sessionid=5defcc5f089147aafdf479467a861b00HTTP/1.1 200 OK Connection: close Transfer-Encoding: chunked Content-Type: application/x-targz Transfer-Encoding: chunked

FAF Content-Disposition: attachment; filename="backup-ESU4000-2016-06-06.tar.gz"

1000

The Problem is that for example in the output above the valeu "FAF" should not be there! And in some other lines ( i have not posted) there are some outputs as well which should not be there! They corrupt the output!

Is there an other process for example uhttpd who sends also any keys back to the client? Or do i understand some thing wrong?

Kind Regards

Flo