about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-08-23 08:52:47 +0000
committerLaurent Bercot <ska@appnovation.com>2023-08-23 08:52:47 +0000
commit8d8edcd55e8601b888bf310c813d26fc328c9eaf (patch)
tree9ec9780a1952e9edcdd5f2c8ce0d7fbe76d4ce82 /src
parent921a959bc43275dc2a39ac3cc95b738d7ea98cf2 (diff)
downloadtipidee-8d8edcd55e8601b888bf310c813d26fc328c9eaf.tar.gz
tipidee-8d8edcd55e8601b888bf310c813d26fc328c9eaf.tar.xz
tipidee-8d8edcd55e8601b888bf310c813d26fc328c9eaf.zip
Bound 3xx response, clean up TCPCONNNUM, fix body reading
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r--src/tipideed/responses.c2
-rw-r--r--src/tipideed/tipideed.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/tipideed/responses.c b/src/tipideed/responses.c
index 02109b3..0c93582 100644
--- a/src/tipideed/responses.c
+++ b/src/tipideed/responses.c
@@ -54,7 +54,7 @@ void respond_30x (tipidee_rql const *rql, tipidee_redirection const *rd)
   tain deadline ;
   tipidee_response_status_line(buffer_1, rql, rsl[rd->type]) ;
   tipidee_response_header_common_put_g(buffer_1, 0) ;
-  buffer_putsnoflush(buffer_1, "Location: ") ;
+  buffer_putsnoflush(buffer_1, "Content-Length: 0\r\nLocation: ") ;
   buffer_putsnoflush(buffer_1, rd->location) ;
   if (rd->sub) buffer_putsnoflush(buffer_1, rd->sub) ;
   buffer_putnoflush(buffer_1, "\r\n\r\n", 4) ;
diff --git a/src/tipideed/tipideed.c b/src/tipideed/tipideed.c
index e1021d3..118f33a 100644
--- a/src/tipideed/tipideed.c
+++ b/src/tipideed/tipideed.c
@@ -42,7 +42,7 @@ static void sigchld_handler (int sig)
 
 static inline void prep_env (void)
 {
-  static char const basevars[] = "PROTO\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_PROTOCOL=HTTP/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") ;
   if (!stralloc_readyplus(&g.sa, 320)) dienomem() ;
@@ -489,6 +489,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
             else exit_400(&rql, "Request body does not match Content-Length") ;
           }
           bodysa.len = content_length ;
+          break ;
         }
         case TIPIDEE_TRANSFERCODING_CHUNKED :
         {
@@ -498,6 +499,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
             else if (errno == EMSGSIZE) exit_413(&rql, "Request body too large") ;
             else exit_400(&rql, "Invalid chunked body") ;
           }
+          break ;
         }
         default : break ;
       }