Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions runtime/fastly/builtins/body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
#include <optional>
#include <string>

// TODO(GB) remove once https://github.com/bytecodealliance/StarlingMonkey/pull/75 lands
// clang-format off
#include "builtin.h"
// clang-format on
#include "../../../StarlingMonkey/builtins/web/fetch/fetch-errors.h"
#include "../../../StarlingMonkey/builtins/web/streams/native-stream-source.h"
#include "../../../StarlingMonkey/builtins/web/url.h"
Expand Down
12 changes: 11 additions & 1 deletion runtime/fastly/host-api/host_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,18 @@ Result<HttpHeaders *> HttpHeaders::FromEntries(vector<tuple<HostString, HostStri
Result<Void>
write_headers(HttpHeaders *headers,
std::vector<std::tuple<host_api::HostString, host_api::HostString>> &list) {
std::vector<std::string_view> seen;
seen.reserve(list.size());
host_api::Result<host_api::Void> res;
for (const auto &[name, value] : list) {
auto res = headers->append(name, value);
if (std::find(seen.begin(), seen.end(), name) == seen.end()) {
// first time seeing a header -> use set in case of existing values on the handle
res = headers->set(name, value);
seen.push_back(name);
} else {
// seen before -> use append
res = headers->append(name, value);
}
if (res.is_err()) {
return res;
}
Expand Down
Loading