HTTPD POST usage help and clarification

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

HTTPD POST usage help and clarification

Mario Luzeiro
Hi all,

I'm looking to use POST messages.
I found the lwip/httpd/post_example that I based my implementation.

it works ok so far, but some questions:
- I found in function http_post_rxpbuf the following comment:
"* ATTENTION: The application is responsible for the pbuf now, so don't free it!"

Does it mean that httpd_post_receive_data callback should free the pbuff ?
The post_example is not free it.


- I was thinking how does this behave when a POST is uploading data
the function httpd_post_receive_data(void *connection, struct pbuf *p) not sure if it tells anything about if all data was received
How should I proceed to implement a progressive handling of data? eg: when a file is uploaded.


- Should I have a look on LWIP_HTTPD_POST_MANUAL_WND ?
Is that important for me and how does it work?

Is there ant online source for learning how to use this POST features in LWIP? or anyone could clarify me?

Mario Luzeiro
_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: HTTPD POST usage help and clarification

Mario Luzeiro
another question on this topic.

These are the 3 functions for handling the post
err_t httpd_post_begin(void *connection, const char *uri, const char *http_request,
                       u16_t http_request_len, int content_len, char *response_uri,
                       u16_t response_uri_len, u8_t *post_auto_wnd);
err_t httpd_post_receive_data(void *connection, struct pbuf *p);
void httpd_post_finished(void *connection, char *response_uri, u16_t response_uri_len);

I am confused about the use of *connection
Is it supposed to handle multiple POST connections at same time?

Then first I got a httpd_post_begin where I identify which URI PORT is called and then it calls httpd_post_receive_data, but there is no way to pass that information

I mean, for GET, we have the
int fs_open_custom (struct fs_file *file, const char *name) function
and fs_file implements a user defined pextension that we can use to store information between open / read / close.

I was looking something like that for POST too.

If it is only one connection at a time is expected, it can be handled by some local variables to manage which POST URI it is dealing with.

What is the right approach for this?

Mario Luzeiro

________________________________________
From: lwip-users <lwip-users-bounces+mrluzeiro=[hidden email]> on behalf of Mário Luzeiro <[hidden email]>
Sent: 11 October 2019 13:04
To: [hidden email]
Subject: [lwip-users] HTTPD POST usage help and clarification

Hi all,

I'm looking to use POST messages.
I found the lwip/httpd/post_example that I based my implementation.

it works ok so far, but some questions:
- I found in function http_post_rxpbuf the following comment:
"* ATTENTION: The application is responsible for the pbuf now, so don't free it!"

Does it mean that httpd_post_receive_data callback should free the pbuff ?
The post_example is not free it.


- I was thinking how does this behave when a POST is uploading data
the function httpd_post_receive_data(void *connection, struct pbuf *p) not sure if it tells anything about if all data was received
How should I proceed to implement a progressive handling of data? eg: when a file is uploaded.


- Should I have a look on LWIP_HTTPD_POST_MANUAL_WND ?
Is that important for me and how does it work?

Is there ant online source for learning how to use this POST features in LWIP? or anyone could clarify me?

Mario Luzeiro
_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users