Code Monkey home page Code Monkey logo

Comments (7)

rousan avatar rousan commented on September 15, 2024

in some situations (such as being combined with rocket), the stream becomes useless as the entire data had to be written from the AsyncRead to accomplish this.

This should not happen as the http body stream in rocket framework does not include the leading new line, so multer-rs will work with any Rust web framework.

In most of the cases, the http request body does not include the trailing new line. Are you using it in any customized http client?

from multer-rs.

vicky5124 avatar vicky5124 commented on September 15, 2024

This should not happen as the http body stream in rocket framework does not include the leading new line, so multer-rs will work with any Rust web framework.

yes, when a request is sent by rocket, this does not happen, the issue is when it receives it.

In most of the cases, the http request body does not include the trailing new line. Are you using it in any customized http client?

The client is an unmodified install of the Unity Web Request library, the data sent has those leading newlines;
using d.stream_to_file("AAAA").await.unwrap(); returned the file on the screenshot, with those leading newlines.

    let mut d = data.open(1.megabytes()).stream_to_vec().await.unwrap();
    d.remove(0);
    d.remove(0);

    let (stream, _) = get_stream_from_bytes(d).await;

this is the solution i went with, which downloads the entire thing into the vector, defeating the point of the initial stream.

from multer-rs.

rousan avatar rousan commented on September 15, 2024

Okay, got it, will fix it tomorrow and release a new version.

from multer-rs.

SergioBenitez avatar SergioBenitez commented on September 15, 2024

@rousan Do you have plans to release a new version with a fix for this issue?

from multer-rs.

rousan avatar rousan commented on September 15, 2024

Hey @nitsuga5124 @SergioBenitez, I am really sorry for slow response, actually, I got stuck in some other work lately. Can you please want to be a contributor? PR is welcome.

from multer-rs.

vicky5124 avatar vicky5124 commented on September 15, 2024

I already tried to look into PRing this, but i was unable to figure out a way to do it.

from multer-rs.

jebrosen avatar jebrosen commented on September 15, 2024

For reference, this paragraph from RFC 2046 section 5.1.1 seems relevant (emphasis mine).

There appears to be room for additional information prior to the
first boundary delimiter line and following the final boundary
delimiter line. These areas should generally be left blank, and
implementations must ignore anything that appears before the first
boundary delimiter line
or after the last one.

It looks like implementing this may require adding an additional Stage: currently Stage::ReadingBoundary is used both before the first boundary and between fields, but additional data is only allowed before the first boundary.

I have some time this week to try this or another approach if nobody else is working on it.

from multer-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.