Chromium Code Reviews| Index: net/spdy/spdy_protocol.cc |
| diff --git a/net/spdy/spdy_protocol.cc b/net/spdy/spdy_protocol.cc |
| index 3537917e2cc8fbeb97317d0c3fac026fcb5a6730..b2b5b7e68c8cb365ef9efb1eb33186c54b85bc87 100644 |
| --- a/net/spdy/spdy_protocol.cc |
| +++ b/net/spdy/spdy_protocol.cc |
| @@ -128,21 +128,46 @@ bool SettingsIdToString(SpdySettingsIds id, const char** settings_id_string) { |
| return false; |
| } |
| -SpdyRstStreamStatus ParseRstStreamStatus(int rst_stream_status_field) { |
| - if (rst_stream_status_field < RST_STREAM_MIN || |
| - rst_stream_status_field > RST_STREAM_MAX) { |
| - return RST_STREAM_INTERNAL_ERROR; |
| +SpdyErrorCode ParseErrorCode(uint32_t wire_error_code) { |
| + if (wire_error_code > ERROR_CODE_MAX) { |
| + return ERROR_CODE_INTERNAL_ERROR; |
| } |
| - return static_cast<SpdyRstStreamStatus>(rst_stream_status_field); |
| + return static_cast<SpdyErrorCode>(wire_error_code); |
| } |
| -SpdyGoAwayStatus ParseGoAwayStatus(int goaway_status_field) { |
| - if (goaway_status_field < GOAWAY_MIN || goaway_status_field > GOAWAY_MAX) { |
| - return GOAWAY_INTERNAL_ERROR; |
| +const char* ErrorCodeToString(SpdyErrorCode error_code) { |
|
Bence
2017/02/02 15:12:25
This method in only introduced in server change 14
diannahu
2017/02/02 15:58:09
Got it, will merge after 145087791 is merged. (I a
Bence
2017/02/02 16:12:00
It's really up to you. You can include 145536832
|
| + switch (error_code) { |
| + case ERROR_CODE_NO_ERROR: |
| + return "NO_ERROR"; |
| + case ERROR_CODE_PROTOCOL_ERROR: |
| + return "PROTOCOL_ERROR"; |
| + case ERROR_CODE_INTERNAL_ERROR: |
| + return "INTERNAL_ERROR"; |
| + case ERROR_CODE_FLOW_CONTROL_ERROR: |
| + return "FLOW_CONTROL_ERROR"; |
| + case ERROR_CODE_SETTINGS_TIMEOUT: |
| + return "SETTINGS_TIMEOUT"; |
| + case ERROR_CODE_STREAM_CLOSED: |
| + return "STREAM_CLOSED"; |
| + case ERROR_CODE_FRAME_SIZE_ERROR: |
| + return "FRAME_SIZE_ERROR"; |
| + case ERROR_CODE_REFUSED_STREAM: |
| + return "REFUSED_STREAM"; |
| + case ERROR_CODE_CANCEL: |
| + return "CANCEL"; |
| + case ERROR_CODE_COMPRESSION_ERROR: |
| + return "COMPRESSION_ERROR"; |
| + case ERROR_CODE_CONNECT_ERROR: |
| + return "CONNECT_ERROR"; |
| + case ERROR_CODE_ENHANCE_YOUR_CALM: |
| + return "ENHANCE_YOUR_CALM"; |
| + case ERROR_CODE_INADEQUATE_SECURITY: |
| + return "INADEQUATE_SECURITY"; |
| + case ERROR_CODE_HTTP_1_1_REQUIRED: |
| + return "HTTP_1_1_REQUIRED"; |
| } |
| - |
| - return static_cast<SpdyGoAwayStatus>(goaway_status_field); |
| + return "UNKNOWN_ERROR_CODE"; |
| } |
| const char* const kHttp2Npn = "h2"; |
| @@ -188,9 +213,9 @@ void SpdyDataIR::Visit(SpdyFrameVisitor* visitor) const { |
| } |
| SpdyRstStreamIR::SpdyRstStreamIR(SpdyStreamId stream_id, |
| - SpdyRstStreamStatus status) |
| + SpdyErrorCode error_code) |
| : SpdyFrameWithStreamIdIR(stream_id) { |
| - set_status(status); |
| + set_error_code(error_code); |
| } |
| SpdyRstStreamIR::~SpdyRstStreamIR() {} |
| @@ -212,27 +237,27 @@ void SpdyPingIR::Visit(SpdyFrameVisitor* visitor) const { |
| } |
| SpdyGoAwayIR::SpdyGoAwayIR(SpdyStreamId last_good_stream_id, |
| - SpdyGoAwayStatus status, |
| + SpdyErrorCode error_code, |
| base::StringPiece description) |
| : description_(description) { |
| - set_last_good_stream_id(last_good_stream_id); |
| - set_status(status); |
| + set_last_good_stream_id(last_good_stream_id); |
| + set_error_code(error_code); |
| } |
| SpdyGoAwayIR::SpdyGoAwayIR(SpdyStreamId last_good_stream_id, |
| - SpdyGoAwayStatus status, |
| + SpdyErrorCode error_code, |
| const char* description) |
| : SpdyGoAwayIR(last_good_stream_id, |
| - status, |
| + error_code, |
| base::StringPiece(description)) {} |
| SpdyGoAwayIR::SpdyGoAwayIR(SpdyStreamId last_good_stream_id, |
| - SpdyGoAwayStatus status, |
| + SpdyErrorCode error_code, |
| std::string description) |
| : description_store_(std::move(description)), |
| description_(description_store_) { |
| set_last_good_stream_id(last_good_stream_id); |
| - set_status(status); |
| + set_error_code(error_code); |
| } |
| SpdyGoAwayIR::~SpdyGoAwayIR() {} |