Code Monkey home page Code Monkey logo

webserver_tng's Introduction

WebServer

ESP8266/ESP32 WebServer library

This is an experimental port of the ESP8266WebServer library that should work on ESP8266 and ESP32. This is NOT an official repo supported by Espressif. Do not depend on this code for anything important or expect it to be updated. Once the official repo is created, this repo will be deleted.

Added Travis CI

webserver_tng's People

Contributors

bbx10 avatar dottoretozzi avatar earlephilhower avatar teejaydub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webserver_tng's Issues

SDWebServer

Example SDWebServer. When I try to open in a browser index.htm the port monitor displays the message "Sent less data than expected!"
dataFile: 1 dataType: text/html dataFile.size(): 451

serving page from flash stops after 5727 bytes

I serve static html code directly from flash (PSTR()), for example an approx. 6KB big style.css file. But the html code is not sent beyond 5727 bytes.

The exact same html code worked on ESP8266.

For testing purposes is split the CSS file into two smaller parts, and everything started to work smoothly.

wdt got triggered when using arduino-esp32 as esp-idf component

Task watchdog got triggered. The following tasks did not feed the watchdog in time:
Tasks currently running:
CPU 0: loopTask

This happens every 5 secs (Default) while running "HelloServer" Example on ESP32

the quickest fix i can think is to add

vTaskDelay(1 / portTICK_RATE_MS);

in loop()

Mem corruption, when POSTing form with more the 32 args

in bool WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len) { there is a hard limit of 32 arguments in the form. unfortunately this is not guarded against and leads to silent memory corruption, if a form contains more. The crash will happen some time later at a completely unrelated place in the code.

I think this bug is present ever since in the WebServer also on the ESP8266.

Dynamically expanding the argument array might be overkill, but we could make the upper limit configurable and stop the parser when postArgsLen++ reaches that limit (also logging an error message)?

Wrong HTTPupload size member semantics

IMHO the semantics of HTTPupload.currentSize and HTTPupload.totalSize are wrong or at least highly misleading.

now we get the size of the last chunk of data in currentSize and the number of bytes received so far in totalSize. But currentSize as it is, is pretty useless and we really want the know how big the file is going to be once complete (for correct progress calculation and for checking filesystem requirements).

i suggest to make currentSize what totalSize is now and put the Content-Length header arg in totalSize.

does this sound reasonable?

Multithreading with AdvancedWebServer?

Thanks for your contribution, as someone new to the ESP32 environment this set of WebServer examples was really helpful!

In using AdvancedWebServer, I have a bit of javascript to reload the SVG every 250msec, and then added in some quick code to receive data from a sensor and populate the graph with this data. Every 2000msec the data is read and stored in a buffer, and on request for the SVG the contents of the buffer are used for the Y values instead of the random values. I believe the code to read the sensor is fairly light weight (tens to a few hundred msec).

I've noticed that when actually reading real values, the server ends up missing most of the requests. It seems to work a bit better when reducing the update from 250msec to 1000msec, and placing the server and sensor code in separate FreeRTOS tasks doesn't appear to help much.

My question is: is there a canonical or suggested method for pairing this webserver with other tasks that require non-zero time, so that it doesn't miss requests?

thanks again,
Peter

SDWebServer.ino

209 output += entry.name(); del
209 output += String(entry.name()).substring(1); add

SPIFFS on ESP32 ?

Hi.

Does serving static pages from SPIFFS work in this lib on the ESP32 ?

server.serveStatic("/", SPIFFS, "/index.htm"); 

I have a file index.htm on the / of the ESP but nothing happens when I call the server with a browser.

HTTPMethod enum causes conflicts with ESPAsyncWebServer

Thank you very much for porting this to ESP32!

In one of my projects, I'm using ESPAsyncWebServer, which also defines a non-class enum for HTTP_GET, etc. I wanted to use WiFiManager as well, but since that pulls in WebServer, I was getting conflicts for these constants.

I re-defined these constants in WebServer_tng using enum class, which resolved the issue. Changes are here:

sidoh@75d2645

Happy to open a PR, but since this affects consumers (they'd need to reference these constants using the HTTPMethod:: namespace), I figured an issue would be more appropriate.

Download time

WebServer_tng

WebServer
update?

Update: upload_SPIFFS_esp32.ino.esp32.bin
Update Success: 530304 B
Download time: 59 sec.
Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c

WebServer
update! 

ESPAsyncWebServer

AsyncWebServer
update?

Update Start: sketch_nov04a.ino.esp32.bin
Update Success: 515152 B
Download time: 1 sec.
Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c

AsyncWebServer
update!

difference of 58 seconds, is this normal !?

WebServer.pcapng
AsyncWebServer.pcapng

WebUpdate.ino

ESP32
WebUpdate:40: error: 'Update' was not declared in this scope (add #include <Update.h> ?)
WebUpdate:46: error: 'stopAll' is not a member of 'WiFiUDP'
WebUpdate:48: error: 'class EspClass' has no member named 'getFreeSketchSpace'

esp32 wrong constructor, server port set to ipaddress first octet

esp32 wifiserver only has this

  WiFiServer(uint16_t port=80, uint8_t max_clients=4):sockfd(-1),_accepted_sockfd(-1),_port(port),_max_clients(max_clients),_listening(false),_noDelay(false){}

so :


WebServer::WebServer(IPAddress addr, int port)
: _server(addr, port)

set ports to ipaddr first octet xxx. instead of port

parsearguments when content = 0

apply fix to parsearguments when no contentlength, same as esp8266

} else {
        // No content - but we can still have arguments in the URL.
        _parseArguments(searchStr);
      }

Can any one tell me how to solve this, multiple libraries ?

i get this error now ?

Arduino: 1.8.5 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default, QIO, 80MHz, 4MB (32Mb), 921600, None"

In file included from C:\Users\Guest One\Documents\Arduino\libraries\WIFIMANAGER-ESP32-master\examples\AutoConnect\AutoConnect.ino:14:0:

C:\Users\Guest One\Documents\Arduino\libraries\WIFIMANAGER-ESP32-master/WiFiManager.h:36:22: error: 'const char HTTP_HEAD []' redeclared as different kind of symbol

const char HTTP_HEAD[] PROGMEM = "<html lang="en"><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/><title>{v}</title>";

                  ^

In file included from C:\Users\Guest One\Documents\Arduino\hardware\espressif\esp32\libraries\WebServer\src/WebServer.h:30:0,

             from C:\Users\Guest One\Documents\Arduino\libraries\WIFIMANAGER-ESP32-master\examples\AutoConnect\AutoConnect.ino:12:

C:\Users\Guest One\Documents\Arduino\hardware\espressif\esp32\libraries\WebServer\src/HTTP_Method.h:10:3: note: previous declaration 'HTTPMethod HTTP_HEAD'

HTTP_HEAD = 0b00100000,

^

Multiple libraries were found for "WiFi.h"
Used: C:\Users\Guest One\Documents\Arduino\hardware\espressif\esp32\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Multiple libraries were found for "WebServer.h"
Used: C:\Users\Guest One\Documents\Arduino\hardware\espressif\esp32\libraries\WebServer
Not used: C:\Users\Guest One\Documents\Arduino\libraries\WebServer_tng-master
exit status 1
Error compiling for board ESP32 Dev Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Sd card not Detected on the server

I uploaded the SDWebServer library to my NodeMCU. The server does start but on the server it shows 'SD card not Detected'. What changes should I make in the code?

error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.