Last active
October 28, 2016 21:07
-
-
Save valenting/f54806e35968cf29f002a7b8559261fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User Valentin Gosu <[email protected]> | |
# Parent 2b19020080b809e6fbe2db968115cd5e051a0b0e | |
[mq]: over_oxid.patch | |
MozReview-Commit-ID: 9a0BfMFkRc5 | |
* * * | |
[mq]: oxidation2 | |
MozReview-Commit-ID: 9hUyJLbcBYu | |
diff --git a/netwerk/base/RustUrlBindings.cpp b/netwerk/base/RustUrlBindings.cpp | |
--- a/netwerk/base/RustUrlBindings.cpp | |
+++ b/netwerk/base/RustUrlBindings.cpp | |
@@ -1,10 +1,10 @@ | |
-#include "nsStandardURL.h" | |
#include "rust/rust-url-capi.h" | |
+#include "nsString.h" | |
static void CheckDifference(const char * method, const nsACString & standardResult, const nsACString & rustResult) | |
{ | |
if (standardResult != rustResult) { | |
printf("[RUST] Difference occured in ::%s\n", method); | |
printf("\t c++ : %s\n", standardResult.BeginReading()); | |
printf("\t rust : %s\n", rustResult.BeginReading()); | |
} | |
@@ -23,31 +23,32 @@ static void CheckDifference(const char * | |
{ | |
if (standardResult != rustResult) { | |
printf("[RUST] Difference occured in ::%s\n", method); | |
printf("\t c++ : %d\n", standardResult); | |
printf("\t rust : %d\n", rustResult); | |
} | |
} | |
-nsresult | |
+nsresult | |
nsStandardURL::RustGetSpec(nsACString & aSpec) | |
{ | |
nsAutoCString rustResult; | |
rusturl_get_spec(mRustURL.get(), &rustResult); | |
CheckDifference(__FUNCTION__, aSpec, rustResult); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetSpec(const nsACString & aSpec) | |
{ | |
mRustURL.reset(rusturl_new(aSpec.BeginReading(), aSpec.Length())); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetPrePath(nsACString & aPrePath) | |
{ | |
nsAutoCString rustResult; | |
rusturl_get_substring(mRustURL.get(), PositionBeforeScheme, PositionAfterPort, &rustResult); | |
@@ -65,32 +66,41 @@ nsStandardURL::RustGetScheme(nsACString | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetScheme(const nsACString & aScheme) | |
{ | |
rusturl_set_scheme(mRustURL.get(), aScheme.BeginReading(), aScheme.Length()); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetUserPass(nsACString & aUserPass) | |
{ | |
nsAutoCString rustResult; | |
rusturl_get_substring(mRustURL.get(), PositionBeforeUsername, PositionAfterPassword, &rustResult); | |
CheckDifference(__FUNCTION__, aUserPass, rustResult); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetUserPass(const nsACString & aUserPass) | |
{ | |
+ int32_t colon = aUserPass.FindChar(':'); | |
+ if (colon == kNotFound) { | |
+ rusturl_set_username(mRustURL.get(), aUserPass.BeginReading(), aUserPass.Length()); | |
+ } else { | |
+ rusturl_set_username(mRustURL.get(), aUserPass.BeginReading(), colon); | |
+ rusturl_set_password(mRustURL.get(), aUserPass.BeginReading() + colon + 1, aUserPass.Length() - colon - 1); | |
+ } | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetUsername(nsACString & aUsername) | |
{ | |
nsAutoCString rustResult; | |
rusturl_get_username(mRustURL.get(), &rustResult); | |
@@ -98,33 +108,35 @@ nsStandardURL::RustGetUsername(nsACStrin | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetUsername(const nsACString & aUsername) | |
{ | |
rusturl_set_username(mRustURL.get(), aUsername.BeginReading(), aUsername.Length()); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetPassword(nsACString & aPassword) | |
{ | |
nsAutoCString rustResult; | |
rusturl_get_password(mRustURL.get(), &rustResult); | |
CheckDifference(__FUNCTION__, aPassword, rustResult); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetPassword(const nsACString & aPassword) | |
{ | |
- rusturl_set_username(mRustURL.get(), aPassword.BeginReading(), aPassword.Length()); | |
+ rusturl_set_password(mRustURL.get(), aPassword.BeginReading(), aPassword.Length()); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetHostPort(nsACString & aHostPort) | |
{ | |
nsAutoCString rustResult; | |
rusturl_get_substring(mRustURL.get(), PositionBeforeHost, PositionAfterPort, &rustResult); | |
@@ -132,131 +144,166 @@ nsStandardURL::RustGetHostPort(nsACStrin | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetHostPort(const nsACString & aHostPort) | |
{ | |
rusturl_set_host_and_port(mRustURL.get(), aHostPort.BeginReading(), aHostPort.Length()); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetHost(nsACString & aHost) | |
{ | |
nsAutoCString rustResult; | |
rusturl_get_host(mRustURL.get(), &rustResult); | |
+ | |
+ | |
+ if (StringBeginsWith(rustResult, NS_LITERAL_CSTRING("[")) && | |
+ StringEndsWith(rustResult, NS_LITERAL_CSTRING("]"))) { | |
+ rustResult = Substring(rustResult, 1, rustResult.Length() - 2); | |
+ } | |
+ | |
CheckDifference(__FUNCTION__, aHost, rustResult); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetHost(const nsACString & aHost) | |
{ | |
rusturl_set_host(mRustURL.get(), aHost.BeginReading(), aHost.Length()); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetPort(int32_t *aPort) | |
{ | |
int32_t port = rusturl_get_port(mRustURL.get()); | |
CheckDifference(__FUNCTION__, *aPort, port); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetPort(int32_t aPort) | |
{ | |
rusturl_set_port_no(mRustURL.get(), aPort); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetPath(nsACString & aPath) | |
{ | |
nsAutoCString rustResult; | |
- rusturl_get_substring(mRustURL.get(), PositionBeforePath, PositionAfterQuery, &rustResult); | |
+ rusturl_get_substring(mRustURL.get(), PositionBeforePath, PositionAfterFragment, &rustResult); | |
CheckDifference(__FUNCTION__, aPath, rustResult); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetPath(const nsACString & aPath) | |
{ | |
+ int32_t queryPos = aPath.FindChar('?'); | |
+ int32_t fragmentPos = aPath.FindChar('#'); | |
+ uint32_t len = aPath.Length(); | |
+ if (fragmentPos != kNotFound) { | |
+ len = fragmentPos; | |
+ } | |
+ if (queryPos != kNotFound) { | |
+ len = queryPos; | |
+ } | |
+ // TODO? | |
rusturl_set_path(mRustURL.get(), aPath.BeginReading(), aPath.Length()); | |
+ if (queryPos != kNotFound) { | |
+ rusturl_set_query(mRustURL.get(), aPath.BeginReading()+queryPos, aPath.Length() - queryPos); | |
+ } | |
+ if (fragmentPos != kNotFound) { | |
+ rusturl_set_fragment(mRustURL.get(), aPath.BeginReading()+fragmentPos, aPath.Length() - fragmentPos); | |
+ } | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustEquals(nsIURI *other, bool *_retval) | |
{ | |
- bool equals = true; | |
- CheckDifference(__FUNCTION__, *_retval, equals); | |
- return NS_OK; | |
+ MOZ_CRASH(); | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
} | |
nsresult | |
nsStandardURL::RustSchemeIs(const char * aScheme, bool *_retval) | |
{ | |
nsAutoCString scheme; | |
rusturl_get_scheme(mRustURL.get(), &scheme); | |
bool rustResult = scheme.Equals(aScheme); | |
CheckDifference(__FUNCTION__, *_retval, rustResult); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustClone(nsIURI * *_retval) | |
{ | |
- return NS_OK; | |
+ MOZ_CRASH(); | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
} | |
nsresult | |
nsStandardURL::RustResolve(const nsACString & relativePath, nsACString & _retval) | |
{ | |
+ nsAutoCString rustResult; | |
+ rusturl_resolve(mRustURL.get(), relativePath.BeginReading(), relativePath.Length(), &rustResult); | |
+ CheckDifference(__FUNCTION__, _retval, rustResult); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetAsciiSpec(nsACString & aAsciiSpec) | |
{ | |
- return NS_OK; | |
+ return RustGetSpec(aAsciiSpec); | |
} | |
nsresult | |
nsStandardURL::RustGetAsciiHostPort(nsACString & aAsciiHostPort) | |
{ | |
- return NS_OK; | |
+ return RustGetHostPort(aAsciiHostPort); | |
} | |
nsresult | |
nsStandardURL::RustGetAsciiHost(nsACString & aAsciiHost) | |
{ | |
- return NS_OK; | |
+ return RustGetHost(aAsciiHost); | |
} | |
nsresult | |
nsStandardURL::RustGetOriginCharset(nsACString & aOriginCharset) | |
{ | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetRef(nsACString & aRef) | |
{ | |
+ nsAutoCString rustResult; | |
+ rusturl_get_fragment(mRustURL.get(), &rustResult); | |
+ CheckDifference(__FUNCTION__, aRef, rustResult); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustSetRef(const nsACString & aRef) | |
{ | |
+ rusturl_set_fragment(mRustURL.get(), aRef.BeginReading(), aRef.Length()); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustEqualsExceptRef(nsIURI *other, bool *_retval) | |
{ | |
return NS_OK; | |
} | |
@@ -267,42 +314,134 @@ nsStandardURL::RustCloneIgnoringRef(nsIU | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetSpecIgnoringRef(nsACString & aSpecIgnoringRef) | |
{ | |
nsAutoCString rustResult; | |
- rusturl_get_spec(mRustURL.get(), &rustResult); | |
- int32_t hashPos = rustResult.FindChar('#'); | |
- if (hashPos != kNotFound) { | |
- rustResult.SetLength(hashPos); | |
- } | |
+ rusturl_get_substring(mRustURL.get(), PositionBeforeScheme, PositionAfterQuery, &rustResult); | |
CheckDifference(__FUNCTION__, aSpecIgnoringRef, rustResult); | |
return NS_OK; | |
} | |
nsresult | |
nsStandardURL::RustGetHasRef(bool *aHasRef) | |
{ | |
int32_t result = rusturl_has_fragment(mRustURL.get()); | |
bool rustResult = (result == 1) ? true : false; | |
CheckDifference(__FUNCTION__, *aHasRef, rustResult); | |
return NS_OK; | |
} | |
/////////////////////////////////////////////////////////////////////////////// | |
+nsresult | |
+nsStandardURL::RustGetFilePath(nsACString & aFilePath) | |
+{ | |
+ nsAutoCString rustResult; | |
+ rusturl_get_substring(mRustURL.get(), PositionBeforePath, PositionAfterPath, &rustResult); | |
+ CheckDifference(__FUNCTION__, aFilePath, rustResult); | |
+ | |
+ return NS_OK; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustSetFilePath(const nsACString & aFilePath) | |
+{ | |
+ rusturl_set_path(mRustURL.get(), aFilePath.BeginReading(), aFilePath.Length()); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
+ return NS_OK; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustGetQuery(nsACString & aQuery) | |
+{ | |
+ nsAutoCString rustResult; | |
+ rusturl_get_query(mRustURL.get(), &rustResult); | |
+ CheckDifference(__FUNCTION__, aQuery, rustResult); | |
+ | |
+ return NS_OK; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustSetQuery(const nsACString & aQuery) | |
+{ | |
+ rusturl_set_query(mRustURL.get(), aQuery.BeginReading(), aQuery.Length()); | |
+ RustCheckSpec(__FUNCTION__, mSpec); | |
+ return NS_OK; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustGetDirectory(nsACString & aDirectory) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustSetDirectory(const nsACString & aDirectory) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustGetFileName(nsACString & aFileName) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustSetFileName(const nsACString & aFileName) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustGetFileBaseName(nsACString & aFileBaseName) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustSetFileBaseName(const nsACString & aFileBaseName) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustGetFileExtension(nsACString & aFileExtension) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustSetFileExtension(const nsACString & aFileExtension) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustGetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
+ | |
+nsresult | |
+nsStandardURL::RustGetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval) | |
+{ | |
+ return NS_ERROR_NOT_IMPLEMENTED; | |
+} | |
/////////////////////////////////////////////////////////////////////////////// | |
nsresult | |
-nsStandardURL::RustCheckSpec(const nsACString & aSpec) | |
+nsStandardURL::RustCheckSpec(const char * method, const nsACString & aSpec) | |
{ | |
nsAutoCString rustResult; | |
rusturl_get_spec(mRustURL.get(), &rustResult); | |
- | |
- CheckDifference(__FUNCTION__, aSpec, rustResult); | |
+ CheckDifference(method, aSpec, rustResult); | |
return NS_OK; | |
-} | |
\ No newline at end of file | |
+} | |
+ | |
+/////////////////////////////////////////////////////////////////////////////// | |
\ No newline at end of file | |
diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build | |
--- a/netwerk/base/moz.build | |
+++ b/netwerk/base/moz.build | |
@@ -233,17 +233,16 @@ UNIFIED_SOURCES += [ | |
'nsSecCheckWrapChannel.cpp', | |
'nsSerializationHelper.cpp', | |
'nsServerSocket.cpp', | |
'nsSimpleNestedURI.cpp', | |
'nsSimpleStreamListener.cpp', | |
'nsSimpleURI.cpp', | |
'nsSocketTransport2.cpp', | |
'nsSocketTransportService2.cpp', | |
- 'nsStandardURL.cpp', | |
'nsStreamListenerTee.cpp', | |
'nsStreamListenerWrapper.cpp', | |
'nsStreamLoader.cpp', | |
'nsStreamTransportService.cpp', | |
'nsSyncStreamListener.cpp', | |
'nsTemporaryFileInputStream.cpp', | |
'nsTransportUtils.cpp', | |
'nsUDPSocket.cpp', | |
@@ -257,20 +256,19 @@ UNIFIED_SOURCES += [ | |
'RedirectChannelRegistrar.cpp', | |
'RequestContextService.cpp', | |
'SimpleBuffer.cpp', | |
'StreamingProtocolService.cpp', | |
'Tickler.cpp', | |
'TLSServerSocket.cpp', | |
] | |
-if CONFIG['MOZ_RUST']: | |
- UNIFIED_SOURCES += [ | |
- 'RustUrlBindings.cpp', | |
- ] | |
+UNIFIED_SOURCES += [ | |
+ 'nsStandardURL.cpp', | |
+] | |
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': | |
SOURCES += [ | |
'nsURLHelperWin.cpp', | |
'ShutdownLayer.cpp', | |
] | |
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': | |
SOURCES += [ | |
diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp | |
--- a/netwerk/base/nsStandardURL.cpp | |
+++ b/netwerk/base/nsStandardURL.cpp | |
@@ -63,17 +63,19 @@ static LazyLogModule gStandardURLLog("ns | |
//---------------------------------------------------------------------------- | |
#ifdef MOZ_RUST | |
#define CALL_RUST_METHOD(func, ...) \ | |
Rust##func (__VA_ARGS__) | |
#define CHECK_RUST_SPEC_EQUALS(spec) \ | |
- RustCheckSpec(spec) | |
+ RustCheckSpec(__FUNCTION__, spec) | |
+ | |
+#include "RustUrlBindings.cpp" | |
#else | |
#define CALL_RUST_METHOD(func, ...) | |
#define CHECK_RUST_SPEC_EQUALS(spec) | |
#endif | |
static nsresult | |
EncodeString(nsIUnicodeEncoder *encoder, const nsAFlatString &str, nsACString &result) | |
@@ -1115,162 +1117,178 @@ nsStandardURL::GetSpecIgnoringRef(nsACSt | |
return NS_OK; | |
} | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetPrePath(nsACString &result) | |
{ | |
result = Prepath(); | |
+ CALL_RUST_METHOD(GetPrePath, result); | |
return NS_OK; | |
} | |
// result is strictly US-ASCII | |
NS_IMETHODIMP | |
nsStandardURL::GetScheme(nsACString &result) | |
{ | |
result = Scheme(); | |
+ CALL_RUST_METHOD(GetScheme, result); | |
return NS_OK; | |
} | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetUserPass(nsACString &result) | |
{ | |
result = Userpass(); | |
+ CALL_RUST_METHOD(GetUserPass, result); | |
return NS_OK; | |
} | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetUsername(nsACString &result) | |
{ | |
result = Username(); | |
+ CALL_RUST_METHOD(GetUsername, result); | |
return NS_OK; | |
} | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetPassword(nsACString &result) | |
{ | |
result = Password(); | |
+ CALL_RUST_METHOD(GetPassword, result); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::GetHostPort(nsACString &result) | |
{ | |
result = Hostport(); | |
+ CALL_RUST_METHOD(GetHostPort, result); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::GetHost(nsACString &result) | |
{ | |
result = Host(); | |
+ CALL_RUST_METHOD(GetHost, result); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::GetPort(int32_t *result) | |
{ | |
*result = mPort; | |
+ CALL_RUST_METHOD(GetPort, result); | |
return NS_OK; | |
} | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetPath(nsACString &result) | |
{ | |
result = Path(); | |
+ CALL_RUST_METHOD(GetPath, result); | |
return NS_OK; | |
} | |
// result is ASCII | |
NS_IMETHODIMP | |
nsStandardURL::GetAsciiSpec(nsACString &result) | |
{ | |
if (mSpecEncoding == eEncoding_Unknown) { | |
if (IsASCII(mSpec)) | |
mSpecEncoding = eEncoding_ASCII; | |
else | |
mSpecEncoding = eEncoding_UTF8; | |
} | |
if (mSpecEncoding == eEncoding_ASCII) { | |
result = mSpec; | |
+ CALL_RUST_METHOD(GetAsciiSpec, result); | |
return NS_OK; | |
} | |
// try to guess the capacity required for result... | |
result.SetCapacity(mSpec.Length() + std::min<uint32_t>(32, mSpec.Length()/10)); | |
result = Substring(mSpec, 0, mScheme.mLen + 3); | |
NS_EscapeURL(Userpass(true), esc_OnlyNonASCII | esc_AlwaysCopy, result); | |
// get the hostport | |
nsAutoCString hostport; | |
MOZ_ALWAYS_SUCCEEDS(GetAsciiHostPort(hostport)); | |
result += hostport; | |
NS_EscapeURL(Path(), esc_OnlyNonASCII | esc_AlwaysCopy, result); | |
+ CALL_RUST_METHOD(GetAsciiSpec, result); | |
return NS_OK; | |
} | |
// result is ASCII | |
NS_IMETHODIMP | |
nsStandardURL::GetAsciiHostPort(nsACString &result) | |
{ | |
if (mHostEncoding == eEncoding_ASCII) { | |
result = Hostport(); | |
+ CALL_RUST_METHOD(GetAsciiHostPort, result); | |
return NS_OK; | |
} | |
MOZ_ALWAYS_SUCCEEDS(GetAsciiHost(result)); | |
// As our mHostEncoding is not eEncoding_ASCII, we know that | |
// the our host is not ipv6, and we can avoid looking at it. | |
MOZ_ASSERT(result.FindChar(':') == -1, "The host must not be ipv6"); | |
// hostport = "hostA" + ":port" | |
uint32_t pos = mHost.mPos + mHost.mLen; | |
if (pos < mPath.mPos) | |
result += Substring(mSpec, pos, mPath.mPos - pos); | |
+ CALL_RUST_METHOD(GetAsciiHostPort, result); | |
return NS_OK; | |
} | |
// result is ASCII | |
NS_IMETHODIMP | |
nsStandardURL::GetAsciiHost(nsACString &result) | |
{ | |
if (mHostEncoding == eEncoding_ASCII) { | |
+ CALL_RUST_METHOD(GetAsciiHost, result); | |
result = Host(); | |
return NS_OK; | |
} | |
// perhaps we have it cached... | |
if (mHostA) { | |
result = mHostA; | |
+ CALL_RUST_METHOD(GetAsciiHost, result); | |
return NS_OK; | |
} | |
if (gIDN) { | |
nsresult rv; | |
rv = gIDN->ConvertUTF8toACE(Host(), result); | |
if (NS_SUCCEEDED(rv)) { | |
mHostA = ToNewCString(result); | |
return NS_OK; | |
} | |
NS_WARNING("nsIDNService::ConvertUTF8toACE failed"); | |
} | |
// something went wrong... guess all we can do is URL escape :-/ | |
NS_EscapeURL(Host(), esc_OnlyNonASCII | esc_AlwaysCopy, result); | |
+ CALL_RUST_METHOD(GetAsciiHost, result); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::GetOriginCharset(nsACString &result) | |
{ | |
if (mOriginCharset.IsEmpty()) | |
result.AssignLiteral("UTF-8"); | |
@@ -1423,16 +1441,18 @@ nsStandardURL::SetScheme(const nsACStrin | |
ShiftFromAuthority(shift); | |
} | |
// ensure new scheme is lowercase | |
// | |
// XXX the string code unfortunately doesn't provide a ToLowerCase | |
// that operates on a substring. | |
net_ToLowerCase((char *) mSpec.get(), mScheme.mLen); | |
+ | |
+ CALL_RUST_METHOD(SetScheme, input); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::SetUserPass(const nsACString &input) | |
{ | |
ENSURE_MUTABLE(); | |
@@ -1528,16 +1548,18 @@ nsStandardURL::SetUserPass(const nsACStr | |
ShiftFromHost(shift); | |
mAuthority.mLen += shift; | |
} | |
// update positions and lengths | |
mUsername.mLen = usernameLen; | |
mPassword.mLen = passwordLen; | |
if (passwordLen) | |
mPassword.mPos = mUsername.mPos + mUsername.mLen + 1; | |
+ | |
+ CALL_RUST_METHOD(SetUserPass, input); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::SetUsername(const nsACString &input) | |
{ | |
ENSURE_MUTABLE(); | |
@@ -1577,16 +1599,18 @@ nsStandardURL::SetUsername(const nsACStr | |
else | |
shift = ReplaceSegment(mUsername.mPos, mUsername.mLen, escUsername); | |
if (shift) { | |
mUsername.mLen = escUsername.Length(); | |
mAuthority.mLen += shift; | |
ShiftFromPassword(shift); | |
} | |
+ | |
+ CALL_RUST_METHOD(SetUsername, input); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::SetPassword(const nsACString &input) | |
{ | |
ENSURE_MUTABLE(); | |
@@ -1614,16 +1638,17 @@ nsStandardURL::SetPassword(const nsACStr | |
if (password.IsEmpty()) { | |
if (mPassword.mLen >= 0) { | |
// cut(":password") | |
mSpec.Cut(mPassword.mPos - 1, mPassword.mLen + 1); | |
ShiftFromHost(-(mPassword.mLen + 1)); | |
mAuthority.mLen -= (mPassword.mLen + 1); | |
mPassword.mLen = -1; | |
} | |
+ CALL_RUST_METHOD(SetPassword, input); | |
return NS_OK; | |
} | |
// escape password if necessary | |
nsAutoCString buf; | |
GET_SEGMENT_ENCODER(encoder); | |
const nsACString &escPassword = | |
encoder.EncodeSegment(password, esc_Password, buf); | |
@@ -1638,16 +1663,17 @@ nsStandardURL::SetPassword(const nsACStr | |
else | |
shift = ReplaceSegment(mPassword.mPos, mPassword.mLen, escPassword); | |
if (shift) { | |
mPassword.mLen = escPassword.Length(); | |
mAuthority.mLen += shift; | |
ShiftFromHost(shift); | |
} | |
+ CALL_RUST_METHOD(SetPassword, input); | |
return NS_OK; | |
} | |
void | |
nsStandardURL::FindHostLimit(nsACString::const_iterator& aStart, | |
nsACString::const_iterator& aEnd) | |
{ | |
for (int32_t i = 0; gHostLimitDigits[i]; ++i) { | |
@@ -1720,16 +1746,17 @@ nsStandardURL::SetHostPort(const nsACStr | |
return NS_ERROR_MALFORMED_URI; | |
} | |
} else { | |
// port number is missing | |
return NS_ERROR_MALFORMED_URI; | |
} | |
} | |
+ CALL_RUST_METHOD(SetHostPort, aValue); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::SetHost(const nsACString &input) | |
{ | |
ENSURE_MUTABLE(); | |
@@ -1816,16 +1843,17 @@ nsStandardURL::SetHost(const nsACString | |
mHost.mLen = len; | |
mAuthority.mLen += shift; | |
ShiftFromPath(shift); | |
} | |
// Now canonicalize the host to lowercase | |
net_ToLowerCase(mSpec.BeginWriting() + mHost.mPos, mHost.mLen); | |
+ CALL_RUST_METHOD(SetHost, input); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::SetPort(int32_t port) | |
{ | |
ENSURE_MUTABLE(); | |
@@ -1846,16 +1874,17 @@ nsStandardURL::SetPort(int32_t port) | |
InvalidateCache(); | |
if (port == mDefaultPort) { | |
port = -1; | |
} | |
ReplacePortInSpec(port); | |
mPort = port; | |
+ CALL_RUST_METHOD(SetPort, port); | |
return NS_OK; | |
} | |
/** | |
* Replaces the existing port in mSpec with aNewPort. | |
* | |
* The caller is responsible for: | |
* - Calling InvalidateCache (since our mSpec is changing). | |
@@ -1924,16 +1953,18 @@ nsStandardURL::SetPath(const nsACString | |
mDirectory.mLen = 1; | |
mFilepath.mLen = 1; | |
// these are no longer defined | |
mBasename.mLen = -1; | |
mExtension.mLen = -1; | |
mQuery.mLen = -1; | |
mRef.mLen = -1; | |
} | |
+ | |
+ CALL_RUST_METHOD(SetPath, input); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::Equals(nsIURI *unknownOther, bool *result) | |
{ | |
return EqualsInternal(unknownOther, eHonorRef, result); | |
} | |
@@ -2079,19 +2110,19 @@ nsStandardURL::CloneInternal(nsStandardU | |
clone.forget(result); | |
return NS_OK; | |
} | |
nsresult nsStandardURL::CopyMembers(nsStandardURL * source, | |
nsStandardURL::RefHandlingEnum refHandlingMode, bool copyCached) | |
{ | |
+ mSpec = source->mSpec; | |
CALL_RUST_METHOD(SetSpec, source->mSpec); | |
- mSpec = source->mSpec; | |
mDefaultPort = source->mDefaultPort; | |
mPort = source->mPort; | |
mScheme = source->mScheme; | |
mAuthority = source->mAuthority; | |
mUsername = source->mUsername; | |
mPassword = source->mPassword; | |
mHost = source->mHost; | |
mPath = source->mPath; | |
@@ -2300,16 +2331,18 @@ nsStandardURL::Resolve(const nsACString | |
resultPath = PL_strstr(result, "://"); | |
if (resultPath) { | |
resultPath = PL_strchr(resultPath + 3, '/'); | |
if (resultPath) | |
net_CoalesceDirs(coalesceFlag,resultPath); | |
} | |
} | |
out.Adopt(result); | |
+ | |
+ CALL_RUST_METHOD(Resolve, in, out); | |
return NS_OK; | |
} | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetCommonBaseSpec(nsIURI *uri2, nsACString &aResult) | |
{ | |
NS_ENSURE_ARG_POINTER(uri2); | |
@@ -2353,16 +2386,18 @@ nsStandardURL::GetCommonBaseSpec(nsIURI | |
// todo: also check for file matches which include '?' and '#' | |
while ((thisIndex != startCharPos) && (*(thisIndex-1) != '/')) | |
thisIndex--; | |
// grab spec from beginning to thisIndex | |
aResult = Substring(mSpec, mScheme.mPos, thisIndex - mSpec.get()); | |
NS_RELEASE(stdurl2); | |
+ | |
+ // CALL_RUST_METHOD(GetCommonBaseSpec, uri2, aResult); | |
return rv; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::GetRelativeSpec(nsIURI *uri2, nsACString &aResult) | |
{ | |
NS_ENSURE_ARG_POINTER(uri2); | |
@@ -2445,51 +2480,57 @@ nsStandardURL::GetRelativeSpec(nsIURI *u | |
} | |
// grab spec from thisIndex to end | |
uint32_t startPos = stdurl2->mScheme.mPos + thatIndex - stdurl2->mSpec.get(); | |
aResult.Append(Substring(stdurl2->mSpec, startPos, | |
stdurl2->mSpec.Length() - startPos)); | |
NS_RELEASE(stdurl2); | |
+ | |
+ // CALL_RUST_METHOD(GetRelativeSpec, uri2, aResult); | |
return rv; | |
} | |
//---------------------------------------------------------------------------- | |
// nsStandardURL::nsIURL | |
//---------------------------------------------------------------------------- | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetFilePath(nsACString &result) | |
{ | |
result = Filepath(); | |
+ // CALL_RUST_METHOD(GetFilePath, result); | |
return NS_OK; | |
} | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetQuery(nsACString &result) | |
{ | |
result = Query(); | |
+ CALL_RUST_METHOD(GetQuery, result); | |
return NS_OK; | |
} | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetRef(nsACString &result) | |
{ | |
result = Ref(); | |
+ CALL_RUST_METHOD(GetRef, result); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::GetHasRef(bool *result) | |
{ | |
*result = (mRef.mLen >= 0); | |
+ CALL_RUST_METHOD(GetHasRef, result); | |
return NS_OK; | |
} | |
// result may contain unescaped UTF-8 characters | |
NS_IMETHODIMP | |
nsStandardURL::GetDirectory(nsACString &result) | |
{ | |
result = Directory(); | |
@@ -2622,16 +2663,17 @@ nsStandardURL::SetQuery(const nsACString | |
if (mQuery.mLen >= 0) { | |
// remove query and leading '?' | |
mSpec.Cut(mQuery.mPos - 1, mQuery.mLen + 1); | |
ShiftFromRef(-(mQuery.mLen + 1)); | |
mPath.mLen -= (mQuery.mLen + 1); | |
mQuery.mPos = 0; | |
mQuery.mLen = -1; | |
} | |
+ CALL_RUST_METHOD(SetQuery, input); | |
return NS_OK; | |
} | |
int32_t queryLen = flat.Length(); | |
if (query[0] == '?') { | |
query++; | |
queryLen--; | |
} | |
@@ -2662,16 +2704,18 @@ nsStandardURL::SetQuery(const nsACString | |
int32_t shift = ReplaceSegment(mQuery.mPos, mQuery.mLen, query, queryLen); | |
if (shift) { | |
mQuery.mLen = queryLen; | |
mPath.mLen += shift; | |
ShiftFromRef(shift); | |
} | |
+ | |
+ CALL_RUST_METHOD(SetQuery, input); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::SetRef(const nsACString &input) | |
{ | |
ENSURE_MUTABLE(); | |
@@ -2693,16 +2737,17 @@ nsStandardURL::SetRef(const nsACString & | |
// remove existing ref | |
if (mRef.mLen >= 0) { | |
// remove ref and leading '#' | |
mSpec.Cut(mRef.mPos - 1, mRef.mLen + 1); | |
mPath.mLen -= (mRef.mLen + 1); | |
mRef.mPos = 0; | |
mRef.mLen = -1; | |
} | |
+ CALL_RUST_METHOD(SetRef, input); | |
return NS_OK; | |
} | |
int32_t refLen = flat.Length(); | |
if (ref[0] == '#') { | |
ref++; | |
refLen--; | |
} | |
@@ -2727,16 +2772,18 @@ nsStandardURL::SetRef(const nsACString & | |
ref = buf.get(); | |
refLen = buf.Length(); | |
} | |
} | |
int32_t shift = ReplaceSegment(mRef.mPos, mRef.mLen, ref, refLen); | |
mPath.mLen += shift; | |
mRef.mLen = refLen; | |
+ | |
+ CALL_RUST_METHOD(SetRef, input); | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::SetDirectory(const nsACString &input) | |
{ | |
NS_NOTYETIMPLEMENTED(""); | |
return NS_ERROR_NOT_IMPLEMENTED; | |
@@ -3165,17 +3212,20 @@ nsStandardURL::Read(nsIObjectInputStream | |
// file and start of the query - mPath should include the param, | |
// query and ref already. Bump the mFilePath and | |
// directory/basename/extension components to include this. | |
mFilepath.Merge(mSpec, ';', old_param); | |
mDirectory.Merge(mSpec, ';', old_param); | |
mBasename.Merge(mSpec, ';', old_param); | |
mExtension.Merge(mSpec, ';', old_param); | |
} | |
- | |
+ | |
+ CALL_RUST_METHOD(SetSpec, mSpec); | |
+ CHECK_RUST_SPEC_EQUALS(mSpec); | |
+ | |
return NS_OK; | |
} | |
NS_IMETHODIMP | |
nsStandardURL::Write(nsIObjectOutputStream *stream) | |
{ | |
MOZ_ASSERT(mSpec.Length() <= (uint32_t) net_GetURLMaxLength(), | |
"The spec should never be this long, we missed a check."); | |
diff --git a/netwerk/base/nsStandardURL.h b/netwerk/base/nsStandardURL.h | |
--- a/netwerk/base/nsStandardURL.h | |
+++ b/netwerk/base/nsStandardURL.h | |
@@ -109,34 +109,33 @@ public: | |
nsresult RustGetRef(nsACString & aRef); | |
nsresult RustSetRef(const nsACString & aRef); | |
nsresult RustEqualsExceptRef(nsIURI *other, bool *_retval); | |
nsresult RustCloneIgnoringRef(nsIURI * *_retval); | |
nsresult RustGetSpecIgnoringRef(nsACString & aSpecIgnoringRef); | |
nsresult RustGetHasRef(bool *aHasRef); | |
// nsIURL | |
- // nsresult RustGetFilePath(nsACString & aFilePath); | |
- // nsresult RustSetFilePath(const nsACString & aFilePath); | |
- // nsresult RustGetQuery(nsACString & aQuery); | |
- // nsresult RustSetQuery(const nsACString & aQuery); | |
- // nsresult RustGetDirectory(nsACString & aDirectory); | |
- // nsresult RustSetDirectory(const nsACString & aDirectory); | |
- // nsresult RustGetFileName(nsACString & aFileName); | |
- // nsresult RustSetFileName(const nsACString & aFileName); | |
- // nsresult RustGetFileBaseName(nsACString & aFileBaseName); | |
- // nsresult RustSetFileBaseName(const nsACString & aFileBaseName); | |
- // nsresult RustGetFileExtension(nsACString & aFileExtension); | |
- // nsresult RustSetFileExtension(const nsACString & aFileExtension); | |
- // nsresult RustGetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval); | |
- // nsresult RustGetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval); | |
- | |
+ nsresult RustGetFilePath(nsACString & aFilePath); | |
+ nsresult RustSetFilePath(const nsACString & aFilePath); | |
+ nsresult RustGetQuery(nsACString & aQuery); | |
+ nsresult RustSetQuery(const nsACString & aQuery); | |
+ nsresult RustGetDirectory(nsACString & aDirectory); | |
+ nsresult RustSetDirectory(const nsACString & aDirectory); | |
+ nsresult RustGetFileName(nsACString & aFileName); | |
+ nsresult RustSetFileName(const nsACString & aFileName); | |
+ nsresult RustGetFileBaseName(nsACString & aFileBaseName); | |
+ nsresult RustSetFileBaseName(const nsACString & aFileBaseName); | |
+ nsresult RustGetFileExtension(nsACString & aFileExtension); | |
+ nsresult RustSetFileExtension(const nsACString & aFileExtension); | |
+ nsresult RustGetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval); | |
+ nsresult RustGetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval); | |
// Extra | |
- nsresult RustCheckSpec(const nsACString & spec); | |
+ nsresult RustCheckSpec(const char * method, const nsACString & spec); | |
#endif | |
public: /* internal -- HPUX compiler can't handle this being private */ | |
// | |
// location and length of an url segment relative to mSpec | |
// | |
struct URLSegment | |
{ | |
diff --git a/netwerk/test/unit/test_standardurl.js b/netwerk/test/unit/test_standardurl.js | |
--- a/netwerk/test/unit/test_standardurl.js | |
+++ b/netwerk/test/unit/test_standardurl.js | |
@@ -133,16 +133,17 @@ add_test(function test_setRef() | |
["http://example.com:80/", "xxxxxxxxxxxxxx", "http://example.com:80/#xxxxxxxxxxxxxx"], | |
["http://example.com/", "xxxxxxxxxxxxxx", "http://example.com/#xxxxxxxxxxxxxx"], | |
["http://example.com/a", "xxxxxxxxxxxxxx", "http://example.com/a#xxxxxxxxxxxxxx"], | |
["http://example.com:80/a", "xxxxxxxxxxxxxx", "http://example.com:80/a#xxxxxxxxxxxxxx"], | |
]; | |
for (var [before, ref, result] of tests) | |
{ | |
+ dump("---------------------------\n"); | |
/* Test1: starting with empty ref */ | |
var a = stringToURL(before); | |
a.ref = ref; | |
var b = stringToURL(result); | |
do_check_eq(a.spec, b.spec); | |
do_check_eq(ref, b.ref); | |
symmetricEquality(true, a, b); | |
diff --git a/rust/rust-url-capi/src/lib.rs b/rust/rust-url-capi/src/lib.rs | |
--- a/rust/rust-url-capi/src/lib.rs | |
+++ b/rust/rust-url-capi/src/lib.rs | |
@@ -166,16 +166,55 @@ pub unsafe extern "C" fn rusturl_has_fra | |
match url.fragment() { | |
Some(_) => return 1, | |
None => return 0 | |
} | |
} | |
#[no_mangle] | |
+pub unsafe extern "C" fn rusturl_get_directory(urlptr: rusturl_ptr, cont: *mut libc::c_void) -> i32 { | |
+ if urlptr.is_null() { | |
+ return NSError::InvalidArg.error_code(); | |
+ } | |
+ let url: &Url = mem::transmute(urlptr); | |
+ | |
+ match url.path_segments() { | |
+ Some(segments) => { | |
+ if let Some(last) = segments.last() { | |
+ cont.assign(last) | |
+ } else { | |
+ 0 | |
+ } | |
+ }, | |
+ None => cont.set_size(0) | |
+ } | |
+} | |
+ | |
+#[no_mangle] | |
+pub unsafe extern "C" fn rusturl_get_filename(urlptr: rusturl_ptr, cont: *mut libc::c_void) -> i32 { | |
+ if urlptr.is_null() { | |
+ return NSError::InvalidArg.error_code(); | |
+ } | |
+ let url: &Url = mem::transmute(urlptr); | |
+ | |
+ match url.path_segments() { | |
+ Some(segments) => { | |
+ if let Some(last) = segments.last() { | |
+ cont.assign(last) | |
+ } else { | |
+ 0 | |
+ } | |
+ }, | |
+ None => cont.set_size(0) | |
+ } | |
+} | |
+ | |
+ | |
+#[no_mangle] | |
pub unsafe extern "C" fn rusturl_set_scheme(urlptr: rusturl_ptr, scheme: *mut libc::c_char, len: size_t) -> i32 { | |
if urlptr.is_null() { | |
return NSError::InvalidArg.error_code(); | |
} | |
let mut url: &mut Url = mem::transmute(urlptr); | |
let slice = std::slice::from_raw_parts(scheme as *const libc::c_uchar, len as usize); | |
let scheme_ = match str::from_utf8(slice).ok() { | |
diff --git a/rust/rust-url-capi/src/rust-url-capi.h b/rust/rust-url-capi/src/rust-url-capi.h | |
--- a/rust/rust-url-capi/src/rust-url-capi.h | |
+++ b/rust/rust-url-capi/src/rust-url-capi.h | |
@@ -41,16 +41,19 @@ int32_t rusturl_get_username(rusturl_ptr | |
int32_t rusturl_get_password(rusturl_ptr url, void*); | |
int32_t rusturl_get_host(rusturl_ptr url, void*); | |
int32_t rusturl_get_port(rusturl_ptr url); // returns port or -1 | |
int32_t rusturl_get_path(rusturl_ptr url, void*); | |
int32_t rusturl_get_query(rusturl_ptr url, void*); | |
int32_t rusturl_get_fragment(rusturl_ptr url, void*); | |
int32_t rusturl_has_fragment(rusturl_ptr url); // 1 true, 0 false, < 0 error | |
+int32_t rusturl_get_directory(rusturl_ptr url, void*); | |
+int32_t rusturl_get_filename(rusturl_ptr url, void*); | |
+ | |
int32_t rusturl_set_scheme(rusturl_ptr url, const char *scheme, size_t len); | |
int32_t rusturl_set_username(rusturl_ptr url, const char *user, size_t len); | |
int32_t rusturl_set_password(rusturl_ptr url, const char *pass, size_t len); | |
int32_t rusturl_set_host_and_port(rusturl_ptr url, const char *hostport, size_t len); | |
int32_t rusturl_set_host(rusturl_ptr url, const char *host, size_t len); | |
int32_t rusturl_set_port(rusturl_ptr url, const char *port, size_t len); | |
int32_t rusturl_set_port_no(rusturl_ptr url, const int32_t port); | |
int32_t rusturl_set_path(rusturl_ptr url, const char *path, size_t len); | |
diff --git a/rust/rust-url-capi/test/test.cpp b/rust/rust-url-capi/test/test.cpp | |
--- a/rust/rust-url-capi/test/test.cpp | |
+++ b/rust/rust-url-capi/test/test.cpp | |
@@ -80,16 +80,21 @@ int main() { | |
TEST_CALL(rusturl_get_spec(url, &container), 0); | |
container.CheckEquals("http://example.com/path/some/file.txt"); | |
TEST_CALL(rusturl_set_host(url, "test.com", strlen("test.com")), 0); | |
TEST_CALL(rusturl_get_host(url, &container), 0); | |
container.CheckEquals("test.com"); | |
TEST_CALL(rusturl_get_path(url, &container), 0); | |
container.CheckEquals("/path/some/file.txt"); | |
+ | |
+ TEST_CALL(rusturl_get_filename(url, &container), 0); | |
+ container.CheckEquals("file.txt"); | |
+ | |
+ | |
TEST_CALL(rusturl_set_path(url, "hello/../else.txt", strlen("hello/../else.txt")), 0); | |
TEST_CALL(rusturl_get_path(url, &container), 0); | |
container.CheckEquals("/else.txt"); | |
TEST_CALL(rusturl_resolve(url, "./bla/file.txt", strlen("./bla/file.txt"), &container), 0); | |
container.CheckEquals("http://test.com/bla/file.txt"); | |
TEST_CALL(rusturl_get_scheme(url, &container), 0); | |
container.CheckEquals("http"); | |
TEST_CALL(rusturl_set_username(url, "user", strlen("user")), 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User Valentin Gosu <[email protected]> | |
# Parent ef9a504d0c422723664f4dcfbdb0bfb23b1d7ae9 | |
[mq]: oxidation-cargo-config.patch | |
MozReview-Commit-ID: DN3aoLX68b2 | |
diff --git a/rust/.cargo/config b/rust/.cargo/config | |
new file mode 100644 | |
--- /dev/null | |
+++ b/rust/.cargo/config | |
@@ -0,0 +1,10 @@ | |
+paths = [ "matches", "unicode-normalization", "unicode-bidi", "libc"] | |
+ | |
+[replace] | |
+"matches:0.1.2" = { path = "matches" } | |
+"unicode-normalization:0.1.2" = { path = "unicode-normalization" } | |
+"unicode-bidi:0.2.3" = { path = "unicode-bidi" } | |
+"libc:0.2.11" = { path = "libc" } | |
+ | |
+[http] | |
+timeout = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment