mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in StringViews and might have a non-properly-null-terminated string as a value. As a bonus, using StringView (and DeprecatedString where necessary) leads to nicer looking code too :^)
This commit is contained in:
parent
60908adcbe
commit
500044906d
43 changed files with 122 additions and 145 deletions
|
@ -151,7 +151,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool save_at_provided_name = false;
|
||||
bool should_follow_url = false;
|
||||
bool verbose_output = false;
|
||||
char const* data = nullptr;
|
||||
StringView data;
|
||||
StringView proxy_spec;
|
||||
DeprecatedString method = "GET";
|
||||
StringView method_override;
|
||||
|
@ -209,7 +209,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (!method_override.is_empty()) {
|
||||
method = method_override;
|
||||
} else if (data) {
|
||||
} else if (!data.is_empty()) {
|
||||
method = "POST";
|
||||
// FIXME: Content-Type?
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
request->stream_into(output_stream);
|
||||
};
|
||||
|
||||
request = protocol_client->start_request(method, url, request_headers, data ? StringView { data, strlen(data) }.bytes() : ReadonlyBytes {}, proxy_data);
|
||||
request = protocol_client->start_request(method, url, request_headers, data.bytes(), proxy_data);
|
||||
setup_request();
|
||||
|
||||
dbgln("started request with id {}", request->id());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue