0

我有一个应用程序,它将任何长 URL 转换为短 URL,如下所示:https://{HOST}/short_link_name我的目标是制作工作脚本。

用户在浏览器中打开https://{HOST},通过带有凭据的身份验证表单,并看到将长 URL 转换为短 URL 的表单。该表单由 3 个输入字段组成:

{long_URL} - is any long URL which user need to convert into short URL
{short_URL_name} - is the name of link given by user for short URL
and the 3rd isn't important in this context.

然后用户单击按钮提交数据,可以看到结果 - 此表单下方的短 URL 链接。

所以,我制作了手动脚本,脚本片段在这里:

web_url("{HOST}", 
    "URL=https://{HOST}/", 
    "Resource=0", 
    "RecContentType=text/html", 
    "Referer=", 
    "Mode=HTML", 
    EXTRARES, 
    "Url=//Grid/GetLinks?_dc=1383645884804&page=1&start=0&limit=6", ENDITEM,
    "Url=//Grid/GetLinks?_dc=1383645898655&page=1&start=0&limit=6", ENDITEM,
            "Url=/GetImage/Methodology?width=200&height=200", ENDITEM,
    LAST);

... (verifying that my username is displayed on the application page = I'm logged in)

web_submit_data("Register",
        "Action=https://{HOST}/UrlRegistration/Register", 
        "Method=POST", 
        "RecContentType=application/json", 
        "Referer=https://{HOST}/", 
        "Mode=HTML", 
        ITEMDATA, 
        "Name=ShortUrl", "Value={short_URL_name}", ENDITEM, 
        "Name=LongUrl", "Value=http://{long_URL}", ENDITEM, 
        "Name=Persistent", "Value=false", ENDITEM, 
        LAST);

笔记:

1)像_dc=1383645884804时间戳这样的值;

2) 我已成功登录申请页面;

3)https://{HOST}/UrlRegistration/Register实际不存在于提交申请表的 HTML 代码中。

问题是,当我运行脚本时,对于这个片段,下一个文本出现错误:

Action.c(65): web_submit_data("Register") started
Action.c(65): Error -26627: HTTP Status-Code=404 (Not Found) for "https://{HOST}/UrlRegistration/Register"
Action.c(65): web_submit_data("Register") highest severity level was "ERROR", 1245 body bytes, 287 header bytes

此表单的 HTML 片段:

<form action="/" method="post">
 ...
</form>

为什么我的 web_submit_data 出现这个错误,我应该怎么做才能让脚本正常工作?请问你能帮帮我吗?

在扩展日志中选中“服务器返回的数据”选项后,我有下一个:

