-
Notifications
You must be signed in to change notification settings - Fork 216
Support for multipart requests, new ways of routing the request to MP graph #3250
New issue
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
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
b77f219
save
dkalinowski 78a0e1e
save
dkalinowski 9c070cb
save
dkalinowski eddcb01
save
dkalinowski a17f3a1
save
dkalinowski 20f4818
save
dkalinowski e2d712a
save
dkalinowski 5b40e69
save
dkalinowski dafa7d1
save
dkalinowski 4c93d9e
adjust unit tests
dkalinowski 0f5fcd7
test
dkalinowski ab09d59
test
dkalinowski f4e02d9
test
dkalinowski 3a4a6e7
Test
dkalinowski a020028
Merge remote-tracking branch 'origin/main' into multipart-rb
dkalinowski b9292a0
ut
dkalinowski c11d885
compilable but failing unit tests
dkalinowski e91b214
3 fails remaining
dkalinowski 684b0eb
all working
dkalinowski 4980010
add test
dkalinowski e17afe4
push
dkalinowski 156bcc7
save
dkalinowski 96eeb09
save
dkalinowski b463504
save
dkalinowski bee88e9
save
dkalinowski a8c3bfa
save
dkalinowski 3c0adf0
save
dkalinowski 7461504
save
dkalinowski 3047943
sanity tests
dkalinowski 4246051
Merge remote-tracking branch 'origin/main' into multipart-rb
dkalinowski 0641d39
post review
dkalinowski 4b4336e
save
dkalinowski 84a7d35
Merge remote-tracking branch 'origin/main' into multipart-rb
dkalinowski 60d94b5
fix compilation
dkalinowski 34c52af
cleanup
dkalinowski 5fc5690
dependency free http test calculators
dkalinowski 886ebbe
save
dkalinowski e36f152
fix
dkalinowski a2fe052
fix
dkalinowski 653fa8f
Merge remote-tracking branch 'origin/main' into multipart-rb
dkalinowski 4aa657c
post-post-post-post-review
dkalinowski 3429c73
fix?
dkalinowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,4 @@ out | |
*.errors.txt | ||
tmp/ | ||
*.zip | ||
*.tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//***************************************************************************** | ||
// Copyright 2025 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
//***************************************************************************** | ||
#include "multi_part_parser_drogon_impl.hpp" | ||
|
||
namespace ovms { | ||
|
||
bool DrogonMultiPartParser::parse() { | ||
this->hasParseError_ = this->parser->parse(request) != 0; | ||
return !this->hasParseError_; | ||
} | ||
|
||
bool DrogonMultiPartParser::hasParseError() const { | ||
return this->hasParseError_; | ||
} | ||
|
||
std::string DrogonMultiPartParser::getFieldByName(const std::string& name) const { | ||
return this->parser->getParameter<std::string>(name); | ||
} | ||
|
||
std::string_view DrogonMultiPartParser::getFileContentByFieldName(const std::string& name) const { | ||
auto fileMap = this->parser->getFilesMap(); | ||
|
||
auto it = fileMap.find(name); | ||
if (it == fileMap.end()) { | ||
return ""; | ||
} | ||
return it->second.fileContent(); | ||
} | ||
|
||
} // namespace ovms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//***************************************************************************** | ||
// Copyright 2025 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
//***************************************************************************** | ||
#pragma once | ||
|
||
#include "../multi_part_parser.hpp" | ||
|
||
#pragma warning(push) | ||
#pragma warning(disable : 6326) | ||
#include <drogon/drogon.h> | ||
#pragma warning(pop) | ||
|
||
#include <string> | ||
#include <string_view> | ||
#include <memory> | ||
|
||
namespace ovms { | ||
|
||
class DrogonMultiPartParser : public MultiPartParser { | ||
bool hasParseError_{true}; | ||
const drogon::HttpRequestPtr request{nullptr}; | ||
const std::shared_ptr<drogon::MultiPartParser> parser{nullptr}; | ||
|
||
public: | ||
DrogonMultiPartParser(const drogon::HttpRequestPtr& request) : | ||
request(request), | ||
parser(std::make_shared<drogon::MultiPartParser>()) {} | ||
|
||
bool parse() override; | ||
|
||
bool hasParseError() const override; | ||
|
||
dkalinowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
std::string getFieldByName(const std::string& name) const override; | ||
std::string_view getFileContentByFieldName(const std::string& name) const override; | ||
}; | ||
|
||
} // namespace ovms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.