@@ -206,7 +206,7 @@ void ngx_link_func_log_info(ngx_link_func_ctx_t *ctx, const char* msg);
206206void ngx_link_func_log_warn (ngx_link_func_ctx_t * ctx , const char * msg );
207207void ngx_link_func_log_err (ngx_link_func_ctx_t * ctx , const char * msg );
208208char * ngx_link_func_strdup (ngx_link_func_ctx_t * ctx , const char * src );
209- u_char * ngx_link_func_get_header (ngx_link_func_ctx_t * ctx , const char * key );
209+ u_char * ngx_link_func_get_header (ngx_link_func_ctx_t * ctx , const char * key , size_t keylen );
210210int ngx_link_func_add_header_in (ngx_link_func_ctx_t * ctx , const char * key , size_t keylen , const char * value , size_t val_len );
211211int ngx_link_func_add_header_out (ngx_link_func_ctx_t * ctx , const char * key , size_t keylen , const char * value , size_t val_len );
212212void * ngx_link_func_get_query_param (ngx_link_func_ctx_t * ctx , const char * key );
@@ -711,7 +711,7 @@ ngx_http_link_func_pre_configuration(ngx_conf_t *cf) {
711711 return NGX_ERROR ;
712712#endif
713713
714- #ifndef ngx_link_func_module_version_30
714+ #ifndef ngx_link_func_module_version_31
715715 ngx_conf_log_error (NGX_LOG_EMERG , cf , 0 , "%s" , "the ngx_http_link_func_module.h might not be latest or not found in the c header path, \
716716 please copy latest ngx_http_link_func_module.h to your /usr/include or /usr/local/include or relavent header search path \
717717 with read and write permission." );
@@ -1670,11 +1670,12 @@ ngx_http_link_func_strdup_with_p(ngx_pool_t *pool, const char *src, size_t len)
16701670}
16711671
16721672u_char *
1673- ngx_link_func_get_header (ngx_link_func_ctx_t * ctx , const char * key ) {
1673+ ngx_link_func_get_header (ngx_link_func_ctx_t * ctx , const char * key , size_t keylen ) {
16741674 ngx_http_request_t * r = (ngx_http_request_t * )ctx -> __r__ ;
16751675 ngx_list_part_t * part = & r -> headers_in .headers .part ;
16761676 ngx_table_elt_t * header = part -> elts ;
16771677 unsigned int i ;
1678+ size_t header_len ;
16781679 for (i = 0 ; /* void */ ; i ++ ) {
16791680 if (i >= part -> nelts ) {
16801681 if (part -> next == NULL ) {
@@ -1686,7 +1687,8 @@ ngx_link_func_get_header(ngx_link_func_ctx_t *ctx, const char*key) {
16861687 i = 0 ;
16871688 }
16881689
1689- if (ngx_strncasecmp ( (u_char * ) key , header [i ].key .data , header [i ].key .len ) == 0 ) {
1690+ header_len = header [i ].key .len ;
1691+ if ( header_len == keylen && ngx_strncasecmp ( (u_char * ) key , header [i ].key .data , header_len ) == 0 ) {
16901692 u_char * ret = ngx_pcalloc (r -> pool , header [i ].value .len + 1 );
16911693 ngx_memcpy (ret , header [i ].value .data , header [i ].value .len );
16921694 return ret ;
0 commit comments