Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get bytes bigger than 1024 from int httpd_req_recv(httpd_req_t *r, char *buf, size_t buf_len) (IDFGH-14202) #15000

Closed
3 tasks done
zzzh opened this issue Dec 8, 2024 · 6 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@zzzh
Copy link

zzzh commented Dec 8, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

I tried to set buf_len to 5120 or 10240 but useless, the return value is limited up to 1024.
How to change it?

@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 8, 2024
@github-actions github-actions bot changed the title How to change buf_len in int httpd_req_recv(httpd_req_t *r, char *buf, size_t buf_len) How to change buf_len in int httpd_req_recv(httpd_req_t *r, char *buf, size_t buf_len) (IDFGH-14202) Dec 8, 2024
@zzzh zzzh changed the title How to change buf_len in int httpd_req_recv(httpd_req_t *r, char *buf, size_t buf_len) (IDFGH-14202) How to get bytes bigger than 1024 from int httpd_req_recv(httpd_req_t *r, char *buf, size_t buf_len) (IDFGH-14202) Dec 9, 2024
@nileshkale123
Copy link
Collaborator

Hello @zzzh,

Could you kindly provide more details about what you aim to achieve by modifying buf_len? Additionally, it would be very helpful if you could share the patch file for the changes you've made related to this issue.

Please also share any relevant debug logs and examples of your modifications so that we can replicate and analyze the issue on our side.

Looking forward to your input!

@zzzh
Copy link
Author

zzzh commented Dec 10, 2024

Hello, @nileshkale123,

I think increase the size of each transfer may speed up the whole upload progress, that's why.
I did not change anything and it works well except slow (need about 1 minute to transfer 1MB), by changing the transfer size from 1k to 10k, I hope it can have 10 times speed.

@nopnop2002
Copy link

nopnop2002 commented Dec 13, 2024

@zzzh

There is no limit to the size of data received by httpd_req_recv.

The return value of httpd_req_recv is the actual number of bytes received.

When using a 2048-byte buffer, processing is performed in 2048-byte units as shown below.

W (36311) example: remaining=4576
W (36311) example: httpd_req_recv ret=2048
W (36311) example: httpd_req_recv ret=2048
W (36311) example: httpd_req_recv ret=480

When using a 4096-byte buffer, processing is performed in 4096-byte units as shown below.

W (13551) example: remaining=4576
W (13551) example: httpd_req_recv ret=4096
W (13551) example: httpd_req_recv ret=480

When using a 4096-byte buffer, a 1M byte transfer will complete in 1.5 second.

W (17061) example: received=1048576 elapsed time[ms]:1510

I used this to send.

curl -X POST --data-binary @1M.dummy  192.168.10.111/echo

There may be a problem on your sending side.

@zzzh
Copy link
Author

zzzh commented Dec 18, 2024

@zzzh

There is no limit to the size of data received by httpd_req_recv.

The return value of httpd_req_recv is the actual number of bytes received.

When using a 2048-byte buffer, processing is performed in 2048-byte units as shown below.

W (36311) example: remaining=4576
W (36311) example: httpd_req_recv ret=2048
W (36311) example: httpd_req_recv ret=2048
W (36311) example: httpd_req_recv ret=480

When using a 4096-byte buffer, processing is performed in 4096-byte units as shown below.

W (13551) example: remaining=4576
W (13551) example: httpd_req_recv ret=4096
W (13551) example: httpd_req_recv ret=480

When using a 4096-byte buffer, a 1M byte transfer will complete in 1.5 second.

W (17061) example: received=1048576 elapsed time[ms]:1510

I used this to send.

curl -X POST --data-binary @1M.dummy  192.168.10.111/echo

There may be a problem on your sending side.

Hi, nopnop2002,

Good to know, what version of esp-idf did you test on?
I'm using v4.4.2, maybe too old.

@nopnop2002
Copy link

what version of esp-idf did you test on?

$ git describe --tags
v5.3.2-1-g9a6aba7401

@zzzh
Copy link
Author

zzzh commented Dec 19, 2024

ok, I'll test it on the latest version.

@zzzh zzzh closed this as completed Dec 19, 2024
@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants