Project

General

Profile

Actions

Bug #3269

closed

HTTP status from CGI

Added by sulakm 7 months ago. Updated 7 months ago.

Status:
Invalid
Priority:
Normal
Category:
mod_cgi
Target version:
-
ASK QUESTIONS IN Forums:
No

Description

Hello, lighttpd does not propagate http status from CGI output header like Apache does.

#include <stdio.h>
int main() {
    fputs("Status: 204 myerror\r\n\r\n", stdout);
    return 0;
}

Output from Apache:

# curl -i http://localhost/cgi-bin/test
HTTP/1.1 204 myerror
Date: Mon, 21 Oct 2024 04:43:53 GMT
Server: Apache/2.4.61 (Debian)

Output from lighttpd:

# curl -i http://localhost/cgi-bin/test
HTTP/1.1 204 *No Content*
Date: Mon, 21 Oct 2024 04:45:55 GMT
Server: lighttpd/1.4.69
Actions #1

Updated by sulakm 7 months ago

Sorry for *, it is HTTP/1.1 204 No Content

Actions #2

Updated by gstrauss 7 months ago

  • Status changed from New to Invalid
  • Target version deleted (1.4.xx)

lighttpd honors the status code. lighttpd intentionally ignores the optional descriptive reason whether or not one is provided. In any case, the descriptive reason is omitted from HTTP/2 and later responses. If you need that info to get to the client portably, you may put that info into an additional response header.

RFC 9110 HTTP Semantics
https://www.rfc-editor.org/rfc/rfc9110#name-overview-of-status-codes

The status codes listed below are defined in this specification. The reason phrases listed here are only recommendations -- they can be replaced by local equivalents or left out altogether without affecting the protocol.

RFC 3875 The Common Gateway Interface (CGI) Version 1.1
https://www.rfc-editor.org/rfc/rfc3875.html#section-6.3.3

      Status         = "Status:" status-code SP reason-phrase NL
      status-code    = "200" | "302" | "400" | "501" | extension-code
      extension-code = 3digit
      reason-phrase  = *TEXT

The *TEXT is optional.


If you file a bug against lighttpd, it should be a bug, with reference to real specifications, not what some other web server does or does not do. If you want to ask about behavior compared to other web servers, then that is a question.
Do not post questions here. Ask questions in the Forums (see tab at top). How to get support


"HTTP status from CGI" is a poor subject line. The status code from lighttpd is valid. You subject line does not describe anything wrong. It is merely a noun.

Actions

Also available in: Atom