diff options
author | Oleg Morozenkov <omorozenkov@gmail.com> | 2015-09-15 18:18:49 +0300 |
---|---|---|
committer | Oleg Morozenkov <omorozenkov@gmail.com> | 2015-09-15 18:18:49 +0300 |
commit | 6a3c8387da208ac2ffa4757dfafe1600a693b24f (patch) | |
tree | a8cfbfd46643784ede5ddfc0ce6dcd5f39d533d2 /src/net/HttpParser.cpp | |
parent | 370df9853702bf9666b8dfa2e4254b9e236b2789 (diff) |
Fix formatting + some minor improvements
Diffstat (limited to 'src/net/HttpParser.cpp')
-rw-r--r-- | src/net/HttpParser.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/net/HttpParser.cpp b/src/net/HttpParser.cpp index 3ea95ec..7c4f9e2 100644 --- a/src/net/HttpParser.cpp +++ b/src/net/HttpParser.cpp @@ -63,16 +63,16 @@ string HttpParser::generateRequest(const Url& url, const vector<HttpReqArg>& arg string bondary = generateMultipartBoundary(args); if (bondary.empty()) { result += "Content-Type: application/x-www-form-urlencoded\r\n"; - requestData = generateWwwFormUrlencoded(args); + requestData = generateWwwFormUrlencoded(args); } else { result += "Content-Type: multipart/form-data; boundary="; result += bondary; - result += "\r\n"; + result += "\r\n"; requestData = generateMultipartFormData(args, bondary); - } + } - result += "Content-Length: "; - result += lexical_cast<string>(requestData.length()); + result += "Content-Length: "; + result += lexical_cast<string>(requestData.length()); result += "\r\n\r\n"; result += requestData; } @@ -86,11 +86,11 @@ string HttpParser::generateMultipartFormData(const vector<HttpReqArg>& args, con result += bondary; result += "\r\nContent-Disposition: form-data; name=\""; result += item.name; - if(item.isFile) { - result += "\"; filename=\"" + item.fileName; - } + if (item.isFile) { + result += "\"; filename=\"" + item.fileName; + } result += "\"\r\n"; - if (item.isFile) { + if (item.isFile) { result += "Content-Type: "; result += item.mimeType; result += "\r\n"; @@ -99,7 +99,7 @@ string HttpParser::generateMultipartFormData(const vector<HttpReqArg>& args, con result += item.value; result += "\r\n"; } - result += "--" + bondary + "--"; + result += "--" + bondary + "--"; return result; } @@ -107,7 +107,7 @@ string HttpParser::generateMultipartBoundary(const vector<HttpReqArg>& args) { string result; srand((unsigned int) time(nullptr)); for (const HttpReqArg& item : args) { - if (item.isFile) { + if (item.isFile) { while (result.empty() || item.value.find(result) != item.value.npos) { result += StringTools::generateRandomString(4); } |