mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-21 20:24:42 +00:00
Merge pull request #1506 from lightpanda-io/allow-propfind-method
http: allow PROPOFIND http method
This commit is contained in:
@@ -106,3 +106,17 @@
|
||||
testing.expectEqual(req5, target);
|
||||
})
|
||||
</script>
|
||||
|
||||
<script id=xhr6 type=module>
|
||||
const req5 = new XMLHttpRequest()
|
||||
const promise5 = new Promise((resolve) => {
|
||||
req5.onload = resolve;
|
||||
req5.open('PROPFIND', 'http://127.0.0.1:9589/xhr')
|
||||
req5.send('foo')
|
||||
});
|
||||
|
||||
testing.async(promise5, () => {
|
||||
testing.expectEqual(200, req5.status);
|
||||
testing.expectEqual('OK', req5.statusText);
|
||||
testing.expectEqual(true, req5.responseText.length > 65);
|
||||
});
|
||||
|
||||
@@ -130,3 +130,10 @@
|
||||
testing.expectEqual("you", request2.headers.get("target"));
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id=propfind>
|
||||
{
|
||||
const req = new Request('https://example.com/api', { method: 'propfind' });
|
||||
testing.expectEqual('PROPFIND', req.method);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -108,7 +108,7 @@ pub fn init(input: Input, opts_: ?InitOpts, page: *Page) !*Request {
|
||||
}
|
||||
|
||||
fn parseMethod(method: []const u8, page: *Page) !Http.Method {
|
||||
if (method.len > "options".len) {
|
||||
if (method.len > "propfind".len) {
|
||||
return error.InvalidMethod;
|
||||
}
|
||||
|
||||
@@ -122,6 +122,7 @@ fn parseMethod(method: []const u8, page: *Page) !Http.Method {
|
||||
.{ "patch", .PATCH },
|
||||
.{ "head", .HEAD },
|
||||
.{ "options", .OPTIONS },
|
||||
.{ "propfind", .PROPFIND },
|
||||
});
|
||||
return method_lookup.get(lower) orelse return error.InvalidMethod;
|
||||
}
|
||||
|
||||
@@ -539,6 +539,9 @@ fn parseMethod(method: []const u8) !Http.Method {
|
||||
if (std.ascii.eqlIgnoreCase(method, "put")) {
|
||||
return .PUT;
|
||||
}
|
||||
if (std.ascii.eqlIgnoreCase(method, "propfind")) {
|
||||
return .PROPFIND;
|
||||
}
|
||||
return error.InvalidMethod;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@ pub const Connection = struct {
|
||||
.HEAD => "HEAD",
|
||||
.OPTIONS => "OPTIONS",
|
||||
.PATCH => "PATCH",
|
||||
.PROPFIND => "PROPFIND",
|
||||
};
|
||||
try errorCheck(c.curl_easy_setopt(easy, c.CURLOPT_CUSTOMREQUEST, m.ptr));
|
||||
}
|
||||
@@ -342,6 +343,7 @@ pub const Method = enum(u8) {
|
||||
HEAD = 4,
|
||||
OPTIONS = 5,
|
||||
PATCH = 6,
|
||||
PROPFIND = 7,
|
||||
};
|
||||
|
||||
// TODO: on BSD / Linux, we could just read the PEM file directly.
|
||||
|
||||
Reference in New Issue
Block a user