W3C home > Mailing lists > Public > www-talk@w3.org > May to June 1996

Re: Sending 'status-code=204'.

From: Mirsad Todorovac <tm@rasips2.rasip.etf.hr>
Date: Thu, 16 May 1996 10:39:29 +0200 (MET DST)
Message-Id: <199605160839.KAA29643@rasips2.rasip.etf.hr>
To: 638net@medusa.es (Domingo Siliceo)
Cc: www-talk@w3.org
] 
] Hi all,
] I'm trying to send a status-code 204 from a script that no contains any 
] data to be shown in the html browser, so, I guess I should not define any 
] content-type header in my script. This script might look like
] 
] #tested under NTPerl 4.036 and EMWAC 0.991
] 
] print "Status-Code=204\n\n";
] 
] open FILE ">>momo.html";
] print FILE "Bon dia!\n";
] close (FILE);
] 
] exit (0);
] 
] I hope you get the idea. 

Probably you ought to use nph-cgi script (in NCSA httpd terminology).
This kind of scripts sends Status code directly to client (browser).
You also need to pass all other fields you want, like Exprises: , Date:, 
Server: , or others.

Personally I dislike this solution, because eg. Netscape(R) shows only
a popup with "Document contains no data" and a button you need to click,
which is IMHO confusing to the client, and shows no reason why document
contains no data.

print "204 No Data\n" ;
print "Server: ", $ENV{'SEVER_SOFTWARE'}, "\n" ;
.
.  # here comes the rest of headers -- if any
.

^This above is what I suppose you wanted.
Instead, you might prefer give some explanation about why CGI returned no
results ("No entries in Dbase match key", "Temporary unavailable service",
"No such entry" ...).

%excuse_pages = ( "-601", "/errors/tempunavail.html",
		  "-602", "/errors/nomatch.html", ... ) ;

$excuse = $excuse_pages{$error_code} ;

print "Content-type: text/html\n") ;
print "Location: ", $excuse, "\n") ;
.
.  # here comes the rest of headers -- if any
.

-- 
    | Mirsad Todorovac					|
    | Faculty of Electrical Engineering and Computing	|
    | University of Zagreb				|
    | Unska 3, Zagreb, Croatia 10000			|
    |							|
    | e-mail: mirsad.todorovac@fer.hr			|
Received on Saturday, 18 May 1996 02:24:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:19 GMT