Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug safari with Content-Encoding: gzip and Content-Disposition #16

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

xlyric
Copy link

@xlyric xlyric commented Apr 27, 2023

hi,

the header Content-Disposition create a bug in this case :
explorer : Safari

html page called in mode gzip ( HTTP compress )
(
GET /index.html HTTP/1.1
Host: xxx
Accept-Encoding: gzip )

the librairie return a wrong"Content-Disposition" and expose a file who was not rerouted
ex :

void compress_html(AsyncWebServerRequest *request,String filefs , String format ) {
      AsyncWebServerResponse *response = request->beginResponse(SPIFFS, filefs, format);
      response->addHeader("Content-Encoding", "gzip");
      response->addHeader("Cache-Control", "max-age=604800");
      request->send(response);
}

 server.on("/",HTTP_GET, [](AsyncWebServerRequest *request){
    if(SPIFFS.exists("/index.html.gz")){
      compress_html(request,"/index-ap.html.gz", "text/html");
    }

the response header is wrong

Accept-Ranges: none
Cache-Control: max-age=604800
Connection: close
Content-Disposition: inline; filename="index.html.gz"
Content-Encoding: gzip
Content-Length: 3890
Content-Type: text/html

and Content-Disposition: is not usefull in this case.

on all navigator except safari, the navigator skip this line. Safari try to call the wrong file.

@mathieucarbou
Copy link

mathieucarbou commented Jun 20, 2024

@jesserockz : FYI @xlyric also warned me about this bug and the fix is something else:

mathieucarbou@cfbe38c

No filename after inline in Content-Disposition header according to RFC2183.

It is fixes in my fork https://github.com/mathieucarbou/ESPAsyncWebServer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants