httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gruno <rum...@cord.dk>
Subject Re: svn commit: r1489400 - /httpd/httpd/trunk/modules/lua/lua_request.c
Date Wed, 05 Jun 2013 13:31:07 GMT
Could you please add these functions to the documentation while you're
at it? (and the others you made)

With regards, and thanks for doing an awesome job,
Daniel.

On 06/04/2013 02:12 PM, fuankg@apache.org wrote:
> Author: fuankg
> Date: Tue Jun  4 12:12:14 2013
> New Revision: 1489400
> 
> URL: http://svn.apache.org/r1489400
> Log:
> Added new function r.date_parse_rfc() to mod_lua.
> 
> Modified:
>     httpd/httpd/trunk/modules/lua/lua_request.c
> 
> Modified: httpd/httpd/trunk/modules/lua/lua_request.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_request.c?rev=1489400&r1=1489399&r2=1489400&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/lua/lua_request.c (original)
> +++ httpd/httpd/trunk/modules/lua/lua_request.c Tue Jun  4 12:12:14 2013
> @@ -23,6 +23,7 @@
>  #include "util_md5.h"
>  #include "util_script.h"
>  #include "util_varbuf.h"
> +#include "apr_date.h"
>  #include "apr_pools.h"
>  #include "apr_thread_mutex.h"
>  
> @@ -927,6 +928,23 @@ static int lua_apr_rmdir(lua_State *L)
>  }
>  
>  /*
> + * lua_apr_date_parse_rfc; r.date_parse_rfc(string) - Parses a DateTime string
> + */
> +static int lua_apr_date_parse_rfc(lua_State *L)
> +{
> +    const char *input;
> +    apr_time_t result;
> +
> +    luaL_checktype(L, 1, LUA_TSTRING);
> +    input = lua_tostring(L, 1);
> +    result = apr_date_parse_rfc(input);
> +    if (result == 0)
> +        return 0;
> +    lua_pushnumber(L, (lua_Number)(result / APR_USEC_PER_SEC));
> +    return 1;
> +}
> +
> +/*
>   * lua_ap_mpm_query; r:mpm_query(info) - Queries for MPM info
>   */
>  static int lua_ap_mpm_query(lua_State *L)
> @@ -2141,6 +2159,8 @@ void ap_lua_load_request_lmodule(lua_Sta
>                   makefun(&lua_apr_mkrdir, APL_REQ_FUNTYPE_LUACFUN, p));
>      apr_hash_set(dispatch, "rmdir", APR_HASH_KEY_STRING,
>                   makefun(&lua_apr_rmdir, APL_REQ_FUNTYPE_LUACFUN, p));
> +    apr_hash_set(dispatch, "date_parse_rfc", APR_HASH_KEY_STRING,
> +                 makefun(&lua_apr_date_parse_rfc, APL_REQ_FUNTYPE_LUACFUN, p));
>      apr_hash_set(dispatch, "escape", APR_HASH_KEY_STRING,
>                   makefun(&lua_ap_escape, APL_REQ_FUNTYPE_LUACFUN, p));
>      apr_hash_set(dispatch, "unescape", APR_HASH_KEY_STRING,
> 
> 


Mime
View raw message