本文介绍了ETag 的语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Redbot 报告我的网页包含无效标题:

Redbot reports that my webpage has invalid header:

ETag 标头的语法无效.

我的标题设置为:

ETag: 4ae413bd

为什么无效?

ETag 的语法是什么?

What is the syntax for an ETag?

推荐答案

试试ETag: "4ae413bd".ETag 的值必须遵循 ABNF 形式:

Try ETag: "4ae413bd".The value of an ETag must follow the ABNF form:

  entity-tag = [ weak ] opaque-tag
  weak       = "W/"
  opaque-tag = quoted-string

  quoted-string  = ( <"> *(qdtext | quoted-pair ) <"> )
  qdtext         = <any TEXT except <">>
  quoted-pair    = "" CHAR
  CHAR           = <any US-ASCII character (octets 0 - 127)>
  TEXT           = <any OCTET except CTLs, but including LWS>
  OCTET          = <any 8-bit sequence of data>
  LWS            = [CRLF] 1*( SP | HT )
  CTL            = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
  CRLF           = CR LF
  CR             = <US-ASCII CR, carriage return (13)>
  LF             = <US-ASCII LF, linefeed (10)>
  SP             = <US-ASCII SP, space (32)>
  HT             = <US-ASCII HT, horizontal-tab (9)>

,它基本上是 regular 正则表达式中的 ([wW]/)?"([^"]|\")*".

, which is basically ([wW]/)?"([^"]|\")*" in regular regex.

请注意,"""/" 都是 etag 的有效值.

Note that both "" and "/" are valid values for etags.

参考:section-14.19, section-3.11, section-2.2.

这篇关于ETag 的语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 05:48