multipart-parser-c
multipart-parser-c copied to clipboard
NOT COMPLIANT WITH RFC FORMAT
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.
Are you sure? Isn't that what s_part_data_final_hyphen
is for?
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)
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 feel free to fork and fix. I don't use it anymore and Cosmonaut was pet project never used in real application
I found this bug yet ...
Just found this bug as well. Please at least add a hint to your readme.
not rfc standard
Hi! Is this commit actual?