blob: bc6b68f6be5627ed583fee57e6938337e99d5868 [file] [log] [blame]
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "quiche/balsa/balsa_enums.h"
namespace quiche {
const char* BalsaFrameEnums::ParseStateToString(
BalsaFrameEnums::ParseState error_code) {
switch (error_code) {
case ERROR:
return "ERROR";
case READING_HEADER_AND_FIRSTLINE:
return "READING_HEADER_AND_FIRSTLINE";
case READING_CHUNK_LENGTH:
return "READING_CHUNK_LENGTH";
case READING_CHUNK_EXTENSION:
return "READING_CHUNK_EXTENSION";
case READING_CHUNK_DATA:
return "READING_CHUNK_DATA";
case READING_CHUNK_TERM:
return "READING_CHUNK_TERM";
case READING_LAST_CHUNK_TERM:
return "READING_LAST_CHUNK_TERM";
case READING_TRAILER:
return "READING_TRAILER";
case READING_UNTIL_CLOSE:
return "READING_UNTIL_CLOSE";
case READING_CONTENT:
return "READING_CONTENT";
case MESSAGE_FULLY_READ:
return "MESSAGE_FULLY_READ";
case NUM_STATES:
return "UNKNOWN_STATE";
}
return "UNKNOWN_STATE";
}
const char* BalsaFrameEnums::ErrorCodeToString(
BalsaFrameEnums::ErrorCode error_code) {
switch (error_code) {
case BALSA_NO_ERROR:
return "BALSA_NO_ERROR";
case NO_STATUS_LINE_IN_RESPONSE:
return "NO_STATUS_LINE_IN_RESPONSE";
case NO_REQUEST_LINE_IN_REQUEST:
return "NO_REQUEST_LINE_IN_REQUEST";
case FAILED_TO_FIND_WS_AFTER_RESPONSE_VERSION:
return "FAILED_TO_FIND_WS_AFTER_RESPONSE_VERSION";
case FAILED_TO_FIND_WS_AFTER_REQUEST_METHOD:
return "FAILED_TO_FIND_WS_AFTER_REQUEST_METHOD";
case FAILED_TO_FIND_WS_AFTER_RESPONSE_STATUSCODE:
return "FAILED_TO_FIND_WS_AFTER_RESPONSE_STATUSCODE";
case FAILED_TO_FIND_WS_AFTER_REQUEST_REQUEST_URI:
return "FAILED_TO_FIND_WS_AFTER_REQUEST_REQUEST_URI";
case FAILED_TO_FIND_NL_AFTER_RESPONSE_REASON_PHRASE:
return "FAILED_TO_FIND_NL_AFTER_RESPONSE_REASON_PHRASE";
case FAILED_TO_FIND_NL_AFTER_REQUEST_HTTP_VERSION:
return "FAILED_TO_FIND_NL_AFTER_REQUEST_HTTP_VERSION";
case FAILED_CONVERTING_STATUS_CODE_TO_INT:
return "FAILED_CONVERTING_STATUS_CODE_TO_INT";
case HEADERS_TOO_LONG:
return "HEADERS_TOO_LONG";
case UNPARSABLE_CONTENT_LENGTH:
return "UNPARSABLE_CONTENT_LENGTH";
case HTTP2_CONTENT_LENGTH_ERROR:
return "HTTP2_CONTENT_LENGTH_ERROR";
case MAYBE_BODY_BUT_NO_CONTENT_LENGTH:
return "MAYBE_BODY_BUT_NO_CONTENT_LENGTH";
case REQUIRED_BODY_BUT_NO_CONTENT_LENGTH:
return "REQUIRED_BODY_BUT_NO_CONTENT_LENGTH";
case HEADER_MISSING_COLON:
return "HEADER_MISSING_COLON";
case INVALID_CHUNK_LENGTH:
return "INVALID_CHUNK_LENGTH";
case CHUNK_LENGTH_OVERFLOW:
return "CHUNK_LENGTH_OVERFLOW";
case CALLED_BYTES_SPLICED_WHEN_UNSAFE_TO_DO_SO:
return "CALLED_BYTES_SPLICED_WHEN_UNSAFE_TO_DO_SO";
case CALLED_BYTES_SPLICED_AND_EXCEEDED_SAFE_SPLICE_AMOUNT:
return "CALLED_BYTES_SPLICED_AND_EXCEEDED_SAFE_SPLICE_AMOUNT";
case MULTIPLE_CONTENT_LENGTH_KEYS:
return "MULTIPLE_CONTENT_LENGTH_KEYS";
case MULTIPLE_TRANSFER_ENCODING_KEYS:
return "MULTIPLE_TRANSFER_ENCODING_KEYS";
case UNKNOWN_TRANSFER_ENCODING:
return "UNKNOWN_TRANSFER_ENCODING";
case BOTH_TRANSFER_ENCODING_AND_CONTENT_LENGTH:
return "BOTH_TRANSFER_ENCODING_AND_CONTENT_LENGTH";
case INVALID_HEADER_FORMAT:
return "INVALID_HEADER_FORMAT";
case HTTP2_INVALID_HEADER_FORMAT:
return "HTTP2_INVALID_HEADER_FORMAT";
case INVALID_TRAILER_FORMAT:
return "INVALID_TRAILER_FORMAT";
case TRAILER_TOO_LONG:
return "TRAILER_TOO_LONG";
case TRAILER_MISSING_COLON:
return "TRAILER_MISSING_COLON";
case INTERNAL_LOGIC_ERROR:
return "INTERNAL_LOGIC_ERROR";
case INVALID_HEADER_CHARACTER:
return "INVALID_HEADER_CHARACTER";
case INVALID_HEADER_NAME_CHARACTER:
return "INVALID_HEADER_NAME_CHARACTER";
case INVALID_TRAILER_NAME_CHARACTER:
return "INVALID_TRAILER_NAME_CHARACTER";
case UNSUPPORTED_100_CONTINUE:
return "UNSUPPORTED_100_CONTINUE";
case NUM_ERROR_CODES:
return "UNKNOWN_ERROR";
}
return "UNKNOWN_ERROR";
}
} // namespace quiche