multipart-parser-c icon indicating copy to clipboard operation
multipart-parser-c copied to clipboard

NOT COMPLIANT WITH RFC FORMAT

Open cheneydeng opened this issue 10 years ago • 8 comments

hi all, I found that you guys have not understand what the format of multipart/form-data, the boundary is not as the same as it show in the body.Say we got the boundary in the HTTP header,as "--xxyy",then the "boundary part" in the body is --boundary =====> ----xxyy. and the last "boundary" =====> --boundary-- ======> --xxyy-- you misunderstand this and it will cause your code parse the data incorrectly.

cheneydeng avatar Aug 07 '14 09:08 cheneydeng

Are you sure? Isn't that what s_part_data_final_hyphen is for?

jamesamcl avatar Aug 07 '14 12:08 jamesamcl

I verified with curl, and "boundary part" in the body is additionally prefixed with "--". @udp s_part_data_final_hyphen handles "--" suffix but not prefix.

$ curl -X POST -F name=John http://localhost:2000 Sends:

POST / HTTP/1.1
User-Agent: curl/7.35.0
Host: localhost:2000
Accept: */*
Content-Length: 143
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------adcf844310cc278d

--------------------------adcf844310cc278d
Content-Disposition: form-data; name="name"

John
--------------------------adcf844310cc278d--

Comparing boundary values:

  ------------------------adcf844310cc278d    (from Content-Type)
--------------------------adcf844310cc278d    (from body)
--------------------------adcf844310cc278d--  (from body)

andrzej-bieniek avatar Dec 15 '14 22:12 andrzej-bieniek

Don't know how it is

Tested as part of Cosmonaut HTTP server.

but code logic is wrong and @cheneydeng absolutely right. Surprisingly that such serious bug still not fixed...

it will cause your code parse the data incorrectly.

in my case it doesn't work at all...

c1tru55 avatar Mar 21 '15 11:03 c1tru55

@c1tru55 feel free to fork and fix. I don't use it anymore and Cosmonaut was pet project never used in real application

iafonov avatar Mar 21 '15 12:03 iafonov

I found this bug yet ...

twxjyg avatar Aug 19 '16 14:08 twxjyg

Just found this bug as well. Please at least add a hint to your readme.

MrBuddyCasino avatar Mar 11 '17 23:03 MrBuddyCasino

not rfc standard

zhengw1024 avatar Apr 10 '19 05:04 zhengw1024

Hi! Is this commit actual?

ghost avatar Aug 25 '22 07:08 ghost