Closed Bug 297056 Opened 20 years ago Closed 19 years ago

nsIChannel::status equals 0 when open failed

Categories

(Core :: Networking, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: surkov, Assigned: darin.moz)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; ru-RU; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 (ax)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b) Gecko/20050217

var ioservice=Components.classes["@mozilla.org/network/io-service;1"].
                     getService(Components.interfaces.nsIIOService);
var channel=ioservice.newChannel(url, null, null);
channel.open();

Channel throws exception (protocol file://) or returns html document (protocol
http://) when requested file is not found. channel.status equals 0. It seems
channel.status should be equaled 404. Why does nsIChannel::open() throw
exception? Maybe instead of exception its better to provide information by
nsIChannel::status?

Reproducible: Always
>Channel throws exception (protocol file://) [...] when requested file is not 
>found. 

(note bug 282432)

>channel.status should be equaled 404

it's an nsresult, not an HTTP status code... for HTTP, you should check
nsIHttpChannel::requestSucceeded. (status is 0 (NS_OK) because the channel did
get some data)

Looks like half dublicate, half invalid.

I mean it's comfortable to have common interface of error processing for file://
and http:// protocols. 

If exception is thrown when file not found then why nresult is 0?
Summary: nsIChannel::status equals 0 → nsIChannel::status equals 0 when open failed
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.