Action.c(32): web_submit_data("Register") started   [MsgId: MMSG-26355]
Action.c(32): t=123159ms: 308-byte response headers for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     HTTP/1.1 401 Unauthorized\r\n
Action.c(32):     Cache-Control: private\r\n
Action.c(32):     Content-Type: text/html\r\n
Action.c(32):     Server: Microsoft-IIS/7.5\r\n
Action.c(32):     X-AspNetMvc-Version: 4.0\r\n
Action.c(32):     X-AspNet-Version: 4.0.30319\r\n
Action.c(32):     WWW-Authenticate: Negotiate\r\n
Action.c(32):     WWW-Authenticate: NTLM\r\n
Action.c(32):     X-UA-Compatible: IE=Edge, chrome=1\r\n
Action.c(32):     Date: Tue, 05 Nov 2013 10:15:18 GMT\r\n
Action.c(32):     Content-Length: 1293\r\n
Action.c(32):     \r\n
Action.c(32): t=123229ms: 1293-byte response body for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/
Action.c(32):     xhtml1-strict.dtd">\r\n
Action.c(32):     <html xmlns="http://www.w3.org/1999/xhtml">\r\n
Action.c(32):     <head>\r\n
Action.c(32):     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>\r\n
Action.c(32):     <title>401 - Unauthorized: Access is denied due to invalid credentials.</title>\r\n
Action.c(32):     <style type="text/css">\r\n
...
Action.c(32):     </style>\r\n
Action.c(32):     </head>\r\n
Action.c(32):     <body>\r\n
Action.c(32):     <div id="header"><h1>Server Error</h1></div>\r\n
Action.c(32):     <div id="content">\r\n
Action.c(32):      <div class="content-container"><fieldset>\r\n
Action.c(32):       <h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>\r\n
Action.c(32):       <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>\r\n
Action.c(32):      </fieldset></div>\r\n
Action.c(32):     </div>\r\n
Action.c(32):     </body>\r\n
Action.c(32):     </html>\r\n
Action.c(32): t=123387ms: 506-byte response headers for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     HTTP/1.1 401 Unauthorized\r\n
Action.c(32):     Content-Type: text/html; charset=us-ascii\r\n
Action.c(32):     Server: Microsoft-HTTPAPI/2.0\r\n
Action.c(32):     WWW-Authenticate: NTLM TlRMTVNTUAACAAAACgAKADgAAAAFgomiq9WGN92mlIoAAAAAAAAAAKwArABCAAAABgGxHQAAAA9NAEkATgBTAEsAAgAKAE0ASQBOAFMASwABABoARQBWAEIAWQBNAEkATgBTAEQANQAxADIAMQAEABwAbQBpAG4AcwBrAC4AZQBwAGEAbQAuAGMAbwBtAAMAOABFAFYAQgBZAE0ASQBOAFMARAA1ADEAMgAxAC4AbQBpAG4AcwBrAC4AZQBwAGEAbQAuAGMAbwBtAAUAEABlAHAAYQBtAC4AYwBvAG0ABwAIANN9tO0P2s4BAAAAAA==\r\n
Action.c(32):     Date: Tue, 05 Nov 2013 10:15:18 GMT\r\n
Action.c(32):     Content-Length: 341\r\n
Action.c(32):     \r\n
Action.c(32): t=123447ms: 341-byte response body for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">\r
Action.c(32):     \n
Action.c(32):     <HTML><HEAD><TITLE>Not Authorized</TITLE>\r\n
Action.c(32):     <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>\r\n
Action.c(32):     <BODY><h2>Not Authorized</h2>\r\n
Action.c(32):     <hr><p>HTTP Error 401. The requested resource requires user authentication.</p>\r\n
Action.c(32):     </BODY></HTML>\r\n
Action.c(32): t=123586ms: 287-byte response headers for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     HTTP/1.1 404 Not Found\r\n
Action.c(32):     Cache-Control: private, s-maxage=0\r\n
Action.c(32):     Content-Type: text/html\r\n
Action.c(32):     Server: Microsoft-IIS/7.5\r\n
Action.c(32):     X-AspNetMvc-Version: 4.0\r\n
Action.c(32):     X-AspNet-Version: 4.0.30319\r\n
Action.c(32):     Persistent-Auth: true\r\n
Action.c(32):     X-UA-Compatible: IE=Edge, chrome=1\r\n
Action.c(32):     Date: Tue, 05 Nov 2013 10:15:18 GMT\r\n
Action.c(32):     Content-Length: 1245\r\n
Action.c(32):     \r\n
Action.c(32): t=123645ms: 1245-byte response body for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/
Action.c(32):     xhtml1-strict.dtd">\r\n
Action.c(32):     <html xmlns="http://www.w3.org/1999/xhtml">\r\n
Action.c(32):     <head>\r\n
Action.c(32):     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>\r\n
Action.c(32):     <title>404 - File or directory not found.</title>\r\n
Action.c(32):     <style type="text/css">\r\n
...
Action.c(32):     </style>\r\n
Action.c(32):     </head>\r\n
Action.c(32):     <body>\r\n
Action.c(32):     <div id="header"><h1>Server Error</h1></div>\r\n
Action.c(32):     <div id="content">\r\n
Action.c(32):      <div class="content-container"><fieldset>\r\n
Action.c(32):       <h2>404 - File or directory not found.</h2>\r\n
Action.c(32):       <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>\r\n
Action.c(32):      </fieldset></div>\r\n
Action.c(32):     </div>\r\n
Action.c(32):     </body>\r\n
Action.c(32):     </html>\r\n
Action.c(32): Error -26627: HTTP Status-Code=404 (Not Found) for "https://{HOST}/UrlRegistration/Register"      [MsgId: MERR-26627]
Action.c(32): web_submit_data("Register") highest severity level was "ERROR", 2879 body bytes, 1101 header bytes    [MsgId: MMSG-26388]

时间戳是否会影响出现的错误?

4

1 回答 1

1

经验法则:使用相同的用户 ID 记录两次。从一个记录会话更改为下一个记录会话的那些项目不是可选的解决方案。这是根据您的时间戳标记的项目。在不同的用户 ID 下添加第三条记录,这将公开需要处理的特定于帐户的项目。

于 2013-11-05T15:53:16.523 回答