Skip to content

Commit cb33ade

Browse files
author
me
committed
- supressed warning
- bug fix in parse_header(). it doesn't really matter since if there is an error, in the if-statement above, then the loop will break out anyway. So not really bug but also definitely a bug
1 parent a395f08 commit cb33ade

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/http.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ namespace http
860860
const auto index = find_header_private(fields, f);
861861
if (index == -1) return std::nullopt;
862862
const auto off = offsets[index];
863-
const auto end = (index+1) < fields.size() ? offsets[index+1] : buf.size();
863+
const auto end = (index+1) < (int)fields.size() ? offsets[index+1] : buf.size();
864864
return std::string_view(&buf[off], end-off);
865865
}
866866

@@ -877,7 +877,7 @@ namespace http
877877
const auto index = find_header_private(fields, f);
878878
if (index == -1) return;
879879
const auto off = offsets[index];
880-
const auto end = (index+1) < fields.size() ? offsets[index+1] : buf.size();
880+
const auto end = (index+1) < (int)fields.size() ? offsets[index+1] : buf.size();
881881
const auto len = end-off;
882882
for (size_t i = index+1 ; i < offsets.size() ; ++i)
883883
offsets[i] -= len;
@@ -891,7 +891,7 @@ namespace http
891891
const auto index = find_header_private(fields, f);
892892
if (index == -1) return add(f, value);
893893
const auto off = offsets[index];
894-
const auto end = (index+1) < fields.size() ? offsets[index+1] : buf.size();
894+
const auto end = (index+1) < (int)fields.size() ? offsets[index+1] : buf.size();
895895
const auto len = end-off;
896896
buf.erase(begin(buf) + off, begin(buf) + end);
897897
buf.insert(begin(buf) + off, begin(value), std::end(value));
@@ -1258,9 +1258,10 @@ namespace http
12581258
if (field == unknown_field)
12591259
ec = make_error_code(http_read_header_unsupported_field);
12601260

1261-
else
1261+
else {
12621262
msg.headers.add(field, value);
12631263
res = parse_ok;
1264+
}
12641265
}
12651266
}
12661267

0 commit comments

Comments
 (0)