[ipxe-devel] HTTP status Codes in ipxe-scripts available?

Michael Brown mcb30 at ipxe.org
Mon Mar 3 12:47:46 UTC 2014

On 02/03/14 18:25, Oliver Rath wrote:
> is it possible to get access to http-return-codes? Normall, all is ok
> (200) so the script continues.
> But in other case there could be differences like
> - not found (404)
> - forbidden (403)
> - Gateway timout (504)
> and many others. Is there a possibility to get this numbers?

Sort of.  Immediately after a failure, the ${errno} variable will 
contain the iPXE error number.  You can use this within a script to e.g. 
report the error back to a log server.

iPXE currently recognises HTTP status codes 401, 403, and 404 as having 
specific meanings.  The EUNIQ() mechanism could potentially be used to 
give all HTTP status codes an individual iPXE error number.  See e.g. 
drivers/block/scsi.c for an example of how EUNIQ() can be used.

You would need to take into account the fact that iPXE has only five 
bits available for EUNIQ() disambiguators.  You could use a similar 
approach to the 802.11 code: this takes a six-bit 802.11 reason code, 
uses the low five bits as the EUNIQ() disambiguator, and uses the sixth 
bit to select between ENETRESET and ECONNRESET as the base error.


More information about the ipxe-devel mailing list