<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # QHttpHeader Class Reference ## [[QtNetwork](index.htm) module] 該QHttpHeader類包含HTTP頭信息。[More...](#details) 通過繼承[QHttpRequestHeader](qhttprequestheader.html)和[QHttpResponseHeader](qhttpresponseheader.html)。 ### Methods * `__init__ (self)` * `__init__ (self, QHttpHeader?header)` * `__init__ (self, QString?str)` * `addValue (self, QString?key, QString?value)` * `QStringList allValues (self, QString?key)` * `int contentLength (self)` * `QString contentType (self)` * `bool hasContentLength (self)` * `bool hasContentType (self)` * `bool hasKey (self, QString?key)` * `bool isValid (self)` * `QStringList keys (self)` * `int majorVersion (self)` * `int minorVersion (self)` * `bool parse (self, QString?str)` * `bool parseLine (self, QString?line, int?number)` * `removeAllValues (self, QString?key)` * `removeValue (self, QString?key)` * `setContentLength (self, int?len)` * `setContentType (self, QString?type)` * `setValid (self, bool)` * `setValue (self, QString?key, QString?value)` * `setValues (self, list-of-tuple-of-QString-QString?values)` * `QString toString (self)` * `QString value (self, QString?key)` * `list-of-tuple-of-QString-QString values (self)` * * * ## Detailed Description 該QHttpHeader類包含HTTP頭信息。 在大多數情況下,你應該使用這個類的更專業的衍生物,[QHttpResponseHeader](qhttpresponseheader.html)和[QHttpRequestHeader](qhttprequestheader.html),而不是直接使用QHttpHeader 。 QHttpHeader提供的HTTP標頭字段。 HTTP頭域由一個名稱,后跟一個冒號,一個空格,和字段值。 (參見RFC 1945 )。字段名不區分大小寫。一個典型的標頭欄位看起來像這樣: ``` content-type: text/html ``` 在API的報頭字段的名稱被稱為“鍵”和內容被稱為“價值” 。您可以獲取和設置一個報頭字段的值,用其與關鍵[value](qhttpheader.html#value)()和[setValue](qhttpheader.html#setValue)( ),例如 ``` header.setValue("content-type", "text/html"); [QString](qstring.html) contentType = header.value("content-type"); ``` 有些領域是如此普遍, getter和setter方法??是為他們提供一個方便的替代品使用[value](qhttpheader.html#value)()和[setValue](qhttpheader.html#setValue)( ),例如[contentLength](qhttpheader.html#contentLength)()和[contentType](qhttpheader.html#contentType)( )[setContentLength](qhttpheader.html#setContentLength)()和[setContentType](qhttpheader.html#setContentType)( ) 。 每頭鍵都有一個_single_與它相關聯的值。如果設置的值已經存在一個關鍵的前一個值將被丟棄。 * * * ## Method Documentation ``` QHttpHeader.__init__ (self) ``` 構造一個空的HTTP標頭。 ``` QHttpHeader.__init__ (self, QHttpHeader?header) ``` 構造的副本_header_。 ``` QHttpHeader.__init__ (self, QString?str) ``` 構造一個HTTP頭的_str_。 這個構造函數解析字符串_str_為報頭字段,并添加該信息。該_str_應該由一個或多個的“ \ r \ n ”分隔行;這些線路的格式應為關鍵,冒號,空格,值。 ``` QHttpHeader.addValue (self, QString?key, QString?value) ``` 添加一個新條目與_key_和_value_。 ``` QStringList QHttpHeader.allValues (self, QString?key) ``` 返回與給定的所有條目_key_。如果沒有條目有這_key_,則返回一個空字符串列表。 ``` int QHttpHeader.contentLength (self) ``` 返回特殊的HTTP標頭字段的值`content-length`。 **See also** [setContentLength](qhttpheader.html#setContentLength)()和[hasContentLength](qhttpheader.html#hasContentLength)( ) 。 ``` QString QHttpHeader.contentType (self) ``` 返回特殊的HTTP標頭字段的值`content-type`。 **See also** [setContentType](qhttpheader.html#setContentType)()和[hasContentType](qhttpheader.html#hasContentType)( ) 。 ``` bool QHttpHeader.hasContentLength (self) ``` 如果頭具有特殊的HTTP標頭字段中的條目,則返回True`content-length`否則返回False 。 **See also** [contentLength](qhttpheader.html#contentLength)()和[setContentLength](qhttpheader.html#setContentLength)( ) 。 ``` bool QHttpHeader.hasContentType (self) ``` 如果頭具有特殊的HTTP標頭字段中的條目,則返回True`content-type`否則返回False 。 **See also** [contentType](qhttpheader.html#contentType)()和[setContentType](qhttpheader.html#setContentType)( ) 。 ``` bool QHttpHeader.hasKey (self, QString?key) ``` 如果HTTP頭有一個給定的條目,則返回True_key_否則返回False 。 **See also** [value](qhttpheader.html#value)( )[setValue](qhttpheader.html#setValue)()和[keys](qhttpheader.html#keys)( ) 。 ``` bool QHttpHeader.isValid (self) ``` 返回True如果HTTP頭是有效的,否則返回False 。 A [QHttpHeader](qhttpheader.html)是無效的,如果它是通過解析一個格式錯誤的字符串創建的。 ``` QStringList QHttpHeader.keys (self) ``` 返回在HTTP報頭中的鍵的列表。 **See also** [hasKey](qhttpheader.html#hasKey)( ) 。 ``` int QHttpHeader.majorVersion (self) ``` 這種方法是抽象的,應在任何子類中重新實現。 返回主協議版本的HTTP標頭。 ``` int QHttpHeader.minorVersion (self) ``` 這種方法是抽象的,應在任何子類中重新實現。 返回未成年協議版本的HTTP標頭。 ``` bool QHttpHeader.parse (self, QString?str) ``` ``` bool QHttpHeader.parseLine (self, QString?line, int?number) ``` ``` QHttpHeader.removeAllValues (self, QString?key) ``` 刪除與該鍵中的所有條目_key_從HTTP標頭。 ``` QHttpHeader.removeValue (self, QString?key) ``` 刪除與該鍵的條目_key_從HTTP標頭。 **See also** [value](qhttpheader.html#value)()和[setValue](qhttpheader.html#setValue)( ) 。 ``` QHttpHeader.setContentLength (self, int?len) ``` 設置特殊的HTTP標頭字段的值`content-length`至_len_。 **See also** [contentLength](qhttpheader.html#contentLength)()和[hasContentLength](qhttpheader.html#hasContentLength)( ) 。 ``` QHttpHeader.setContentType (self, QString?type) ``` 設置特殊的HTTP標頭字段的值`content-type`至_type_。 **See also** [contentType](qhttpheader.html#contentType)()和[hasContentType](qhttpheader.html#hasContentType)( ) 。 ``` QHttpHeader.setValid (self, bool) ``` ``` QHttpHeader.setValue (self, QString?key, QString?value) ``` 設置與該項目的值_key_至_value_。 如果沒有條目_key_存在,一個新的項與給定_key_和_value_被創建。如果與一個條目_key_已經存在,則第一個值將被丟棄并用給定的替換_value_。 **See also** [value](qhttpheader.html#value)( )[hasKey](qhttpheader.html#hasKey)()和[removeValue](qhttpheader.html#removeValue)( ) 。 ``` QHttpHeader.setValues (self, list-of-tuple-of-QString-QString?values) ``` 套頭項是在鍵值對列表_values_。 **See also** [values](qhttpheader.html#values)( ) 。 ``` QString QHttpHeader.toString (self) ``` 返回的HTTP標頭的字符串表示形式。 該字符串是適合于采用一個構造函數使用[QString](qstring.html)。它是由線的格式:關鍵,冒號,空格,值, “ \ r \ N” 。 ``` QString QHttpHeader.value (self, QString?key) ``` 返回與給定條目中的第一個值_key_。如果沒有條目有這_key_,則返回一個空字符串。 **See also** [setValue](qhttpheader.html#setValue)( )[removeValue](qhttpheader.html#removeValue)( )[hasKey](qhttpheader.html#hasKey)()和[keys](qhttpheader.html#keys)( ) 。 ``` list-of-tuple-of-QString-QString QHttpHeader.values (self) ``` 返回頭中的所有條目。 **See also** [setValues](qhttpheader.html#setValues)( ) 。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看