Skip to content

Commit

Permalink
HttpResponseStatusCode initial value
Browse files Browse the repository at this point in the history
  • Loading branch information
tigercosmos committed Aug 15, 2023
1 parent 03bbf4d commit f6df30d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Packet++/header/HttpLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ namespace pcpp
constexpr bool operator==(const Value &otherValue) const { return m_value == otherValue; }
constexpr bool operator!=(const Value &otherValue) const { return m_value != otherValue; }
private:
Value m_value;
Value m_value = HttpStatusCodeError;
};

// -------- Class HttpResponseLayer -----------------
Expand Down
8 changes: 4 additions & 4 deletions Packet++/src/HttpLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,9 +794,9 @@ HttpResponseFirstLine::HttpResponseFirstLine(HttpResponseLayer* httpResponse) :

HttpResponseFirstLine::HttpResponseFirstLine(HttpResponseLayer* httpResponse, HttpVersion version, HttpResponseStatusCode statusCode, std::string statusCodeString)
{
if (m_StatusCode.isUnsupportedCode())
if (statusCode.isUnsupportedCode())
{
m_Exception.setMessage("Status code supplied was " + statusCodeExplanationStringMap.at(m_StatusCode));
m_Exception.setMessage("Status code supplied was " + statusCodeExplanationStringMap.at(statusCode));
throw m_Exception;
}

Expand All @@ -812,9 +812,9 @@ HttpResponseFirstLine::HttpResponseFirstLine(HttpResponseLayer* httpResponse, H
m_Version = version;

if(statusCodeString == "") {
statusCodeString = statusCodeExplanationStringMap.at(statusCode);
statusCodeString = statusCodeExplanationStringMap.at(m_StatusCode);
}
std::string firstLine = "HTTP/" + VersionEnumToString[m_Version] + " " + statusCode.toString() + " " + statusCodeString + "\r\n";
std::string firstLine = "HTTP/" + VersionEnumToString[m_Version] + " " + m_StatusCode.toString() + " " + statusCodeString + "\r\n";

m_FirstLineEndOffset = firstLine.length();

Expand Down

0 comments on commit f6df30d

Please sign in to comment.