ASF Bugzilla – Attachment 19658 Details for
Bug 38034
PUT If-None-Match: "*" failures
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
test cases for LOCK request with if-* headers
lock-null-if.js (text/javascript), 3.39 KB, created by
Julian Reschke
on 2007-03-02 07:58:12 UTC
(
hide
)
Description:
test cases for LOCK request with if-* headers
Filename:
MIME Type:
Creator:
Julian Reschke
Created:
2007-03-02 07:58:12 UTC
Size:
3.39 KB
patch
obsolete
>var req = new ActiveXObject ("MSXML2.ServerXMLHTTP"); > >var uri = WScript.Arguments(0); >var user = null; >var pwd = null; > >if (WScript.Arguments.length > 1) { > user = WScript.Arguments(1); >} > >if (WScript.Arguments.length > 2) { > pwd = WScript.Arguments(2); >} > > >function dumpResponse(r) { > WScript.Echo(r.status); > WScript.Echo(r.getAllResponseHeaders()); > WScript.Echo(r.responseText); >} > >// delete target just in case >WScript.Echo("DELETE " + uri); >req.open("DELETE", uri, false, user, pwd); >req.send(); >dumpResponse(req); > >// create collection >WScript.Echo("MKCOL " + uri); >req.open("MKCOL", uri, false, user, pwd); >req.send(); >if ((req.status < 200 || req.status >= 300) && req.status != 405) { > WScript.Echo("unexpected status upon MKCOL:" + req.status + " " + req.responseText); > WScript.Quit(2); >} >dumpResponse(req); > >var testuri = uri + "/non-existing1"; > >WScript.Echo("LOCK " + testuri + " (if-none-match: *)"); >req.open("LOCK", testuri, false, user, pwd); >req.setRequestHeader("If-None-Match", "*"); >req.setRequestHeader("Depth", "infinity"); >req.setRequestHeader("Timeout", "Second-60"); >req.send("<D:lockinfo xmlns:D='DAV:'><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockinfo>"); >dumpResponse(req); > >if (req.status == 200 || req.status == 201) { > WScript.Echo("PASS"); >} >else { > WScript.Echo("ERROR: resource not locked, status: " + req.status + " " + req.responseText); >} > >var testuri = uri + "/non-existing2"; > >WScript.Echo("\nLOCK " + testuri + " (if-match: *)"); >req.open("LOCK", testuri, false, user, pwd); >req.setRequestHeader("If-Match", "*"); >req.setRequestHeader("Depth", "infinity"); >req.setRequestHeader("Timeout", "Second-60"); >req.send("<D:lockinfo xmlns:D='DAV:'><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockinfo>"); >dumpResponse(req); > >if (req.status != 412) { > WScript.Echo("ERROR: request did not fail as expected, status: " + req.status + " " + req.responseText); >} >else { > WScript.Echo("PASS"); >} > > >var testuri = uri + "/existing1"; > >WScript.Echo("\nPUT/LOCK " + testuri + " (if-match: *)"); >req.open("PUT", testuri, false, user, pwd); >req.send(""); >dumpResponse(req); > >req.open("LOCK", testuri, false, user, pwd); >req.setRequestHeader("If-Match", "*"); >req.setRequestHeader("Depth", "infinity"); >req.setRequestHeader("Timeout", "Second-60"); >req.send("<D:lockinfo xmlns:D='DAV:'><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockinfo>"); >dumpResponse(req); > >if (req.status == 200 || req.status == 201) { > WScript.Echo("PASS"); >} >else { > WScript.Echo("ERROR: resource not locked, status: " + req.status + " " + req.responseText); >} > >var testuri = uri + "/existing2"; > >WScript.Echo("\nPUT/LOCK " + testuri + " (if-none-match: *)"); >req.open("PUT", testuri, false, user, pwd); >req.send(""); >dumpResponse(req); > >req.open("LOCK", testuri, false, user, pwd); >req.setRequestHeader("If-None-Match", "*"); >req.setRequestHeader("Depth", "infinity"); >req.setRequestHeader("Timeout", "Second-60"); >req.send("<D:lockinfo xmlns:D='DAV:'><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockinfo>"); >dumpResponse(req); > >if (req.status != 412) { > WScript.Echo("ERROR: request did not fail as expected, status: " + req.status + " " + req.responseText); >} >else { > WScript.Echo("PASS"); >} > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 38034
: 19658 |
20552
|
20553
|
21295
|
21343