pistacheio / pistache

A high-performance REST toolkit written in C++
https://pistacheio.github.io/pistache/
Apache License 2.0
3.19k stars 698 forks source link

Wrong parsing of an incoming request's body #556

Open KocsisV opened 5 years ago

KocsisV commented 5 years ago

Hello!

I'm writing a program that uses pistache as a rest server and I noticed that the incoming Pistache::Rest::Request object's body() function returns a string which is missing the first CRLF. If I send a request which contains a form-data parameter (multipart/form-data content type) then the first boundary starts with "--" instead of "\r\n--". By rfc7578 the boundary consists of "\r\n--" plus the text specified in the header parameter "boundary". Im not getting the first CRLF, it starts with "--" instead. The sending side correctly sends the two sets of CRLF., so my assumption is that the parser in pistache cuts request into header and body at the wrong place. The first CRLF is the separator from between the header and the body, but the second one is part of the body.

hydratim commented 5 years ago

We're all a little tied up with the V0.1 release presently, but this looks like it should be fairly straight forward for anyone who wants to submit a PR.