Http post max size

MattiaBerton
Posts: 3
Joined: Thu Aug 30, 2018 8:16 am

Http post max size

Postby MattiaBerton » Mon Mar 11, 2019 8:20 am

Hello,
I have a webserver which handles some GET and POST action. With the POST action, if I have a small content length I receive the packets, but when the content length gets bigger, I receive a null body.

I there a limit to the max content length I can receive? Is there a way to increase it?

Thank you,
Mattia

MattiaBerton
Posts: 3
Joined: Thu Aug 30, 2018 8:16 am

Re: Http post max size

Postby MattiaBerton » Mon Mar 11, 2019 3:39 pm

Hello,
I'm adding some more information to better understand the problem: I use a structure like this:

Code: Select all

	err = netconn_recv(conn, &inbuf);

	if (err == ERR_OK) {
	  
		// get the request and terminate the string
		netbuf_data(inbuf, (void**)&buf, &buflen);
		buf[buflen] = '\0';
		
		// get the request body and the first line
		char* body = strstr(buf, "\r\n\r\n");
		char *request_line = strtok(buf, "\n");
		
		if (request_line) {
		....
		}
I see that the netbuf receive only the first 457 bytes, but not all the packet as I would like (around 7000 bytes). If I call more times

Code: Select all

err = netconn_recv(conn, &inbuf);
I see that I receive what I'm missing, but I don't like such a clumsy way to solve the received data problem...

Do you have any idea?

gecko242
Posts: 12
Joined: Tue Oct 02, 2018 7:11 am

Re: Http post max size

Postby gecko242 » Mon Mar 11, 2019 4:59 pm

This is familiar! I have this exact problem.

I currently see if my length is between 400 and 600, and if I am after more data, I call netconn_recv() again.
Whilst I have used this successfully on large (1MB+) WAV files, I too feel that this is clumsy and there must be a better way.

That being said, I have not had a chance to properly look into it. I would be very interested in any info that people might have..

Cheers,
Sam

gecko242
Posts: 12
Joined: Tue Oct 02, 2018 7:11 am

Re: Http post max size

Postby gecko242 » Thu Mar 21, 2019 8:55 am

Okay, spurred on by this post I have migrated my application webserver over to using the official HTTPD web server component.
It seems to be much more responsive than my previous implementation of netconn/lwip.

https://docs.espressif.com/projects/esp ... erver.html

The library is nice and easy to use, it only took me a few hours to get it all up and running.

Who is online

Users browsing this forum: No registered users and 21 guests