Http post file (multipart).

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Http post file (multipart).

Postby snahmad75 » Wed Jun 13, 2018 11:25 am

Hi,
Http post file (multi part) is not implemented.

HttpServer class does not support file post.

Have any one implement its own.

class MyMultiPart is commented out in https://github.com/nkolban/ESP32_Explorer


Thanks,
Naeem

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: Http post file (multipart).

Postby snahmad75 » Thu Jun 14, 2018 10:39 am

Sending large file cause stack overflow. I guess HttpServer does not handle multi-part.

D (1451808) HttpServerTask: HttpServer that was listening on port 80 has received a new client connection; sockFd=4098
D (1451819) HttpParser: >> parse: socket: fd: 4098
D (1451825) HttpParser: >> parseRequestLine: "POST /upload_file HTTP/1.1" [26]
D (1451831) HttpParser: << parseRequestLine: method: POST, url: /upload_file, version: HTTP/1.1
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception)
Debug exception reason: Stack canary watchpoint triggered (HttpServerTask)

Backtrace: 0x4000c350:0x3ffcf300 0x401436ab:0x3ffcf310 0x4013d2f9:0x3ffcf330 0x4013db3d:0x3ffcf3b0 0x4013dbae:0x3ffcf3e0 0x4010c753:0x3ffcf400 0x4010f9fe:0x3ffcf430 0x4010d82a:0x3ffd4080 0x40109e2a:0x3ffd4310 0x4010c2a0:0x3ffd4420
0x401436ab: pbuf_copy_partial at C:/Work/LibDev/esp32/esp-idf/components/lwip/core/pbuf.c:1247

0x4013d2f9: lwip_recvfrom at C:/Work/LibDev/esp32/esp-idf/components/lwip/api/sockets.c:1814

0x4013db3d: lwip_recvfrom_r at C:/Work/LibDev/esp32/esp-idf/components/lwip/api/sockets.c:1814

0x4013dbae: lwip_recv_r at C:/Work/LibDev/esp32/esp-idf/components/lwip/api/sockets.c:1814

0x4010c753: Socket::receive(unsigned char*, unsigned int, bool) at C:/Work/LibDev/esp32/esp-idf/components/cpp_utils/Socket.cpp:245

0x4010f9fe: HttpParser::parse(std::shared_ptr) at C:/Work/LibDev/esp32/esp-idf/components/cpp_utils/HttpParser.cpp:219

0x4010d82a: HttpRequest::HttpRequest(std::shared_ptr) at C:/Work/LibDev/esp32/esp-idf/components/cpp_utils/HttpRequest.cpp:98

0x40109e2a: HttpServerTask::run(void*) at C:/Work/LibDev/esp32/esp-idf/components/cpp_utils/HttpServer.cpp:323

0x4010c2a0: Task::runTask(void*) at C:/Work/LibDev/esp32/esp-idf/components/cpp_utils/Task.cpp:59

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: Http post file (multipart).

Postby snahmad75 » Thu Jun 14, 2018 3:59 pm

Can any one answer this thread. I am struggling handling upload file.

Any free open source to parse multipart/form http post request and extract file content.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: Http post file (multipart).

Postby snahmad75 » Mon Jun 18, 2018 9:22 pm

WebServer c++ class which is based on mongoose handle multi-part http request. it works.

I need same functionality in HttpServer class. Can any one suggest where i can get buffer with file content with multiple request.
and pass to my Multi-part parser.

Wireshark is not helping. it does not shows upload file content chunk by chunk for unsecured http.

dinosauria123
Posts: 5
Joined: Fri Oct 05, 2018 6:10 pm

Re: Http post file (multipart).

Postby dinosauria123 » Fri Oct 05, 2018 6:12 pm

Any progress ?
I am also interesting about it.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: Http post file (multipart).

Postby snahmad75 » Sat Oct 06, 2018 11:17 am

I am using Mongoose web server. It is working good.

dinosauria123
Posts: 5
Joined: Fri Oct 05, 2018 6:10 pm

Re: Http post file (multipart).

Postby dinosauria123 » Tue Oct 09, 2018 7:32 am

Thank you for your comment.

Did you just copy mongoose.c and mongoose.h files to your build tree ?
Did you have uploaded your code somewhere ?

I try to upload jpag data from M5camera to my Node-RED server.
I could post partial base64 data to sever, but the base64 data is too big,
I need multipart upload.....

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: Http post file (multipart).

Postby snahmad75 » Tue Oct 09, 2018 1:06 pm

I am using Kolban c++ class.

https://github.com/nkolban/esp32-snippe ... Server.cpp which encapsulate mongoose.

I tweak few things. by and large. It is same as above.
Multipart upload works for me.

Try first above class. It not working I can share my modified version of WebServer.cpp and WebServer.ch


Thanks,
Naeem

dinosauria123
Posts: 5
Joined: Fri Oct 05, 2018 6:10 pm

Re: Http post file (multipart).

Postby dinosauria123 » Tue Oct 09, 2018 11:33 pm

Thank you for the link.

I will add mongoose codes to my project.

Here's my M5Camera code without POST. (article written in Japanese)

https://qiita.com/dinosauria123/items/c ... 23dc916609

Thank you again for your helps !

dinosauria123
Posts: 5
Joined: Fri Oct 05, 2018 6:10 pm

Re: Http post file (multipart).

Postby dinosauria123 » Fri Oct 12, 2018 1:09 am

I found two API http_response_begin_multipart(), http_response_end_multipart() in esp32-http-server.

https://github.com/igrr/esp32-http-server/

This may help implement http multipart.

Who is online

Users browsing this forum: Bing [Bot] and 179 guests