cryptosense / multipart-form-data Goto Github PK
View Code? Open in Web Editor NEWmultipart/form-data (RFC2388) parser for OCaml
License: BSD 2-Clause "Simplified" License
multipart/form-data (RFC2388) parser for OCaml
License: BSD 2-Clause "Simplified" License
Would be great to cut a first release on opam, so that ocaml/opam-repository#7981 could be merged :-)
Thanks!
Right now we can get the name of a File via Multipart.file_name
, and the body via Multipart.file_stream file
- how can I get the number of bytes in the file?
Would be nice to also create multipart-form-data
. This is sort of why I became aware of the project (since I first started my own, same-named one, and realized it is silly), so if you don't mind I'd offer to contribute the creation part of it.
Took awhile to track this down, but our binary uploads may contain \r\n
in the file bodies somewhere, and it looks like Multipart is stripping every instance, leading to invalid files being stored to disk.
It looks like it might be here https://github.com/cryptosense/multipart-form-data/blob/master/lib/multipart.ml#L163 where all of the lines, having been split on \r\n
, are simply concatenated together as-is, not restoring the \r\n
that was there beforehand (to be clear, we need the bytes 0d0a
to be in the final filestream).
I tried a few different hacks, but I'm not very familiar with Lwt_stream
, and couldn't quite figure out how best to get it to interpose the streams I need. Any hints on how to make it work?
Right now, Multipart.file_name file
returns the name=
portion of the Content-Disposition
header, and not the filename
portion. Is there a way to get both?
The current implementation builds a list of prefixes every time and checks if any is a suffix. It is possible to be better, either by precomputing the list of prefixes, or by building a suffix list.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.