Skip to content

WebServer #2020

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

Closed
MartinDavidWaller opened this issue Nov 5, 2018 · 8 comments
Closed

WebServer #2020

MartinDavidWaller opened this issue Nov 5, 2018 · 8 comments
Assignees
Labels
Area: BT&Wifi BT & Wifi related issues Status: Solved

Comments

@MartinDavidWaller
Copy link

MartinDavidWaller commented Nov 5, 2018

Hi,

I've recently moved some code from the NodeMCU environment to the ESP32 environment and I've found something very odd with the WebServer code. I've refreshed my sources from today and it still fails.

I have an index.html file stored in SPIFFS that contains the header:

<link rel="stylesheet" type="text/css" href="styles.css" media="all" />
<script type="text/javascript" src="jquery-3.2.1.min.js"></script>

The server code makes use of the standard pattern:

server.onNotFound([]() {    

  // Try to send the file requested
  
  if (!handleFileRead(server.uri())) {

    // We have not located the file, return not found.
    
    server.send(404, "text/plain", "404: Not Found");  
  }
});

and the handlerFileRead method starts with:

bool handleFileRead(String path) {

// A request has come in for a file, we can process that here.

Serial.println("");
Serial.println("File requested:" + path);

This all seems to work fine, the index.html file is served as expected and the styles.css file is severed as expected. The jquery-3.2.1.min.js request is never server when requested via the index.html page? Seemingly the request never gets as far as the handlerFileRead method.

However, if I request the jquery-3.2.1.min.js file directly then it works.

It's almost as if it can't handle all the requests from the index.html page. Using Chrome to try and debug this I can see the request going out correctly from index.html but Chrome shows no response?

I wonder if anyone else has similar issues. This worked fine on the NodeMCU device.

Any help / guidance much appreciated.

Martin

@MartinDavidWaller
Copy link
Author

ESP32Failure.zip

Hi, the attached Sketch will demonstrate the issue. You will need to upload the data folder to the SPIFFS and then connect to the SSID "Hello" and browse to 192.168.4.1. If you then look at the output and the developer console in Chrome you'll see the failure to download jquery...

Martin

@MartinDavidWaller
Copy link
Author

The chip being used is the ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB external flash.

@tfry-git
Copy link

I suspect this may be the same issue as #1921 . Likely the browser requests the .js file, while index.html is still loading. That will currently not work. You could try moving the <script>-tag all the way to the end of index.html (it's allowed anywhere in HTML), perhaps that will defer the loading long enough.

@stale
Copy link

stale bot commented Aug 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 1, 2019
@stale
Copy link

stale bot commented Aug 15, 2019

This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Aug 15, 2019
@PilnyTomas PilnyTomas reopened this Mar 31, 2022
@PilnyTomas
Copy link
Contributor

PilnyTomas commented Mar 31, 2022

Hello @MartinDavidWaller .
There has been a recent update (v 2.0.3-RC1) which should fix lots of WiFi issues.
I tried your sketch with the new version and it seems ok.
Could you please try it out and let us know?

@PilnyTomas PilnyTomas self-assigned this Mar 31, 2022
@VojtechBartoska VojtechBartoska added Area: BT&Wifi BT & Wifi related issues Resolution: Awaiting response Waiting for response of author and removed Status: Stale Issue is stale stage (outdated/stuck) labels Mar 31, 2022
@VojtechBartoska VojtechBartoska moved this to Under investigation in Arduino ESP32 Core Project Roadmap Apr 6, 2022
@VojtechBartoska
Copy link
Contributor

Ping

@VojtechBartoska
Copy link
Contributor

Closing as solved, if you still face the issue, please reopen it. Thanks for understanding.

Repository owner moved this from Under investigation to Done in Arduino ESP32 Core Project Roadmap May 4, 2022
@VojtechBartoska VojtechBartoska added Status: Solved and removed Resolution: Awaiting response Waiting for response of author labels May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BT&Wifi BT & Wifi related issues Status: Solved
Projects
Development

No branches or pull requests

4 participants