Comments (3)
Hello @gayathriaccount ,
The file upload callback function is intended to be executed multiple times, as mentionned in the documentation:
* The callback function file_upload_callback will be called
* multiple times, with the uploaded file in striped in parts
Also, remember to use the size_t size
parameter because, as in your example, the const char * data
is longer than 22 in the first call, but the second will continue starting at offset 22, so if you concat data into another variable, the result may be different than what's expected.
This functionality was designed to avoid large uploads to be included in the const struct _u_request * request
in the callback function, because the parameters included in it are malloc'd. This solution provides a process that will let you deal with possibly large data the way you want it.
from ulfius.
Hi,
Thank you for the detailed description. But may I get little more clarification on why this behavior is like this only for TLS mode. And also why doesn't the size match with the size of the data in the first call of the file_upload_callback.
Thanks and regards
Gayathri
from ulfius.
The difference between TLS and non TLS mode may be because underneath libmocrohttpd handles its buffer differently, but if you try with a larger file, both modes will have multiple calls to the callback function.
The size parameter is also handled by libmocrohttpd so I'm not sure how they manage it with the data parameter, but I suppose the data parameter can be a FIFO. However, don't expect data to be complete, always use size and offset for your file upload management.
from ulfius.
Related Issues (20)
- HTTP GET with array as response body HOT 2
- simple_example as static build for managed server HOT 2
- undefined reference to `pointer_list_init' HOT 2
- How to setup https mode? HOT 4
- Sending file in response for Ulfius REST request
- Do we have any official Ulifius Yocto recipe? HOT 1
- How can I reopen a closed issue? HOT 4
- [Issue]../../src/libulfius.so: undefined reference to `[email protected]' HOT 1
- [Issue] A use after free bug in src/ulfius.c HOT 1
- [Issue]A double free bug in ulfius.c HOT 4
- [Issue]A use after free bug in src/ulfius.c HOT 1
- [Feature request] How to use libulfius to implement a secure, asynchronious and scalable REST API? HOT 3
- What is the best way to let libulfius interact with libpq? HOT 2
- uwsc can't connect to socket while wscat can HOT 2
- Ulfius failed to link microhttpd on mingw64 using CMake HOT 4
- Support for graceful shutdown HOT 2
- How to add swagger openAPI documentation for ulfius based webservices ? HOT 4
- When ulfius starts in a docker container it exits 0 HOT 6
- Non-ASCII symbols in test cookie HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ulfius.