From d1f0bf4be6a9646658b5ae04df01f81474b65f5b Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Wed, 17 Oct 2007 18:40:53 +0000 Subject: [PATCH] - Send CGI pages as HTTP/1.1 unless the client asked for HTTP/1.0. - White space fix. --- cgi.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/cgi.c b/cgi.c index 5cd2e11b..0d7a0855 100644 --- a/cgi.c +++ b/cgi.c @@ -1,4 +1,4 @@ -const char cgi_rcs[] = "$Id: cgi.c,v 1.98 2007/05/14 10:33:51 fabiankeil Exp $"; +const char cgi_rcs[] = "$Id: cgi.c,v 1.99 2007/08/05 13:42:22 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgi.c,v $ @@ -38,6 +38,9 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.98 2007/05/14 10:33:51 fabiankeil Exp $"; * * Revisions : * $Log: cgi.c,v $ + * Revision 1.99 2007/08/05 13:42:22 fabiankeil + * #1763173 from Stefan Huehner: declare some more functions static. + * * Revision 1.98 2007/05/14 10:33:51 fabiankeil * - Use strlcpy() and strlcat() instead of strcpy() and strcat(). * @@ -1985,9 +1988,12 @@ struct http_response *finish_http_response(const struct client_state *csp, struc } /* - * Fill in the HTTP Status + * Fill in the HTTP Status, using HTTP/1.1 + * unless the client asked for HTTP/1.0. */ - snprintf(buf, sizeof(buf), "HTTP/1.0 %s", rsp->status ? rsp->status : "200 OK"); + snprintf(buf, sizeof(buf), "%s %s", + strcmpic(csp->http->ver, "HTTP/1.0") ? "HTTP/1.1" : "HTTP/1.0", + rsp->status ? rsp->status : "200 OK"); err = enlist_first(rsp->headers, buf); /* @@ -2023,12 +2029,12 @@ struct http_response *finish_http_response(const struct client_state *csp, struc if (strncmpic(rsp->status, "302", 3)) { - /* - * If it's not a redirect without any content, - * set the Content-Type to text/html if it's - * not already specified. - */ - if (!err) err = enlist_unique(rsp->headers, "Content-Type: text/html", 13); + /* + * If it's not a redirect without any content, + * set the Content-Type to text/html if it's + * not already specified. + */ + if (!err) err = enlist_unique(rsp->headers, "Content-Type: text/html", 13); } /* -- 2.39.2