aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/URLDecomposition.cpp
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-03-22 18:09:51 -0700
committerGravatar GitHub <noreply@github.com> 2023-03-22 18:09:51 -0700
commit31c2fea74af66d60dceab608b1cfdd9a3f08a7db (patch)
tree97f871a571ed2d48d3ef2d92240b3dcc0cdbf6b1 /src/bun.js/bindings/URLDecomposition.cpp
parenta5f92224b586289fc72f0abdb68b08eef9f017db (diff)
downloadbun-31c2fea74af66d60dceab608b1cfdd9a3f08a7db.tar.gz
bun-31c2fea74af66d60dceab608b1cfdd9a3f08a7db.tar.zst
bun-31c2fea74af66d60dceab608b1cfdd9a3f08a7db.zip
A couple bug fixes (#2458)
* fix valid status code range * update path * highwatermark option * throw DOMException * remove extra transpiler output * more transpiler tests * comment * get index not quickly * replace with `getDirectIndex` * update abort test * throw out of range status code * promisify test fix * move stdio test instance files * working crypto tests * allow duplicate set-cookie headers * different formatting * revert, fix will be in different pr * it is called * use min buffer size * fix url tests * null origin for other protocols * remove overload * add very large file test * await * coerce to int64 * 64 * no cast * add todo blob url tests * use `tryConvertToInt52`
Diffstat (limited to 'src/bun.js/bindings/URLDecomposition.cpp')
-rw-r--r--src/bun.js/bindings/URLDecomposition.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/bun.js/bindings/URLDecomposition.cpp b/src/bun.js/bindings/URLDecomposition.cpp
index f13d6b093..14cf25b6c 100644
--- a/src/bun.js/bindings/URLDecomposition.cpp
+++ b/src/bun.js/bindings/URLDecomposition.cpp
@@ -32,20 +32,11 @@ namespace WebCore {
String URLDecomposition::origin() const
{
auto fullURL = this->fullURL();
- auto protocol = fullURL.protocol();
- auto host = fullURL.host();
- auto port = fullURL.port();
- if (protocol == "file"_s)
- return "file://"_s;
+ if (fullURL.protocolIsInHTTPFamily() or fullURL.protocolIsInFTPFamily() or fullURL.protocolIs("ws"_s) or fullURL.protocolIs("wss"_s))
+ return fullURL.protocolHostAndPort();
- if (protocol.isEmpty() && host.isEmpty())
- return {};
-
- if (!port)
- return makeString(protocol, "://", host);
-
- return makeString(protocol, "://", host, ':', static_cast<uint32_t>(*port));
+ return "null"_s;
}
String URLDecomposition::protocol() const