이 페이지에서

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::AIM0
QHttpHeaders::WellKnownHeader::Accept1
QHttpHeaders::WellKnownHeader::AcceptAdditions2
QHttpHeaders::WellKnownHeader::AcceptCH3
QHttpHeaders::WellKnownHeader::AcceptDatetime4
QHttpHeaders::WellKnownHeader::AcceptEncoding5
QHttpHeaders::WellKnownHeader::AcceptFeatures6
QHttpHeaders::WellKnownHeader::AcceptLanguage7
QHttpHeaders::WellKnownHeader::AcceptPatch8
QHttpHeaders::WellKnownHeader::AcceptPost9
QHttpHeaders::WellKnownHeader::AcceptRanges10
QHttpHeaders::WellKnownHeader::AcceptSignature11
QHttpHeaders::WellKnownHeader::AccessControlAllowCredentials12
QHttpHeaders::WellKnownHeader::AccessControlAllowHeaders13
QHttpHeaders::WellKnownHeader::AccessControlAllowMethods14
QHttpHeaders::WellKnownHeader::AccessControlAllowOrigin15
QHttpHeaders::WellKnownHeader::AccessControlExposeHeaders16
QHttpHeaders::WellKnownHeader::AccessControlMaxAge17
QHttpHeaders::WellKnownHeader::AccessControlRequestHeaders18
QHttpHeaders::WellKnownHeader::AccessControlRequestMethod19
QHttpHeaders::WellKnownHeader::Age20
QHttpHeaders::WellKnownHeader::Allow21
QHttpHeaders::WellKnownHeader::ALPN22
QHttpHeaders::WellKnownHeader::AltSvc23
QHttpHeaders::WellKnownHeader::AltUsed24
QHttpHeaders::WellKnownHeader::Alternates25
QHttpHeaders::WellKnownHeader::ApplyToRedirectRef26
QHttpHeaders::WellKnownHeader::AuthenticationControl27
QHttpHeaders::WellKnownHeader::AuthenticationInfo28
QHttpHeaders::WellKnownHeader::Authorization29
QHttpHeaders::WellKnownHeader::CacheControl30
QHttpHeaders::WellKnownHeader::CacheStatus31
QHttpHeaders::WellKnownHeader::CalManagedID32
QHttpHeaders::WellKnownHeader::CalDAVTimezones33
QHttpHeaders::WellKnownHeader::CapsuleProtocol34
QHttpHeaders::WellKnownHeader::CDNCacheControl35
QHttpHeaders::WellKnownHeader::CDNLoop36
QHttpHeaders::WellKnownHeader::CertNotAfter37
QHttpHeaders::WellKnownHeader::CertNotBefore38
QHttpHeaders::WellKnownHeader::ClearSiteData39
QHttpHeaders::WellKnownHeader::ClientCert40
QHttpHeaders::WellKnownHeader::ClientCertChain41
QHttpHeaders::WellKnownHeader::Close42
QHttpHeaders::WellKnownHeader::Connection43
QHttpHeaders::WellKnownHeader::ContentDigest44
QHttpHeaders::WellKnownHeader::ContentDisposition45
QHttpHeaders::WellKnownHeader::ContentEncoding46
QHttpHeaders::WellKnownHeader::ContentID47
QHttpHeaders::WellKnownHeader::ContentLanguage48
QHttpHeaders::WellKnownHeader::ContentLength49
QHttpHeaders::WellKnownHeader::ContentLocation50
QHttpHeaders::WellKnownHeader::ContentRange51
QHttpHeaders::WellKnownHeader::ContentSecurityPolicy52
QHttpHeaders::WellKnownHeader::ContentSecurityPolicyReportOnly53
QHttpHeaders::WellKnownHeader::ContentType54
QHttpHeaders::WellKnownHeader::Cookie55
QHttpHeaders::WellKnownHeader::CrossOriginEmbedderPolicy56
QHttpHeaders::WellKnownHeader::CrossOriginEmbedderPolicyReportOnly57
QHttpHeaders::WellKnownHeader::CrossOriginOpenerPolicy58
QHttpHeaders::WellKnownHeader::CrossOriginOpenerPolicyReportOnly59
QHttpHeaders::WellKnownHeader::CrossOriginResourcePolicy60
QHttpHeaders::WellKnownHeader::DASL61
QHttpHeaders::WellKnownHeader::Date62
QHttpHeaders::WellKnownHeader::DAV63
QHttpHeaders::WellKnownHeader::DeltaBase64
QHttpHeaders::WellKnownHeader::Depth65
QHttpHeaders::WellKnownHeader::Destination66
QHttpHeaders::WellKnownHeader::DifferentialID67
QHttpHeaders::WellKnownHeader::DPoP68
QHttpHeaders::WellKnownHeader::DPoPNonce69
QHttpHeaders::WellKnownHeader::EarlyData70
QHttpHeaders::WellKnownHeader::ETag71
QHttpHeaders::WellKnownHeader::Expect72
QHttpHeaders::WellKnownHeader::ExpectCT73
QHttpHeaders::WellKnownHeader::Expires74
QHttpHeaders::WellKnownHeader::Forwarded75
QHttpHeaders::WellKnownHeader::From76
QHttpHeaders::WellKnownHeader::Hobareg77
QHttpHeaders::WellKnownHeader::Host78
QHttpHeaders::WellKnownHeader::If79
QHttpHeaders::WellKnownHeader::IfMatch80
QHttpHeaders::WellKnownHeader::IfModifiedSince81
QHttpHeaders::WellKnownHeader::IfNoneMatch82
QHttpHeaders::WellKnownHeader::IfRange83
QHttpHeaders::WellKnownHeader::IfScheduleTagMatch84
QHttpHeaders::WellKnownHeader::IfUnmodifiedSince85
QHttpHeaders::WellKnownHeader::IM86
QHttpHeaders::WellKnownHeader::IncludeReferredTokenBindingID87
QHttpHeaders::WellKnownHeader::KeepAlive88
QHttpHeaders::WellKnownHeader::Label89
QHttpHeaders::WellKnownHeader::LastEventID90
QHttpHeaders::WellKnownHeader::LastModified91
QHttpHeaders::WellKnownHeader::Link92
QHttpHeaders::WellKnownHeader::Location93
QHttpHeaders::WellKnownHeader::LockToken94
QHttpHeaders::WellKnownHeader::MaxForwards95
QHttpHeaders::WellKnownHeader::MementoDatetime96
QHttpHeaders::WellKnownHeader::Meter97
QHttpHeaders::WellKnownHeader::MIMEVersion98
QHttpHeaders::WellKnownHeader::Negotiate99
QHttpHeaders::WellKnownHeader::NEL100
QHttpHeaders::WellKnownHeader::ODataEntityId101
QHttpHeaders::WellKnownHeader::ODataIsolation102
QHttpHeaders::WellKnownHeader::ODataMaxVersion103
QHttpHeaders::WellKnownHeader::ODataVersion104
QHttpHeaders::WellKnownHeader::OptionalWWWAuthenticate105
QHttpHeaders::WellKnownHeader::OrderingType106
QHttpHeaders::WellKnownHeader::Origin107
QHttpHeaders::WellKnownHeader::OriginAgentCluster108
QHttpHeaders::WellKnownHeader::OSCORE109
QHttpHeaders::WellKnownHeader::OSLCCoreVersion110
QHttpHeaders::WellKnownHeader::Overwrite111
QHttpHeaders::WellKnownHeader::PingFrom112
QHttpHeaders::WellKnownHeader::PingTo113
QHttpHeaders::WellKnownHeader::Position114
QHttpHeaders::WellKnownHeader::Prefer115
QHttpHeaders::WellKnownHeader::PreferenceApplied116
QHttpHeaders::WellKnownHeader::Priority117
QHttpHeaders::WellKnownHeader::ProxyAuthenticate118
QHttpHeaders::WellKnownHeader::ProxyAuthenticationInfo119
QHttpHeaders::WellKnownHeader::ProxyAuthorization120
QHttpHeaders::WellKnownHeader::ProxyStatus121
QHttpHeaders::WellKnownHeader::PublicKeyPins122
QHttpHeaders::WellKnownHeader::PublicKeyPinsReportOnly123
QHttpHeaders::WellKnownHeader::Range124
QHttpHeaders::WellKnownHeader::RedirectRef125
QHttpHeaders::WellKnownHeader::Referer126
QHttpHeaders::WellKnownHeader::Refresh127
QHttpHeaders::WellKnownHeader::ReplayNonce128
QHttpHeaders::WellKnownHeader::ReprDigest129
QHttpHeaders::WellKnownHeader::RetryAfter130
QHttpHeaders::WellKnownHeader::ScheduleReply131
QHttpHeaders::WellKnownHeader::ScheduleTag132
QHttpHeaders::WellKnownHeader::SecPurpose133
QHttpHeaders::WellKnownHeader::SecTokenBinding134
QHttpHeaders::WellKnownHeader::SecWebSocketAccept135
QHttpHeaders::WellKnownHeader::SecWebSocketExtensions136
QHttpHeaders::WellKnownHeader::SecWebSocketKey137
QHttpHeaders::WellKnownHeader::SecWebSocketProtocol138
QHttpHeaders::WellKnownHeader::SecWebSocketVersion139
QHttpHeaders::WellKnownHeader::Server140
QHttpHeaders::WellKnownHeader::ServerTiming141
QHttpHeaders::WellKnownHeader::SetCookie142
QHttpHeaders::WellKnownHeader::Signature143
QHttpHeaders::WellKnownHeader::SignatureInput144
QHttpHeaders::WellKnownHeader::SLUG145
QHttpHeaders::WellKnownHeader::SoapAction146
QHttpHeaders::WellKnownHeader::StatusURI147
QHttpHeaders::WellKnownHeader::StrictTransportSecurity148
QHttpHeaders::WellKnownHeader::Sunset149
QHttpHeaders::WellKnownHeader::SurrogateCapability150
QHttpHeaders::WellKnownHeader::SurrogateControl151
QHttpHeaders::WellKnownHeader::TCN152
QHttpHeaders::WellKnownHeader::TE153
QHttpHeaders::WellKnownHeader::Timeout154
QHttpHeaders::WellKnownHeader::Topic155
QHttpHeaders::WellKnownHeader::Traceparent156
QHttpHeaders::WellKnownHeader::Tracestate157
QHttpHeaders::WellKnownHeader::Trailer158
QHttpHeaders::WellKnownHeader::TransferEncoding159
QHttpHeaders::WellKnownHeader::TTL160
QHttpHeaders::WellKnownHeader::Upgrade161
QHttpHeaders::WellKnownHeader::Urgency162
QHttpHeaders::WellKnownHeader::UserAgent163
QHttpHeaders::WellKnownHeader::VariantVary164
QHttpHeaders::WellKnownHeader::Vary165
QHttpHeaders::WellKnownHeader::Via166
QHttpHeaders::WellKnownHeader::WantContentDigest167
QHttpHeaders::WellKnownHeader::WantReprDigest168
QHttpHeaders::WellKnownHeader::WWWAuthenticate169
QHttpHeaders::WellKnownHeader::XContentTypeOptions170
QHttpHeaders::WellKnownHeader::XFrameOptions171
QHttpHeaders::WellKnownHeader::AcceptCharset172
QHttpHeaders::WellKnownHeader::CPEPInfo173
QHttpHeaders::WellKnownHeader::Pragma174
QHttpHeaders::WellKnownHeader::ProtocolInfo175
QHttpHeaders::WellKnownHeader::ProtocolQuery176

멤버 함수 문서

[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() 참조).

헤더 이름은 대소문자를 구분하지 않으며, 반환되는 이름은 소문자로 변환됩니다.

size() 및 valueAt()도 참조하십시오 .

[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.