Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Http ETag的语法?_Http_Http Headers_Etag - Fatal编程技术网

Http ETag的语法?

Http ETag的语法?,http,http-headers,etag,Http,Http Headers,Etag,报告我的网页的标题无效: ETag标头的语法无效 我的标题设置为: ETag: 4ae413bd 为什么它是无效的 ETag的语法是什么?“ETag是由web服务器分配给URL上找到的资源的特定版本的不透明标识符”。这意味着它几乎可以是任何东西 问题可能在于语法,请使用: ETag: "4ae413bd" 尝试ETag:“4ae413bd”。 ETag的值必须遵循以下格式: entity标记=[weak]不透明标记 弱=“W/” 不透明标记=带引号的字符串 带引号的字符串=() qdtext

报告我的网页的标题无效:

ETag标头的语法无效

我的标题设置为:

ETag: 4ae413bd
为什么它是无效的

ETag的语法是什么?

“ETag是由web服务器分配给URL上找到的资源的特定版本的不透明标识符”。这意味着它几乎可以是任何东西

问题可能在于语法,请使用:

ETag: "4ae413bd"
尝试
ETag:“4ae413bd”
。 ETag的值必须遵循以下格式:

entity标记=[weak]不透明标记
弱=“W/”
不透明标记=带引号的字符串
带引号的字符串=()

qdtext=,。

如Arnaud所述,请确保已引用该值

替换

new EntityTagHeaderValue("0");


如果由于下面的堆栈跟踪而出现此错误,请确保取消选中Visual Studio中导致此错误的“启用浏览器链接”选项:

