QHttpHeaders Class
QHttpHeaders는 HTTP 헤더를 저장하기 위한 클래스입니다. 더 보기...
| 헤더: | #include <QHttpHeaders> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Network) target_link_libraries(mytarget PRIVATE Qt6::Network) |
| qmake: | QT += network |
| 다음부터: | Qt 6.7부터 |
공개 유형
| enum class | WellKnownHeader { AIM, Accept, AcceptAdditions, AcceptCH, AcceptDatetime, …, ProtocolQuery } |
공개 함수
| QHttpHeaders() | |
| QHttpHeaders(const QHttpHeaders &other) | |
| QHttpHeaders(QHttpHeaders &&other) | |
| ~QHttpHeaders() | |
| bool | append(QAnyStringView name, QAnyStringView value) |
| bool | append(QHttpHeaders::WellKnownHeader name, QAnyStringView value) |
| void | clear() |
| QByteArray | combinedValue(QAnyStringView name) const |
| QByteArray | combinedValue(QHttpHeaders::WellKnownHeader name) const |
| bool | contains(QAnyStringView name) const |
| bool | contains(QHttpHeaders::WellKnownHeader name) const |
(since 6.10) std::optional<QDateTime> | dateTimeValue(QAnyStringView name) const |
(since 6.10) std::optional<QDateTime> | dateTimeValue(QHttpHeaders::WellKnownHeader name) const |
(since 6.10) std::optional<QDateTime> | dateTimeValueAt(qsizetype i) const |
(since 6.10) std::optional<QList<QDateTime>> | dateTimeValues(QAnyStringView name) const |
(since 6.10) std::optional<QList<QDateTime>> | dateTimeValues(QHttpHeaders::WellKnownHeader name) const |
| bool | insert(qsizetype i, QAnyStringView name, QAnyStringView value) |
| bool | insert(qsizetype i, QHttpHeaders::WellKnownHeader name, QAnyStringView value) |
(since 6.10) std::optional<qint64> | intValue(QAnyStringView name) const |
(since 6.10) std::optional<qint64> | intValue(QHttpHeaders::WellKnownHeader name) const |
(since 6.10) std::optional<qint64> | intValueAt(qsizetype i) const |
(since 6.10) std::optional<QList<qint64>> | intValues(QAnyStringView name) const |
(since 6.10) std::optional<QList<qint64>> | intValues(QHttpHeaders::WellKnownHeader name) const |
| bool | isEmpty() const |
| QLatin1StringView | nameAt(qsizetype i) const |
(since 6.12) std::optional<QHttpHeaderRangeSet> | rangeValues() const |
| void | removeAll(QAnyStringView name) |
| void | removeAll(QHttpHeaders::WellKnownHeader name) |
| void | removeAt(qsizetype i) |
| bool | replace(qsizetype i, QAnyStringView name, QAnyStringView newValue) |
| bool | replace(qsizetype i, QHttpHeaders::WellKnownHeader name, QAnyStringView newValue) |
(since 6.8) bool | replaceOrAppend(QHttpHeaders::WellKnownHeader name, QAnyStringView newValue) |
| bool | replaceOrAppend(QAnyStringView name, QAnyStringView newValue) |
| void | reserve(qsizetype size) |
(since 6.10) void | setDateTimeValue(QAnyStringView name, const QDateTime &dateTime) |
(since 6.10) void | setDateTimeValue(QHttpHeaders::WellKnownHeader name, const QDateTime &dateTime) |
(since 6.12) void | setRangeValues(const QHttpHeaderRangeSet &ranges) |
| qsizetype | size() const |
| void | swap(QHttpHeaders &other) |
| QList<std::pair<QByteArray, QByteArray>> | toListOfPairs() const |
| QMultiHash<QByteArray, QByteArray> | toMultiHash() const |
| QMultiMap<QByteArray, QByteArray> | toMultiMap() const |
| QByteArrayView | value(QAnyStringView name, QByteArrayView defaultValue = {}) const |
| QByteArrayView | value(QHttpHeaders::WellKnownHeader name, QByteArrayView defaultValue = {}) const |
| QByteArrayView | valueAt(qsizetype i) const |
| QList<QByteArray> | values(QAnyStringView name) const |
| QList<QByteArray> | values(QHttpHeaders::WellKnownHeader name) const |
| QHttpHeaders & | operator=(QHttpHeaders &&other) |
| QHttpHeaders & | operator=(const QHttpHeaders &other) |
정적 공용 멤버
| QHttpHeaders | fromListOfPairs(const QList<std::pair<QByteArray, QByteArray>> &headers) |
| QHttpHeaders | fromMultiHash(const QMultiHash<QByteArray, QByteArray> &headers) |
| QHttpHeaders | fromMultiMap(const QMultiMap<QByteArray, QByteArray> &headers) |
| QByteArrayView | wellKnownHeaderName(QHttpHeaders::WellKnownHeader name) |
관련 비멤버
(since 6.12) QDataStream & | operator<<(QDataStream &out, const QHttpHeaders &headers) |
| QDebug | operator<<(QDebug debug, const QHttpHeaders &headers) |
(since 6.12) QDataStream & | operator>>(QDataStream &in, QHttpHeaders &headers) |
상세 설명
이 클래스는 해당 헤더를 사용하거나 활용하는 Qt Network API를 위한 인터페이스 유형입니다.
허용되는 필드 이름 및 값 문자
HTTP 헤더는 이름과 값으로 구성됩니다. 이를 설정할 때, QHttpHeaders는 이름과 값에 HTTP RFC에서 허용하는 문자만 포함되도록 유효성 검사를 수행합니다. 자세한 내용은 RFC 9110의 5.1장과 5.5장을 참조하십시오.
요약하면 다음과 같습니다:
name가시적인 ASCII 문자로 구성되어야 하며, 비어 있어서는 안 됩니다value헤더 및 사용 사례별 인코딩 규칙을 준수하는 한 임의의 바이트로 구성될 수 있습니다.value는 비어 있을 수 있습니다
이 클래스의 세터 메서드는 값 처리 과정에서 무시되어야 하므로, value에서 앞뒤의 공백을 자동으로 제거합니다.
값 결합
대부분의 HTTP 헤더 값은 쉼표( ',' ) 하나와 선택적인 공백을 사용하여 결합할 수 있으며, 이 경우 의미적 내용이 보존됩니다. 예를 들어, 다음 두 가지는 의미적으로 유사해야 합니다:
// Values as separate header entries
myheadername: myheadervalue1
myheadername: myheadervalue2
// Combined value
myheadername: myheadervalue1, myheadervalue2그러나 이 규칙에는 주목할 만한 예외가 하나 있습니다. 바로 Set-Cookie입니다. 이 점과 사용자 정의 사용 사례의 가능성을 고려하여, QHttpHeaders는 값을 자동으로 결합하지 않습니다.
성능
대부분의 QHttpHeaders 함수는 QHttpHeaders::WellKnownHeader 및 QAnyStringView 오버로드를 모두 제공합니다. 메모리 사용량 및 계산 효율성 측면에서 QHttpHeaders::WellKnownHeader 오버로드를 사용하는 것이 권장됩니다.
멤버 유형 문서
enum class QHttpHeaders::WellKnownHeader
IANA 레지스트리에 등재된 잘 알려진 헤더 목록.
| 상수 | 값 |
|---|---|
QHttpHeaders::WellKnownHeader::AIM | 0 |
QHttpHeaders::WellKnownHeader::Accept | 1 |
QHttpHeaders::WellKnownHeader::AcceptAdditions | 2 |
QHttpHeaders::WellKnownHeader::AcceptCH | 3 |
QHttpHeaders::WellKnownHeader::AcceptDatetime | 4 |
QHttpHeaders::WellKnownHeader::AcceptEncoding | 5 |
QHttpHeaders::WellKnownHeader::AcceptFeatures | 6 |
QHttpHeaders::WellKnownHeader::AcceptLanguage | 7 |
QHttpHeaders::WellKnownHeader::AcceptPatch | 8 |
QHttpHeaders::WellKnownHeader::AcceptPost | 9 |
QHttpHeaders::WellKnownHeader::AcceptRanges | 10 |
QHttpHeaders::WellKnownHeader::AcceptSignature | 11 |
QHttpHeaders::WellKnownHeader::AccessControlAllowCredentials | 12 |
QHttpHeaders::WellKnownHeader::AccessControlAllowHeaders | 13 |
QHttpHeaders::WellKnownHeader::AccessControlAllowMethods | 14 |
QHttpHeaders::WellKnownHeader::AccessControlAllowOrigin | 15 |
QHttpHeaders::WellKnownHeader::AccessControlExposeHeaders | 16 |
QHttpHeaders::WellKnownHeader::AccessControlMaxAge | 17 |
QHttpHeaders::WellKnownHeader::AccessControlRequestHeaders | 18 |
QHttpHeaders::WellKnownHeader::AccessControlRequestMethod | 19 |
QHttpHeaders::WellKnownHeader::Age | 20 |
QHttpHeaders::WellKnownHeader::Allow | 21 |
QHttpHeaders::WellKnownHeader::ALPN | 22 |
QHttpHeaders::WellKnownHeader::AltSvc | 23 |
QHttpHeaders::WellKnownHeader::AltUsed | 24 |
QHttpHeaders::WellKnownHeader::Alternates | 25 |
QHttpHeaders::WellKnownHeader::ApplyToRedirectRef | 26 |
QHttpHeaders::WellKnownHeader::AuthenticationControl | 27 |
QHttpHeaders::WellKnownHeader::AuthenticationInfo | 28 |
QHttpHeaders::WellKnownHeader::Authorization | 29 |
QHttpHeaders::WellKnownHeader::CacheControl | 30 |
QHttpHeaders::WellKnownHeader::CacheStatus | 31 |
QHttpHeaders::WellKnownHeader::CalManagedID | 32 |
QHttpHeaders::WellKnownHeader::CalDAVTimezones | 33 |
QHttpHeaders::WellKnownHeader::CapsuleProtocol | 34 |
QHttpHeaders::WellKnownHeader::CDNCacheControl | 35 |
QHttpHeaders::WellKnownHeader::CDNLoop | 36 |
QHttpHeaders::WellKnownHeader::CertNotAfter | 37 |
QHttpHeaders::WellKnownHeader::CertNotBefore | 38 |
QHttpHeaders::WellKnownHeader::ClearSiteData | 39 |
QHttpHeaders::WellKnownHeader::ClientCert | 40 |
QHttpHeaders::WellKnownHeader::ClientCertChain | 41 |
QHttpHeaders::WellKnownHeader::Close | 42 |
QHttpHeaders::WellKnownHeader::Connection | 43 |
QHttpHeaders::WellKnownHeader::ContentDigest | 44 |
QHttpHeaders::WellKnownHeader::ContentDisposition | 45 |
QHttpHeaders::WellKnownHeader::ContentEncoding | 46 |
QHttpHeaders::WellKnownHeader::ContentID | 47 |
QHttpHeaders::WellKnownHeader::ContentLanguage | 48 |
QHttpHeaders::WellKnownHeader::ContentLength | 49 |
QHttpHeaders::WellKnownHeader::ContentLocation | 50 |
QHttpHeaders::WellKnownHeader::ContentRange | 51 |
QHttpHeaders::WellKnownHeader::ContentSecurityPolicy | 52 |
QHttpHeaders::WellKnownHeader::ContentSecurityPolicyReportOnly | 53 |
QHttpHeaders::WellKnownHeader::ContentType | 54 |
QHttpHeaders::WellKnownHeader::Cookie | 55 |
QHttpHeaders::WellKnownHeader::CrossOriginEmbedderPolicy | 56 |
QHttpHeaders::WellKnownHeader::CrossOriginEmbedderPolicyReportOnly | 57 |
QHttpHeaders::WellKnownHeader::CrossOriginOpenerPolicy | 58 |
QHttpHeaders::WellKnownHeader::CrossOriginOpenerPolicyReportOnly | 59 |
QHttpHeaders::WellKnownHeader::CrossOriginResourcePolicy | 60 |
QHttpHeaders::WellKnownHeader::DASL | 61 |
QHttpHeaders::WellKnownHeader::Date | 62 |
QHttpHeaders::WellKnownHeader::DAV | 63 |
QHttpHeaders::WellKnownHeader::DeltaBase | 64 |
QHttpHeaders::WellKnownHeader::Depth | 65 |
QHttpHeaders::WellKnownHeader::Destination | 66 |
QHttpHeaders::WellKnownHeader::DifferentialID | 67 |
QHttpHeaders::WellKnownHeader::DPoP | 68 |
QHttpHeaders::WellKnownHeader::DPoPNonce | 69 |
QHttpHeaders::WellKnownHeader::EarlyData | 70 |
QHttpHeaders::WellKnownHeader::ETag | 71 |
QHttpHeaders::WellKnownHeader::Expect | 72 |
QHttpHeaders::WellKnownHeader::ExpectCT | 73 |
QHttpHeaders::WellKnownHeader::Expires | 74 |
QHttpHeaders::WellKnownHeader::Forwarded | 75 |
QHttpHeaders::WellKnownHeader::From | 76 |
QHttpHeaders::WellKnownHeader::Hobareg | 77 |
QHttpHeaders::WellKnownHeader::Host | 78 |
QHttpHeaders::WellKnownHeader::If | 79 |
QHttpHeaders::WellKnownHeader::IfMatch | 80 |
QHttpHeaders::WellKnownHeader::IfModifiedSince | 81 |
QHttpHeaders::WellKnownHeader::IfNoneMatch | 82 |
QHttpHeaders::WellKnownHeader::IfRange | 83 |
QHttpHeaders::WellKnownHeader::IfScheduleTagMatch | 84 |
QHttpHeaders::WellKnownHeader::IfUnmodifiedSince | 85 |
QHttpHeaders::WellKnownHeader::IM | 86 |
QHttpHeaders::WellKnownHeader::IncludeReferredTokenBindingID | 87 |
QHttpHeaders::WellKnownHeader::KeepAlive | 88 |
QHttpHeaders::WellKnownHeader::Label | 89 |
QHttpHeaders::WellKnownHeader::LastEventID | 90 |
QHttpHeaders::WellKnownHeader::LastModified | 91 |
QHttpHeaders::WellKnownHeader::Link | 92 |
QHttpHeaders::WellKnownHeader::Location | 93 |
QHttpHeaders::WellKnownHeader::LockToken | 94 |
QHttpHeaders::WellKnownHeader::MaxForwards | 95 |
QHttpHeaders::WellKnownHeader::MementoDatetime | 96 |
QHttpHeaders::WellKnownHeader::Meter | 97 |
QHttpHeaders::WellKnownHeader::MIMEVersion | 98 |
QHttpHeaders::WellKnownHeader::Negotiate | 99 |
QHttpHeaders::WellKnownHeader::NEL | 100 |
QHttpHeaders::WellKnownHeader::ODataEntityId | 101 |
QHttpHeaders::WellKnownHeader::ODataIsolation | 102 |
QHttpHeaders::WellKnownHeader::ODataMaxVersion | 103 |
QHttpHeaders::WellKnownHeader::ODataVersion | 104 |
QHttpHeaders::WellKnownHeader::OptionalWWWAuthenticate | 105 |
QHttpHeaders::WellKnownHeader::OrderingType | 106 |
QHttpHeaders::WellKnownHeader::Origin | 107 |
QHttpHeaders::WellKnownHeader::OriginAgentCluster | 108 |
QHttpHeaders::WellKnownHeader::OSCORE | 109 |
QHttpHeaders::WellKnownHeader::OSLCCoreVersion | 110 |
QHttpHeaders::WellKnownHeader::Overwrite | 111 |
QHttpHeaders::WellKnownHeader::PingFrom | 112 |
QHttpHeaders::WellKnownHeader::PingTo | 113 |
QHttpHeaders::WellKnownHeader::Position | 114 |
QHttpHeaders::WellKnownHeader::Prefer | 115 |
QHttpHeaders::WellKnownHeader::PreferenceApplied | 116 |
QHttpHeaders::WellKnownHeader::Priority | 117 |
QHttpHeaders::WellKnownHeader::ProxyAuthenticate | 118 |
QHttpHeaders::WellKnownHeader::ProxyAuthenticationInfo | 119 |
QHttpHeaders::WellKnownHeader::ProxyAuthorization | 120 |
QHttpHeaders::WellKnownHeader::ProxyStatus | 121 |
QHttpHeaders::WellKnownHeader::PublicKeyPins | 122 |
QHttpHeaders::WellKnownHeader::PublicKeyPinsReportOnly | 123 |
QHttpHeaders::WellKnownHeader::Range | 124 |
QHttpHeaders::WellKnownHeader::RedirectRef | 125 |
QHttpHeaders::WellKnownHeader::Referer | 126 |
QHttpHeaders::WellKnownHeader::Refresh | 127 |
QHttpHeaders::WellKnownHeader::ReplayNonce | 128 |
QHttpHeaders::WellKnownHeader::ReprDigest | 129 |
QHttpHeaders::WellKnownHeader::RetryAfter | 130 |
QHttpHeaders::WellKnownHeader::ScheduleReply | 131 |
QHttpHeaders::WellKnownHeader::ScheduleTag | 132 |
QHttpHeaders::WellKnownHeader::SecPurpose | 133 |
QHttpHeaders::WellKnownHeader::SecTokenBinding | 134 |
QHttpHeaders::WellKnownHeader::SecWebSocketAccept | 135 |
QHttpHeaders::WellKnownHeader::SecWebSocketExtensions | 136 |
QHttpHeaders::WellKnownHeader::SecWebSocketKey | 137 |
QHttpHeaders::WellKnownHeader::SecWebSocketProtocol | 138 |
QHttpHeaders::WellKnownHeader::SecWebSocketVersion | 139 |
QHttpHeaders::WellKnownHeader::Server | 140 |
QHttpHeaders::WellKnownHeader::ServerTiming | 141 |
QHttpHeaders::WellKnownHeader::SetCookie | 142 |
QHttpHeaders::WellKnownHeader::Signature | 143 |
QHttpHeaders::WellKnownHeader::SignatureInput | 144 |
QHttpHeaders::WellKnownHeader::SLUG | 145 |
QHttpHeaders::WellKnownHeader::SoapAction | 146 |
QHttpHeaders::WellKnownHeader::StatusURI | 147 |
QHttpHeaders::WellKnownHeader::StrictTransportSecurity | 148 |
QHttpHeaders::WellKnownHeader::Sunset | 149 |
QHttpHeaders::WellKnownHeader::SurrogateCapability | 150 |
QHttpHeaders::WellKnownHeader::SurrogateControl | 151 |
QHttpHeaders::WellKnownHeader::TCN | 152 |
QHttpHeaders::WellKnownHeader::TE | 153 |
QHttpHeaders::WellKnownHeader::Timeout | 154 |
QHttpHeaders::WellKnownHeader::Topic | 155 |
QHttpHeaders::WellKnownHeader::Traceparent | 156 |
QHttpHeaders::WellKnownHeader::Tracestate | 157 |
QHttpHeaders::WellKnownHeader::Trailer | 158 |
QHttpHeaders::WellKnownHeader::TransferEncoding | 159 |
QHttpHeaders::WellKnownHeader::TTL | 160 |
QHttpHeaders::WellKnownHeader::Upgrade | 161 |
QHttpHeaders::WellKnownHeader::Urgency | 162 |
QHttpHeaders::WellKnownHeader::UserAgent | 163 |
QHttpHeaders::WellKnownHeader::VariantVary | 164 |
QHttpHeaders::WellKnownHeader::Vary | 165 |
QHttpHeaders::WellKnownHeader::Via | 166 |
QHttpHeaders::WellKnownHeader::WantContentDigest | 167 |
QHttpHeaders::WellKnownHeader::WantReprDigest | 168 |
QHttpHeaders::WellKnownHeader::WWWAuthenticate | 169 |
QHttpHeaders::WellKnownHeader::XContentTypeOptions | 170 |
QHttpHeaders::WellKnownHeader::XFrameOptions | 171 |
QHttpHeaders::WellKnownHeader::AcceptCharset | 172 |
QHttpHeaders::WellKnownHeader::CPEPInfo | 173 |
QHttpHeaders::WellKnownHeader::Pragma | 174 |
QHttpHeaders::WellKnownHeader::ProtocolInfo | 175 |
QHttpHeaders::WellKnownHeader::ProtocolQuery | 176 |
멤버 함수 문서
[noexcept] QHttpHeaders::QHttpHeaders()
새로운 QHttpHeaders 객체를 생성합니다.
QHttpHeaders::QHttpHeaders(const QHttpHeaders &other)
other 의 복사본을 생성합니다.
[constexpr noexcept default] QHttpHeaders::QHttpHeaders(QHttpHeaders &&other)
other 에서 객체를 이동 생성하며, 는 그대로 유지됩니다 empty.
[noexcept] QHttpHeaders::~QHttpHeaders()
헤더 객체를 제거합니다.
bool QHttpHeaders::append(QAnyStringView name, QAnyStringView value)
name 와 value 를 가진 헤더 항목을 추가하고, 성공하면 true 를 반환합니다.
append(QHttpHeaders::WellKnownHeader, QAnyStringView) 및 Allowed field name and value characters도 참조하십시오 .
bool QHttpHeaders::append(QHttpHeaders::WellKnownHeader name, QAnyStringView value)
이 함수는 ` QHttpHeaders::append(QAnyStringView, QAnyStringView)`를 오버로드합니다.
void QHttpHeaders::clear()
모든 헤더 항목을 지웁니다.
size()도 참조하십시오 .
QByteArray QHttpHeaders::combinedValue(QAnyStringView name) const
name 헤더의 값을 쉼표로 구분된 문자열로 반환합니다. name 값을 가진 헤더가 존재하지 않으면 null QByteArray 를 반환합니다.
참고: 이러한 방식으로 'Set-Cookie' 헤더의 값에접근하면 의도한 대로 작동하지 않을 수 있습니다. 이 헤더의 값은 이러한 방식으로 결합할 수 없다는 점에서 HTTP RFC의 주목할 만한 예외 사항입니다. 대신 values()를 사용하는 것이 좋습니다.
values(QAnyStringView)도 참조하십시오 .
QByteArray QHttpHeaders::combinedValue(QHttpHeaders::WellKnownHeader name) const
이 함수는 ` QHttpHeaders::combinedValue`(`QAnyStringView`)를 오버로드합니다.
bool QHttpHeaders::contains(QAnyStringView name) const
헤더에 name 가 포함되어 있는지 여부를 반환합니다.
contains(QHttpHeaders::WellKnownHeader)항목도 참조하십시오 .
bool QHttpHeaders::contains(QHttpHeaders::WellKnownHeader name) const
이 함수는 QHttpHeaders::has(QAnyStringView)를 오버로드합니다.
[since 6.10] std::optional<QDateTime> QHttpHeaders::dateTimeValue(QAnyStringView name) const
표준 HTTP 날짜 형식에 따라 ` name `에서 처음 발견된 헤더 값을 ` QDateTime ` 객체로 변환합니다. 헤더가 존재하지 않거나 유효하지 않은 ` QDateTime`을 포함하는 경우, ` std::nullopt`을 반환합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
setDateTimeValue(), dateTimeValues(QAnyStringView name) 및 dateTimeValueAt(qsizetype i)도 참조하십시오 .
[since 6.10] std::optional<QDateTime> QHttpHeaders::dateTimeValue(QHttpHeaders::WellKnownHeader name) const
이 함수는 ` QHttpHeaders::dateTimeValue`(QAnyStringView)를 오버로드합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
[since 6.10] std::optional<QDateTime> QHttpHeaders::dateTimeValueAt(qsizetype i) const
인덱스 i 에 있는 헤더 값을 표준 HTTP 날짜 형식에 따라 QDateTime 객체로 변환합니다. 인덱스 i 은 유효해야 합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
dateTimeValue(QAnyStringView name) 및 dateTimeValues(QAnyStringView name)도 참조하십시오 .
[since 6.10] std::optional<QList<QDateTime>> QHttpHeaders::dateTimeValues(QAnyStringView name) const
name 의 모든 헤더 값을 표준 HTTP 날짜 형식에 따라 ` QDateTime ` 객체 목록으로 반환합니다. 유효한 날짜-시간 값이 발견되지 않으면 ` std::nullopt`를 반환합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
dateTimeValue(QAnyStringView name) 및 dateTimeValueAt(qsizetype i)도 참조하십시오 .
[since 6.10] std::optional<QList<QDateTime>> QHttpHeaders::dateTimeValues(QHttpHeaders::WellKnownHeader name) const
이 함수는 ` QHttpHeaders::dateTimeValues`(QAnyStringView)를 오버로드합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
[static] QHttpHeaders QHttpHeaders::fromListOfPairs(const QList<std::pair<QByteArray, QByteArray>> &headers)
headers 의 값이 설정된 새로운 QHttpHeaders 객체를 생성합니다.
Allowed field name and value characters도 참조하십시오 .
[static] QHttpHeaders QHttpHeaders::fromMultiHash(const QMultiHash<QByteArray, QByteArray> &headers)
headers 의 값이 설정된 새로운 QHttpHeaders 객체를 생성합니다.
Allowed field name and value characters도 참조하십시오 .
[static] QHttpHeaders QHttpHeaders::fromMultiMap(const QMultiMap<QByteArray, QByteArray> &headers)
headers 의 값이 채워진 새로운 QHttpHeaders 객체를 생성합니다.
Allowed field name and value characters도 참조하십시오 .
bool QHttpHeaders::insert(qsizetype i, QAnyStringView name, QAnyStringView value)
인덱스 i 에 헤더 항목을 삽입하며, name 및 value 를 지정합니다. 인덱스는 유효해야 합니다( size() 참조). 삽입이 성공했는지 여부를 반환합니다.
append(), insert(qsizetype, QHttpHeaders::WellKnownHeader, QAnyStringView), size() 및 Allowed field name and value characters도 참조하십시오 .
bool QHttpHeaders::insert(qsizetype i, QHttpHeaders::WellKnownHeader name, QAnyStringView value)
이 함수는 ` QHttpHeaders::insert`(`qsizetype`, `QAnyStringView`, `QAnyStringView`)을 오버로드합니다.
[noexcept, since 6.10] std::optional<qint64> QHttpHeaders::intValue(QAnyStringView name) const
첫 번째 유효한 헤더 name 의 값을 64비트 정수로 해석하여 반환합니다. 헤더가 존재하지 않거나 정수로 구문 분석할 수 없는 경우, ` std::nullopt`을 반환합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
intValues(QAnyStringView name) 및 intValueAt(qsizetype i)도 참조하십시오 .
[noexcept, since 6.10] std::optional<qint64> QHttpHeaders::intValue(QHttpHeaders::WellKnownHeader name) const
이 함수는 ` QHttpHeaders::intValue`(QAnyStringView)를 오버로드합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
[noexcept, since 6.10] std::optional<qint64> QHttpHeaders::intValueAt(qsizetype i) const
i 인덱스에서 64비트 정수로 해석된 헤더 값을 반환합니다. i 인덱스는 유효해야 합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
intValues(QAnyStringView name) 및 intValue(QAnyStringView name)도 참조하십시오 .
[since 6.10] std::optional<QList<qint64>> QHttpHeaders::intValues(QAnyStringView name) const
name 헤더의 값을 64비트 정수로 해석하여 목록 형태로 반환합니다. 헤더가 존재하지 않거나 정수로 파싱할 수 없는 경우, std::nullopt 를 반환합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
intValue(QAnyStringView name) 및 intValueAt(qsizetype i)도 참조하십시오 .
[since 6.10] std::optional<QList<qint64>> QHttpHeaders::intValues(QHttpHeaders::WellKnownHeader name) const
이 함수는 ` QHttpHeaders::intValues`(QAnyStringView)를 오버로드합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
[noexcept] bool QHttpHeaders::isEmpty() const
헤더의 크기가 0인 경우 ` true `을 반환하고, 그렇지 않은 경우 ` false`을 반환합니다.
size()도 참조하십시오 .
[noexcept] QLatin1StringView QHttpHeaders::nameAt(qsizetype i) const
i 인덱스에 있는 헤더 이름을 반환합니다. i 인덱스는 유효해야 합니다( size() 참조).
헤더 이름은 대소문자를 구분하지 않으며, 반환되는 이름은 소문자로 변환됩니다.
[since 6.12] std::optional<QHttpHeaderRangeSet> QHttpHeaders::rangeValues() const
Range HTTP 헤더 필드의 범위를 반환하거나, 구문 분석에 실패한 경우 std::nullopt 를 반환합니다.
각 범위는 바이트 범위를 나타냅니다. RFC 9110에 따르면:
- 시작 범위는 지정되었으나 끝 범위가 지정되지 않은 경우(예: "bytes=500-"), ` QHttpHeaderRangeSpec ` 값은 `
start=500` 및 `end=std::nullopt`이 됩니다. - 끝이 지정되었으나 시작이 지정되지 않은 경우(예: "bytes=-500"), QHttpHeaderRangeSpec 에는
start=std::nullopt및end=500이 포함되며, 이는 마지막 500바이트를 나타냅니다. - 양쪽이 모두 지정된 경우(예: "bytes=0-499"), QHttpHeaderRangeSpec 에는
start=0및end=499가 포함됩니다.
범위는 헤더에 나타나는 순서대로 반환됩니다.
구문 분석은 다음과 같이 수행됩니다:
Range헤더가 없는 경우, 빈 범위 집합이 반환됩니다.- RFC 9110 섹션 14.2에 따르면, "bytes" 이외의 단위(예: "seconds=1-2")를 포함하는
Range헤더는 무시됩니다. 이러한 무시된 헤더로 인해 구문 분석이 실패하지는 않습니다. Range헤더가 "bytes" 단위를 사용하지만 형식이 잘못된 경우(예: 하이픈 누락, 유효하지 않은 문자 포함, 유효하지 않은 숫자 포함), 이 함수는 `std::nullopt`를 반환합니다.
이 함수는 Qt 6.12에서 도입되었습니다.
setRangeValues 및 WellKnownHeader::Range도 참조하십시오 .
void QHttpHeaders::removeAll(QAnyStringView name)
name 헤더를 제거합니다.
removeAt() 및 removeAll(QHttpHeaders::WellKnownHeader)도 참조하십시오 .
void QHttpHeaders::removeAll(QHttpHeaders::WellKnownHeader name)
이 함수는 ` QHttpHeaders::removeAll`(`QAnyStringView`)를 오버로드합니다.
void QHttpHeaders::removeAt(qsizetype i)
인덱스 i 에 있는 헤더를 제거합니다. 인덱스 i 는 유효해야 합니다( size() 참조).
removeAll(QHttpHeaders::WellKnownHeader), removeAll(QAnyStringView) 및 size()도 참조하십시오 .
bool QHttpHeaders::replace(qsizetype i, QAnyStringView name, QAnyStringView newValue)
인덱스 i 에 있는 헤더 항목을 name 및 newValue 로 대체합니다. 인덱스는 유효해야 합니다( size() 참조). 대체가 성공했는지 여부를 반환합니다.
append(), replace(qsizetype, QHttpHeaders::WellKnownHeader, QAnyStringView), size(), 및 Allowed field name and value characters도 참조하십시오 .
bool QHttpHeaders::replace(qsizetype i, QHttpHeaders::WellKnownHeader name, QAnyStringView newValue)
이 함수는 ` QHttpHeaders::replace`(`qsizetype`, `QAnyStringView`, `QAnyStringView`)를 오버로드합니다.
[since 6.8] bool QHttpHeaders::replaceOrAppend(QHttpHeaders::WellKnownHeader name, QAnyStringView newValue)
QHttpHeaders 에 이미 name 가 포함되어 있다면, 그 값을 newValue 로 대체하고, 추가로 있을 수 있는 name 항목을 제거합니다. name 가 존재하지 않는 경우, 새로운 항목을 추가합니다. 성공하면 true 를 반환합니다.
이 함수는 고유한 name: newValue 헤더를 설정하기 위한 편의 메서드입니다. 대부분의 헤더의 경우 상대적 순서는 중요하지 않으므로, 기존 항목이 존재하면 이를 재사용할 수 있습니다.
이 함수는 Qt 6.8에서 도입되었습니다.
replaceOrAppend(QAnyStringView, QAnyStringView)항목도 참조하십시오 .
bool QHttpHeaders::replaceOrAppend(QAnyStringView name, QAnyStringView newValue)
이 함수는 QHttpHeaders::replaceOrAppend(WellKnownHeader, QAnyStringView)를 오버로드합니다.
void QHttpHeaders::reserve(qsizetype size)
size 개 이상의 헤더 항목에 대한 메모리를 할당하려고 시도합니다.
헤더 항목의 개수를 미리 알고 있는 경우, 이 함수를 호출하여 재할당 및 메모리 단편화를 방지할 수 있습니다.
[since 6.10] void QHttpHeaders::setDateTimeValue(QAnyStringView name, const QDateTime &dateTime)
표준 HTTP IMF-fixdate 형식에 따라 헤더 이름 name 의 값을 dateTime 로 설정합니다. 해당 헤더가 존재하지 않으면 새로운 헤더를 추가합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
dateTimeValue(QAnyStringView name) 및 dateTimeValueAt(qsizetype i)도 참조하십시오 .
[since 6.10] void QHttpHeaders::setDateTimeValue(QHttpHeaders::WellKnownHeader name, const QDateTime &dateTime)
이 함수는 QHttpHeaders::setDateTimeValue(QAnyStringView)를 오버로드합니다.
이 함수는 Qt 6.10에서 도입되었습니다.
[since 6.12] void QHttpHeaders::setRangeValues(const QHttpHeaderRangeSet &ranges)
Range HTTP 헤더 필드를 지정된 ranges 목록으로 설정합니다.
범위는 "바이트(bytes)" 단위로 형식화되며, ` ranges `가 이를 저장하는 순서대로 나열됩니다. 각 ` QHttpHeaderRangeSpec`에 대해:
- 시작점만 있는 범위(예: QHttpHeaderRangeSpec(500, std::nullopt))는
"500-"형식으로 표시됩니다. - 끝점만 있는 범위(예: QHttpHeaderRangeSpec(std::nullopt, 500))는
"-500"형식으로 표시되며, 이는 마지막 500바이트를 나타냅니다. - 시작과 끝이 모두 지정된 범위(예: QHttpHeaderRangeSpec(0, 499))는
"0-499"로 형식화됩니다.
여러 범위가 제공된 경우, 쉼표로 연결됩니다(예: "bytes=0-499, 1000-").
ranges 가 비어 있는 경우, Range 헤더가 제거됩니다.
이 함수는 Qt 6.12에서 도입되었습니다.
rangeValues() 및 WellKnownHeader::Range도 참조하십시오 .
[noexcept] qsizetype QHttpHeaders::size() const
헤더 항목의 개수를 반환합니다.
[noexcept] void QHttpHeaders::swap(QHttpHeaders &other)
QHttpHeaders 를 other 로 교체합니다. 이 작업은 매우 빠르며 절대 실패하지 않습니다.
QList<std::pair<QByteArray, QByteArray>> QHttpHeaders::toListOfPairs() const
헤더 항목을 (이름, 값) 짝으로 구성된 목록으로 반환합니다. 헤더 이름은 대소문자를 구분하지 않으며, 반환되는 이름은 소문자로 변환됩니다.
QMultiHash<QByteArray, QByteArray> QHttpHeaders::toMultiHash() const
헤더 항목을 이름과 값(들)의 해시 형태로 반환합니다. 헤더 이름은 대소문자를 구분하지 않으며, 반환되는 이름은 소문자로 변환됩니다.
QMultiMap<QByteArray, QByteArray> QHttpHeaders::toMultiMap() const
헤더 항목을 ‘이름’과 ‘값(들)’의 맵 형태로 반환합니다. 헤더 이름은 대소문자를 구분하지 않으며, 반환되는 이름은 소문자로 변환됩니다.
[noexcept] QByteArrayView QHttpHeaders::value(QAnyStringView name, QByteArrayView defaultValue = {}) const
name 의 (첫 번째) 헤더 값을 반환하며, 해당 헤더가 존재하지 않을 경우 defaultValue 를 반환합니다.
value(QHttpHeaders::WellKnownHeader, QByteArrayView)도 참조하십시오 .
[noexcept] QByteArrayView QHttpHeaders::value(QHttpHeaders::WellKnownHeader name, QByteArrayView defaultValue = {}) const
이 함수는 ` QHttpHeaders::value`(`QAnyStringView`, `QByteArrayView`)를 오버로드합니다.
[noexcept] QByteArrayView QHttpHeaders::valueAt(qsizetype i) const
i 인덱스에 있는 헤더 값을 반환합니다. i 인덱스는 유효해야 합니다( size() 참조).
size(), value(), values(), combinedValue() 및 nameAt()도 참조하십시오 .
QList<QByteArray> QHttpHeaders::values(QAnyStringView name) const
name 헤더의 값들을 목록 형태로 반환합니다. name 헤더가 존재하지 않으면 빈 목록을 반환합니다.
values(QHttpHeaders::WellKnownHeader)도 참조하십시오 .
QList<QByteArray> QHttpHeaders::values(QHttpHeaders::WellKnownHeader name) const
이 함수는 ` QHttpHeaders::values`(`QAnyStringView`)를 오버로드합니다.
[static noexcept] QByteArrayView QHttpHeaders::wellKnownHeaderName(QHttpHeaders::WellKnownHeader name)
지정된 ` name `에 해당하는 헤더 이름을 뷰로 반환합니다.
[noexcept] QHttpHeaders &QHttpHeaders::operator=(QHttpHeaders &&other)
other 에 값을 할당하고 이 객체에 대한 참조를 반환합니다.
other empty 가 남게 됩니다.
QHttpHeaders &QHttpHeaders::operator=(const QHttpHeaders &other)
other 의 내용을 할당하고, 이 객체에 대한 참조를 반환합니다.
관련 비회원
[since 6.12] QDataStream &operator<<(QDataStream &out, const QHttpHeaders &headers)
` headers `를 ` out ` 스트림에 기록합니다.
이 함수는 Qt 6.12에서 도입되었습니다.
'Qt 데이터 유형 직렬화'항목도 참조하십시오 .
QDebug operator<<(QDebug debug, const QHttpHeaders &headers)
headers 를 debug 스트림에 기록합니다.
[since 6.12] QDataStream &operator>>(QDataStream &in, QHttpHeaders &headers)
in 스트림에서 헤더를 읽어 headers 에 저장합니다.
이 함수는 Qt 6.12에서 도입되었습니다.
'Qt 데이터 유형 직렬화'항목도 참조하십시오 .
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.