Giter VIP home page Giter VIP logo

Comments (10)

alexindigo avatar alexindigo commented on May 28, 2024

Can you elaborate more on use case? Thank you.

from form-data.

hustfyb avatar hustfyb commented on May 28, 2024

When I use form-data upload file to wechat server(Chinese IM),It always reject my request, but wth curl it's ok. At last I compare the requests, and found the reason is the _lastBoundary lack of '\r\n'. By the way It's ok on my own server, I think It's more safe to append CRLF.

from form-data.

hustfyb avatar hustfyb commented on May 28, 2024

part code from curl
https://github.com/bagder/curl/blob/6374ab2a36e7d287039b0fc148f9079f2ae5fb97/lib/formdata.c

1359-1375

    if(post->more) {
      /* this was a multiple-file inclusion, make a termination file
         boundary: */
      result = AddFormDataf(&form, &size,
                           "\r\n--%s--",
                           fileboundary);
      if(result)
        break;
    }

  } while((post = post->next) != NULL); /* for each field */
  /* end-boundary for everything */

  if(CURLE_OK == result)
    result = AddFormDataf(&form, &size,"\r\n--%s--\r\n",boundary);

only the last boundary should end with \r\n.

from form-data.

alexindigo avatar alexindigo commented on May 28, 2024

I'll put it to v0.2, so more people will be aware of incoming change and can test it against their endpoints. I don't have access to many different webservers to test it properly.

from form-data.

yfwz100 avatar yfwz100 commented on May 28, 2024

I came across this bug, too... However, formstream seems to work fine here but node-request relies on form-data instead of formstream.

At present, the workaround could be adding an extra form-data part to correctly end the previous form-data part. @hustfyb

from form-data.

michaelgwelch avatar michaelgwelch commented on May 28, 2024

I had same issue: Kong/unirest-nodejs#23 (comment)

Manually fixing _lastBoundary fixed my issue.

from form-data.

nijikokun avatar nijikokun commented on May 28, 2024

I had same issue: Kong/unirest-nodejs#23 (comment)

Manually fixing _lastBoundary fixed my issue.

Was coming here to comment about this, it's specific to .NET (you can search around, square specifically references the RFC where it's stated it doesn't matter what is after lastBoundary)

square/retrofit/pull/552

from form-data.

michaelgwelch avatar michaelgwelch commented on May 28, 2024

Was following advice here: http://debuggable.com/posts/how-to-fork-patch-npm-modules:4e2eb9f3-e584-44be-b1a9-3db7cbdd56cb

which I think might have been written by you. I'm new to npm. I followed those steps and deleted the node_modules directory and typed

npm install

thinking that it would fetch all of the packages including my patch. But it doesn't seem to do that.

from form-data.

michaelgwelch avatar michaelgwelch commented on May 28, 2024

@nijikokun thanks for the info. I figured it could be an IIS or ASP.Net thing.

from form-data.

alexindigo avatar alexindigo commented on May 28, 2024

Fixed in #123

from form-data.

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.