转换>[13:31:10 ERR]连接id“0HLJ153E20LDJ”,请求id“0HLJ153E20LDJ:00000003”:应用程序引发了未处理的异常。
转换>System.ObjectDisposedException:由于未处理的应用程序异常,响应已中止。-->System.FormatException:无效的ETag名称
转换>位于Microsoft.Net.Http.Headers.EntityTagHeaderValue..ctor(StringSegment标记,布尔值弱)
转换>位于Microsoft.Net.Http.Headers.EntityTagHeaderValue..ctor(StringSegment标记)
转换>位于Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleWareUtil.AddToETag(ResponseHeaders responseHeader,Int32端口)
转换>位于Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.c__DisplayClass7_0.b__0()
转换>位于Microsoft.AspNetCore.Http.HttpResponse.c.b_uu30_0(对象回调)
转换>位于Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.FireOnStartingMayAwait(堆栈'1 onStarting)
转换>---内部异常堆栈跟踪结束---
转换>位于Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowResponseAbortedException()
转换>位于Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.httprotocol.InitializeResponseAsync(Int32 firstWriteByteCount)
转换>位于Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.WriteAsync(ReadOnlyMemory`1数据,CancellationToken CancellationToken)
转换>位于Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.WriteAsync(字节[]缓冲区,Int32偏移量,Int32计数,取消令牌取消令牌)
转换>在System.IO.Stream.WriteAsync(字节[]缓冲区,Int32偏移量,Int32计数)
转换>位于Microsoft.VisualStudio.Web.BrowserLink.ScriptInjectionFilterStream.c__DisplayClass37_0.d.MoveNext()
转换>---从引发异常的上一个位置开始的堆栈结束跟踪---
转换>位于Microsoft.VisualStudio.Web.BrowserLink.SocketReader.ReadBytesIntoResponseHandler(Int64 totalBytesToRead,ResponseHandler,CancellationToken CancellationToken)
转换>位于Microsoft.VisualStudio.Web.BrowserLink.HttpSocketAdapter.ResponseReader.ReadBytesIntoResponse(Int64 bytesToRead)
转换>位于Microsoft.VisualStudio.Web.BrowserLink.HttpSocketAdapter.ResponseReader.ReadChunkedContent()
转换>位于Microsoft.VisualStudio.Web.BrowserLink.HttpSocketAdapter.ResponseReader.ReadResponse()
转换>位于Microsoft.VisualStudio.Web.BrowserLink.DelayConnectionHttpSocketAdapter.Microsoft.VisualStudio.Web.BrowserLink.IHttpSocketAdapter.WaitForResponseComplete()处
转换>位于Microsoft.VisualStudio.Web.BrowserLink.ScriptInjectionFilterStream.WaitForFilterComplete()上
转换>位于Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.ExecuteWithFilter(IHttpSocketAdapter injectScriptSocket,String requestId,HttpContext HttpContext)
转换>位于Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext上下文)
转换>位于Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext上下文)
转换>位于Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext HttpContext)
转换>位于Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1应用程序)

虽然HTTP 1.1允许
“\”
,但HTTP 1.1 bis草案不允许。2007年,W3C考虑了这个问题——请参阅——并认定语法错误。在草案04中对其进行了修正。您可以在上看到编辑。因此,无论何时HTTP 1.1 bis最终发货(假设它发货)
“\”
将不再有效,因此您最好避免使用它,即使它在今天技术上是允许的。@IanGriffiths,预计发货日期是什么?我想计划在2013年9月将其作为提议的标准提交。(相关工作组的最后一个电话本应在今年早些时候结束,我认为这确实按计划进行了。)我不认为有一个计划,说明它需要多长时间才能从“提议”转变为完全成熟——我相信这取决于后来才变得明显的事情(例如,采用率,是否发现问题).用外行的话说:值必须以RFC的“(双引号)更新版本开头和结尾。它不允许使用空格,例如。
new EntityTagHeaderValue("0");
new EntityTagHeaderValue("\"0\"");
Conversion> [13:31:10 ERR] Connection id "0HLJ153E20LDJ", Request id "0HLJ153E20LDJ:00000003": An unhandled exception was thrown by the application.
Conversion> System.ObjectDisposedException: The response has been aborted due to an unhandled application exception. ---> System.FormatException: Invalid ETag name
Conversion>    at Microsoft.Net.Http.Headers.EntityTagHeaderValue..ctor(StringSegment tag, Boolean isWeak)
Conversion>    at Microsoft.Net.Http.Headers.EntityTagHeaderValue..ctor(StringSegment tag)
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleWareUtil.AddToETag(ResponseHeaders responseHeader, Int32 port)
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.<>c__DisplayClass7_0.<ExecuteWithFilter>b__0()
Conversion>    at Microsoft.AspNetCore.Http.HttpResponse.<>c.<.cctor>b__30_0(Object callback)
Conversion>    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.FireOnStartingMayAwait(Stack`1 onStarting)
Conversion>    --- End of inner exception stack trace ---
Conversion>    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowResponseAbortedException()
Conversion>    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.InitializeResponseAsync(Int32 firstWriteByteCount)
Conversion>    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.WriteAsync(ReadOnlyMemory`1 data, CancellationToken cancellationToken)
Conversion>    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
Conversion>    at System.IO.Stream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count)
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.ScriptInjectionFilterStream.<>c__DisplayClass37_0.<<CreateResponseHandler>b__0>d.MoveNext()
Conversion> --- End of stack trace from previous location where exception was thrown ---
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.SocketReader.ReadBytesIntoResponseHandler(Int64 totalBytesToRead, ResponseHandler handler, CancellationToken cancellationToken)
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.HttpSocketAdapter.ResponseReader.ReadBytesIntoResponse(Int64 bytesToRead)
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.HttpSocketAdapter.ResponseReader.ReadChunkedContent()
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.HttpSocketAdapter.ResponseReader.ReadResponse()
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.DelayConnectingHttpSocketAdapter.Microsoft.VisualStudio.Web.BrowserLink.IHttpSocketAdapter.WaitForResponseComplete()
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.ScriptInjectionFilterStream.WaitForFilterComplete()
Conversion>    at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.ExecuteWithFilter(IHttpSocketAdapter injectScriptSocket, String requestId, HttpContext httpContext)
Conversion>    at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Conversion>    at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Conversion>    at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
Conversion>    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)