Accept units from configured source roots
This commit is contained in:
@@ -24,16 +24,8 @@ DValue resp = http_request(req);
|
||||
print("HTTP ", resp["status"].to_u64(), ", ", resp["body"].to_string().length(), " bytes returned\n");
|
||||
|
||||
:example
|
||||
// GitHub token exchange: client_secret stays in stdin body, not argv.
|
||||
DValue token; token["method"]="POST"; token["url"]="https://github.com/login/oauth/access_token";
|
||||
token["headers"]["Accept"]="application/json"; token["headers"]["Content-Type"]="application/x-www-form-urlencoded";
|
||||
token["body"]="client_id="+uri_encode(client_id)+"&client_secret="+uri_encode(client_secret)+"&code="+uri_encode(code);
|
||||
for(String key:{"https_only","public_dns_only","pin_dns","isolated_curl","no_redirects"}) token["security"][key].set_bool(true);
|
||||
DValue token_response=http_request(token);
|
||||
|
||||
:example
|
||||
// ATProto metadata discovery uses the same generic policy; no provider operation name.
|
||||
DValue meta; meta["method"]="GET"; meta["url"]="https://"+issuer_host+"/.well-known/oauth-authorization-server";
|
||||
meta["headers"]["Accept"]="application/json";
|
||||
for(String key:{"https_only","public_dns_only","pin_dns","isolated_curl","no_redirects"}) meta["security"][key].set_bool(true);
|
||||
DValue metadata=http_request(meta);
|
||||
// Hardened requests reject IP-literal hosts before they start curl.
|
||||
DValue hardened; hardened["method"]="GET"; hardened["url"]="https://127.0.0.1/";
|
||||
for(String key:{"https_only","public_dns_only","pin_dns","isolated_curl","no_redirects"}) hardened["security"][key].set_bool(true);
|
||||
DValue rejected=http_request(hardened);
|
||||
print(rejected["error"].to_string(), "\n");
|
||||
|
||||
Reference in New Issue
Block a user