Page 1 of 1

Http post max size

Posted: Mon Mar 11, 2019 8:20 am
by MattiaBerton
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,

Re: Http post max size

Posted: Mon Mar 11, 2019 3:39 pm
by MattiaBerton
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?

Re: Http post max size

Posted: Mon Mar 11, 2019 4:59 pm
by gecko242
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..


Re: Http post max size

Posted: Thu Mar 21, 2019 8:55 am
by gecko242
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. ... erver.html

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