LCOV - code coverage report
Current view: top level - home/build/openresty-1.13.6.1/build/ngx_lua-0.10.11/src - ngx_http_lua_consts.c (source / functions) Hit Total Coverage
Test: coverage ngix Lines: 114 114 100.0 %
Date: 2020-03-03 04:25:50 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : 
       2             : /*
       3             :  * Copyright (C) Xiaozhe Wang (chaoslawful)
       4             :  * Copyright (C) Yichun Zhang (agentzh)
       5             :  */
       6             : 
       7             : 
       8             : #ifndef DDEBUG
       9             : #define DDEBUG 0
      10             : #endif
      11             : #include "ddebug.h"
      12             : 
      13             : 
      14             : #include "ngx_http_lua_consts.h"
      15             : 
      16             : 
      17             : void
      18          18 : ngx_http_lua_inject_core_consts(lua_State *L)
      19             : {
      20             :     /* {{{ core constants */
      21          18 :     lua_pushinteger(L, NGX_OK);
      22          18 :     lua_setfield(L, -2, "OK");
      23             : 
      24          18 :     lua_pushinteger(L, NGX_AGAIN);
      25          18 :     lua_setfield(L, -2, "AGAIN");
      26             : 
      27          18 :     lua_pushinteger(L, NGX_DONE);
      28          18 :     lua_setfield(L, -2, "DONE");
      29             : 
      30          18 :     lua_pushinteger(L, NGX_DECLINED);
      31          18 :     lua_setfield(L, -2, "DECLINED");
      32             : 
      33          18 :     lua_pushinteger(L, NGX_ERROR);
      34          18 :     lua_setfield(L, -2, "ERROR");
      35             : 
      36          18 :     lua_pushlightuserdata(L, NULL);
      37          18 :     lua_setfield(L, -2, "null");
      38             :     /* }}} */
      39          18 : }
      40             : 
      41             : 
      42             : void
      43          18 : ngx_http_lua_inject_http_consts(lua_State *L)
      44             : {
      45             :     /* {{{ HTTP status constants */
      46          18 :     lua_pushinteger(L, NGX_HTTP_GET);
      47          18 :     lua_setfield(L, -2, "HTTP_GET");
      48             : 
      49          18 :     lua_pushinteger(L, NGX_HTTP_POST);
      50          18 :     lua_setfield(L, -2, "HTTP_POST");
      51             : 
      52          18 :     lua_pushinteger(L, NGX_HTTP_PUT);
      53          18 :     lua_setfield(L, -2, "HTTP_PUT");
      54             : 
      55          18 :     lua_pushinteger(L, NGX_HTTP_HEAD);
      56          18 :     lua_setfield(L, -2, "HTTP_HEAD");
      57             : 
      58          18 :     lua_pushinteger(L, NGX_HTTP_DELETE);
      59          18 :     lua_setfield(L, -2, "HTTP_DELETE");
      60             : 
      61          18 :     lua_pushinteger(L, NGX_HTTP_OPTIONS);
      62          18 :     lua_setfield(L, -2, "HTTP_OPTIONS");
      63             : 
      64          18 :     lua_pushinteger(L, NGX_HTTP_MKCOL);
      65          18 :     lua_setfield(L, -2, "HTTP_MKCOL");
      66             : 
      67          18 :     lua_pushinteger(L, NGX_HTTP_COPY);
      68          18 :     lua_setfield(L, -2, "HTTP_COPY");
      69             : 
      70          18 :     lua_pushinteger(L, NGX_HTTP_MOVE);
      71          18 :     lua_setfield(L, -2, "HTTP_MOVE");
      72             : 
      73          18 :     lua_pushinteger(L, NGX_HTTP_PROPFIND);
      74          18 :     lua_setfield(L, -2, "HTTP_PROPFIND");
      75             : 
      76          18 :     lua_pushinteger(L, NGX_HTTP_PROPPATCH);
      77          18 :     lua_setfield(L, -2, "HTTP_PROPPATCH");
      78             : 
      79          18 :     lua_pushinteger(L, NGX_HTTP_LOCK);
      80          18 :     lua_setfield(L, -2, "HTTP_LOCK");
      81             : 
      82          18 :     lua_pushinteger(L, NGX_HTTP_UNLOCK);
      83          18 :     lua_setfield(L, -2, "HTTP_UNLOCK");
      84             : 
      85          18 :     lua_pushinteger(L, NGX_HTTP_PATCH);
      86          18 :     lua_setfield(L, -2, "HTTP_PATCH");
      87             : 
      88          18 :     lua_pushinteger(L, NGX_HTTP_TRACE);
      89          18 :     lua_setfield(L, -2, "HTTP_TRACE");
      90             :     /* }}} */
      91             : 
      92          18 :     lua_pushinteger(L, NGX_HTTP_CONTINUE);
      93          18 :     lua_setfield(L, -2, "HTTP_CONTINUE");
      94             : 
      95          18 :     lua_pushinteger(L, NGX_HTTP_SWITCHING_PROTOCOLS);
      96          18 :     lua_setfield(L, -2, "HTTP_SWITCHING_PROTOCOLS");
      97             : 
      98          18 :     lua_pushinteger(L, NGX_HTTP_OK);
      99          18 :     lua_setfield(L, -2, "HTTP_OK");
     100             : 
     101          18 :     lua_pushinteger(L, NGX_HTTP_CREATED);
     102          18 :     lua_setfield(L, -2, "HTTP_CREATED");
     103             : 
     104          18 :     lua_pushinteger(L, NGX_HTTP_ACCEPTED);
     105          18 :     lua_setfield(L, -2, "HTTP_ACCEPTED");
     106             : 
     107          18 :     lua_pushinteger(L, NGX_HTTP_NO_CONTENT);
     108          18 :     lua_setfield(L, -2, "HTTP_NO_CONTENT");
     109             : 
     110          18 :     lua_pushinteger(L, NGX_HTTP_PARTIAL_CONTENT);
     111          18 :     lua_setfield(L, -2, "HTTP_PARTIAL_CONTENT");
     112             : 
     113          18 :     lua_pushinteger(L, NGX_HTTP_SPECIAL_RESPONSE);
     114          18 :     lua_setfield(L, -2, "HTTP_SPECIAL_RESPONSE");
     115             : 
     116          18 :     lua_pushinteger(L, NGX_HTTP_MOVED_PERMANENTLY);
     117          18 :     lua_setfield(L, -2, "HTTP_MOVED_PERMANENTLY");
     118             : 
     119          18 :     lua_pushinteger(L, NGX_HTTP_MOVED_TEMPORARILY);
     120          18 :     lua_setfield(L, -2, "HTTP_MOVED_TEMPORARILY");
     121             : 
     122             : #if defined(nginx_version) && nginx_version >= 8042
     123          18 :     lua_pushinteger(L, NGX_HTTP_SEE_OTHER);
     124          18 :     lua_setfield(L, -2, "HTTP_SEE_OTHER");
     125             : #endif
     126             : 
     127          18 :     lua_pushinteger(L, NGX_HTTP_NOT_MODIFIED);
     128          18 :     lua_setfield(L, -2, "HTTP_NOT_MODIFIED");
     129             : 
     130          18 :     lua_pushinteger(L, NGX_HTTP_TEMPORARY_REDIRECT);
     131          18 :     lua_setfield(L, -2, "HTTP_TEMPORARY_REDIRECT");
     132             : 
     133          18 :     lua_pushinteger(L, NGX_HTTP_BAD_REQUEST);
     134          18 :     lua_setfield(L, -2, "HTTP_BAD_REQUEST");
     135             : 
     136          18 :     lua_pushinteger(L, NGX_HTTP_UNAUTHORIZED);
     137          18 :     lua_setfield(L, -2, "HTTP_UNAUTHORIZED");
     138             : 
     139          18 :     lua_pushinteger(L, 402);
     140          18 :     lua_setfield(L, -2, "HTTP_PAYMENT_REQUIRED");
     141             : 
     142          18 :     lua_pushinteger(L, NGX_HTTP_FORBIDDEN);
     143          18 :     lua_setfield(L, -2, "HTTP_FORBIDDEN");
     144             : 
     145          18 :     lua_pushinteger(L, NGX_HTTP_NOT_FOUND);
     146          18 :     lua_setfield(L, -2, "HTTP_NOT_FOUND");
     147             : 
     148          18 :     lua_pushinteger(L, NGX_HTTP_NOT_ALLOWED);
     149          18 :     lua_setfield(L, -2, "HTTP_NOT_ALLOWED");
     150             : 
     151          18 :     lua_pushinteger(L, 406);
     152          18 :     lua_setfield(L, -2, "HTTP_NOT_ACCEPTABLE");
     153             : 
     154          18 :     lua_pushinteger(L, NGX_HTTP_REQUEST_TIME_OUT);
     155          18 :     lua_setfield(L, -2, "HTTP_REQUEST_TIMEOUT");
     156             : 
     157          18 :     lua_pushinteger(L, NGX_HTTP_CONFLICT);
     158          18 :     lua_setfield(L, -2, "HTTP_CONFLICT");
     159             : 
     160          18 :     lua_pushinteger(L, 410);
     161          18 :     lua_setfield(L, -2, "HTTP_GONE");
     162             : 
     163          18 :     lua_pushinteger(L, 426);
     164          18 :     lua_setfield(L, -2, "HTTP_UPGRADE_REQUIRED");
     165             : 
     166          18 :     lua_pushinteger(L, 429);
     167          18 :     lua_setfield(L, -2, "HTTP_TOO_MANY_REQUESTS");
     168             : 
     169          18 :     lua_pushinteger(L, 451);
     170          18 :     lua_setfield(L, -2, "HTTP_ILLEGAL");
     171             : 
     172          18 :     lua_pushinteger(L, NGX_HTTP_CLOSE);
     173          18 :     lua_setfield(L, -2, "HTTP_CLOSE");
     174             : 
     175          18 :     lua_pushinteger(L, NGX_HTTP_INTERNAL_SERVER_ERROR);
     176          18 :     lua_setfield(L, -2, "HTTP_INTERNAL_SERVER_ERROR");
     177             : 
     178          18 :     lua_pushinteger(L, NGX_HTTP_NOT_IMPLEMENTED);
     179          18 :     lua_setfield(L, -2, "HTTP_METHOD_NOT_IMPLEMENTED");
     180             : 
     181          18 :     lua_pushinteger(L, NGX_HTTP_BAD_GATEWAY);
     182          18 :     lua_setfield(L, -2, "HTTP_BAD_GATEWAY");
     183             : 
     184          18 :     lua_pushinteger(L, NGX_HTTP_SERVICE_UNAVAILABLE);
     185          18 :     lua_setfield(L, -2, "HTTP_SERVICE_UNAVAILABLE");
     186             : 
     187          18 :     lua_pushinteger(L, NGX_HTTP_GATEWAY_TIME_OUT);
     188          18 :     lua_setfield(L, -2, "HTTP_GATEWAY_TIMEOUT");
     189             : 
     190          18 :     lua_pushinteger(L, 505);
     191          18 :     lua_setfield(L, -2, "HTTP_VERSION_NOT_SUPPORTED");
     192             : 
     193          18 :     lua_pushinteger(L, NGX_HTTP_INSUFFICIENT_STORAGE);
     194          18 :     lua_setfield(L, -2, "HTTP_INSUFFICIENT_STORAGE");
     195             : 
     196             :     /* }}} */
     197          18 : }
     198             : 
     199             : /* vi:set ft=c ts=4 sw=4 et fdm=marker: */

Generated by: LCOV version 1.13