We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If I set a blank space on the end of content-Disposition header in multipart/form-data, serverino throws a core.exception.ArrayIndexError.
In line 521 of interfaces, the .strip method is used without checking that the array is empty.
.strip
auto k = f[0].strip; auto v = f[1].strip;
I modified a previous test to reproduce the error, just add the following test:
//Blank space on Content-Disposition in multipart/form-data { string content; string postBody = "-----------------------------blahblahblah\r Content-Disposition: form-data; name=\"field1\"\r \r first value\r -----------------------------blahblahblah\r Content-Disposition: form-data; name=\"field2\"\r \r second value\r -----------------------------blahblahblah\r Content-Disposition: form-data; name=\"myfile\"; filename=\"file1.txt\";\" \"\r Content-Type: application/json \r \r {} \r -----------------------------blahblahblah--\r "; auto http = HTTP("http://myuser@127.0.0.1:8080/json/dump/test?"); http.setPostData(postBody,"multipart/form-data; boundary=---------------------------blahblahblah"); http.method = HTTP.Method.post; http.onReceive = (ubyte[] data) { content ~= data; return data.length; }; http.perform(); auto j = parseJSON(content); assert(j["method"].str == "POST"); assert(j["uri"].str == "/json/dump/test"); assert(j["host"].str == "127.0.0.1:8080"); assert(j["get"].array.map!(x=>x.str).array.sort.array == []); assert(j["post"].array.map!(x=>x.str).array.sort.array == []); assert(j["cookie"].array.map!(x=>x.str).array.sort.array == []); assert(j["username"].str == "myuser"); assert(j["password"].str == string.init); assert(j["form-data"].array.map!(x=>x.str).array.sort.array == ["field1,text/plain,first value", "field2,text/plain,second value"]); assert(j["form-file"].array.map!(x=>x.str).array.sort.array == ["myfile,file1.txt,application/json,{}\n"]); assert(j["content-type"].str == "multipart/form-data"); }
The text was updated successfully, but these errors were encountered:
Merge pull request #11 from m1dok/master-M1dok
b1fb0f3
Resolve issue #10
No branches or pull requests
If I set a blank space on the end of content-Disposition header in multipart/form-data, serverino throws a
core.exception.ArrayIndexError.
In line 521 of interfaces, the
.strip
method is used without checking that the array is empty.auto k = f[0].strip; auto v = f[1].strip;
I modified a previous test to reproduce the error, just add the following test:
The text was updated successfully, but these errors were encountered: