Diff for /embedaddon/lighttpd/src/mod_ssi_expr.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2013/10/14 10:32:48 version 1.1.1.2, 2016/11/02 10:35:00
Line 1 Line 1
   #include "first.h"
   
 #include "buffer.h"  #include "buffer.h"
 #include "log.h"  #include "log.h"
 #include "mod_ssi.h"  #include "mod_ssi.h"
Line 35  void ssi_val_free(ssi_val_t *s) { Line 37  void ssi_val_free(ssi_val_t *s) {
   
 int ssi_val_tobool(ssi_val_t *B) {  int ssi_val_tobool(ssi_val_t *B) {
         if (B->type == SSI_TYPE_STRING) {          if (B->type == SSI_TYPE_STRING) {
                return B->str->used > 1 ? 1 : 0;                return !buffer_string_is_empty(B->str);
         } else {          } else {
                 return B->bo;                  return B->bo;
         }          }
Line 207  static int ssi_expr_tokenizer(server *srv, connection  Line 209  static int ssi_expr_tokenizer(server *srv, connection 
   
                                 buffer_copy_string_len(token, t->input + t->offset + 2, i-3);                                  buffer_copy_string_len(token, t->input + t->offset + 2, i-3);
                         } else {                          } else {
                                for (i = 1; isalpha(t->input[t->offset + i]) || t->input[t->offset + i] == '_';  i++);                                for (i = 1; isalpha(t->input[t->offset + i]) ||
                                             t->input[t->offset + i] == '_' ||
                                             ((i > 1) && isdigit(t->input[t->offset + i]));  i++);
   
                                 buffer_copy_string_len(token, t->input + t->offset + 1, i-1);                                  buffer_copy_string_len(token, t->input + t->offset + 1, i-1);
                         }                          }
Line 215  static int ssi_expr_tokenizer(server *srv, connection  Line 219  static int ssi_expr_tokenizer(server *srv, connection 
                         tid = TK_VALUE;                          tid = TK_VALUE;
   
                         if (NULL != (ds = (data_string *)array_get_element(p->ssi_cgi_env, token->ptr))) {                          if (NULL != (ds = (data_string *)array_get_element(p->ssi_cgi_env, token->ptr))) {
                                buffer_copy_string_buffer(token, ds->value);                                buffer_copy_buffer(token, ds->value);
                         } else if (NULL != (ds = (data_string *)array_get_element(p->ssi_vars, token->ptr))) {                          } else if (NULL != (ds = (data_string *)array_get_element(p->ssi_vars, token->ptr))) {
                                buffer_copy_string_buffer(token, ds->value);                                buffer_copy_buffer(token, ds->value);
                         } else {                          } else {
                                 buffer_copy_string_len(token, CONST_STR_LEN(""));                                  buffer_copy_string_len(token, CONST_STR_LEN(""));
                         }                          }
Line 291  int ssi_eval_expr(server *srv, connection *con, plugin Line 295  int ssi_eval_expr(server *srv, connection *con, plugin
         /* default context */          /* default context */
   
         pParser = ssiexprparserAlloc( malloc );          pParser = ssiexprparserAlloc( malloc );
           force_assert(pParser);
         token = buffer_init();          token = buffer_init();
         while((1 == (ret = ssi_expr_tokenizer(srv, con, p, &t, &token_id, token))) && context.ok) {          while((1 == (ret = ssi_expr_tokenizer(srv, con, p, &t, &token_id, token))) && context.ok) {
                 ssiexprparser(pParser, token_id, token, &context);                  ssiexprparser(pParser, token_id, token, &context);

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>