From e92469cb8e5dd39f4e676fd12fd3cb876c470204 Mon Sep 17 00:00:00 2001 From: "valeski%netscape.com" Date: Tue, 11 Jan 2000 22:16:19 +0000 Subject: [PATCH] r=rhp. datetime protocol wasn't initializing properly which would cause a datetime url without a host to spin --- extensions/datetime/nsDateTimeChannel.cpp | 17 +++++++++++------ .../protocol/datetime/src/nsDateTimeChannel.cpp | 17 +++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/extensions/datetime/nsDateTimeChannel.cpp b/extensions/datetime/nsDateTimeChannel.cpp index 7214f4f8310c..01df6eda5103 100644 --- a/extensions/datetime/nsDateTimeChannel.cpp +++ b/extensions/datetime/nsDateTimeChannel.cpp @@ -55,9 +55,20 @@ nsDateTimeChannel::Init(const char* verb, { nsresult rv; + NS_ASSERTION(uri, "no uri"); + mOriginalURI = originalURI ? originalURI : uri; mUrl = uri; + rv = mUrl->GetPort(&mPort); + if (NS_FAILED(rv) || mPort < 1) + mPort = DATETIME_PORT; + + rv = mUrl->GetPath(getter_Copies(mHost)); + if (NS_FAILED(rv)) return rv; + + if (!*(const char *)mHost) return NS_ERROR_NOT_INITIALIZED; + rv = SetLoadAttributes(loadAttributes); if (NS_FAILED(rv)) return rv; rv = SetLoadGroup(aLoadGroup); @@ -65,12 +76,6 @@ nsDateTimeChannel::Init(const char* verb, rv = SetNotificationCallbacks(notificationCallbacks); if (NS_FAILED(rv)) return rv; - rv = mUrl->GetPort(&mPort); - if (NS_FAILED(rv) || mPort < 1) - mPort = DATETIME_PORT; - - rv = mUrl->GetPath(getter_Copies(mHost)); - if (NS_FAILED(rv)) return rv; return NS_OK; } diff --git a/netwerk/protocol/datetime/src/nsDateTimeChannel.cpp b/netwerk/protocol/datetime/src/nsDateTimeChannel.cpp index 7214f4f8310c..01df6eda5103 100644 --- a/netwerk/protocol/datetime/src/nsDateTimeChannel.cpp +++ b/netwerk/protocol/datetime/src/nsDateTimeChannel.cpp @@ -55,9 +55,20 @@ nsDateTimeChannel::Init(const char* verb, { nsresult rv; + NS_ASSERTION(uri, "no uri"); + mOriginalURI = originalURI ? originalURI : uri; mUrl = uri; + rv = mUrl->GetPort(&mPort); + if (NS_FAILED(rv) || mPort < 1) + mPort = DATETIME_PORT; + + rv = mUrl->GetPath(getter_Copies(mHost)); + if (NS_FAILED(rv)) return rv; + + if (!*(const char *)mHost) return NS_ERROR_NOT_INITIALIZED; + rv = SetLoadAttributes(loadAttributes); if (NS_FAILED(rv)) return rv; rv = SetLoadGroup(aLoadGroup); @@ -65,12 +76,6 @@ nsDateTimeChannel::Init(const char* verb, rv = SetNotificationCallbacks(notificationCallbacks); if (NS_FAILED(rv)) return rv; - rv = mUrl->GetPort(&mPort); - if (NS_FAILED(rv) || mPort < 1) - mPort = DATETIME_PORT; - - rv = mUrl->GetPath(getter_Copies(mHost)); - if (NS_FAILED(rv)) return rv; return NS_OK; }