已解码的方法

上次修改时间: 2010年3月23日

适用范围: SharePoint Foundation 2010

本参考中的解码部分所显示的代码不是您在使用程序(例如网络监视器,该程序允许在数据包级别检查进出服务器的网络通信,从而捕获 Microsoft FrontPage Server Extensions 与客户端应用程序(例如 Microsoft Office FrontPage2003)之间的数据包)时实际看到的代码。本主题介绍您在数据包捕获程序中观察到的代码,以及本参考中采取的提高示例可读性的步骤。

备注

根据您使用的操作系统和程序,可以筛选 HTTP 或 TCP 数据包之类的数据包。如果使用 TCP 作为筛选器,则必须检查每个 TCP 数据包的 HTTP POST 命令。例如,在 UNIX 系统上,HTTP 协议总是嵌入在 TCP 数据包中。

捕获的第一个数据包通常是 HTTP POST。紧跟着是保持活动状态 数据包。要传输的最后一个或一组数据包包含方法的返回代码。返回代码总是采用一个或多个 HTML 页的形式。大多数返回代码都包括载有要传输的数据信息的元键。

客户端应用程序使用 Microsoft SharePoint Foundation 或 Microsoft FrontPage Server Extensions 发送的每个 POST 请求都包括一个字符串,用来指定要执行的 RPC 方法以及该方法所需的任何参数。例如,下面是实现 FrontPage Server Extensions 的一个示例 POST:

POST./site_url/_vti_bin/_vti_aut/author.dll 
HTTP/1.0CRLF
Date: Thu, 03 Dec 2003 19:09:16 GMTCRLF
MIME-Version: 1.0CRLF
User-Agent: MSFrontPage/6.0CRLF
Host: server_nameCRLF
Accept: auth/sicilyCRLF
Authorization: Basic cm9iZjpUS3NvKjUwCRLF
Content-Length: 343CRLF
Content-Type: application/x-www-form-urlencodedCRLF
X-Vermeer-Content-Type: application/x-www-form-urlencodedCRLF
method=list+documents%3a6%2e0%2e2%2e5420service%5
fname=%2fallnew&listHiddenDocs=false&listExplorerDocs=
   false&listRecurse=false&listFiles=true&listFolders=true
&listLinkInfo=true&listIncludeParent=true&listDerived=
   false&listBorders=false&listChildWebs=true
&initialUrl=&platform=WinI386&folderList=
   %5b%3bTW%7c09+Nov+1998+17%3a03%3a25+%2d0000%5d.LF

前面的示例演示客户端应用程序发送的格式。但是,当使用网络监视器这样的程序捕获 POST 时,它的显示如下:

POST./site_url/_vti_bin/_vti_aut/author.dll.HTTP/1.0..Date:.Tue,.19.Jan.2003.19:58:GMT.. 
MIME-Version:.1.0..User-Agent:.MSFrontPage/6.0..Host:.v-rfrank3.. 
Accept:.auth/sicily..Authorization:.Basic.di1yZnJhbms6VEtzbzUwKg==.. 
Content-Length:.317..Content-Type:.application/x-www-form-urlencode.. 
X-Vermeer-Content-Type:.application/x-www-form-urlencoded.... 
method=list+documents%3a6%2e0%2e2%2e5420&service%5fname=&listHiddenDocs=false 
&listExplorerDocs=false&listRecurse=false&listFiles=true&listFolders=true 
&listLinkInfo=true&listIncludeParent=true&listDerived=false&listBorders=false 
&listChildWebs=true&initialUrl=&folderList=%5b%3bTW%7c13+Jan+2003+16%3a16%3a17+%2d0000%5d.

前面的示例演示最初嵌入其他代码中的数据流,如下所示:

00000030 50 4F 53 54 20 2F 70 72 6F 64 
POST./site_url/ 00000040 39 38 2F 5F 76 74 69 5F 62 69 6E 2F 5F 76 74 69 
98/_vti_bin/_vti 00000050 5F 61 75 74 2F 61 75 74 68 6F 72 2E 64 6C 6C 20 
_aut/author.dll. 00000060 48 54 54 50 2F 31 2E 30 0D 0A 44 61 74 65 3A 20 
HTTP/1.0..Date:. 00000070 54 75 65 2C 20 31 39 20 4A 61 6E 20 31 39 39 39 
Tue,.19.Jan.2003 00000080 20 32 30 3A 33 35 3A 32 36 20 47 4D 54 0D 0A 4D 
.19:58:GMT..M

为使这种类型的代码更容易阅读以便在参考中使用,需要进行几处更改。首先,删除每行开头的代码以显示 POST 命令。其次,移除所有剩余的换行符以形成数据流。最后,重新添加换行符,使之更容易阅读。此流中的句点 (.) 表示控制字符或空格,也应移除。下面的示例演示经过这些更改后的结果,仍难于理解。

method=list+documents%3a6%2e0%2e2%2e5420&service%5fname=%2fallnew&listHiddenDocs=false 
&listExplorerDocs=false&listRecurse=false&listFiles=true&listFolders=true 
&listLinkInfo=true&listIncludeParent=true&listDerived=false&listBorders=false 
&listChildWebs=true &initialUrl=&platform=WinI386 
&folderList=%5b%3bTW%7c09+Nov+2003+17%3a03%3a25+%2d0000%5d.

为了在方法主题的"解码"部分中使用,在最后的准备阶段,又做了几处更改,从而产生下面的格式:

POST./allnew/_vti_bin/_vti_aut/author.dll 
HTTP/1.0CRLF
.
.
.
method=list+documents:6.0.2.5420 &service_name=/allnew 
&listHiddenDocs=false &listExplorerDocs=false 
&listRecurse=false &listFiles=true 
&listFolders=true &listLinkInfo=true 
&listIncludeParent=true 
&listDerived=false &listBorders=false 
&listChildWebs=true &initialUrl= 
&platform=WinI386 &folderList=[;TW|09+Nov+2003+17:03:25+-0000]

此示例演示 POST 命令以及方法,在本例中,POST 命令的路径将 post 定向到 author.dll。省略号 (...) 表示移除的 HTTP 头行。方法及其参数值采用可读的格式。

为了在方法主题中显示,在"解码"部分中添加了换行符。

有关发送 POST 命令所采用的格式的详细信息,请参阅方法语法