d-a-v / ESPWebDAV

macOS, linux, windows: Natively sharing files - port 80 is shared
Other
40 stars 9 forks source link

[FEATURE REQUEST]ESP32 support #5

Open luc-github opened 3 years ago

luc-github commented 3 years ago

I know it may need some esp32 core update but any chance for ESP32 support ?

d-a-v commented 3 years ago

There are little updates done in esp8266 arduino core to enable web hooks. Unfortunately the PR is mixed with other internal changes. Functionality main changes are:

I guess the hook call in ESP 32 arduino would have to happen there.

Do you think you could make a PR of it ?

luc-github commented 3 years ago

So if I implement each steps - in theory it should be ok ? I give a try and report to you ^_^ thank you

d-a-v commented 3 years ago

So if I implement each steps - in theory it should be ok ?

It will be OK, no reason against it.

I forgot to mention the return type in

bool WebServer::_parseRequest(WiFiClient& client)

that must be changed to ClientFuture.

luc-github commented 3 years ago

ok noted - thank you 👍

luc-github commented 3 years ago

@d-a-v I did first part https://github.com/luc-github/arduino-esp32/commit/b5233795d7e61a2fc724397bb61db7065921bb41 seems working - I have followed your instructions even I have no idea of what I am doing ^_^

Testing with HelloServer.ino

/ and I got hello from esp32! in browser=>ok /dump and no answer in browser =>ok /yes and got proper answer

File Not Found

URI: /yes
Method: GET
Arguments: 0

On serial

Connected to WIFI_OFFICE_A2G
IP address: 192.168.1.61
MDNS responder started
HTTP server started
A useless web hook has passed
A useless web hook has passed
The dumper web hook is on the run
(<32> chars)Host: 192.168.1.61
Connection: (<32> chars)keep-alive
Upgrade-Insecure-Req(<32> chars)uests: 1
User-Agent: Mozilla/5.(<32> chars)0 (Windows NT 10.0; Win64; x64) (<32> chars)AppleWebKit/537.36 (KHTML, like (<32> chars)Gecko) Chrome/87.0.4280.88 Safar(<32> chars)i/537.36
Accept: text/html,appl(<32> chars)ication/xhtml+xml,application/xm(<32> chars)l;q=0.9,image/avif,image/webp,im(<32> chars)age/apng,*/*;q=0.8,application/s(<32> chars)igned-exchange;v=b3;q=0.9
Accep(<32> chars)t-Encoding: gzip, deflate
Accep(<32> chars)t-Language: fr-FR,fr;q=0.9,en-US(<19> chars);q=0.8,en;q=0.7

Telling server to forget this connection

Now checking WebDav code but I have realized that FS of ESP32 is different from ESP8266 so cannot be drop as it is , as well as all call related to ESP8266WebServer - I will check that part first before pushing PR to ESP32 core

d-a-v commented 3 years ago

The "hooked" way of using espwebdav imposes that the files on the filesystem are stored in /theHookedDirectory/. I understand that it is currently a limitation. Until this is improved, can you try to store files in the FS's directory /yes/ and check if you can see them in a webdav browser ?

luc-github commented 3 years ago

Sorry you misunderstood my test / is to check root /dump is the hook /yes was to go to not found handler so it is working as expect

So it is ok with Helloserver.ino, I have clarified my report

luc-github commented 3 years ago

hi here the POC https://github.com/luc-github/ESPWebDAV/commit/d949d6fe47a53c1e472af5bcd278bd54d3b3ffbd

I have some refresh problem - but not sure how to address it

luc-github commented 3 years ago

OK I have followed your advice and indeed debug was part of issue the other part was the File system difference SPIFFS esp32 is different to SPIFFS

Helloserver.ino => Ok Simple_esp32.ino =>Ok Hooked_esp32.ino => WebDav Not working - under investigation

d-a-v commented 3 years ago

the mkdir feature - it does not work

spiffs has no support for directories, but sdfs has. What FS did you try with ? Does esp32/arduino have littlefs (it has support for directories too).

luc-github commented 3 years ago

yes I know, I am trying with SPIFFS - ESP32 has SPIFFS/FAT /SD not yet LITTLEFS , it is planned in 2.0 but currently it can be used as external FS - I will try it later

I also suspect the pb with the hooked is also related with directory pb, a nice to have would be to separate the url from the real directory name for example use http://192.168.1.61/dav but map the / of the FS or /www/dav of FS not /dav

d-a-v commented 3 years ago

The "hooked" way of using espwebdav imposes that the files on the filesystem are stored in /theHookedDirectory/.

for example use http://192.168.1.61/dav but map the / of the FS or /www/dav of FS not /dav

That is a fair request

luc-github commented 3 years ago

still working on difference of FS here as example the output between the 2 littleFS

ESP8266 Little FS

>>>>>>>> dir /
1.PNG                                      0MiB     76KiB 77569
1.md                                       0MiB      0KiB 6
[Z]
[dav]
    0.txt                                      0MiB      0KiB 0
    1.txt                                      0MiB      0KiB 0
    2.txt                                      0MiB      0KiB 0
    Capture.PNG                                0MiB     76KiB 77569
    espconf.ini                                0MiB      2KiB 2239
    readme.md                                  0MiB      0KiB 6
<<<<<<<< dir
interactive: F/ormat D/ir C/reateFile
Heap stats: free heap: 46536 - max block: 46296 - fragmentation: 1%
interactive: F/ormat D/ir C/reateFile
Heap stats: free heap: 46536 - max block: 46296 - fragmentation: 1%

ESP32 LittleFS

>>>>>>>> dir /
/readme.md                                 0MiB      0KiB 6
/test.file                                 0MiB      0KiB 0
[/dav]
    ///dav/New Text Document.txt               0MiB      0KiB 0
    ///dav/www.txt                             0MiB      0KiB 0
<<<<<<<< dir
interactive: F/ormat D/ir C/reateFile
Heap stats: free heap: 356360
interactive: F/ormat D/ir C/reateFile
Heap stats: free heap: 356360

ESP32 SPIFFS

>>>>>>>> dir /
/readme.md                                 0MiB      0KiB 6
<<<<<<<< dir
interactive: F/ormat D/ir C/reateFile
Heap stats: free heap: 356620
interactive: F/ormat D/ir C/reateFile
Heap stats: free heap: 356620
luc-github commented 3 years ago

The simple_esp32.ino is ok The hooked_esp32.ino is still failing esp8266.log esp32.log Esp32 do not have HTTP_HEAD neither keepAlive connection - so I think I have added them but I may still miss one part to make the connection to succeed here the esp32 webserver modified https://github.com/luc-github/arduino-esp32/commits/webserver-hook/libraries/WebServer

I do not know what is missing 😭

agoy507 commented 3 years ago

How wiring sdcard to esp32 ? how configuration pin on sourcecode? can you describe ?

d-a-v commented 3 years ago

SD cards have mmc emulation. It's on the SPI bus. You need one of the SPI buses (MISO, MOSI, CLK) and another unused GPIO for CS.

agoy507 commented 3 years ago

thanks :D