about summary refs log tree commit diff
path: root/src/tipideed
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-06 00:13:28 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-06 00:13:28 +0000
commitd9f5cb7a28ee79e299e41d3ce325171f01e1a3d7 (patch)
treec13af66675cbd2ed3de340ab139297e4dcdbd199 /src/tipideed
parent8d66c8c5cac310958fa64e3f62b828ea960202ba (diff)
downloadtipidee-d9f5cb7a28ee79e299e41d3ce325171f01e1a3d7.tar.gz
tipidee-d9f5cb7a28ee79e299e41d3ce325171f01e1a3d7.tar.xz
tipidee-d9f5cb7a28ee79e299e41d3ce325171f01e1a3d7.zip
Some fixes, preparation for changes in error responses
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/tipideed')
-rw-r--r--src/tipideed/cgi.c5
-rw-r--r--src/tipideed/tipideed.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/tipideed/cgi.c b/src/tipideed/cgi.c
index a875acd..9cd395d 100644
--- a/src/tipideed/cgi.c
+++ b/src/tipideed/cgi.c
@@ -66,6 +66,11 @@ static inline void modify_env (tipidee_rql const *rql, tipidee_headers const *hd
   else delenv(rql, "QUERY_STRING") ;
   addenv(rql, "SCRIPT_NAME", script) ;
   addenv(rql, "SERVER_NAME", rql->uri.host) ;
+  {
+    char proto[9] = "HTTP/1.1" ;
+    if (!rql->http_minor) proto[7] = '0' ;
+    addenv(rql, "SERVER_PROTOCOL", proto) ;
+  }
   
   for (size_t i = 0 ; i < hdr->n ; i++)
   {
diff --git a/src/tipideed/tipideed.c b/src/tipideed/tipideed.c
index e7dd3a1..b85f509 100644
--- a/src/tipideed/tipideed.c
+++ b/src/tipideed/tipideed.c
@@ -47,7 +47,7 @@ static void sigchld_handler (int sig)
 
 static inline void prep_env (void)
 {
-  static char const basevars[] = "PROTO\0TCPCONNNUM\0GATEWAY_INTERFACE=CGI/1.1\0SERVER_PROTOCOL=HTTP/1.1\0SERVER_SOFTWARE=tipidee/" TIPIDEE_VERSION ;
+  static char const basevars[] = "PROTO\0TCPCONNNUM\0GATEWAY_INTERFACE=CGI/1.1\0SERVER_SOFTWARE=tipidee/" TIPIDEE_VERSION ;
   static char const sslvars[] = "SSL_PROTOCOL\0SSL_CIPHER\0SSL_TLS_SNI_SERVERNAME\0SSL_PEER_CERT_HASH\0SSL_PEER_CERT_SUBJECT\0HTTPS=on" ;
   char const *x = getenv("SSL_PROTOCOL") ;
   size_t protolen ;
@@ -500,7 +500,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
       case TIPIDEE_METHOD_DELETE : exit_405(&rql, 1) ;
       case TIPIDEE_METHOD_TRACE : respond_trace(hdrbuf, &rql, &hdr) ; continue ;
       case TIPIDEE_METHOD_CONNECT : exit_501(&rql, "CONNECT method unsupported") ;
-      case TIPIDEE_METHOD_PRI : exit_501(&rql, "PRI method attempted with HTTP/1.1") ;
+      case TIPIDEE_METHOD_PRI : exit_501(&rql, "PRI method attempted with HTTP version 1") ;
       default : die500x(&rql, 101, "can't happen: unknown HTTP method") ;
     }