Implement more HTTP:C functionality (#7035)
* Implement missing http:c functionality. * More implementation details and cleanup. * Organize code * Disable treat errors as warnings for httplib * Fix defines * Remove pragmas that do nothing and mark as SYSTEM * Make httplib system * Try to fix issue from httplib * Apply suggestions * Fix header ordering * Fix compilation issue * Create and use ctx.CommandID() * Add and use Common::TruncateString * Apply more suggestions * Apply suggestions * Fix compilation * Apply suggestions * Fix format * Revert SplitURL to previous version * Apply suggestions
This commit is contained in:
parent
1acb03b579
commit
897d1fa957
6 changed files with 2102 additions and 629 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
@ -84,6 +85,15 @@ std::string UTF16BufferToUTF8(const T& text) {
|
|||
return UTF16ToUTF8(buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes trailing null bytes from the string.
|
||||
*/
|
||||
inline void TruncateString(std::string& str) {
|
||||
while (str.size() && str.back() == '\0') {
|
||||
str.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a std::string from a fixed-size NUL-terminated char buffer. If the buffer isn't
|
||||
* NUL-terminated then the string ends at max_len characters.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue