Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling building on Windows #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ngx_http_sticky_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@
// /* - bugfix for compiling on sles11 - needs gcc4.6 or later*/
// #pragma GCC diagnostic ignored "-Wuninitialized"

#ifdef _WIN32
static ngx_int_t cookie_expires(char *str, size_t size, time_t t)
{
char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
char *wdays[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
struct tm e;
gmtime_s(&e, &t);
return snprintf(str, size, "%s, %02d-%s-%04d %02d:%02d:%02d GMT",
wdays[e.tm_wday], e.tm_mday, months[e.tm_mon], e.tm_year + 1900, e.tm_hour, e.tm_min, e.tm_sec);
}
#else
static ngx_int_t cookie_expires(char *str, size_t size, time_t t)
{
char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
Expand All @@ -40,7 +51,7 @@ static ngx_int_t cookie_expires(char *str, size_t size, time_t t)
return snprintf(str, size, "%s, %02d-%s-%04d %02d:%02d:%02d GMT",
wdays[e.tm_wday], e.tm_mday, months[e.tm_mon], e.tm_year + 1900, e.tm_hour,e.tm_min,e.tm_sec);
}

#endif

ngx_int_t ngx_http_sticky_misc_set_cookie(ngx_http_request_t *r, ngx_str_t *name, ngx_str_t *value, ngx_str_t *domain, ngx_str_t *path, time_t expires, unsigned secure, unsigned httponly)
{
Expand Down