Skip to content
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

implement HttpResponseStatusCode toString & toInt #1180

Merged
merged 28 commits into from
Aug 26, 2023
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1a80c82
implement HttpResponseStatusCode toString & toInt
tigercosmos Jul 26, 2023
e98a719
simplified the code in HttpResponseParseStatusCodeTest
tigercosmos Aug 11, 2023
8a93743
updated status code according to the latest spec
tigercosmos Aug 12, 2023
45d02a8
put previously supported code back
tigercosmos Aug 15, 2023
2afa3e8
HttpResponseStatusCode backward compatibility
tigercosmos Aug 15, 2023
9645cd5
improve http test
tigercosmos Aug 15, 2023
03d73e7
format
tigercosmos Aug 15, 2023
03bbf4d
fix test
tigercosmos Aug 15, 2023
f6df30d
HttpResponseStatusCode initial value
tigercosmos Aug 15, 2023
3eb74d8
update doc
tigercosmos Aug 16, 2023
8002ca2
Merge branch 'dev' into 20230812HttpStatusCode
tigercosmos Aug 16, 2023
2e33f38
disable cppcheck for a line
tigercosmos Aug 16, 2023
a257f45
Merge branch '20230812HttpStatusCode' of https://github.com/tigercosm…
tigercosmos Aug 16, 2023
12a9527
move HttpResponseStatusCodeHash to cpp
tigercosmos Aug 20, 2023
cfd3461
fix comment
tigercosmos Aug 20, 2023
8ff4b89
refactor a little bit
tigercosmos Aug 20, 2023
7d036f7
more efficient way to construct HttpResponseStatusCode from int
tigercosmos Aug 20, 2023
e259e35
Rename `m_value` to `m_Value`
seladb Aug 24, 2023
01f8490
Rename `m_value` to `m_Value`
seladb Aug 24, 2023
5fe8ebe
prevent using stoi
tigercosmos Aug 24, 2023
2b57ca8
fix logic
tigercosmos Aug 24, 2023
490c0fd
simplify HttpResponseStatusCodeHash
tigercosmos Aug 24, 2023
363a695
Merge branch '20230812HttpStatusCode' of github.com:tigercosmos/PcapP…
tigercosmos Aug 17, 2023
b8f1327
suppress containerOutOfBounds
tigercosmos Aug 24, 2023
6115b3b
fix logic
tigercosmos Aug 25, 2023
5760ce7
fix wrong logic
tigercosmos Aug 25, 2023
4703115
fix
tigercosmos Aug 25, 2023
e0eb088
Merge branch 'dev' into 20230812HttpStatusCode
seladb Aug 26, 2023
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
6 changes: 2 additions & 4 deletions Packet++/src/HttpLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,14 +857,12 @@ HttpResponseStatusCode HttpResponseFirstLine::parseStatusCode(const char* data,

std::string codeString = std::string(data + 9, 3);

if(!codeString.empty() && std::find_if(codeString.begin(), codeString.end(), [](unsigned char c){ return !std::isdigit(c); }) == codeString.end())
if(!codeString.empty() || std::find_if(codeString.begin(), codeString.end(), [](unsigned char c){ return !std::isdigit(c); }) == codeString.end())
seladb marked this conversation as resolved.
Show resolved Hide resolved
{
return HttpResponseStatusCode::HttpStatusCodeUnknown;
}

// cppcheck-suppress containerOutOfBounds
int statusCodeInt = codeString[0] * 100 + codeString[1] * 10 + codeString[2];
return HttpResponseStatusCode(statusCodeInt);
return HttpResponseStatusCode(std::stoi(codeString));
}

HttpResponseFirstLine::HttpResponseFirstLine(HttpResponseLayer* httpResponse) : m_HttpResponse(httpResponse)
Expand Down
Loading