mirror of
https://github.com/simon987/ngx_http_js_challenge_module.git
synced 2025-04-10 05:56:44 +00:00
Fix v1.23.0 compatibility
This commit is contained in:
parent
40d2173fbd
commit
11a7bf1627
@ -1,9 +1,9 @@
|
|||||||
|
#include <ngx_http.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "ngx_http.c"
|
|
||||||
|
|
||||||
#define DEFAULT_SECRET "changeme"
|
#define DEFAULT_SECRET "changeme"
|
||||||
#define SHA1_MD_LEN 20
|
#define SHA1_MD_LEN 20
|
||||||
#define SHA1_STR_LEN 40
|
#define SHA1_STR_LEN 40
|
||||||
@ -298,15 +298,20 @@ int verify_response(ngx_str_t response, char *challenge) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int get_cookie(ngx_http_request_t *r, ngx_str_t *name, ngx_str_t *value) {
|
int get_cookie(ngx_http_request_t *r, ngx_str_t *name, ngx_str_t *value) {
|
||||||
|
#if defined(nginx_version) && nginx_version >= 1023000
|
||||||
|
ngx_table_elt_t *h;
|
||||||
|
for (h = r->headers_in.cookie; h; h = h->next) {
|
||||||
|
u_char *start = h->value.data;
|
||||||
|
u_char *end = h->value.data + h->value.len;
|
||||||
|
#else
|
||||||
ngx_table_elt_t **h;
|
ngx_table_elt_t **h;
|
||||||
|
|
||||||
h = r->headers_in.cookies.elts;
|
h = r->headers_in.cookies.elts;
|
||||||
|
|
||||||
ngx_uint_t i = 0;
|
ngx_uint_t i = 0;
|
||||||
for (i = 0; i < r->headers_in.cookies.nelts; i++) {
|
for (i = 0; i < r->headers_in.cookies.nelts; i++) {
|
||||||
u_char *start = h[i]->value.data;
|
u_char *start = h[i]->value.data;
|
||||||
u_char *end = h[i]->value.data + h[i]->value.len;
|
u_char *end = h[i]->value.data + h[i]->value.len;
|
||||||
|
#endif
|
||||||
while (start < end) {
|
while (start < end) {
|
||||||
while (start < end && *start == ' ') { start++; }
|
while (start < end && *start == ' ') { start++; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user