tests: ikev2: add nat traversal & cert based auth test
[vpp.git] / src / plugins / http_static / static_server.c
index 16136d2..45d8731 100644 (file)
 
 #include <vppinfra/bihash_template.c>
 
-/** @file Static http server, sufficient to
-    serve .html / .css / .js content.
-*/
+/** @file static_server.c
+ *  Static http server, sufficient to
+ *  serve .html / .css / .js content.
+ */
 /*? %%clicmd:group_label Static HTTP Server %% ?*/
 
 http_static_server_main_t http_static_server_main;
@@ -133,8 +134,10 @@ http_static_server_session_alloc (u32 thread_index)
 {
   http_static_server_main_t *hsm = &http_static_server_main;
   http_session_t *hs;
-  pool_get (hsm->sessions[thread_index], hs);
-  memset (hs, 0, sizeof (*hs));
+  pool_get_aligned_zero_numa (hsm->sessions[thread_index], hs,
+                             0 /* not aligned */ ,
+                             1 /* zero */ ,
+                             os_get_numa_index ());
   hs->session_index = hs - hsm->sessions[thread_index];
   hs->thread_index = thread_index;
   hs->timer_handle = ~0;
@@ -297,6 +300,7 @@ static const char *http_response_template =
 /** \brief send http data
     @param hs - http session
     @param data - the data vector to transmit
+    @param length - length of data
     @param offset - transmit offset for this operation
     @return offset for next transmit operation, may be unchanged w/ full fifo
 */
@@ -676,10 +680,10 @@ find_end:
   if (p)
     {
       int rv;
-      int (*fp) (u8 *, http_session_t *);
+      int (*fp) (http_builtin_method_type_t, u8 *, http_session_t *);
       fp = (void *) p[0];
       hs->path = path;
-      rv = (*fp) (request, hs);
+      rv = (*fp) (request_type, request, hs);
       if (rv)
        {
          clib_warning ("builtin handler %llx hit on %s '%s' but failed!",
@@ -933,7 +937,7 @@ state_sent_ok (session_t * s, http_session_t * hs,
 
   /* What kind of dog food are we serving? */
   suffix = (char *) (hs->path + vec_len (hs->path) - 1);
-  while (*suffix != '.')
+  while ((u8 *) suffix >= hs->path && *suffix != '.')
     suffix--;
   suffix++;
   http_type = "text/html";
@@ -1116,7 +1120,8 @@ http_static_server_session_reset_callback (session_t * s)
 
 static int
 http_static_server_session_connected_callback (u32 app_index, u32 api_context,
-                                              session_t * s, u8 is_fail)
+                                              session_t * s,
+                                              session_error_t err)
 {
   clib_warning ("called...");
   return -1;
@@ -1741,7 +1746,8 @@ http_static_server_main_init (vlib_main_t * vm)
   hsm->first_index = hsm->last_index = ~0;
 
   clib_timebase_init (&hsm->timebase, 0 /* GMT */ ,
-                     CLIB_TIMEBASE_DAYLIGHT_NONE);
+                     CLIB_TIMEBASE_DAYLIGHT_NONE,
+                     &vm->clib_time /* share the system clock */ );
 
   return 0;
 }