_ZNK6google8protobuf8internal14ArenaStringPtr3GetEv:
  299|     64|  PROTOBUF_NDEBUG_INLINE const std::string& Get() const {
  300|       |    // Unconditionally mask away the tag.
  301|     64|    return *tagged_ptr_.Get();
  302|     64|  }
_ZNK6google8protobuf8internal15TaggedStringPtr3GetEv:
  189|     64|  inline std::string* Get() const {
  190|     64|    return reinterpret_cast<std::string*>(as_int() & ~kMask);
  191|     64|  }
_ZNK6google8protobuf8internal15TaggedStringPtr6as_intEv:
  210|     64|  uintptr_t as_int() const { return reinterpret_cast<uintptr_t>(ptr_); }
_ZN6google8protobuf8internal15TaggedStringPtrC2EPNS1_21ExplicitlyConstructedINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEELm8EEE:
  133|     32|      : ptr_(ptr) {}
_ZN6google8protobuf8internal14ArenaStringPtr11InitDefaultEv:
  395|     32|inline void ArenaStringPtr::InitDefault() {
  396|     32|  tagged_ptr_ = TaggedStringPtr(&fixed_address_empty_string);
  397|     32|}

_ZN6google8protobuf8internal10CachedSizeC2Ev:
  198|     16|  constexpr CachedSize() noexcept : atom_(Scalar{}) {}

_ZN6google8protobuf8internal7HasBitsILm1EEixEi:
   57|     32|  PROTOBUF_NDEBUG_INLINE uint32_t& operator[](int index) {
   58|     32|    return has_bits_[index];
   59|     32|  }
_ZN6google8protobuf8internal7HasBitsILm1EEC2Ev:
   51|     16|  PROTOBUF_NDEBUG_INLINE constexpr HasBits() : has_bits_{} {}
_ZN6google8protobuf8internal7HasBitsILm1EE5ClearEv:
   53|     32|  PROTOBUF_NDEBUG_INLINE void Clear() {
   54|     32|    memset(has_bits_, 0, sizeof(has_bits_));
   55|     32|  }

_ZN6google8protobuf7MessageC2EPNS0_5ArenaE:
  414|     16|  inline explicit Message(Arena* arena) : MessageLite(arena) {}

_ZN6google8protobuf11MessageLiteC2EPNS0_5ArenaE:
  468|     16|  inline explicit MessageLite(Arena* arena) : _internal_metadata_(arena) {}
_ZN6google8protobuf11MessageLiteD2Ev:
  175|     16|  virtual ~MessageLite() = default;

_ZN6google8protobuf8internal16InternalMetadataC2EPNS0_5ArenaE:
   70|     16|  explicit InternalMetadata(Arena* arena) {
   71|     16|    ptr_ = reinterpret_cast<intptr_t>(arena);
   72|     16|  }
_ZNK6google8protobuf8internal16InternalMetadata19have_unknown_fieldsEv:
  106|     48|  PROTOBUF_NDEBUG_INLINE bool have_unknown_fields() const {
  107|     48|    return HasUnknownFieldsTag();
  108|     48|  }
_ZNK6google8protobuf8internal16InternalMetadata19HasUnknownFieldsTagEv:
  173|     48|  PROTOBUF_ALWAYS_INLINE bool HasUnknownFieldsTag() const {
  174|     48|    return ptr_ & kUnknownFieldsTagMask;
  175|     48|  }
_ZNK6google8protobuf8internal16InternalMetadata8PtrValueINS0_5ArenaEEEPT_v:
  178|     16|  U* PtrValue() const {
  179|     16|    return reinterpret_cast<U*>(ptr_ & kPtrValueMask);
  180|     16|  }
_ZN6google8protobuf8internal16InternalMetadata17DeleteReturnArenaINS0_15UnknownFieldSetEEEPNS0_5ArenaEv:
   90|     16|  Arena* DeleteReturnArena() {
   91|     16|    if (have_unknown_fields()) {
  ------------------
  |  Branch (91:9): [True: 0, False: 16]
  ------------------
   92|      0|      return DeleteOutOfLineHelper<T>();
   93|     16|    } else {
   94|     16|      return PtrValue<Arena>();
   95|     16|    }
   96|     16|  }
_ZN6google8protobuf8internal16InternalMetadata5ClearINS0_15UnknownFieldSetEEEvv:
  158|     32|  PROTOBUF_NDEBUG_INLINE void Clear() {
  159|     32|    if (have_unknown_fields()) {
  ------------------
  |  Branch (159:9): [True: 0, False: 32]
  ------------------
  160|      0|      DoClear<T>();
  161|      0|    }
  162|     32|  }

nginx.c:ngx_core_module_create_conf:
 1046|      1|{
 1047|      1|    ngx_core_conf_t  *ccf;
 1048|       |
 1049|      1|    ccf = ngx_pcalloc(cycle->pool, sizeof(ngx_core_conf_t));
 1050|      1|    if (ccf == NULL) {
  ------------------
  |  Branch (1050:9): [True: 0, False: 1]
  ------------------
 1051|      0|        return NULL;
 1052|      0|    }
 1053|       |
 1054|       |    /*
 1055|       |     * set by ngx_pcalloc()
 1056|       |     *
 1057|       |     *     ccf->pid = NULL;
 1058|       |     *     ccf->oldpid = NULL;
 1059|       |     *     ccf->priority = 0;
 1060|       |     *     ccf->cpu_affinity_auto = 0;
 1061|       |     *     ccf->cpu_affinity_n = 0;
 1062|       |     *     ccf->cpu_affinity = NULL;
 1063|       |     */
 1064|       |
 1065|      1|    ccf->daemon = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1066|      1|    ccf->master = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1067|      1|    ccf->timer_resolution = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      1|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1068|      1|    ccf->shutdown_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      1|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1069|       |
 1070|      1|    ccf->worker_processes = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1071|      1|    ccf->debug_points = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1072|       |
 1073|      1|    ccf->rlimit_nofile = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1074|      1|    ccf->rlimit_core = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1075|       |
 1076|      1|    ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1077|      1|    ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1078|       |
 1079|      1|    if (ngx_array_init(&ccf->env, cycle->pool, 1, sizeof(ngx_str_t))
  ------------------
  |  Branch (1079:9): [True: 0, False: 1]
  ------------------
 1080|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1081|      0|    {
 1082|      0|        return NULL;
 1083|      0|    }
 1084|       |
 1085|      1|    return ccf;
 1086|      1|}
nginx.c:ngx_core_module_init_conf:
 1091|      1|{
 1092|      1|    ngx_core_conf_t  *ccf = conf;
 1093|       |
 1094|      1|    ngx_conf_init_value(ccf->daemon, 1);
  ------------------
  |  |  181|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (181:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  182|      1|        conf = default;                                                      \
  |  |  183|      1|    }
  ------------------
 1095|      1|    ngx_conf_init_value(ccf->master, 1);
  ------------------
  |  |  181|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (181:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  182|      1|        conf = default;                                                      \
  |  |  183|      1|    }
  ------------------
 1096|      1|    ngx_conf_init_msec_value(ccf->timer_resolution, 0);
  ------------------
  |  |  201|      1|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (201:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  202|      1|        conf = default;                                                      \
  |  |  203|      1|    }
  ------------------
 1097|      1|    ngx_conf_init_msec_value(ccf->shutdown_timeout, 0);
  ------------------
  |  |  201|      1|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (201:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  202|      1|        conf = default;                                                      \
  |  |  203|      1|    }
  ------------------
 1098|       |
 1099|      1|    ngx_conf_init_value(ccf->worker_processes, 1);
  ------------------
  |  |  181|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (181:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  182|      1|        conf = default;                                                      \
  |  |  183|      1|    }
  ------------------
 1100|      1|    ngx_conf_init_value(ccf->debug_points, 0);
  ------------------
  |  |  181|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (181:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  182|      1|        conf = default;                                                      \
  |  |  183|      1|    }
  ------------------
 1101|       |
 1102|      1|#if (NGX_HAVE_CPU_AFFINITY)
 1103|       |
 1104|      1|    if (!ccf->cpu_affinity_auto
  ------------------
  |  Branch (1104:9): [True: 1, False: 0]
  ------------------
 1105|      1|        && ccf->cpu_affinity_n
  ------------------
  |  Branch (1105:12): [True: 0, False: 1]
  ------------------
 1106|      1|        && ccf->cpu_affinity_n != 1
  ------------------
  |  Branch (1106:12): [True: 0, False: 0]
  ------------------
 1107|      1|        && ccf->cpu_affinity_n != (ngx_uint_t) ccf->worker_processes)
  ------------------
  |  Branch (1107:12): [True: 0, False: 0]
  ------------------
 1108|      0|    {
 1109|      0|        ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1110|      0|                      "the number of \"worker_processes\" is not equal to "
 1111|      0|                      "the number of \"worker_cpu_affinity\" masks, "
 1112|      0|                      "using last mask for remaining worker processes");
 1113|      0|    }
 1114|       |
 1115|      1|#endif
 1116|       |
 1117|       |
 1118|      1|    if (ccf->pid.len == 0) {
  ------------------
  |  Branch (1118:9): [True: 1, False: 0]
  ------------------
 1119|      1|        ngx_str_set(&ccf->pid, NGX_PID_PATH);
  ------------------
  |  |   43|      1|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 1120|      1|    }
 1121|       |
 1122|      1|    if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (1122:9): [True: 0, False: 1]
  ------------------
 1123|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1124|      0|    }
 1125|       |
 1126|      1|    ccf->oldpid.len = ccf->pid.len + sizeof(NGX_OLDPID_EXT);
  ------------------
  |  |   23|      1|#define NGX_OLDPID_EXT     ".oldbin"
  ------------------
 1127|       |
 1128|      1|    ccf->oldpid.data = ngx_pnalloc(cycle->pool, ccf->oldpid.len);
 1129|      1|    if (ccf->oldpid.data == NULL) {
  ------------------
  |  Branch (1129:9): [True: 0, False: 1]
  ------------------
 1130|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1131|      0|    }
 1132|       |
 1133|      1|    ngx_memcpy(ngx_cpymem(ccf->oldpid.data, ccf->pid.data, ccf->pid.len),
  ------------------
  |  |  106|      1|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1134|      1|               NGX_OLDPID_EXT, sizeof(NGX_OLDPID_EXT));
 1135|       |
 1136|       |
 1137|      1|#if !(NGX_WIN32)
 1138|       |
 1139|      1|    if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) {
  ------------------
  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  |  Branch (1139:9): [True: 1, False: 0]
  |  Branch (1139:53): [True: 1, False: 0]
  ------------------
 1140|      1|        struct group   *grp;
 1141|      1|        struct passwd  *pwd;
 1142|       |
 1143|      1|        ngx_set_errno(0);
  ------------------
  |  |   71|      1|#define ngx_set_errno(err)         errno = err
  ------------------
 1144|      1|        pwd = getpwnam(NGX_USER);
  ------------------
  |  |  467|      1|#define NGX_USER  "nobody"
  ------------------
 1145|      1|        if (pwd == NULL) {
  ------------------
  |  Branch (1145:13): [True: 0, False: 1]
  ------------------
 1146|      0|            ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1147|      0|                          "getpwnam(\"" NGX_USER "\") failed");
 1148|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1149|      0|        }
 1150|       |
 1151|      1|        ccf->username = NGX_USER;
  ------------------
  |  |  467|      1|#define NGX_USER  "nobody"
  ------------------
 1152|      1|        ccf->user = pwd->pw_uid;
 1153|       |
 1154|      1|        ngx_set_errno(0);
  ------------------
  |  |   71|      1|#define ngx_set_errno(err)         errno = err
  ------------------
 1155|      1|        grp = getgrnam(NGX_GROUP);
  ------------------
  |  |  472|      1|#define NGX_GROUP  "nogroup"
  ------------------
 1156|      1|        if (grp == NULL) {
  ------------------
  |  Branch (1156:13): [True: 0, False: 1]
  ------------------
 1157|      0|            ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1158|      0|                          "getgrnam(\"" NGX_GROUP "\") failed");
 1159|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1160|      0|        }
 1161|       |
 1162|      1|        ccf->group = grp->gr_gid;
 1163|      1|    }
 1164|       |
 1165|       |
 1166|      1|    if (ccf->lock_file.len == 0) {
  ------------------
  |  Branch (1166:9): [True: 1, False: 0]
  ------------------
 1167|      1|        ngx_str_set(&ccf->lock_file, NGX_LOCK_PATH);
  ------------------
  |  |   43|      1|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 1168|      1|    }
 1169|       |
 1170|      1|    if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (1170:9): [True: 0, False: 1]
  ------------------
 1171|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1172|      0|    }
 1173|       |
 1174|      1|    {
 1175|      1|    ngx_str_t  lock_file;
 1176|       |
 1177|      1|    lock_file = cycle->old_cycle->lock_file;
 1178|       |
 1179|      1|    if (lock_file.len) {
  ------------------
  |  Branch (1179:9): [True: 0, False: 1]
  ------------------
 1180|      0|        lock_file.len--;
 1181|       |
 1182|      0|        if (ccf->lock_file.len != lock_file.len
  ------------------
  |  Branch (1182:13): [True: 0, False: 0]
  ------------------
 1183|      0|            || ngx_strncmp(ccf->lock_file.data, lock_file.data, lock_file.len)
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (1183:16): [True: 0, False: 0]
  ------------------
 1184|      0|               != 0)
 1185|      0|        {
 1186|      0|            ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1187|      0|                          "\"lock_file\" could not be changed, ignored");
 1188|      0|        }
 1189|       |
 1190|      0|        cycle->lock_file.len = lock_file.len + 1;
 1191|      0|        lock_file.len += sizeof(".accept");
 1192|       |
 1193|      0|        cycle->lock_file.data = ngx_pstrdup(cycle->pool, &lock_file);
 1194|      0|        if (cycle->lock_file.data == NULL) {
  ------------------
  |  Branch (1194:13): [True: 0, False: 0]
  ------------------
 1195|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1196|      0|        }
 1197|       |
 1198|      1|    } else {
 1199|      1|        cycle->lock_file.len = ccf->lock_file.len + 1;
 1200|      1|        cycle->lock_file.data = ngx_pnalloc(cycle->pool,
 1201|      1|                                      ccf->lock_file.len + sizeof(".accept"));
 1202|      1|        if (cycle->lock_file.data == NULL) {
  ------------------
  |  Branch (1202:13): [True: 0, False: 1]
  ------------------
 1203|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1204|      0|        }
 1205|       |
 1206|      1|        ngx_memcpy(ngx_cpymem(cycle->lock_file.data, ccf->lock_file.data,
  ------------------
  |  |  106|      1|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1207|      1|                              ccf->lock_file.len),
 1208|      1|                   ".accept", sizeof(".accept"));
 1209|      1|    }
 1210|      1|    }
 1211|       |
 1212|      1|#endif
 1213|       |
 1214|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1215|      1|}

ngx_array_create:
   14|     27|{
   15|     27|    ngx_array_t *a;
   16|       |
   17|     27|    a = ngx_palloc(p, sizeof(ngx_array_t));
   18|     27|    if (a == NULL) {
  ------------------
  |  Branch (18:9): [True: 0, False: 27]
  ------------------
   19|      0|        return NULL;
   20|      0|    }
   21|       |
   22|     27|    if (ngx_array_init(a, p, n, size) != NGX_OK) {
  ------------------
  |  |   38|     27|#define  NGX_OK          0
  ------------------
  |  Branch (22:9): [True: 0, False: 27]
  ------------------
   23|      0|        return NULL;
   24|      0|    }
   25|       |
   26|     27|    return a;
   27|     27|}
ngx_array_push:
   49|    588|{
   50|    588|    void        *elt, *new;
   51|    588|    size_t       size;
   52|    588|    ngx_pool_t  *p;
   53|       |
   54|    588|    if (a->nelts == a->nalloc) {
  ------------------
  |  Branch (54:9): [True: 38, False: 550]
  ------------------
   55|       |
   56|       |        /* the array is full */
   57|       |
   58|     38|        size = a->size * a->nalloc;
   59|       |
   60|     38|        p = a->pool;
   61|       |
   62|     38|        if ((u_char *) a->elts + size == p->d.last
  ------------------
  |  Branch (62:13): [True: 0, False: 38]
  ------------------
   63|     38|            && p->d.last + a->size <= p->d.end)
  ------------------
  |  Branch (63:16): [True: 0, False: 0]
  ------------------
   64|      0|        {
   65|       |            /*
   66|       |             * the array allocation is the last in the pool
   67|       |             * and there is space for new allocation
   68|       |             */
   69|       |
   70|      0|            p->d.last += a->size;
   71|      0|            a->nalloc++;
   72|       |
   73|     38|        } else {
   74|       |            /* allocate a new array */
   75|       |
   76|     38|            new = ngx_palloc(p, 2 * size);
   77|     38|            if (new == NULL) {
  ------------------
  |  Branch (77:17): [True: 0, False: 38]
  ------------------
   78|      0|                return NULL;
   79|      0|            }
   80|       |
   81|     38|            ngx_memcpy(new, a->elts, size);
  ------------------
  |  |  106|     38|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
   82|     38|            a->elts = new;
   83|     38|            a->nalloc *= 2;
   84|     38|        }
   85|     38|    }
   86|       |
   87|    588|    elt = (u_char *) a->elts + a->size * a->nelts;
   88|    588|    a->nelts++;
   89|       |
   90|    588|    return elt;
   91|    588|}
ngx_array_push_n:
   96|     95|{
   97|     95|    void        *elt, *new;
   98|     95|    size_t       size;
   99|     95|    ngx_uint_t   nalloc;
  100|     95|    ngx_pool_t  *p;
  101|       |
  102|     95|    size = n * a->size;
  103|       |
  104|     95|    if (a->nelts + n > a->nalloc) {
  ------------------
  |  Branch (104:9): [True: 5, False: 90]
  ------------------
  105|       |
  106|       |        /* the array is full */
  107|       |
  108|      5|        p = a->pool;
  109|       |
  110|      5|        if ((u_char *) a->elts + a->size * a->nalloc == p->d.last
  ------------------
  |  Branch (110:13): [True: 0, False: 5]
  ------------------
  111|      5|            && p->d.last + size <= p->d.end)
  ------------------
  |  Branch (111:16): [True: 0, False: 0]
  ------------------
  112|      0|        {
  113|       |            /*
  114|       |             * the array allocation is the last in the pool
  115|       |             * and there is space for new allocation
  116|       |             */
  117|       |
  118|      0|            p->d.last += size;
  119|      0|            a->nalloc += n;
  120|       |
  121|      5|        } else {
  122|       |            /* allocate a new array */
  123|       |
  124|      5|            nalloc = 2 * ((n >= a->nalloc) ? n : a->nalloc);
  ------------------
  |  Branch (124:27): [True: 0, False: 5]
  ------------------
  125|       |
  126|      5|            new = ngx_palloc(p, nalloc * a->size);
  127|      5|            if (new == NULL) {
  ------------------
  |  Branch (127:17): [True: 0, False: 5]
  ------------------
  128|      0|                return NULL;
  129|      0|            }
  130|       |
  131|      5|            ngx_memcpy(new, a->elts, a->nelts * a->size);
  ------------------
  |  |  106|      5|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  132|      5|            a->elts = new;
  133|      5|            a->nalloc = nalloc;
  134|      5|        }
  135|      5|    }
  136|       |
  137|     95|    elt = (u_char *) a->elts + a->size * a->nelts;
  138|     95|    a->nelts += n;
  139|       |
  140|     95|    return elt;
  141|     95|}

nginx.c:ngx_array_init:
   33|      1|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      1|    array->nelts = 0;
   40|      1|    array->size = size;
   41|      1|    array->nalloc = n;
   42|      1|    array->pool = pool;
   43|       |
   44|      1|    array->elts = ngx_palloc(pool, n * size);
   45|      1|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 1]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   50|      1|}
ngx_array.c:ngx_array_init:
   33|     27|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|     27|    array->nelts = 0;
   40|     27|    array->size = size;
   41|     27|    array->nalloc = n;
   42|     27|    array->pool = pool;
   43|       |
   44|     27|    array->elts = ngx_palloc(pool, n * size);
   45|     27|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 27]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|     27|    return NGX_OK;
  ------------------
  |  |   38|     27|#define  NGX_OK          0
  ------------------
   50|     27|}
ngx_hash.c:ngx_array_init:
   33|     93|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|     93|    array->nelts = 0;
   40|     93|    array->size = size;
   41|     93|    array->nalloc = n;
   42|     93|    array->pool = pool;
   43|       |
   44|     93|    array->elts = ngx_palloc(pool, n * size);
   45|     93|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 93]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|     93|    return NGX_OK;
  ------------------
  |  |   38|     93|#define  NGX_OK          0
  ------------------
   50|     93|}
ngx_cycle.c:ngx_array_init:
   33|      3|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      3|    array->nelts = 0;
   40|      3|    array->size = size;
   41|      3|    array->nalloc = n;
   42|      3|    array->pool = pool;
   43|       |
   44|      3|    array->elts = ngx_palloc(pool, n * size);
   45|      3|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 3]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      3|    return NGX_OK;
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
   50|      3|}
ngx_http.c:ngx_array_init:
   33|     11|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|     11|    array->nelts = 0;
   40|     11|    array->size = size;
   41|     11|    array->nalloc = n;
   42|     11|    array->pool = pool;
   43|       |
   44|     11|    array->elts = ngx_palloc(pool, n * size);
   45|     11|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 11]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|     11|    return NGX_OK;
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
   50|     11|}
ngx_http_core_module.c:ngx_array_init:
   33|      4|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      4|    array->nelts = 0;
   40|      4|    array->size = size;
   41|      4|    array->nalloc = n;
   42|      4|    array->pool = pool;
   43|       |
   44|      4|    array->elts = ngx_palloc(pool, n * size);
   45|      4|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 4]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      4|    return NGX_OK;
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
   50|      4|}
ngx_http_log_module.c:ngx_array_init:
   33|      1|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      1|    array->nelts = 0;
   40|      1|    array->size = size;
   41|      1|    array->nalloc = n;
   42|      1|    array->pool = pool;
   43|       |
   44|      1|    array->elts = ngx_palloc(pool, n * size);
   45|      1|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 1]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   50|      1|}
ngx_http_variables.c:ngx_array_init:
   33|      2|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      2|    array->nelts = 0;
   40|      2|    array->size = size;
   41|      2|    array->nalloc = n;
   42|      2|    array->pool = pool;
   43|       |
   44|      2|    array->elts = ngx_palloc(pool, n * size);
   45|      2|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 2]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      2|    return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
   50|      2|}
ngx_http_script.c:ngx_array_init:
   33|      6|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      6|    array->nelts = 0;
   40|      6|    array->size = size;
   41|      6|    array->nalloc = n;
   42|      6|    array->pool = pool;
   43|       |
   44|      6|    array->elts = ngx_palloc(pool, n * size);
   45|      6|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 6]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      6|    return NGX_OK;
  ------------------
  |  |   38|      6|#define  NGX_OK          0
  ------------------
   50|      6|}
ngx_http_upstream.c:ngx_array_init:
   33|      7|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      7|    array->nelts = 0;
   40|      7|    array->size = size;
   41|      7|    array->nalloc = n;
   42|      7|    array->pool = pool;
   43|       |
   44|      7|    array->elts = ngx_palloc(pool, n * size);
   45|      7|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 7]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      7|    return NGX_OK;
  ------------------
  |  |   38|      7|#define  NGX_OK          0
  ------------------
   50|      7|}
ngx_http_charset_filter_module.c:ngx_array_init:
   33|      3|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      3|    array->nelts = 0;
   40|      3|    array->size = size;
   41|      3|    array->nalloc = n;
   42|      3|    array->pool = pool;
   43|       |
   44|      3|    array->elts = ngx_palloc(pool, n * size);
   45|      3|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 3]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      3|    return NGX_OK;
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
   50|      3|}
ngx_http_map_module.c:ngx_array_init:
   33|      5|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      5|    array->nelts = 0;
   40|      5|    array->size = size;
   41|      5|    array->nalloc = n;
   42|      5|    array->pool = pool;
   43|       |
   44|      5|    array->elts = ngx_palloc(pool, n * size);
   45|      5|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 5]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
   50|      5|}
ngx_http_proxy_module.c:ngx_array_init:
   33|      5|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      5|    array->nelts = 0;
   40|      5|    array->size = size;
   41|      5|    array->nalloc = n;
   42|      5|    array->pool = pool;
   43|       |
   44|      5|    array->elts = ngx_palloc(pool, n * size);
   45|      5|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 5]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
   50|      5|}
ngx_http_fastcgi_module.c:ngx_array_init:
   33|      1|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      1|    array->nelts = 0;
   40|      1|    array->size = size;
   41|      1|    array->nalloc = n;
   42|      1|    array->pool = pool;
   43|       |
   44|      1|    array->elts = ngx_palloc(pool, n * size);
   45|      1|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 1]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   50|      1|}
ngx_http_uwsgi_module.c:ngx_array_init:
   33|      1|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      1|    array->nelts = 0;
   40|      1|    array->size = size;
   41|      1|    array->nalloc = n;
   42|      1|    array->pool = pool;
   43|       |
   44|      1|    array->elts = ngx_palloc(pool, n * size);
   45|      1|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 1]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   50|      1|}
ngx_http_scgi_module.c:ngx_array_init:
   33|      1|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      1|    array->nelts = 0;
   40|      1|    array->size = size;
   41|      1|    array->nalloc = n;
   42|      1|    array->pool = pool;
   43|       |
   44|      1|    array->elts = ngx_palloc(pool, n * size);
   45|      1|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 1]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   50|      1|}
ngx_http_grpc_module.c:ngx_array_init:
   33|      2|{
   34|       |    /*
   35|       |     * set "array->nelts" before "array->elts", otherwise MSVC thinks
   36|       |     * that "array->nelts" may be used without having been initialized
   37|       |     */
   38|       |
   39|      2|    array->nelts = 0;
   40|      2|    array->size = size;
   41|      2|    array->nalloc = n;
   42|      2|    array->pool = pool;
   43|       |
   44|      2|    array->elts = ngx_palloc(pool, n * size);
   45|      2|    if (array->elts == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 2]
  ------------------
   46|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   47|      0|    }
   48|       |
   49|      2|    return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
   50|      2|}

ngx_create_temp_buf:
   14|     32|{
   15|     32|    ngx_buf_t *b;
   16|       |
   17|     32|    b = ngx_calloc_buf(pool);
  ------------------
  |  |  145|     32|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
   18|     32|    if (b == NULL) {
  ------------------
  |  Branch (18:9): [True: 0, False: 32]
  ------------------
   19|      0|        return NULL;
   20|      0|    }
   21|       |
   22|     32|    b->start = ngx_palloc(pool, size);
   23|     32|    if (b->start == NULL) {
  ------------------
  |  Branch (23:9): [True: 0, False: 32]
  ------------------
   24|      0|        return NULL;
   25|      0|    }
   26|       |
   27|       |    /*
   28|       |     * set by ngx_calloc_buf():
   29|       |     *
   30|       |     *     b->file_pos = 0;
   31|       |     *     b->file_last = 0;
   32|       |     *     b->file = NULL;
   33|       |     *     b->shadow = NULL;
   34|       |     *     b->tag = 0;
   35|       |     *     and flags
   36|       |     */
   37|       |
   38|     32|    b->pos = b->start;
   39|     32|    b->last = b->start;
   40|     32|    b->end = b->last + size;
   41|     32|    b->temporary = 1;
   42|       |
   43|     32|    return b;
   44|     32|}
ngx_alloc_chain_link:
   49|    107|{
   50|    107|    ngx_chain_t  *cl;
   51|       |
   52|    107|    cl = pool->chain;
   53|       |
   54|    107|    if (cl) {
  ------------------
  |  Branch (54:9): [True: 62, False: 45]
  ------------------
   55|     62|        pool->chain = cl->next;
   56|     62|        return cl;
   57|     62|    }
   58|       |
   59|     45|    cl = ngx_palloc(pool, sizeof(ngx_chain_t));
   60|     45|    if (cl == NULL) {
  ------------------
  |  Branch (60:9): [True: 0, False: 45]
  ------------------
   61|      0|        return NULL;
   62|      0|    }
   63|       |
   64|     45|    return cl;
   65|     45|}
ngx_chain_get_free_buf:
  158|     71|{
  159|     71|    ngx_chain_t  *cl;
  160|       |
  161|     71|    if (*free) {
  ------------------
  |  Branch (161:9): [True: 59, False: 12]
  ------------------
  162|     59|        cl = *free;
  163|     59|        *free = cl->next;
  164|     59|        cl->next = NULL;
  165|     59|        return cl;
  166|     59|    }
  167|       |
  168|     12|    cl = ngx_alloc_chain_link(p);
  169|     12|    if (cl == NULL) {
  ------------------
  |  Branch (169:9): [True: 0, False: 12]
  ------------------
  170|      0|        return NULL;
  171|      0|    }
  172|       |
  173|     12|    cl->buf = ngx_calloc_buf(p);
  ------------------
  |  |  145|     12|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
  174|     12|    if (cl->buf == NULL) {
  ------------------
  |  Branch (174:9): [True: 0, False: 12]
  ------------------
  175|      0|        return NULL;
  176|      0|    }
  177|       |
  178|     12|    cl->next = NULL;
  179|       |
  180|     12|    return cl;
  181|     12|}
ngx_chain_update_chains:
  187|    134|{
  188|    134|    ngx_chain_t  *cl;
  189|       |
  190|    134|    if (*out) {
  ------------------
  |  Branch (190:9): [True: 59, False: 75]
  ------------------
  191|     59|        if (*busy == NULL) {
  ------------------
  |  Branch (191:13): [True: 55, False: 4]
  ------------------
  192|     55|            *busy = *out;
  193|       |
  194|     55|        } else {
  195|      5|            for (cl = *busy; cl->next; cl = cl->next) { /* void */ }
  ------------------
  |  Branch (195:30): [True: 1, False: 4]
  ------------------
  196|       |
  197|      4|            cl->next = *out;
  198|      4|        }
  199|       |
  200|     59|        *out = NULL;
  201|     59|    }
  202|       |
  203|    203|    while (*busy) {
  ------------------
  |  Branch (203:12): [True: 79, False: 124]
  ------------------
  204|     79|        cl = *busy;
  205|       |
  206|     79|        if (cl->buf->tag != tag) {
  ------------------
  |  Branch (206:13): [True: 4, False: 75]
  ------------------
  207|      4|            *busy = cl->next;
  208|      4|            ngx_free_chain(p, cl);
  ------------------
  |  |  149|      4|    (cl)->next = (pool)->chain;                                              \
  |  |  150|      4|    (pool)->chain = (cl)
  ------------------
  209|      4|            continue;
  210|      4|        }
  211|       |
  212|     75|        if (ngx_buf_size(cl->buf) != 0) {
  ------------------
  |  |  137|     75|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|     75|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 74, False: 1]
  |  |  |  |  |  Branch (125:55): [True: 1, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|     75|                            ((b)->file_last - (b)->file_pos))
  ------------------
  |  Branch (212:13): [True: 10, False: 65]
  ------------------
  213|     10|            break;
  214|     10|        }
  215|       |
  216|     65|        cl->buf->pos = cl->buf->start;
  217|     65|        cl->buf->last = cl->buf->start;
  218|       |
  219|     65|        *busy = cl->next;
  220|     65|        cl->next = *free;
  221|     65|        *free = cl;
  222|     65|    }
  223|    134|}

ngx_conf_param:
   64|      1|{
   65|      1|    char             *rv;
   66|      1|    ngx_str_t        *param;
   67|      1|    ngx_buf_t         b;
   68|      1|    ngx_conf_file_t   conf_file;
   69|       |
   70|      1|    param = &cf->cycle->conf_param;
   71|       |
   72|      1|    if (param->len == 0) {
  ------------------
  |  Branch (72:9): [True: 1, False: 0]
  ------------------
   73|      1|        return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
   74|      1|    }
   75|       |
   76|      0|    ngx_memzero(&conf_file, sizeof(ngx_conf_file_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
   77|       |
   78|      0|    ngx_memzero(&b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
   79|       |
   80|      0|    b.start = param->data;
   81|      0|    b.pos = param->data;
   82|      0|    b.last = param->data + param->len;
   83|      0|    b.end = b.last;
   84|      0|    b.temporary = 1;
   85|       |
   86|      0|    conf_file.file.fd = NGX_INVALID_FILE;
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
   87|      0|    conf_file.file.name.data = NULL;
   88|      0|    conf_file.line = 0;
   89|       |
   90|      0|    cf->conf_file = &conf_file;
   91|      0|    cf->conf_file->buffer = &b;
   92|       |
   93|      0|    rv = ngx_conf_parse(cf, NULL);
   94|       |
   95|      0|    cf->conf_file = NULL;
   96|       |
   97|      0|    return rv;
   98|      1|}
ngx_conf_parse:
  159|      8|{
  160|      8|    char             *rv;
  161|      8|    ngx_fd_t          fd;
  162|      8|    ngx_int_t         rc;
  163|      8|    ngx_buf_t         buf;
  164|      8|    ngx_conf_file_t  *prev, conf_file;
  165|      8|    enum {
  166|      8|        parse_file = 0,
  167|      8|        parse_block,
  168|      8|        parse_param
  169|      8|    } type;
  170|       |
  171|      8|#if (NGX_SUPPRESS_WARN)
  172|      8|    fd = NGX_INVALID_FILE;
  ------------------
  |  |   49|      8|#define NGX_INVALID_FILE         -1
  ------------------
  173|      8|    prev = NULL;
  174|      8|#endif
  175|       |
  176|      8|    if (filename) {
  ------------------
  |  Branch (176:9): [True: 1, False: 7]
  ------------------
  177|       |
  178|       |        /* open configuration file */
  179|       |
  180|      1|        fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
  ------------------
  |  |   66|      1|    open((const char *) name, mode|create, access)
  ------------------
  181|       |
  182|      1|        if (fd == NGX_INVALID_FILE) {
  ------------------
  |  |   49|      1|#define NGX_INVALID_FILE         -1
  ------------------
  |  Branch (182:13): [True: 0, False: 1]
  ------------------
  183|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
                          ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
  ------------------
  |  |   69|      0|#define ngx_errno                  errno
  ------------------
  184|      0|                               ngx_open_file_n " \"%s\" failed",
  ------------------
  |  |   70|      0|#define ngx_open_file_n          "open()"
  ------------------
  185|      0|                               filename->data);
  186|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  187|      0|        }
  188|       |
  189|      1|        prev = cf->conf_file;
  190|       |
  191|      1|        cf->conf_file = &conf_file;
  192|       |
  193|      1|        if (ngx_fd_info(fd, &cf->conf_file->file.info) == NGX_FILE_ERROR) {
  ------------------
  |  |  176|      1|#define ngx_fd_info(fd, sb)      fstat(fd, sb)
  ------------------
                      if (ngx_fd_info(fd, &cf->conf_file->file.info) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      1|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (193:13): [True: 0, False: 1]
  ------------------
  194|      0|            ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  195|      0|                          ngx_fd_info_n " \"%s\" failed", filename->data);
  196|      0|        }
  197|       |
  198|      1|        cf->conf_file->buffer = &buf;
  199|       |
  200|      1|        buf.start = ngx_alloc(NGX_CONF_BUFFER, cf->log);
  ------------------
  |  |   11|      1|#define NGX_CONF_BUFFER  4096
  ------------------
  201|      1|        if (buf.start == NULL) {
  ------------------
  |  Branch (201:13): [True: 0, False: 1]
  ------------------
  202|      0|            goto failed;
  203|      0|        }
  204|       |
  205|      1|        buf.pos = buf.start;
  206|      1|        buf.last = buf.start;
  207|      1|        buf.end = buf.last + NGX_CONF_BUFFER;
  ------------------
  |  |   11|      1|#define NGX_CONF_BUFFER  4096
  ------------------
  208|      1|        buf.temporary = 1;
  209|       |
  210|      1|        cf->conf_file->file.fd = fd;
  211|      1|        cf->conf_file->file.name.len = filename->len;
  212|      1|        cf->conf_file->file.name.data = filename->data;
  213|      1|        cf->conf_file->file.offset = 0;
  214|      1|        cf->conf_file->file.log = cf->log;
  215|      1|        cf->conf_file->line = 1;
  216|       |
  217|      1|        type = parse_file;
  218|       |
  219|      1|        if (ngx_dump_config
  ------------------
  |  Branch (219:13): [True: 0, False: 1]
  ------------------
  220|       |#if (NGX_DEBUG)
  221|       |            || 1
  222|       |#endif
  223|      1|           )
  224|      0|        {
  225|      0|            if (ngx_conf_add_dump(cf, filename) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (225:17): [True: 0, False: 0]
  ------------------
  226|      0|                goto failed;
  227|      0|            }
  228|       |
  229|      1|        } else {
  230|      1|            cf->conf_file->dump = NULL;
  231|      1|        }
  232|       |
  233|      7|    } else if (cf->conf_file->file.fd != NGX_INVALID_FILE) {
  ------------------
  |  |   49|      7|#define NGX_INVALID_FILE         -1
  ------------------
  |  Branch (233:16): [True: 7, False: 0]
  ------------------
  234|       |
  235|      7|        type = parse_block;
  236|       |
  237|      7|    } else {
  238|      0|        type = parse_param;
  239|      0|    }
  240|       |
  241|       |
  242|     62|    for ( ;; ) {
  243|     62|        rc = ngx_conf_read_token(cf);
  244|       |
  245|       |        /*
  246|       |         * ngx_conf_read_token() may return
  247|       |         *
  248|       |         *    NGX_ERROR             there is error
  249|       |         *    NGX_OK                the token terminated by ";" was found
  250|       |         *    NGX_CONF_BLOCK_START  the token terminated by "{" was found
  251|       |         *    NGX_CONF_BLOCK_DONE   the "}" was found
  252|       |         *    NGX_CONF_FILE_DONE    the configuration file is done
  253|       |         */
  254|       |
  255|     62|        if (rc == NGX_ERROR) {
  ------------------
  |  |   39|     62|#define  NGX_ERROR      -1
  ------------------
  |  Branch (255:13): [True: 0, False: 62]
  ------------------
  256|      0|            goto done;
  257|      0|        }
  258|       |
  259|     62|        if (rc == NGX_CONF_BLOCK_DONE) {
  ------------------
  |  |   67|     62|#define NGX_CONF_BLOCK_DONE  2
  ------------------
  |  Branch (259:13): [True: 7, False: 55]
  ------------------
  260|       |
  261|      7|            if (type != parse_block) {
  ------------------
  |  Branch (261:17): [True: 0, False: 7]
  ------------------
  262|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\"");
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  263|      0|                goto failed;
  264|      0|            }
  265|       |
  266|      7|            goto done;
  267|      7|        }
  268|       |
  269|     55|        if (rc == NGX_CONF_FILE_DONE) {
  ------------------
  |  |   68|     55|#define NGX_CONF_FILE_DONE   3
  ------------------
  |  Branch (269:13): [True: 1, False: 54]
  ------------------
  270|       |
  271|      1|            if (type == parse_block) {
  ------------------
  |  Branch (271:17): [True: 0, False: 1]
  ------------------
  272|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  273|      0|                                   "unexpected end of file, expecting \"}\"");
  274|      0|                goto failed;
  275|      0|            }
  276|       |
  277|      1|            goto done;
  278|      1|        }
  279|       |
  280|     54|        if (rc == NGX_CONF_BLOCK_START) {
  ------------------
  |  |   66|     54|#define NGX_CONF_BLOCK_START 1
  ------------------
  |  Branch (280:13): [True: 7, False: 47]
  ------------------
  281|       |
  282|      7|            if (type == parse_param) {
  ------------------
  |  Branch (282:17): [True: 0, False: 7]
  ------------------
  283|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  284|      0|                                   "block directives are not supported "
  285|      0|                                   "in -g option");
  286|      0|                goto failed;
  287|      0|            }
  288|      7|        }
  289|       |
  290|       |        /* rc == NGX_OK || rc == NGX_CONF_BLOCK_START */
  291|       |
  292|     54|        if (cf->handler) {
  ------------------
  |  Branch (292:13): [True: 3, False: 51]
  ------------------
  293|       |
  294|       |            /*
  295|       |             * the custom handler, i.e., that is used in the http's
  296|       |             * "types { ... }" directive
  297|       |             */
  298|       |
  299|      3|            if (rc == NGX_CONF_BLOCK_START) {
  ------------------
  |  |   66|      3|#define NGX_CONF_BLOCK_START 1
  ------------------
  |  Branch (299:17): [True: 0, False: 3]
  ------------------
  300|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"{\"");
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  301|      0|                goto failed;
  302|      0|            }
  303|       |
  304|      3|            rv = (*cf->handler)(cf, NULL, cf->handler_conf);
  305|      3|            if (rv == NGX_CONF_OK) {
  ------------------
  |  |   63|      3|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (305:17): [True: 3, False: 0]
  ------------------
  306|      3|                continue;
  307|      3|            }
  308|       |
  309|      0|            if (rv == NGX_CONF_ERROR) {
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  |  Branch (309:17): [True: 0, False: 0]
  ------------------
  310|      0|                goto failed;
  311|      0|            }
  312|       |
  313|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", rv);
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  314|       |
  315|      0|            goto failed;
  316|      0|        }
  317|       |
  318|       |
  319|     51|        rc = ngx_conf_handler(cf, rc);
  320|       |
  321|     51|        if (rc == NGX_ERROR) {
  ------------------
  |  |   39|     51|#define  NGX_ERROR      -1
  ------------------
  |  Branch (321:13): [True: 0, False: 51]
  ------------------
  322|      0|            goto failed;
  323|      0|        }
  324|     51|    }
  325|       |
  326|      0|failed:
  327|       |
  328|      0|    rc = NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  329|       |
  330|      8|done:
  331|       |
  332|      8|    if (filename) {
  ------------------
  |  Branch (332:9): [True: 1, False: 7]
  ------------------
  333|      1|        if (cf->conf_file->buffer->start) {
  ------------------
  |  Branch (333:13): [True: 1, False: 0]
  ------------------
  334|      1|            ngx_free(cf->conf_file->buffer->start);
  ------------------
  |  |   19|      1|#define ngx_free          free
  ------------------
  335|      1|        }
  336|       |
  337|      1|        if (ngx_close_file(fd) == NGX_FILE_ERROR) {
  ------------------
  |  |  109|      1|#define ngx_close_file           close
  ------------------
                      if (ngx_close_file(fd) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      1|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (337:13): [True: 0, False: 1]
  ------------------
  338|      0|            ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  339|      0|                          ngx_close_file_n " %s failed",
  340|      0|                          filename->data);
  341|      0|            rc = NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  342|      0|        }
  343|       |
  344|      1|        cf->conf_file = prev;
  345|      1|    }
  346|       |
  347|      8|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      8|#define  NGX_ERROR      -1
  ------------------
  |  Branch (347:9): [True: 0, False: 8]
  ------------------
  348|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  349|      0|    }
  350|       |
  351|      8|    return NGX_CONF_OK;
  ------------------
  |  |   63|      8|#define NGX_CONF_OK          NULL
  ------------------
  352|      8|}
ngx_conf_full_name:
  888|      8|{
  889|      8|    ngx_str_t  *prefix;
  890|       |
  891|      8|    prefix = conf_prefix ? &cycle->conf_prefix : &cycle->prefix;
  ------------------
  |  Branch (891:14): [True: 0, False: 8]
  ------------------
  892|       |
  893|      8|    return ngx_get_full_name(cycle->pool, prefix, name);
  894|      8|}
ngx_conf_open_file:
  899|      2|{
  900|      2|    ngx_str_t         full;
  901|      2|    ngx_uint_t        i;
  902|      2|    ngx_list_part_t  *part;
  903|      2|    ngx_open_file_t  *file;
  904|       |
  905|      2|#if (NGX_SUPPRESS_WARN)
  906|      2|    ngx_str_null(&full);
  ------------------
  |  |   44|      2|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
  907|      2|#endif
  908|       |
  909|      2|    if (name->len) {
  ------------------
  |  Branch (909:9): [True: 0, False: 2]
  ------------------
  910|      0|        full = *name;
  911|       |
  912|      0|        if (ngx_conf_full_name(cycle, &full, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (912:13): [True: 0, False: 0]
  ------------------
  913|      0|            return NULL;
  914|      0|        }
  915|       |
  916|      0|        part = &cycle->open_files.part;
  917|      0|        file = part->elts;
  918|       |
  919|      0|        for (i = 0; /* void */ ; i++) {
  920|       |
  921|      0|            if (i >= part->nelts) {
  ------------------
  |  Branch (921:17): [True: 0, False: 0]
  ------------------
  922|      0|                if (part->next == NULL) {
  ------------------
  |  Branch (922:21): [True: 0, False: 0]
  ------------------
  923|      0|                    break;
  924|      0|                }
  925|      0|                part = part->next;
  926|      0|                file = part->elts;
  927|      0|                i = 0;
  928|      0|            }
  929|       |
  930|      0|            if (full.len != file[i].name.len) {
  ------------------
  |  Branch (930:17): [True: 0, False: 0]
  ------------------
  931|      0|                continue;
  932|      0|            }
  933|       |
  934|      0|            if (ngx_strcmp(full.data, file[i].name.data) == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (934:17): [True: 0, False: 0]
  ------------------
  935|      0|                return &file[i];
  936|      0|            }
  937|      0|        }
  938|      0|    }
  939|       |
  940|      2|    file = ngx_list_push(&cycle->open_files);
  941|      2|    if (file == NULL) {
  ------------------
  |  Branch (941:9): [True: 0, False: 2]
  ------------------
  942|      0|        return NULL;
  943|      0|    }
  944|       |
  945|      2|    if (name->len) {
  ------------------
  |  Branch (945:9): [True: 0, False: 2]
  ------------------
  946|      0|        file->fd = NGX_INVALID_FILE;
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
  947|      0|        file->name = full;
  948|       |
  949|      2|    } else {
  950|      2|        file->fd = ngx_stderr;
  ------------------
  |  |  373|      2|#define ngx_stderr               STDERR_FILENO
  ------------------
  951|      2|        file->name = *name;
  952|      2|    }
  953|       |
  954|      2|    file->flush = NULL;
  955|      2|    file->data = NULL;
  956|       |
  957|      2|    return file;
  958|      2|}
ngx_conf_set_flag_slot:
 1027|      5|{
 1028|      5|    char  *p = conf;
 1029|       |
 1030|      5|    ngx_str_t        *value;
 1031|      5|    ngx_flag_t       *fp;
 1032|      5|    ngx_conf_post_t  *post;
 1033|       |
 1034|      5|    fp = (ngx_flag_t *) (p + cmd->offset);
 1035|       |
 1036|      5|    if (*fp != NGX_CONF_UNSET) {
  ------------------
  |  |   56|      5|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (1036:9): [True: 0, False: 5]
  ------------------
 1037|      0|        return "is duplicate";
 1038|      0|    }
 1039|       |
 1040|      5|    value = cf->args->elts;
 1041|       |
 1042|      5|    if (ngx_strcasecmp(value[1].data, (u_char *) "on") == 0) {
  ------------------
  |  Branch (1042:9): [True: 0, False: 5]
  ------------------
 1043|      0|        *fp = 1;
 1044|       |
 1045|      5|    } else if (ngx_strcasecmp(value[1].data, (u_char *) "off") == 0) {
  ------------------
  |  Branch (1045:16): [True: 5, False: 0]
  ------------------
 1046|      5|        *fp = 0;
 1047|       |
 1048|      5|    } else {
 1049|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1050|      0|                     "invalid value \"%s\" in \"%s\" directive, "
 1051|      0|                     "it must be \"on\" or \"off\"",
 1052|      0|                     value[1].data, cmd->name.data);
 1053|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1054|      0|    }
 1055|       |
 1056|      5|    if (cmd->post) {
  ------------------
  |  Branch (1056:9): [True: 0, False: 5]
  ------------------
 1057|      0|        post = cmd->post;
 1058|      0|        return post->post_handler(cf, post, fp);
 1059|      0|    }
 1060|       |
 1061|      5|    return NGX_CONF_OK;
  ------------------
  |  |   63|      5|#define NGX_CONF_OK          NULL
  ------------------
 1062|      5|}
ngx_conf_set_str_slot:
 1067|      1|{
 1068|      1|    char  *p = conf;
 1069|       |
 1070|      1|    ngx_str_t        *field, *value;
 1071|      1|    ngx_conf_post_t  *post;
 1072|       |
 1073|      1|    field = (ngx_str_t *) (p + cmd->offset);
 1074|       |
 1075|      1|    if (field->data) {
  ------------------
  |  Branch (1075:9): [True: 0, False: 1]
  ------------------
 1076|      0|        return "is duplicate";
 1077|      0|    }
 1078|       |
 1079|      1|    value = cf->args->elts;
 1080|       |
 1081|      1|    *field = value[1];
 1082|       |
 1083|      1|    if (cmd->post) {
  ------------------
  |  Branch (1083:9): [True: 0, False: 1]
  ------------------
 1084|      0|        post = cmd->post;
 1085|      0|        return post->post_handler(cf, post, field);
 1086|      0|    }
 1087|       |
 1088|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1089|      1|}
ngx_conf_set_keyval_slot:
 1130|      7|{
 1131|      7|    char  *p = conf;
 1132|       |
 1133|      7|    ngx_str_t         *value;
 1134|      7|    ngx_array_t      **a;
 1135|      7|    ngx_keyval_t      *kv;
 1136|      7|    ngx_conf_post_t   *post;
 1137|       |
 1138|      7|    a = (ngx_array_t **) (p + cmd->offset);
 1139|       |
 1140|      7|    if (*a == NGX_CONF_UNSET_PTR || *a == NULL) {
  ------------------
  |  |   58|     14|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  |  Branch (1140:9): [True: 2, False: 5]
  |  Branch (1140:37): [True: 0, False: 5]
  ------------------
 1141|      2|        *a = ngx_array_create(cf->pool, 4, sizeof(ngx_keyval_t));
 1142|      2|        if (*a == NULL) {
  ------------------
  |  Branch (1142:13): [True: 0, False: 2]
  ------------------
 1143|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1144|      0|        }
 1145|      2|    }
 1146|       |
 1147|      7|    kv = ngx_array_push(*a);
 1148|      7|    if (kv == NULL) {
  ------------------
  |  Branch (1148:9): [True: 0, False: 7]
  ------------------
 1149|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1150|      0|    }
 1151|       |
 1152|      7|    value = cf->args->elts;
 1153|       |
 1154|      7|    kv->key = value[1];
 1155|      7|    kv->value = value[2];
 1156|       |
 1157|      7|    if (cmd->post) {
  ------------------
  |  Branch (1157:9): [True: 0, False: 7]
  ------------------
 1158|      0|        post = cmd->post;
 1159|      0|        return post->post_handler(cf, post, kv);
 1160|      0|    }
 1161|       |
 1162|      7|    return NGX_CONF_OK;
  ------------------
  |  |   63|      7|#define NGX_CONF_OK          NULL
  ------------------
 1163|      7|}
ngx_conf_set_num_slot:
 1168|      1|{
 1169|      1|    char  *p = conf;
 1170|       |
 1171|      1|    ngx_int_t        *np;
 1172|      1|    ngx_str_t        *value;
 1173|      1|    ngx_conf_post_t  *post;
 1174|       |
 1175|       |
 1176|      1|    np = (ngx_int_t *) (p + cmd->offset);
 1177|       |
 1178|      1|    if (*np != NGX_CONF_UNSET) {
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (1178:9): [True: 0, False: 1]
  ------------------
 1179|      0|        return "is duplicate";
 1180|      0|    }
 1181|       |
 1182|      1|    value = cf->args->elts;
 1183|      1|    *np = ngx_atoi(value[1].data, value[1].len);
 1184|      1|    if (*np == NGX_ERROR) {
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1184:9): [True: 0, False: 1]
  ------------------
 1185|      0|        return "invalid number";
 1186|      0|    }
 1187|       |
 1188|      1|    if (cmd->post) {
  ------------------
  |  Branch (1188:9): [True: 0, False: 1]
  ------------------
 1189|      0|        post = cmd->post;
 1190|      0|        return post->post_handler(cf, post, np);
 1191|      0|    }
 1192|       |
 1193|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1194|      1|}
ngx_conf_set_size_slot:
 1199|      3|{
 1200|      3|    char  *p = conf;
 1201|       |
 1202|      3|    size_t           *sp;
 1203|      3|    ngx_str_t        *value;
 1204|      3|    ngx_conf_post_t  *post;
 1205|       |
 1206|       |
 1207|      3|    sp = (size_t *) (p + cmd->offset);
 1208|      3|    if (*sp != NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      3|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (1208:9): [True: 0, False: 3]
  ------------------
 1209|      0|        return "is duplicate";
 1210|      0|    }
 1211|       |
 1212|      3|    value = cf->args->elts;
 1213|       |
 1214|      3|    *sp = ngx_parse_size(&value[1]);
 1215|      3|    if (*sp == (size_t) NGX_ERROR) {
  ------------------
  |  |   39|      3|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1215:9): [True: 0, False: 3]
  ------------------
 1216|      0|        return "invalid value";
 1217|      0|    }
 1218|       |
 1219|      3|    if (cmd->post) {
  ------------------
  |  Branch (1219:9): [True: 0, False: 3]
  ------------------
 1220|      0|        post = cmd->post;
 1221|      0|        return post->post_handler(cf, post, sp);
 1222|      0|    }
 1223|       |
 1224|      3|    return NGX_CONF_OK;
  ------------------
  |  |   63|      3|#define NGX_CONF_OK          NULL
  ------------------
 1225|      3|}
ngx_conf_set_off_slot:
 1230|      1|{
 1231|      1|    char  *p = conf;
 1232|       |
 1233|      1|    off_t            *op;
 1234|      1|    ngx_str_t        *value;
 1235|      1|    ngx_conf_post_t  *post;
 1236|       |
 1237|       |
 1238|      1|    op = (off_t *) (p + cmd->offset);
 1239|      1|    if (*op != NGX_CONF_UNSET) {
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (1239:9): [True: 0, False: 1]
  ------------------
 1240|      0|        return "is duplicate";
 1241|      0|    }
 1242|       |
 1243|      1|    value = cf->args->elts;
 1244|       |
 1245|      1|    *op = ngx_parse_offset(&value[1]);
 1246|      1|    if (*op == (off_t) NGX_ERROR) {
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1246:9): [True: 0, False: 1]
  ------------------
 1247|      0|        return "invalid value";
 1248|      0|    }
 1249|       |
 1250|      1|    if (cmd->post) {
  ------------------
  |  Branch (1250:9): [True: 0, False: 1]
  ------------------
 1251|      0|        post = cmd->post;
 1252|      0|        return post->post_handler(cf, post, op);
 1253|      0|    }
 1254|       |
 1255|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1256|      1|}
ngx_conf_set_msec_slot:
 1261|      1|{
 1262|      1|    char  *p = conf;
 1263|       |
 1264|      1|    ngx_msec_t       *msp;
 1265|      1|    ngx_str_t        *value;
 1266|      1|    ngx_conf_post_t  *post;
 1267|       |
 1268|       |
 1269|      1|    msp = (ngx_msec_t *) (p + cmd->offset);
 1270|      1|    if (*msp != NGX_CONF_UNSET_MSEC) {
  ------------------
  |  |   60|      1|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
  |  Branch (1270:9): [True: 0, False: 1]
  ------------------
 1271|      0|        return "is duplicate";
 1272|      0|    }
 1273|       |
 1274|      1|    value = cf->args->elts;
 1275|       |
 1276|      1|    *msp = ngx_parse_time(&value[1], 0);
 1277|      1|    if (*msp == (ngx_msec_t) NGX_ERROR) {
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1277:9): [True: 0, False: 1]
  ------------------
 1278|      0|        return "invalid value";
 1279|      0|    }
 1280|       |
 1281|      1|    if (cmd->post) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 1]
  ------------------
 1282|      0|        post = cmd->post;
 1283|      0|        return post->post_handler(cf, post, msp);
 1284|      0|    }
 1285|       |
 1286|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1287|      1|}
ngx_conf_set_bufs_slot:
 1323|      1|{
 1324|      1|    char *p = conf;
 1325|       |
 1326|      1|    ngx_str_t   *value;
 1327|      1|    ngx_bufs_t  *bufs;
 1328|       |
 1329|       |
 1330|      1|    bufs = (ngx_bufs_t *) (p + cmd->offset);
 1331|      1|    if (bufs->num) {
  ------------------
  |  Branch (1331:9): [True: 0, False: 1]
  ------------------
 1332|      0|        return "is duplicate";
 1333|      0|    }
 1334|       |
 1335|      1|    value = cf->args->elts;
 1336|       |
 1337|      1|    bufs->num = ngx_atoi(value[1].data, value[1].len);
 1338|      1|    if (bufs->num == NGX_ERROR || bufs->num == 0) {
  ------------------
  |  |   39|      2|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1338:9): [True: 0, False: 1]
  |  Branch (1338:35): [True: 0, False: 1]
  ------------------
 1339|      0|        return "invalid value";
 1340|      0|    }
 1341|       |
 1342|      1|    bufs->size = ngx_parse_size(&value[2]);
 1343|      1|    if (bufs->size == (size_t) NGX_ERROR || bufs->size == 0) {
  ------------------
  |  |   39|      2|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1343:9): [True: 0, False: 1]
  |  Branch (1343:45): [True: 0, False: 1]
  ------------------
 1344|      0|        return "invalid value";
 1345|      0|    }
 1346|       |
 1347|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1348|      1|}
ngx_conf_set_enum_slot:
 1353|      2|{
 1354|      2|    char  *p = conf;
 1355|       |
 1356|      2|    ngx_uint_t       *np, i;
 1357|      2|    ngx_str_t        *value;
 1358|      2|    ngx_conf_enum_t  *e;
 1359|       |
 1360|      2|    np = (ngx_uint_t *) (p + cmd->offset);
 1361|       |
 1362|      2|    if (*np != NGX_CONF_UNSET_UINT) {
  ------------------
  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  |  Branch (1362:9): [True: 0, False: 2]
  ------------------
 1363|      0|        return "is duplicate";
 1364|      0|    }
 1365|       |
 1366|      2|    value = cf->args->elts;
 1367|      2|    e = cmd->post;
 1368|       |
 1369|      3|    for (i = 0; e[i].name.len != 0; i++) {
  ------------------
  |  Branch (1369:17): [True: 3, False: 0]
  ------------------
 1370|      3|        if (e[i].name.len != value[1].len
  ------------------
  |  Branch (1370:13): [True: 0, False: 3]
  ------------------
 1371|      3|            || ngx_strcasecmp(e[i].name.data, value[1].data) != 0)
  ------------------
  |  Branch (1371:16): [True: 1, False: 2]
  ------------------
 1372|      1|        {
 1373|      1|            continue;
 1374|      1|        }
 1375|       |
 1376|      2|        *np = e[i].value;
 1377|       |
 1378|      2|        return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 1379|      3|    }
 1380|       |
 1381|      0|    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1382|      0|                       "invalid value \"%s\"", value[1].data);
 1383|       |
 1384|      0|    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1385|      2|}
ngx_conf_set_bitmask_slot:
 1390|      1|{
 1391|      1|    char  *p = conf;
 1392|       |
 1393|      1|    ngx_uint_t          *np, i, m;
 1394|      1|    ngx_str_t           *value;
 1395|      1|    ngx_conf_bitmask_t  *mask;
 1396|       |
 1397|       |
 1398|      1|    np = (ngx_uint_t *) (p + cmd->offset);
 1399|      1|    value = cf->args->elts;
 1400|      1|    mask = cmd->post;
 1401|       |
 1402|      2|    for (i = 1; i < cf->args->nelts; i++) {
  ------------------
  |  Branch (1402:17): [True: 1, False: 1]
  ------------------
 1403|     13|        for (m = 0; mask[m].name.len != 0; m++) {
  ------------------
  |  Branch (1403:21): [True: 13, False: 0]
  ------------------
 1404|       |
 1405|     13|            if (mask[m].name.len != value[i].len
  ------------------
  |  Branch (1405:17): [True: 12, False: 1]
  ------------------
 1406|     13|                || ngx_strcasecmp(mask[m].name.data, value[i].data) != 0)
  ------------------
  |  Branch (1406:20): [True: 0, False: 1]
  ------------------
 1407|     12|            {
 1408|     12|                continue;
 1409|     12|            }
 1410|       |
 1411|      1|            if (*np & mask[m].mask) {
  ------------------
  |  Branch (1411:17): [True: 0, False: 1]
  ------------------
 1412|      0|                ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
  ------------------
  |  |   21|      0|#define NGX_LOG_WARN              5
  ------------------
 1413|      0|                                   "duplicate value \"%s\"", value[i].data);
 1414|       |
 1415|      1|            } else {
 1416|      1|                *np |= mask[m].mask;
 1417|      1|            }
 1418|       |
 1419|      1|            break;
 1420|     13|        }
 1421|       |
 1422|      1|        if (mask[m].name.len == 0) {
  ------------------
  |  Branch (1422:13): [True: 0, False: 1]
  ------------------
 1423|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1424|      0|                               "invalid value \"%s\"", value[i].data);
 1425|       |
 1426|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1427|      0|        }
 1428|      1|    }
 1429|       |
 1430|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1431|      1|}
ngx_conf_file.c:ngx_conf_handler:
  357|     51|{
  358|     51|    char           *rv;
  359|     51|    void           *conf, **confp;
  360|     51|    ngx_uint_t      i, found;
  361|     51|    ngx_str_t      *name;
  362|     51|    ngx_command_t  *cmd;
  363|       |
  364|     51|    name = cf->args->elts;
  365|       |
  366|     51|    found = 0;
  367|       |
  368|    820|    for (i = 0; cf->cycle->modules[i]; i++) {
  ------------------
  |  Branch (368:17): [True: 820, False: 0]
  ------------------
  369|       |
  370|    820|        cmd = cf->cycle->modules[i]->commands;
  371|    820|        if (cmd == NULL) {
  ------------------
  |  Branch (371:13): [True: 21, False: 799]
  ------------------
  372|     21|            continue;
  373|     21|        }
  374|       |
  375|  6.89k|        for ( /* void */ ; cmd->name.len; cmd++) {
  ------------------
  |  Branch (375:28): [True: 6.14k, False: 748]
  ------------------
  376|       |
  377|  6.14k|            if (name->len != cmd->name.len) {
  ------------------
  |  Branch (377:17): [True: 5.81k, False: 330]
  ------------------
  378|  5.81k|                continue;
  379|  5.81k|            }
  380|       |
  381|    330|            if (ngx_strcmp(name->data, cmd->name.data) != 0) {
  ------------------
  |  |   57|    330|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (381:17): [True: 268, False: 62]
  ------------------
  382|    268|                continue;
  383|    268|            }
  384|       |
  385|     62|            found = 1;
  386|       |
  387|     62|            if (cf->cycle->modules[i]->type != NGX_CONF_MODULE
  ------------------
  |  |   71|    124|#define NGX_CONF_MODULE      0x464E4F43  /* "CONF" */
  ------------------
  |  Branch (387:17): [True: 62, False: 0]
  ------------------
  388|     62|                && cf->cycle->modules[i]->type != cf->module_type)
  ------------------
  |  Branch (388:20): [True: 1, False: 61]
  ------------------
  389|      1|            {
  390|      1|                continue;
  391|      1|            }
  392|       |
  393|       |            /* is the directive's location right ? */
  394|       |
  395|     61|            if (!(cmd->type & cf->cmd_type)) {
  ------------------
  |  Branch (395:17): [True: 10, False: 51]
  ------------------
  396|     10|                continue;
  397|     10|            }
  398|       |
  399|     51|            if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) {
  ------------------
  |  |   43|     51|#define NGX_CONF_BLOCK       0x00000100
  ------------------
                          if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) {
  ------------------
  |  |   38|     44|#define  NGX_OK          0
  ------------------
  |  Branch (399:17): [True: 44, False: 7]
  |  Branch (399:50): [True: 0, False: 44]
  ------------------
  400|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  401|      0|                                  "directive \"%s\" is not terminated by \";\"",
  402|      0|                                  name->data);
  403|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  404|      0|            }
  405|       |
  406|     51|            if ((cmd->type & NGX_CONF_BLOCK) && last != NGX_CONF_BLOCK_START) {
  ------------------
  |  |   43|     51|#define NGX_CONF_BLOCK       0x00000100
  ------------------
                          if ((cmd->type & NGX_CONF_BLOCK) && last != NGX_CONF_BLOCK_START) {
  ------------------
  |  |   66|      7|#define NGX_CONF_BLOCK_START 1
  ------------------
  |  Branch (406:17): [True: 7, False: 44]
  |  Branch (406:49): [True: 0, False: 7]
  ------------------
  407|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  408|      0|                                   "directive \"%s\" has no opening \"{\"",
  409|      0|                                   name->data);
  410|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  411|      0|            }
  412|       |
  413|       |            /* is the directive's argument count right ? */
  414|       |
  415|     51|            if (!(cmd->type & NGX_CONF_ANY)) {
  ------------------
  |  |   45|     51|#define NGX_CONF_ANY         0x00000400
  ------------------
  |  Branch (415:17): [True: 51, False: 0]
  ------------------
  416|       |
  417|     51|                if (cmd->type & NGX_CONF_FLAG) {
  ------------------
  |  |   44|     51|#define NGX_CONF_FLAG        0x00000200
  ------------------
  |  Branch (417:21): [True: 5, False: 46]
  ------------------
  418|       |
  419|      5|                    if (cf->args->nelts != 2) {
  ------------------
  |  Branch (419:25): [True: 0, False: 5]
  ------------------
  420|      0|                        goto invalid;
  421|      0|                    }
  422|       |
  423|     46|                } else if (cmd->type & NGX_CONF_1MORE) {
  ------------------
  |  |   46|     46|#define NGX_CONF_1MORE       0x00000800
  ------------------
  |  Branch (423:28): [True: 16, False: 30]
  ------------------
  424|       |
  425|     16|                    if (cf->args->nelts < 2) {
  ------------------
  |  Branch (425:25): [True: 0, False: 16]
  ------------------
  426|      0|                        goto invalid;
  427|      0|                    }
  428|       |
  429|     30|                } else if (cmd->type & NGX_CONF_2MORE) {
  ------------------
  |  |   47|     30|#define NGX_CONF_2MORE       0x00001000
  ------------------
  |  Branch (429:28): [True: 0, False: 30]
  ------------------
  430|       |
  431|      0|                    if (cf->args->nelts < 3) {
  ------------------
  |  Branch (431:25): [True: 0, False: 0]
  ------------------
  432|      0|                        goto invalid;
  433|      0|                    }
  434|       |
  435|     30|                } else if (cf->args->nelts > NGX_CONF_MAX_ARGS) {
  ------------------
  |  |   31|     30|#define NGX_CONF_MAX_ARGS    8
  ------------------
  |  Branch (435:28): [True: 0, False: 30]
  ------------------
  436|       |
  437|      0|                    goto invalid;
  438|       |
  439|     30|                } else if (!(cmd->type & argument_number[cf->args->nelts - 1]))
  ------------------
  |  Branch (439:28): [True: 0, False: 30]
  ------------------
  440|      0|                {
  441|      0|                    goto invalid;
  442|      0|                }
  443|     51|            }
  444|       |
  445|       |            /* set up the directive's configuration context */
  446|       |
  447|     51|            conf = NULL;
  448|       |
  449|     51|            if (cmd->type & NGX_DIRECT_CONF) {
  ------------------
  |  |   49|     51|#define NGX_DIRECT_CONF      0x00010000
  ------------------
  |  Branch (449:17): [True: 1, False: 50]
  ------------------
  450|      1|                conf = ((void **) cf->ctx)[cf->cycle->modules[i]->index];
  451|       |
  452|     50|            } else if (cmd->type & NGX_MAIN_CONF) {
  ------------------
  |  |   51|     50|#define NGX_MAIN_CONF        0x01000000
  ------------------
  |  Branch (452:24): [True: 3, False: 47]
  ------------------
  453|      3|                conf = &(((void **) cf->ctx)[cf->cycle->modules[i]->index]);
  454|       |
  455|     47|            } else if (cf->ctx) {
  ------------------
  |  Branch (455:24): [True: 47, False: 0]
  ------------------
  456|     47|                confp = *(void **) ((char *) cf->ctx + cmd->conf);
  457|       |
  458|     47|                if (confp) {
  ------------------
  |  Branch (458:21): [True: 47, False: 0]
  ------------------
  459|     47|                    conf = confp[cf->cycle->modules[i]->ctx_index];
  460|     47|                }
  461|     47|            }
  462|       |
  463|     51|            rv = cmd->set(cf, cmd, conf);
  464|       |
  465|     51|            if (rv == NGX_CONF_OK) {
  ------------------
  |  |   63|     51|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (465:17): [True: 51, False: 0]
  ------------------
  466|     51|                return NGX_OK;
  ------------------
  |  |   38|     51|#define  NGX_OK          0
  ------------------
  467|     51|            }
  468|       |
  469|      0|            if (rv == NGX_CONF_ERROR) {
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  |  Branch (469:17): [True: 0, False: 0]
  ------------------
  470|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  471|      0|            }
  472|       |
  473|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  474|      0|                               "\"%s\" directive %s", name->data, rv);
  475|       |
  476|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  477|      0|        }
  478|    799|    }
  479|       |
  480|      0|    if (found) {
  ------------------
  |  Branch (480:9): [True: 0, False: 0]
  ------------------
  481|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  482|      0|                           "\"%s\" directive is not allowed here", name->data);
  483|       |
  484|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  485|      0|    }
  486|       |
  487|      0|    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  488|      0|                       "unknown directive \"%s\"", name->data);
  489|       |
  490|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  491|       |
  492|      0|invalid:
  493|       |
  494|      0|    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  495|      0|                       "invalid number of arguments in \"%s\" directive",
  496|      0|                       name->data);
  497|       |
  498|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  499|      0|}
ngx_conf_file.c:ngx_conf_read_token:
  504|     62|{
  505|     62|    u_char      *start, ch, *src, *dst;
  506|     62|    off_t        file_size;
  507|     62|    size_t       len;
  508|     62|    ssize_t      n, size;
  509|     62|    ngx_uint_t   found, need_space, last_space, sharp_comment, variable;
  510|     62|    ngx_uint_t   quoted, s_quoted, d_quoted, start_line;
  511|     62|    ngx_str_t   *word;
  512|     62|    ngx_buf_t   *b, *dump;
  513|       |
  514|     62|    found = 0;
  515|     62|    need_space = 0;
  516|     62|    last_space = 1;
  517|     62|    sharp_comment = 0;
  518|     62|    variable = 0;
  519|     62|    quoted = 0;
  520|     62|    s_quoted = 0;
  521|     62|    d_quoted = 0;
  522|       |
  523|     62|    cf->args->nelts = 0;
  524|     62|    b = cf->conf_file->buffer;
  525|     62|    dump = cf->conf_file->dump;
  526|     62|    start = b->pos;
  527|     62|    start_line = cf->conf_file->line;
  528|       |
  529|     62|    file_size = ngx_file_size(&cf->conf_file->file.info);
  ------------------
  |  |  187|     62|#define ngx_file_size(sb)        (sb)->st_size
  ------------------
  530|       |
  531|  1.75k|    for ( ;; ) {
  532|       |
  533|  1.75k|        if (b->pos >= b->last) {
  ------------------
  |  Branch (533:13): [True: 2, False: 1.75k]
  ------------------
  534|       |
  535|      2|            if (cf->conf_file->file.offset >= file_size) {
  ------------------
  |  Branch (535:17): [True: 1, False: 1]
  ------------------
  536|       |
  537|      1|                if (cf->args->nelts > 0 || !last_space) {
  ------------------
  |  Branch (537:21): [True: 0, False: 1]
  |  Branch (537:44): [True: 0, False: 1]
  ------------------
  538|       |
  539|      0|                    if (cf->conf_file->file.fd == NGX_INVALID_FILE) {
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
  |  Branch (539:25): [True: 0, False: 0]
  ------------------
  540|      0|                        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  541|      0|                                           "unexpected end of parameter, "
  542|      0|                                           "expecting \";\"");
  543|      0|                        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  544|      0|                    }
  545|       |
  546|      0|                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  547|      0|                                       "unexpected end of file, "
  548|      0|                                       "expecting \";\" or \"}\"");
  549|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  550|      0|                }
  551|       |
  552|      1|                return NGX_CONF_FILE_DONE;
  ------------------
  |  |   68|      1|#define NGX_CONF_FILE_DONE   3
  ------------------
  553|      1|            }
  554|       |
  555|      1|            len = b->pos - start;
  556|       |
  557|      1|            if (len == NGX_CONF_BUFFER) {
  ------------------
  |  |   11|      1|#define NGX_CONF_BUFFER  4096
  ------------------
  |  Branch (557:17): [True: 0, False: 1]
  ------------------
  558|      0|                cf->conf_file->line = start_line;
  559|       |
  560|      0|                if (d_quoted) {
  ------------------
  |  Branch (560:21): [True: 0, False: 0]
  ------------------
  561|      0|                    ch = '"';
  562|       |
  563|      0|                } else if (s_quoted) {
  ------------------
  |  Branch (563:28): [True: 0, False: 0]
  ------------------
  564|      0|                    ch = '\'';
  565|       |
  566|      0|                } else {
  567|      0|                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  568|      0|                                       "too long parameter \"%*s...\" started",
  569|      0|                                       10, start);
  570|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  571|      0|                }
  572|       |
  573|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  574|      0|                                   "too long parameter, probably "
  575|      0|                                   "missing terminating \"%c\" character", ch);
  576|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  577|      0|            }
  578|       |
  579|      1|            if (len) {
  ------------------
  |  Branch (579:17): [True: 0, False: 1]
  ------------------
  580|      0|                ngx_memmove(b->start, start, len);
  ------------------
  |  |  143|      0|#define ngx_memmove(dst, src, n)  (void) memmove(dst, src, n)
  ------------------
  581|      0|            }
  582|       |
  583|      1|            size = (ssize_t) (file_size - cf->conf_file->file.offset);
  584|       |
  585|      1|            if (size > b->end - (b->start + len)) {
  ------------------
  |  Branch (585:17): [True: 0, False: 1]
  ------------------
  586|      0|                size = b->end - (b->start + len);
  587|      0|            }
  588|       |
  589|      1|            n = ngx_read_file(&cf->conf_file->file, b->start + len, size,
  590|      1|                              cf->conf_file->file.offset);
  591|       |
  592|      1|            if (n == NGX_ERROR) {
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
  |  Branch (592:17): [True: 0, False: 1]
  ------------------
  593|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  594|      0|            }
  595|       |
  596|      1|            if (n != size) {
  ------------------
  |  Branch (596:17): [True: 0, False: 1]
  ------------------
  597|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  598|      0|                                   ngx_read_file_n " returned "
  ------------------
  |  |  124|      0|#define ngx_read_file_n          "pread()"
  ------------------
  599|      0|                                   "only %z bytes instead of %z",
  600|      0|                                   n, size);
  601|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  602|      0|            }
  603|       |
  604|      1|            b->pos = b->start + len;
  605|      1|            b->last = b->pos + n;
  606|      1|            start = b->start;
  607|       |
  608|      1|            if (dump) {
  ------------------
  |  Branch (608:17): [True: 0, False: 1]
  ------------------
  609|      0|                dump->last = ngx_cpymem(dump->last, b->pos, size);
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  610|      0|            }
  611|      1|        }
  612|       |
  613|  1.75k|        ch = *b->pos++;
  614|       |
  615|  1.75k|        if (ch == LF) {
  ------------------
  |  |  103|  1.75k|#define LF     (u_char) '\n'
  ------------------
  |  Branch (615:13): [True: 62, False: 1.69k]
  ------------------
  616|     62|            cf->conf_file->line++;
  617|       |
  618|     62|            if (sharp_comment) {
  ------------------
  |  Branch (618:17): [True: 0, False: 62]
  ------------------
  619|      0|                sharp_comment = 0;
  620|      0|            }
  621|     62|        }
  622|       |
  623|  1.75k|        if (sharp_comment) {
  ------------------
  |  Branch (623:13): [True: 0, False: 1.75k]
  ------------------
  624|      0|            continue;
  625|      0|        }
  626|       |
  627|  1.75k|        if (quoted) {
  ------------------
  |  Branch (627:13): [True: 1, False: 1.75k]
  ------------------
  628|      1|            quoted = 0;
  629|      1|            continue;
  630|      1|        }
  631|       |
  632|  1.75k|        if (need_space) {
  ------------------
  |  Branch (632:13): [True: 2, False: 1.75k]
  ------------------
  633|      2|            if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
  ------------------
  |  |  104|      3|#define CR     (u_char) '\r'
  ------------------
                          if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
  ------------------
  |  |  103|      1|#define LF     (u_char) '\n'
  ------------------
  |  Branch (633:17): [True: 1, False: 1]
  |  Branch (633:30): [True: 0, False: 1]
  |  Branch (633:44): [True: 0, False: 1]
  |  Branch (633:56): [True: 0, False: 1]
  ------------------
  634|      1|                last_space = 1;
  635|      1|                need_space = 0;
  636|      1|                continue;
  637|      1|            }
  638|       |
  639|      1|            if (ch == ';') {
  ------------------
  |  Branch (639:17): [True: 1, False: 0]
  ------------------
  640|      1|                return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  641|      1|            }
  642|       |
  643|      0|            if (ch == '{') {
  ------------------
  |  Branch (643:17): [True: 0, False: 0]
  ------------------
  644|      0|                return NGX_CONF_BLOCK_START;
  ------------------
  |  |   66|      0|#define NGX_CONF_BLOCK_START 1
  ------------------
  645|      0|            }
  646|       |
  647|      0|            if (ch == ')') {
  ------------------
  |  Branch (647:17): [True: 0, False: 0]
  ------------------
  648|      0|                last_space = 1;
  649|      0|                need_space = 0;
  650|       |
  651|      0|            } else {
  652|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  653|      0|                                   "unexpected \"%c\"", ch);
  654|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  655|      0|            }
  656|      0|        }
  657|       |
  658|  1.75k|        if (last_space) {
  ------------------
  |  Branch (658:13): [True: 501, False: 1.25k]
  ------------------
  659|       |
  660|    501|            start = b->pos - 1;
  661|    501|            start_line = cf->conf_file->line;
  662|       |
  663|    501|            if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
  ------------------
  |  |  104|    704|#define CR     (u_char) '\r'
  ------------------
                          if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
  ------------------
  |  |  103|    203|#define LF     (u_char) '\n'
  ------------------
  |  Branch (663:17): [True: 298, False: 203]
  |  Branch (663:30): [True: 0, False: 203]
  |  Branch (663:44): [True: 0, False: 203]
  |  Branch (663:56): [True: 62, False: 141]
  ------------------
  664|    360|                continue;
  665|    360|            }
  666|       |
  667|    141|            switch (ch) {
  668|       |
  669|      0|            case ';':
  ------------------
  |  Branch (669:13): [True: 0, False: 141]
  ------------------
  670|      7|            case '{':
  ------------------
  |  Branch (670:13): [True: 7, False: 134]
  ------------------
  671|      7|                if (cf->args->nelts == 0) {
  ------------------
  |  Branch (671:21): [True: 0, False: 7]
  ------------------
  672|      0|                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  673|      0|                                       "unexpected \"%c\"", ch);
  674|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  675|      0|                }
  676|       |
  677|      7|                if (ch == '{') {
  ------------------
  |  Branch (677:21): [True: 7, False: 0]
  ------------------
  678|      7|                    return NGX_CONF_BLOCK_START;
  ------------------
  |  |   66|      7|#define NGX_CONF_BLOCK_START 1
  ------------------
  679|      7|                }
  680|       |
  681|      0|                return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  682|       |
  683|      7|            case '}':
  ------------------
  |  Branch (683:13): [True: 7, False: 134]
  ------------------
  684|      7|                if (cf->args->nelts != 0) {
  ------------------
  |  Branch (684:21): [True: 0, False: 7]
  ------------------
  685|      0|                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  686|      0|                                       "unexpected \"}\"");
  687|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  688|      0|                }
  689|       |
  690|      7|                return NGX_CONF_BLOCK_DONE;
  ------------------
  |  |   67|      7|#define NGX_CONF_BLOCK_DONE  2
  ------------------
  691|       |
  692|      0|            case '#':
  ------------------
  |  Branch (692:13): [True: 0, False: 141]
  ------------------
  693|      0|                sharp_comment = 1;
  694|      0|                continue;
  695|       |
  696|      0|            case '\\':
  ------------------
  |  Branch (696:13): [True: 0, False: 141]
  ------------------
  697|      0|                quoted = 1;
  698|      0|                last_space = 0;
  699|      0|                continue;
  700|       |
  701|      0|            case '"':
  ------------------
  |  Branch (701:13): [True: 0, False: 141]
  ------------------
  702|      0|                start++;
  703|      0|                d_quoted = 1;
  704|      0|                last_space = 0;
  705|      0|                continue;
  706|       |
  707|      2|            case '\'':
  ------------------
  |  Branch (707:13): [True: 2, False: 139]
  ------------------
  708|      2|                start++;
  709|      2|                s_quoted = 1;
  710|      2|                last_space = 0;
  711|      2|                continue;
  712|       |
  713|     10|            case '$':
  ------------------
  |  Branch (713:13): [True: 10, False: 131]
  ------------------
  714|     10|                variable = 1;
  715|     10|                last_space = 0;
  716|     10|                continue;
  717|       |
  718|    115|            default:
  ------------------
  |  Branch (718:13): [True: 115, False: 26]
  ------------------
  719|    115|                last_space = 0;
  720|    141|            }
  721|       |
  722|  1.25k|        } else {
  723|  1.25k|            if (ch == '{' && variable) {
  ------------------
  |  Branch (723:17): [True: 0, False: 1.25k]
  |  Branch (723:30): [True: 0, False: 0]
  ------------------
  724|      0|                continue;
  725|      0|            }
  726|       |
  727|  1.25k|            variable = 0;
  728|       |
  729|  1.25k|            if (ch == '\\') {
  ------------------
  |  Branch (729:17): [True: 1, False: 1.25k]
  ------------------
  730|      1|                quoted = 1;
  731|      1|                continue;
  732|      1|            }
  733|       |
  734|  1.25k|            if (ch == '$') {
  ------------------
  |  Branch (734:17): [True: 2, False: 1.25k]
  ------------------
  735|      2|                variable = 1;
  736|      2|                continue;
  737|      2|            }
  738|       |
  739|  1.25k|            if (d_quoted) {
  ------------------
  |  Branch (739:17): [True: 0, False: 1.25k]
  ------------------
  740|      0|                if (ch == '"') {
  ------------------
  |  Branch (740:21): [True: 0, False: 0]
  ------------------
  741|      0|                    d_quoted = 0;
  742|      0|                    need_space = 1;
  743|      0|                    found = 1;
  744|      0|                }
  745|       |
  746|  1.25k|            } else if (s_quoted) {
  ------------------
  |  Branch (746:24): [True: 2, False: 1.24k]
  ------------------
  747|      2|                if (ch == '\'') {
  ------------------
  |  Branch (747:21): [True: 2, False: 0]
  ------------------
  748|      2|                    s_quoted = 0;
  749|      2|                    need_space = 1;
  750|      2|                    found = 1;
  751|      2|                }
  752|       |
  753|  1.24k|            } else if (ch == ' ' || ch == '\t' || ch == CR || ch == LF
  ------------------
  |  |  104|  2.41k|#define CR     (u_char) '\r'
  ------------------
                          } else if (ch == ' ' || ch == '\t' || ch == CR || ch == LF
  ------------------
  |  |  103|  2.41k|#define LF     (u_char) '\n'
  ------------------
  |  Branch (753:24): [True: 79, False: 1.16k]
  |  Branch (753:37): [True: 0, False: 1.16k]
  |  Branch (753:51): [True: 0, False: 1.16k]
  |  Branch (753:63): [True: 0, False: 1.16k]
  ------------------
  754|  1.24k|                       || ch == ';' || ch == '{')
  ------------------
  |  Branch (754:27): [True: 46, False: 1.12k]
  |  Branch (754:40): [True: 0, False: 1.12k]
  ------------------
  755|    125|            {
  756|    125|                last_space = 1;
  757|    125|                found = 1;
  758|    125|            }
  759|       |
  760|  1.25k|            if (found) {
  ------------------
  |  Branch (760:17): [True: 127, False: 1.12k]
  ------------------
  761|    127|                word = ngx_array_push(cf->args);
  762|    127|                if (word == NULL) {
  ------------------
  |  Branch (762:21): [True: 0, False: 127]
  ------------------
  763|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  764|      0|                }
  765|       |
  766|    127|                word->data = ngx_pnalloc(cf->pool, b->pos - 1 - start + 1);
  767|    127|                if (word->data == NULL) {
  ------------------
  |  Branch (767:21): [True: 0, False: 127]
  ------------------
  768|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  769|      0|                }
  770|       |
  771|    127|                for (dst = word->data, src = start, len = 0;
  772|  1.37k|                     src < b->pos - 1;
  ------------------
  |  Branch (772:22): [True: 1.25k, False: 127]
  ------------------
  773|  1.25k|                     len++)
  774|  1.25k|                {
  775|  1.25k|                    if (*src == '\\') {
  ------------------
  |  Branch (775:25): [True: 1, False: 1.25k]
  ------------------
  776|      1|                        switch (src[1]) {
  ------------------
  |  Branch (776:33): [True: 1, False: 0]
  ------------------
  777|      0|                        case '"':
  ------------------
  |  Branch (777:25): [True: 0, False: 1]
  ------------------
  778|      0|                        case '\'':
  ------------------
  |  Branch (778:25): [True: 0, False: 1]
  ------------------
  779|      0|                        case '\\':
  ------------------
  |  Branch (779:25): [True: 0, False: 1]
  ------------------
  780|      0|                            src++;
  781|      0|                            break;
  782|       |
  783|      0|                        case 't':
  ------------------
  |  Branch (783:25): [True: 0, False: 1]
  ------------------
  784|      0|                            *dst++ = '\t';
  785|      0|                            src += 2;
  786|      0|                            continue;
  787|       |
  788|      0|                        case 'r':
  ------------------
  |  Branch (788:25): [True: 0, False: 1]
  ------------------
  789|      0|                            *dst++ = '\r';
  790|      0|                            src += 2;
  791|      0|                            continue;
  792|       |
  793|      0|                        case 'n':
  ------------------
  |  Branch (793:25): [True: 0, False: 1]
  ------------------
  794|      0|                            *dst++ = '\n';
  795|      0|                            src += 2;
  796|      0|                            continue;
  797|      1|                        }
  798|       |
  799|      1|                    }
  800|  1.25k|                    *dst++ = *src++;
  801|  1.25k|                }
  802|    127|                *dst = '\0';
  803|    127|                word->len = len;
  804|       |
  805|    127|                if (ch == ';') {
  ------------------
  |  Branch (805:21): [True: 46, False: 81]
  ------------------
  806|     46|                    return NGX_OK;
  ------------------
  |  |   38|     46|#define  NGX_OK          0
  ------------------
  807|     46|                }
  808|       |
  809|     81|                if (ch == '{') {
  ------------------
  |  Branch (809:21): [True: 0, False: 81]
  ------------------
  810|      0|                    return NGX_CONF_BLOCK_START;
  ------------------
  |  |   66|      0|#define NGX_CONF_BLOCK_START 1
  ------------------
  811|      0|                }
  812|       |
  813|     81|                found = 0;
  814|     81|            }
  815|  1.25k|        }
  816|  1.75k|    }
  817|     62|}

ngx_create_listening:
   22|      1|{
   23|      1|    size_t            len;
   24|      1|    ngx_listening_t  *ls;
   25|      1|    struct sockaddr  *sa;
   26|      1|    u_char            text[NGX_SOCKADDR_STRLEN];
   27|       |
   28|      1|    ls = ngx_array_push(&cf->cycle->listening);
   29|      1|    if (ls == NULL) {
  ------------------
  |  Branch (29:9): [True: 0, False: 1]
  ------------------
   30|      0|        return NULL;
   31|      0|    }
   32|       |
   33|      1|    ngx_memzero(ls, sizeof(ngx_listening_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
   34|       |
   35|      1|    sa = ngx_palloc(cf->pool, socklen);
   36|      1|    if (sa == NULL) {
  ------------------
  |  Branch (36:9): [True: 0, False: 1]
  ------------------
   37|      0|        return NULL;
   38|      0|    }
   39|       |
   40|      1|    ngx_memcpy(sa, sockaddr, socklen);
  ------------------
  |  |  106|      1|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
   41|       |
   42|      1|    ls->sockaddr = sa;
   43|      1|    ls->socklen = socklen;
   44|       |
   45|      1|    len = ngx_sock_ntop(sa, socklen, text, NGX_SOCKADDR_STRLEN, 1);
  ------------------
  |  |   24|      1|#define NGX_SOCKADDR_STRLEN   NGX_UNIX_ADDRSTRLEN
  |  |  ------------------
  |  |  |  |   20|      1|    (sizeof("unix:") - 1 +                                                   \
  |  |  |  |   21|      1|     sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path))
  |  |  ------------------
  ------------------
   46|      1|    ls->addr_text.len = len;
   47|       |
   48|      1|    switch (ls->sockaddr->sa_family) {
   49|      0|#if (NGX_HAVE_INET6)
   50|      0|    case AF_INET6:
  ------------------
  |  Branch (50:5): [True: 0, False: 1]
  ------------------
   51|      0|        ls->addr_text_max_len = NGX_INET6_ADDRSTRLEN;
  ------------------
  |  |   18|      0|    (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") - 1)
  ------------------
   52|      0|        break;
   53|      0|#endif
   54|      0|#if (NGX_HAVE_UNIX_DOMAIN)
   55|      1|    case AF_UNIX:
  ------------------
  |  Branch (55:5): [True: 1, False: 0]
  ------------------
   56|      1|        ls->addr_text_max_len = NGX_UNIX_ADDRSTRLEN;
  ------------------
  |  |   20|      1|    (sizeof("unix:") - 1 +                                                   \
  |  |   21|      1|     sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path))
  ------------------
   57|      1|        len++;
   58|      1|        break;
   59|      0|#endif
   60|      0|    case AF_INET:
  ------------------
  |  Branch (60:5): [True: 0, False: 1]
  ------------------
   61|      0|        ls->addr_text_max_len = NGX_INET_ADDRSTRLEN;
  ------------------
  |  |   16|      0|#define NGX_INET_ADDRSTRLEN   (sizeof("255.255.255.255") - 1)
  ------------------
   62|      0|        break;
   63|      0|    default:
  ------------------
  |  Branch (63:5): [True: 0, False: 1]
  ------------------
   64|      0|        ls->addr_text_max_len = NGX_SOCKADDR_STRLEN;
  ------------------
  |  |   24|      0|#define NGX_SOCKADDR_STRLEN   NGX_UNIX_ADDRSTRLEN
  |  |  ------------------
  |  |  |  |   20|      0|    (sizeof("unix:") - 1 +                                                   \
  |  |  |  |   21|      0|     sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path))
  |  |  ------------------
  ------------------
   65|      0|        break;
   66|      1|    }
   67|       |
   68|      1|    ls->addr_text.data = ngx_pnalloc(cf->pool, len);
   69|      1|    if (ls->addr_text.data == NULL) {
  ------------------
  |  Branch (69:9): [True: 0, False: 1]
  ------------------
   70|      0|        return NULL;
   71|      0|    }
   72|       |
   73|      1|    ngx_memcpy(ls->addr_text.data, text, len);
  ------------------
  |  |  106|      1|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
   74|       |
   75|      1|#if !(NGX_WIN32)
   76|      1|    ngx_rbtree_init(&ls->rbtree, &ls->sentinel, ngx_udp_rbtree_insert_value);
  ------------------
  |  |   45|      1|    ngx_rbtree_sentinel_init(s);                                              \
  |  |  ------------------
  |  |  |  |   73|      1|#define ngx_rbtree_sentinel_init(node)  ngx_rbt_black(node)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      1|#define ngx_rbt_black(node)             ((node)->color = 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   46|      1|    (tree)->root = s;                                                         \
  |  |   47|      1|    (tree)->sentinel = s;                                                     \
  |  |   48|      1|    (tree)->insert = i
  ------------------
   77|      1|#endif
   78|       |
   79|      1|    ls->fd = (ngx_socket_t) -1;
   80|      1|    ls->type = SOCK_STREAM;
   81|       |
   82|      1|    ls->backlog = NGX_LISTEN_BACKLOG;
  ------------------
  |  |  111|      1|#define NGX_LISTEN_BACKLOG        511
  ------------------
   83|      1|    ls->rcvbuf = -1;
   84|      1|    ls->sndbuf = -1;
   85|       |
   86|       |#if (NGX_HAVE_SETFIB)
   87|       |    ls->setfib = -1;
   88|       |#endif
   89|       |
   90|       |#if (NGX_HAVE_TCP_FASTOPEN)
   91|       |    ls->fastopen = -1;
   92|       |#endif
   93|       |
   94|      1|    return ls;
   95|      1|}
ngx_open_listening_sockets:
  408|      1|{
  409|      1|    int               reuseaddr;
  410|      1|    ngx_uint_t        i, tries, failed;
  411|      1|    ngx_err_t         err;
  412|      1|    ngx_log_t        *log;
  413|      1|    ngx_socket_t      s;
  414|      1|    ngx_listening_t  *ls;
  415|       |
  416|      1|    reuseaddr = 1;
  417|      1|#if (NGX_SUPPRESS_WARN)
  418|      1|    failed = 0;
  419|      1|#endif
  420|       |
  421|      1|    log = cycle->log;
  422|       |
  423|       |    /* TODO: configurable try number */
  424|       |
  425|      1|    for (tries = 5; tries; tries--) {
  ------------------
  |  Branch (425:21): [True: 1, False: 0]
  ------------------
  426|      1|        failed = 0;
  427|       |
  428|       |        /* for each listening socket */
  429|       |
  430|      1|        ls = cycle->listening.elts;
  431|      2|        for (i = 0; i < cycle->listening.nelts; i++) {
  ------------------
  |  Branch (431:21): [True: 1, False: 1]
  ------------------
  432|       |
  433|      1|            if (ls[i].ignore) {
  ------------------
  |  Branch (433:17): [True: 0, False: 1]
  ------------------
  434|      0|                continue;
  435|      0|            }
  436|       |
  437|       |#if (NGX_HAVE_REUSEPORT)
  438|       |
  439|       |            if (ls[i].add_reuseport) {
  440|       |
  441|       |                /*
  442|       |                 * to allow transition from a socket without SO_REUSEPORT
  443|       |                 * to multiple sockets with SO_REUSEPORT, we have to set
  444|       |                 * SO_REUSEPORT on the old socket before opening new ones
  445|       |                 */
  446|       |
  447|       |                int  reuseport = 1;
  448|       |
  449|       |#ifdef SO_REUSEPORT_LB
  450|       |
  451|       |                if (setsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT_LB,
  452|       |                               (const void *) &reuseport, sizeof(int))
  453|       |                    == -1)
  454|       |                {
  455|       |                    ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  456|       |                                  "setsockopt(SO_REUSEPORT_LB) %V failed, "
  457|       |                                  "ignored",
  458|       |                                  &ls[i].addr_text);
  459|       |                }
  460|       |
  461|       |#else
  462|       |
  463|       |                if (setsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT,
  464|       |                               (const void *) &reuseport, sizeof(int))
  465|       |                    == -1)
  466|       |                {
  467|       |                    ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  468|       |                                  "setsockopt(SO_REUSEPORT) %V failed, ignored",
  469|       |                                  &ls[i].addr_text);
  470|       |                }
  471|       |#endif
  472|       |
  473|       |                ls[i].add_reuseport = 0;
  474|       |            }
  475|       |#endif
  476|       |
  477|      1|            if (ls[i].fd != (ngx_socket_t) -1) {
  ------------------
  |  Branch (477:17): [True: 0, False: 1]
  ------------------
  478|      0|                continue;
  479|      0|            }
  480|       |
  481|      1|            if (ls[i].inherited) {
  ------------------
  |  Branch (481:17): [True: 0, False: 1]
  ------------------
  482|       |
  483|       |                /* TODO: close on exit */
  484|       |                /* TODO: nonblocking */
  485|       |                /* TODO: deferred accept */
  486|       |
  487|      0|                continue;
  488|      0|            }
  489|       |
  490|      1|            s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0);
  ------------------
  |  |   21|      1|#define ngx_socket          socket
  ------------------
  491|       |
  492|      1|            if (s == (ngx_socket_t) -1) {
  ------------------
  |  Branch (492:17): [True: 0, False: 1]
  ------------------
  493|      0|                ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  494|      0|                              ngx_socket_n " %V failed", &ls[i].addr_text);
  495|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  496|      0|            }
  497|       |
  498|      1|            if (ls[i].type != SOCK_DGRAM || !ngx_test_config) {
  ------------------
  |  Branch (498:17): [True: 1, False: 0]
  |  Branch (498:45): [True: 0, False: 0]
  ------------------
  499|       |
  500|      1|                if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
  ------------------
  |  Branch (500:21): [True: 0, False: 1]
  ------------------
  501|      1|                               (const void *) &reuseaddr, sizeof(int))
  502|      1|                    == -1)
  503|      0|                {
  504|      0|                    ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  505|      0|                                  "setsockopt(SO_REUSEADDR) %V failed",
  506|      0|                                  &ls[i].addr_text);
  507|       |
  508|      0|                    if (ngx_close_socket(s) == -1) {
  ------------------
  |  |   69|      0|#define ngx_close_socket    close
  ------------------
  |  Branch (508:25): [True: 0, False: 0]
  ------------------
  509|      0|                        ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  510|      0|                                      ngx_close_socket_n " %V failed",
  511|      0|                                      &ls[i].addr_text);
  512|      0|                    }
  513|       |
  514|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  515|      0|                }
  516|      1|            }
  517|       |
  518|       |#if (NGX_HAVE_REUSEPORT)
  519|       |
  520|       |            if (ls[i].reuseport && !ngx_test_config) {
  521|       |                int  reuseport;
  522|       |
  523|       |                reuseport = 1;
  524|       |
  525|       |#ifdef SO_REUSEPORT_LB
  526|       |
  527|       |                if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT_LB,
  528|       |                               (const void *) &reuseport, sizeof(int))
  529|       |                    == -1)
  530|       |                {
  531|       |                    ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  532|       |                                  "setsockopt(SO_REUSEPORT_LB) %V failed",
  533|       |                                  &ls[i].addr_text);
  534|       |
  535|       |                    if (ngx_close_socket(s) == -1) {
  536|       |                        ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  537|       |                                      ngx_close_socket_n " %V failed",
  538|       |                                      &ls[i].addr_text);
  539|       |                    }
  540|       |
  541|       |                    return NGX_ERROR;
  542|       |                }
  543|       |
  544|       |#else
  545|       |
  546|       |                if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT,
  547|       |                               (const void *) &reuseport, sizeof(int))
  548|       |                    == -1)
  549|       |                {
  550|       |                    ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  551|       |                                  "setsockopt(SO_REUSEPORT) %V failed",
  552|       |                                  &ls[i].addr_text);
  553|       |
  554|       |                    if (ngx_close_socket(s) == -1) {
  555|       |                        ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  556|       |                                      ngx_close_socket_n " %V failed",
  557|       |                                      &ls[i].addr_text);
  558|       |                    }
  559|       |
  560|       |                    return NGX_ERROR;
  561|       |                }
  562|       |#endif
  563|       |            }
  564|       |#endif
  565|       |
  566|      1|#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
  567|       |
  568|      1|            if (ls[i].sockaddr->sa_family == AF_INET6) {
  ------------------
  |  Branch (568:17): [True: 0, False: 1]
  ------------------
  569|      0|                int  ipv6only;
  570|       |
  571|      0|                ipv6only = ls[i].ipv6only;
  572|       |
  573|      0|                if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
  ------------------
  |  Branch (573:21): [True: 0, False: 0]
  ------------------
  574|      0|                               (const void *) &ipv6only, sizeof(int))
  575|      0|                    == -1)
  576|      0|                {
  577|      0|                    ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  578|      0|                                  "setsockopt(IPV6_V6ONLY) %V failed, ignored",
  579|      0|                                  &ls[i].addr_text);
  580|      0|                }
  581|      0|            }
  582|      1|#endif
  583|       |            /* TODO: close on exit */
  584|       |
  585|      1|            if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) {
  ------------------
  |  |  245|      1|#define NGX_USE_IOCP_EVENT       0x00000200
  ------------------
  |  Branch (585:17): [True: 1, False: 0]
  ------------------
  586|      1|                if (ngx_nonblocking(s) == -1) {
  ------------------
  |  Branch (586:21): [True: 0, False: 1]
  ------------------
  587|      0|                    ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  588|      0|                                  ngx_nonblocking_n " %V failed",
  589|      0|                                  &ls[i].addr_text);
  590|       |
  591|      0|                    if (ngx_close_socket(s) == -1) {
  ------------------
  |  |   69|      0|#define ngx_close_socket    close
  ------------------
  |  Branch (591:25): [True: 0, False: 0]
  ------------------
  592|      0|                        ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  593|      0|                                      ngx_close_socket_n " %V failed",
  594|      0|                                      &ls[i].addr_text);
  595|      0|                    }
  596|       |
  597|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  598|      0|                }
  599|      1|            }
  600|       |
  601|      1|            ngx_log_debug2(NGX_LOG_DEBUG_CORE, log, 0,
  602|      1|                           "bind() %V #%d ", &ls[i].addr_text, s);
  603|       |
  604|      1|            if (bind(s, ls[i].sockaddr, ls[i].socklen) == -1) {
  ------------------
  |  Branch (604:17): [True: 0, False: 1]
  ------------------
  605|      0|                err = ngx_socket_errno;
  ------------------
  |  |   70|      0|#define ngx_socket_errno           errno
  ------------------
  606|       |
  607|      0|                if (err != NGX_EADDRINUSE || !ngx_test_config) {
  ------------------
  |  |   40|      0|#define NGX_EADDRINUSE    EADDRINUSE
  ------------------
  |  Branch (607:21): [True: 0, False: 0]
  |  Branch (607:46): [True: 0, False: 0]
  ------------------
  608|      0|                    ngx_log_error(NGX_LOG_EMERG, log, err,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  609|      0|                                  "bind() to %V failed", &ls[i].addr_text);
  610|      0|                }
  611|       |
  612|      0|                if (ngx_close_socket(s) == -1) {
  ------------------
  |  |   69|      0|#define ngx_close_socket    close
  ------------------
  |  Branch (612:21): [True: 0, False: 0]
  ------------------
  613|      0|                    ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  614|      0|                                  ngx_close_socket_n " %V failed",
  615|      0|                                  &ls[i].addr_text);
  616|      0|                }
  617|       |
  618|      0|                if (err != NGX_EADDRINUSE) {
  ------------------
  |  |   40|      0|#define NGX_EADDRINUSE    EADDRINUSE
  ------------------
  |  Branch (618:21): [True: 0, False: 0]
  ------------------
  619|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  620|      0|                }
  621|       |
  622|      0|                if (!ngx_test_config) {
  ------------------
  |  Branch (622:21): [True: 0, False: 0]
  ------------------
  623|      0|                    failed = 1;
  624|      0|                }
  625|       |
  626|      0|                continue;
  627|      0|            }
  628|       |
  629|      1|#if (NGX_HAVE_UNIX_DOMAIN)
  630|       |
  631|      1|            if (ls[i].sockaddr->sa_family == AF_UNIX) {
  ------------------
  |  Branch (631:17): [True: 1, False: 0]
  ------------------
  632|      1|                mode_t   mode;
  633|      1|                u_char  *name;
  634|       |
  635|      1|                name = ls[i].addr_text.data + sizeof("unix:") - 1;
  636|      1|                mode = (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
  637|       |
  638|      1|                if (chmod((char *) name, mode) == -1) {
  ------------------
  |  Branch (638:21): [True: 0, False: 1]
  ------------------
  639|      0|                    ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  640|      0|                                  "chmod() \"%s\" failed", name);
  641|      0|                }
  642|       |
  643|      1|                if (ngx_test_config) {
  ------------------
  |  Branch (643:21): [True: 0, False: 1]
  ------------------
  644|      0|                    if (ngx_delete_file(name) == NGX_FILE_ERROR) {
  ------------------
  |  |  113|      0|#define ngx_delete_file(name)    unlink((const char *) name)
  ------------------
                                  if (ngx_delete_file(name) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      0|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (644:25): [True: 0, False: 0]
  ------------------
  645|      0|                        ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  646|      0|                                      ngx_delete_file_n " %s failed", name);
  647|      0|                    }
  648|      0|                }
  649|      1|            }
  650|      1|#endif
  651|       |
  652|      1|            if (ls[i].type != SOCK_STREAM) {
  ------------------
  |  Branch (652:17): [True: 0, False: 1]
  ------------------
  653|      0|                ls[i].fd = s;
  654|      0|                continue;
  655|      0|            }
  656|       |
  657|      1|            if (listen(s, ls[i].backlog) == -1) {
  ------------------
  |  Branch (657:17): [True: 0, False: 1]
  ------------------
  658|      0|                err = ngx_socket_errno;
  ------------------
  |  |   70|      0|#define ngx_socket_errno           errno
  ------------------
  659|       |
  660|       |                /*
  661|       |                 * on OpenVZ after suspend/resume EADDRINUSE
  662|       |                 * may be returned by listen() instead of bind(), see
  663|       |                 * https://bugs.openvz.org/browse/OVZ-5587
  664|       |                 */
  665|       |
  666|      0|                if (err != NGX_EADDRINUSE || !ngx_test_config) {
  ------------------
  |  |   40|      0|#define NGX_EADDRINUSE    EADDRINUSE
  ------------------
  |  Branch (666:21): [True: 0, False: 0]
  |  Branch (666:46): [True: 0, False: 0]
  ------------------
  667|      0|                    ngx_log_error(NGX_LOG_EMERG, log, err,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  668|      0|                                  "listen() to %V, backlog %d failed",
  669|      0|                                  &ls[i].addr_text, ls[i].backlog);
  670|      0|                }
  671|       |
  672|      0|                if (ngx_close_socket(s) == -1) {
  ------------------
  |  |   69|      0|#define ngx_close_socket    close
  ------------------
  |  Branch (672:21): [True: 0, False: 0]
  ------------------
  673|      0|                    ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  674|      0|                                  ngx_close_socket_n " %V failed",
  675|      0|                                  &ls[i].addr_text);
  676|      0|                }
  677|       |
  678|      0|                if (err != NGX_EADDRINUSE) {
  ------------------
  |  |   40|      0|#define NGX_EADDRINUSE    EADDRINUSE
  ------------------
  |  Branch (678:21): [True: 0, False: 0]
  ------------------
  679|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  680|      0|                }
  681|       |
  682|      0|                if (!ngx_test_config) {
  ------------------
  |  Branch (682:21): [True: 0, False: 0]
  ------------------
  683|      0|                    failed = 1;
  684|      0|                }
  685|       |
  686|      0|                continue;
  687|      0|            }
  688|       |
  689|      1|            ls[i].listen = 1;
  690|       |
  691|      1|            ls[i].fd = s;
  692|      1|        }
  693|       |
  694|      1|        if (!failed) {
  ------------------
  |  Branch (694:13): [True: 1, False: 0]
  ------------------
  695|      1|            break;
  696|      1|        }
  697|       |
  698|       |        /* TODO: delay configurable */
  699|       |
  700|      0|        ngx_log_error(NGX_LOG_NOTICE, log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  701|      0|                      "try again to bind() after 500ms");
  702|       |
  703|      0|        ngx_msleep(500);
  ------------------
  |  |   62|      0|#define ngx_msleep(ms)        (void) usleep(ms * 1000)
  ------------------
  704|      0|    }
  705|       |
  706|      1|    if (failed) {
  ------------------
  |  Branch (706:9): [True: 0, False: 1]
  ------------------
  707|      0|        ngx_log_error(NGX_LOG_EMERG, log, 0, "still could not bind()");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  708|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  709|      0|    }
  710|       |
  711|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  712|      1|}
ngx_configure_listening_sockets:
  717|      1|{
  718|      1|    int                        value;
  719|      1|    ngx_uint_t                 i;
  720|      1|    ngx_listening_t           *ls;
  721|       |
  722|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
  723|       |    struct accept_filter_arg   af;
  724|       |#endif
  725|       |
  726|      1|    ls = cycle->listening.elts;
  727|      2|    for (i = 0; i < cycle->listening.nelts; i++) {
  ------------------
  |  Branch (727:17): [True: 1, False: 1]
  ------------------
  728|       |
  729|      1|        ls[i].log = *ls[i].logp;
  730|       |
  731|      1|        if (ls[i].rcvbuf != -1) {
  ------------------
  |  Branch (731:13): [True: 0, False: 1]
  ------------------
  732|      0|            if (setsockopt(ls[i].fd, SOL_SOCKET, SO_RCVBUF,
  ------------------
  |  Branch (732:17): [True: 0, False: 0]
  ------------------
  733|      0|                           (const void *) &ls[i].rcvbuf, sizeof(int))
  734|      0|                == -1)
  735|      0|            {
  736|      0|                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  737|      0|                              "setsockopt(SO_RCVBUF, %d) %V failed, ignored",
  738|      0|                              ls[i].rcvbuf, &ls[i].addr_text);
  739|      0|            }
  740|      0|        }
  741|       |
  742|      1|        if (ls[i].sndbuf != -1) {
  ------------------
  |  Branch (742:13): [True: 0, False: 1]
  ------------------
  743|      0|            if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SNDBUF,
  ------------------
  |  Branch (743:17): [True: 0, False: 0]
  ------------------
  744|      0|                           (const void *) &ls[i].sndbuf, sizeof(int))
  745|      0|                == -1)
  746|      0|            {
  747|      0|                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  748|      0|                              "setsockopt(SO_SNDBUF, %d) %V failed, ignored",
  749|      0|                              ls[i].sndbuf, &ls[i].addr_text);
  750|      0|            }
  751|      0|        }
  752|       |
  753|      1|        if (ls[i].keepalive) {
  ------------------
  |  Branch (753:13): [True: 0, False: 1]
  ------------------
  754|      0|            value = (ls[i].keepalive == 1) ? 1 : 0;
  ------------------
  |  Branch (754:21): [True: 0, False: 0]
  ------------------
  755|       |
  756|      0|            if (setsockopt(ls[i].fd, SOL_SOCKET, SO_KEEPALIVE,
  ------------------
  |  Branch (756:17): [True: 0, False: 0]
  ------------------
  757|      0|                           (const void *) &value, sizeof(int))
  758|      0|                == -1)
  759|      0|            {
  760|      0|                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  761|      0|                              "setsockopt(SO_KEEPALIVE, %d) %V failed, ignored",
  762|      0|                              value, &ls[i].addr_text);
  763|      0|            }
  764|      0|        }
  765|       |
  766|       |#if (NGX_HAVE_KEEPALIVE_TUNABLE)
  767|       |
  768|       |        if (ls[i].keepidle) {
  769|       |            value = ls[i].keepidle;
  770|       |
  771|       |#if (NGX_KEEPALIVE_FACTOR)
  772|       |            value *= NGX_KEEPALIVE_FACTOR;
  773|       |#endif
  774|       |
  775|       |            if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPIDLE,
  776|       |                           (const void *) &value, sizeof(int))
  777|       |                == -1)
  778|       |            {
  779|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  780|       |                              "setsockopt(TCP_KEEPIDLE, %d) %V failed, ignored",
  781|       |                              value, &ls[i].addr_text);
  782|       |            }
  783|       |        }
  784|       |
  785|       |        if (ls[i].keepintvl) {
  786|       |            value = ls[i].keepintvl;
  787|       |
  788|       |#if (NGX_KEEPALIVE_FACTOR)
  789|       |            value *= NGX_KEEPALIVE_FACTOR;
  790|       |#endif
  791|       |
  792|       |            if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPINTVL,
  793|       |                           (const void *) &value, sizeof(int))
  794|       |                == -1)
  795|       |            {
  796|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  797|       |                             "setsockopt(TCP_KEEPINTVL, %d) %V failed, ignored",
  798|       |                             value, &ls[i].addr_text);
  799|       |            }
  800|       |        }
  801|       |
  802|       |        if (ls[i].keepcnt) {
  803|       |            if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPCNT,
  804|       |                           (const void *) &ls[i].keepcnt, sizeof(int))
  805|       |                == -1)
  806|       |            {
  807|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  808|       |                              "setsockopt(TCP_KEEPCNT, %d) %V failed, ignored",
  809|       |                              ls[i].keepcnt, &ls[i].addr_text);
  810|       |            }
  811|       |        }
  812|       |
  813|       |#endif
  814|       |
  815|       |#if (NGX_HAVE_SETFIB)
  816|       |        if (ls[i].setfib != -1) {
  817|       |            if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SETFIB,
  818|       |                           (const void *) &ls[i].setfib, sizeof(int))
  819|       |                == -1)
  820|       |            {
  821|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  822|       |                              "setsockopt(SO_SETFIB, %d) %V failed, ignored",
  823|       |                              ls[i].setfib, &ls[i].addr_text);
  824|       |            }
  825|       |        }
  826|       |#endif
  827|       |
  828|       |#if (NGX_HAVE_TCP_FASTOPEN)
  829|       |        if (ls[i].fastopen != -1) {
  830|       |            if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_FASTOPEN,
  831|       |                           (const void *) &ls[i].fastopen, sizeof(int))
  832|       |                == -1)
  833|       |            {
  834|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  835|       |                              "setsockopt(TCP_FASTOPEN, %d) %V failed, ignored",
  836|       |                              ls[i].fastopen, &ls[i].addr_text);
  837|       |            }
  838|       |        }
  839|       |#endif
  840|       |
  841|       |#if 0
  842|       |        if (1) {
  843|       |            int tcp_nodelay = 1;
  844|       |
  845|       |            if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_NODELAY,
  846|       |                       (const void *) &tcp_nodelay, sizeof(int))
  847|       |                == -1)
  848|       |            {
  849|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  850|       |                              "setsockopt(TCP_NODELAY) %V failed, ignored",
  851|       |                              &ls[i].addr_text);
  852|       |            }
  853|       |        }
  854|       |#endif
  855|       |
  856|      1|        if (ls[i].listen) {
  ------------------
  |  Branch (856:13): [True: 1, False: 0]
  ------------------
  857|       |
  858|       |            /* change backlog via listen() */
  859|       |
  860|      1|            if (listen(ls[i].fd, ls[i].backlog) == -1) {
  ------------------
  |  Branch (860:17): [True: 0, False: 1]
  ------------------
  861|      0|                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  862|      0|                              "listen() to %V, backlog %d failed, ignored",
  863|      0|                              &ls[i].addr_text, ls[i].backlog);
  864|      0|            }
  865|      1|        }
  866|       |
  867|       |        /*
  868|       |         * setting deferred mode should be last operation on socket,
  869|       |         * because code may prematurely continue cycle on failure
  870|       |         */
  871|       |
  872|       |#if (NGX_HAVE_DEFERRED_ACCEPT)
  873|       |
  874|       |#ifdef SO_ACCEPTFILTER
  875|       |
  876|       |        if (ls[i].delete_deferred) {
  877|       |            if (setsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)
  878|       |                == -1)
  879|       |            {
  880|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  881|       |                              "setsockopt(SO_ACCEPTFILTER, NULL) "
  882|       |                              "for %V failed, ignored",
  883|       |                              &ls[i].addr_text);
  884|       |
  885|       |                if (ls[i].accept_filter) {
  886|       |                    ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
  887|       |                                  "could not change the accept filter "
  888|       |                                  "to \"%s\" for %V, ignored",
  889|       |                                  ls[i].accept_filter, &ls[i].addr_text);
  890|       |                }
  891|       |
  892|       |                continue;
  893|       |            }
  894|       |
  895|       |            ls[i].deferred_accept = 0;
  896|       |        }
  897|       |
  898|       |        if (ls[i].add_deferred) {
  899|       |            ngx_memzero(&af, sizeof(struct accept_filter_arg));
  900|       |            (void) ngx_cpystrn((u_char *) af.af_name,
  901|       |                               (u_char *) ls[i].accept_filter, 16);
  902|       |
  903|       |            if (setsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER,
  904|       |                           &af, sizeof(struct accept_filter_arg))
  905|       |                == -1)
  906|       |            {
  907|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  908|       |                              "setsockopt(SO_ACCEPTFILTER, \"%s\") "
  909|       |                              "for %V failed, ignored",
  910|       |                              ls[i].accept_filter, &ls[i].addr_text);
  911|       |                continue;
  912|       |            }
  913|       |
  914|       |            ls[i].deferred_accept = 1;
  915|       |        }
  916|       |
  917|       |#endif
  918|       |
  919|       |#ifdef TCP_DEFER_ACCEPT
  920|       |
  921|       |        if (ls[i].add_deferred || ls[i].delete_deferred) {
  922|       |
  923|       |            if (ls[i].add_deferred) {
  924|       |                /*
  925|       |                 * There is no way to find out how long a connection was
  926|       |                 * in queue (and a connection may bypass deferred queue at all
  927|       |                 * if syncookies were used), hence we use 1 second timeout
  928|       |                 * here.
  929|       |                 */
  930|       |                value = 1;
  931|       |
  932|       |            } else {
  933|       |                value = 0;
  934|       |            }
  935|       |
  936|       |            if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_DEFER_ACCEPT,
  937|       |                           &value, sizeof(int))
  938|       |                == -1)
  939|       |            {
  940|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  941|       |                              "setsockopt(TCP_DEFER_ACCEPT, %d) for %V failed, "
  942|       |                              "ignored",
  943|       |                              value, &ls[i].addr_text);
  944|       |
  945|       |                continue;
  946|       |            }
  947|       |        }
  948|       |
  949|       |        if (ls[i].add_deferred) {
  950|       |            ls[i].deferred_accept = 1;
  951|       |        }
  952|       |
  953|       |#endif
  954|       |
  955|       |#endif /* NGX_HAVE_DEFERRED_ACCEPT */
  956|       |
  957|       |#if (NGX_HAVE_IP_RECVDSTADDR)
  958|       |
  959|       |        if (ls[i].wildcard
  960|       |            && ls[i].type == SOCK_DGRAM
  961|       |            && ls[i].sockaddr->sa_family == AF_INET)
  962|       |        {
  963|       |            value = 1;
  964|       |
  965|       |            if (setsockopt(ls[i].fd, IPPROTO_IP, IP_RECVDSTADDR,
  966|       |                           (const void *) &value, sizeof(int))
  967|       |                == -1)
  968|       |            {
  969|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  970|       |                              "setsockopt(IP_RECVDSTADDR) "
  971|       |                              "for %V failed, ignored",
  972|       |                              &ls[i].addr_text);
  973|       |            }
  974|       |        }
  975|       |
  976|       |#elif (NGX_HAVE_IP_PKTINFO)
  977|       |
  978|       |        if (ls[i].wildcard
  979|       |            && ls[i].type == SOCK_DGRAM
  980|       |            && ls[i].sockaddr->sa_family == AF_INET)
  981|       |        {
  982|       |            value = 1;
  983|       |
  984|       |            if (setsockopt(ls[i].fd, IPPROTO_IP, IP_PKTINFO,
  985|       |                           (const void *) &value, sizeof(int))
  986|       |                == -1)
  987|       |            {
  988|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
  989|       |                              "setsockopt(IP_PKTINFO) "
  990|       |                              "for %V failed, ignored",
  991|       |                              &ls[i].addr_text);
  992|       |            }
  993|       |        }
  994|       |
  995|       |#endif
  996|       |
  997|       |#if (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO)
  998|       |
  999|       |        if (ls[i].wildcard
 1000|       |            && ls[i].type == SOCK_DGRAM
 1001|       |            && ls[i].sockaddr->sa_family == AF_INET6)
 1002|       |        {
 1003|       |            value = 1;
 1004|       |
 1005|       |            if (setsockopt(ls[i].fd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
 1006|       |                           (const void *) &value, sizeof(int))
 1007|       |                == -1)
 1008|       |            {
 1009|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
 1010|       |                              "setsockopt(IPV6_RECVPKTINFO) "
 1011|       |                              "for %V failed, ignored",
 1012|       |                              &ls[i].addr_text);
 1013|       |            }
 1014|       |        }
 1015|       |
 1016|       |#endif
 1017|       |
 1018|       |#if (NGX_HAVE_IP_MTU_DISCOVER)
 1019|       |
 1020|       |        if (ls[i].quic && ls[i].sockaddr->sa_family == AF_INET) {
 1021|       |            value = IP_PMTUDISC_DO;
 1022|       |
 1023|       |            if (setsockopt(ls[i].fd, IPPROTO_IP, IP_MTU_DISCOVER,
 1024|       |                           (const void *) &value, sizeof(int))
 1025|       |                == -1)
 1026|       |            {
 1027|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
 1028|       |                              "setsockopt(IP_MTU_DISCOVER) "
 1029|       |                              "for %V failed, ignored",
 1030|       |                              &ls[i].addr_text);
 1031|       |            }
 1032|       |        }
 1033|       |
 1034|       |#elif (NGX_HAVE_IP_DONTFRAG)
 1035|       |
 1036|       |        if (ls[i].quic && ls[i].sockaddr->sa_family == AF_INET) {
 1037|       |            value = 1;
 1038|       |
 1039|       |            if (setsockopt(ls[i].fd, IPPROTO_IP, IP_DONTFRAG,
 1040|       |                           (const void *) &value, sizeof(int))
 1041|       |                == -1)
 1042|       |            {
 1043|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
 1044|       |                              "setsockopt(IP_DONTFRAG) "
 1045|       |                              "for %V failed, ignored",
 1046|       |                              &ls[i].addr_text);
 1047|       |            }
 1048|       |        }
 1049|       |
 1050|       |#endif
 1051|       |
 1052|      1|#if (NGX_HAVE_INET6)
 1053|       |
 1054|       |#if (NGX_HAVE_IPV6_MTU_DISCOVER)
 1055|       |
 1056|       |        if (ls[i].quic && ls[i].sockaddr->sa_family == AF_INET6) {
 1057|       |            value = IPV6_PMTUDISC_DO;
 1058|       |
 1059|       |            if (setsockopt(ls[i].fd, IPPROTO_IPV6, IPV6_MTU_DISCOVER,
 1060|       |                           (const void *) &value, sizeof(int))
 1061|       |                == -1)
 1062|       |            {
 1063|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
 1064|       |                              "setsockopt(IPV6_MTU_DISCOVER) "
 1065|       |                              "for %V failed, ignored",
 1066|       |                              &ls[i].addr_text);
 1067|       |            }
 1068|       |        }
 1069|       |
 1070|       |#elif (NGX_HAVE_IP_DONTFRAG)
 1071|       |
 1072|       |        if (ls[i].quic && ls[i].sockaddr->sa_family == AF_INET6) {
 1073|       |            value = 1;
 1074|       |
 1075|       |            if (setsockopt(ls[i].fd, IPPROTO_IPV6, IPV6_DONTFRAG,
 1076|       |                           (const void *) &value, sizeof(int))
 1077|       |                == -1)
 1078|       |            {
 1079|       |                ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
 1080|       |                              "setsockopt(IPV6_DONTFRAG) "
 1081|       |                              "for %V failed, ignored",
 1082|       |                              &ls[i].addr_text);
 1083|       |            }
 1084|       |        }
 1085|       |
 1086|       |#endif
 1087|       |
 1088|      1|#endif
 1089|      1|    }
 1090|       |
 1091|      1|    return;
 1092|      1|}
ngx_get_connection:
 1176|     21|{
 1177|     21|    ngx_uint_t         instance;
 1178|     21|    ngx_event_t       *rev, *wev;
 1179|     21|    ngx_connection_t  *c;
 1180|       |
 1181|       |    /* disable warning: Win32 SOCKET is u_int while UNIX socket is int */
 1182|       |
 1183|     21|    if (ngx_cycle->files && (ngx_uint_t) s >= ngx_cycle->files_n) {
  ------------------
  |  Branch (1183:9): [True: 0, False: 21]
  |  Branch (1183:29): [True: 0, False: 0]
  ------------------
 1184|      0|        ngx_log_error(NGX_LOG_ALERT, log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1185|      0|                      "the new socket has number %d, "
 1186|      0|                      "but only %ui files are available",
 1187|      0|                      s, ngx_cycle->files_n);
 1188|      0|        return NULL;
 1189|      0|    }
 1190|       |
 1191|     21|    ngx_drain_connections((ngx_cycle_t *) ngx_cycle);
 1192|       |
 1193|     21|    c = ngx_cycle->free_connections;
 1194|       |
 1195|     21|    if (c == NULL) {
  ------------------
  |  Branch (1195:9): [True: 0, False: 21]
  ------------------
 1196|      0|        ngx_log_error(NGX_LOG_ALERT, log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1197|      0|                      "%ui worker_connections are not enough",
 1198|      0|                      ngx_cycle->connection_n);
 1199|       |
 1200|      0|        return NULL;
 1201|      0|    }
 1202|       |
 1203|     21|    ngx_cycle->free_connections = c->data;
 1204|     21|    ngx_cycle->free_connection_n--;
 1205|       |
 1206|     21|    if (ngx_cycle->files && ngx_cycle->files[s] == NULL) {
  ------------------
  |  Branch (1206:9): [True: 0, False: 21]
  |  Branch (1206:29): [True: 0, False: 0]
  ------------------
 1207|      0|        ngx_cycle->files[s] = c;
 1208|      0|    }
 1209|       |
 1210|     21|    rev = c->read;
 1211|     21|    wev = c->write;
 1212|       |
 1213|     21|    ngx_memzero(c, sizeof(ngx_connection_t));
  ------------------
  |  |   88|     21|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1214|       |
 1215|     21|    c->read = rev;
 1216|     21|    c->write = wev;
 1217|     21|    c->fd = s;
 1218|     21|    c->log = log;
 1219|       |
 1220|     21|    instance = rev->instance;
 1221|       |
 1222|     21|    ngx_memzero(rev, sizeof(ngx_event_t));
  ------------------
  |  |   88|     21|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1223|     21|    ngx_memzero(wev, sizeof(ngx_event_t));
  ------------------
  |  |   88|     21|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1224|       |
 1225|     21|    rev->instance = !instance;
 1226|     21|    wev->instance = !instance;
 1227|       |
 1228|     21|    rev->index = NGX_INVALID_INDEX;
  ------------------
  |  |   16|     21|#define NGX_INVALID_INDEX  0xd0d0d0d0
  ------------------
 1229|     21|    wev->index = NGX_INVALID_INDEX;
  ------------------
  |  |   16|     21|#define NGX_INVALID_INDEX  0xd0d0d0d0
  ------------------
 1230|       |
 1231|     21|    rev->data = c;
 1232|     21|    wev->data = c;
 1233|       |
 1234|     21|    wev->write = 1;
 1235|       |
 1236|     21|    return c;
 1237|     21|}
ngx_free_connection:
 1242|     16|{
 1243|     16|    c->data = ngx_cycle->free_connections;
 1244|     16|    ngx_cycle->free_connections = c;
 1245|     16|    ngx_cycle->free_connection_n++;
 1246|       |
 1247|     16|    if (ngx_cycle->files && ngx_cycle->files[c->fd] == c) {
  ------------------
  |  Branch (1247:9): [True: 0, False: 16]
  |  Branch (1247:29): [True: 0, False: 0]
  ------------------
 1248|      0|        ngx_cycle->files[c->fd] = NULL;
 1249|      0|    }
 1250|     16|}
ngx_close_connection:
 1255|     23|{
 1256|     23|    ngx_err_t     err;
 1257|     23|    ngx_uint_t    log_error, level;
 1258|     23|    ngx_socket_t  fd;
 1259|       |
 1260|     23|    if (c->fd == (ngx_socket_t) -1) {
  ------------------
  |  Branch (1260:9): [True: 7, False: 16]
  ------------------
 1261|      7|        ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed");
  ------------------
  |  |   86|      7|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 7]
  |  |  ------------------
  ------------------
 1262|      7|        return;
 1263|      7|    }
 1264|       |
 1265|     16|    if (c->read->timer_set) {
  ------------------
  |  Branch (1265:9): [True: 7, False: 9]
  ------------------
 1266|      7|        ngx_del_timer(c->read);
  ------------------
  |  |  411|      7|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 1267|      7|    }
 1268|       |
 1269|     16|    if (c->write->timer_set) {
  ------------------
  |  Branch (1269:9): [True: 0, False: 16]
  ------------------
 1270|      0|        ngx_del_timer(c->write);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 1271|      0|    }
 1272|       |
 1273|     16|    if (!c->shared) {
  ------------------
  |  Branch (1273:9): [True: 0, False: 16]
  ------------------
 1274|      0|        if (ngx_del_conn) {
  ------------------
  |  |  406|      0|#define ngx_del_conn         ngx_event_actions.del_conn
  |  |  ------------------
  |  |  |  Branch (406:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1275|      0|            ngx_del_conn(c, NGX_CLOSE_EVENT);
  ------------------
  |  |  406|      0|#define ngx_del_conn         ngx_event_actions.del_conn
  ------------------
                          ngx_del_conn(c, NGX_CLOSE_EVENT);
  ------------------
  |  |  281|      0|#define NGX_CLOSE_EVENT    1
  ------------------
 1276|       |
 1277|      0|        } else {
 1278|      0|            if (c->read->active || c->read->disabled) {
  ------------------
  |  Branch (1278:17): [True: 0, False: 0]
  |  Branch (1278:36): [True: 0, False: 0]
  ------------------
 1279|      0|                ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT);
  ------------------
  |  |  404|      0|#define ngx_del_event        ngx_event_actions.del
  ------------------
                              ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT);
  ------------------
  |  |  349|      0|#define NGX_READ_EVENT     (EPOLLIN|EPOLLRDHUP)
  ------------------
                              ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT);
  ------------------
  |  |  281|      0|#define NGX_CLOSE_EVENT    1
  ------------------
 1280|      0|            }
 1281|       |
 1282|      0|            if (c->write->active || c->write->disabled) {
  ------------------
  |  Branch (1282:17): [True: 0, False: 0]
  |  Branch (1282:37): [True: 0, False: 0]
  ------------------
 1283|      0|                ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT);
  ------------------
  |  |  404|      0|#define ngx_del_event        ngx_event_actions.del
  ------------------
                              ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT);
  ------------------
  |  |  350|      0|#define NGX_WRITE_EVENT    EPOLLOUT
  ------------------
                              ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT);
  ------------------
  |  |  281|      0|#define NGX_CLOSE_EVENT    1
  ------------------
 1284|      0|            }
 1285|      0|        }
 1286|      0|    }
 1287|       |
 1288|     16|    if (c->read->posted) {
  ------------------
  |  Branch (1288:9): [True: 5, False: 11]
  ------------------
 1289|      5|        ngx_delete_posted_event(c->read);
  ------------------
  |  |   33|      5|    (ev)->posted = 0;                                                         \
  |  |   34|      5|    ngx_queue_remove(&(ev)->queue);                                           \
  |  |  ------------------
  |  |  |  |   81|      5|    (x)->next->prev = (x)->prev;                                              \
  |  |  |  |   82|      5|    (x)->prev->next = (x)->next
  |  |  ------------------
  |  |   35|      5|                                                                              \
  |  |   36|      5|    ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                          \
  |  |   37|      5|                   "delete posted event %p", ev);
  ------------------
 1290|      5|    }
 1291|       |
 1292|     16|    if (c->write->posted) {
  ------------------
  |  Branch (1292:9): [True: 0, False: 16]
  ------------------
 1293|      0|        ngx_delete_posted_event(c->write);
  ------------------
  |  |   33|      0|    (ev)->posted = 0;                                                         \
  |  |   34|      0|    ngx_queue_remove(&(ev)->queue);                                           \
  |  |  ------------------
  |  |  |  |   81|      0|    (x)->next->prev = (x)->prev;                                              \
  |  |  |  |   82|      0|    (x)->prev->next = (x)->next
  |  |  ------------------
  |  |   35|      0|                                                                              \
  |  |   36|      0|    ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                          \
  |  |   37|      0|                   "delete posted event %p", ev);
  ------------------
 1294|      0|    }
 1295|       |
 1296|     16|    c->read->closed = 1;
 1297|     16|    c->write->closed = 1;
 1298|       |
 1299|     16|    ngx_reusable_connection(c, 0);
 1300|       |
 1301|     16|    log_error = c->log_error;
 1302|       |
 1303|     16|    ngx_free_connection(c);
 1304|       |
 1305|     16|    fd = c->fd;
 1306|     16|    c->fd = (ngx_socket_t) -1;
 1307|       |
 1308|     16|    if (c->shared) {
  ------------------
  |  Branch (1308:9): [True: 16, False: 0]
  ------------------
 1309|     16|        return;
 1310|     16|    }
 1311|       |
 1312|      0|    if (ngx_close_socket(fd) == -1) {
  ------------------
  |  |   69|      0|#define ngx_close_socket    close
  ------------------
  |  Branch (1312:9): [True: 0, False: 0]
  ------------------
 1313|       |
 1314|      0|        err = ngx_socket_errno;
  ------------------
  |  |   70|      0|#define ngx_socket_errno           errno
  ------------------
 1315|       |
 1316|      0|        if (err == NGX_ECONNRESET || err == NGX_ENOTCONN) {
  ------------------
  |  |   42|      0|#define NGX_ECONNRESET    ECONNRESET
  ------------------
                      if (err == NGX_ECONNRESET || err == NGX_ENOTCONN) {
  ------------------
  |  |   43|      0|#define NGX_ENOTCONN      ENOTCONN
  ------------------
  |  Branch (1316:13): [True: 0, False: 0]
  |  Branch (1316:38): [True: 0, False: 0]
  ------------------
 1317|       |
 1318|      0|            switch (log_error) {
 1319|       |
 1320|      0|            case NGX_ERROR_INFO:
  ------------------
  |  Branch (1320:13): [True: 0, False: 0]
  ------------------
 1321|      0|                level = NGX_LOG_INFO;
  ------------------
  |  |   23|      0|#define NGX_LOG_INFO              7
  ------------------
 1322|      0|                break;
 1323|       |
 1324|      0|            case NGX_ERROR_ERR:
  ------------------
  |  Branch (1324:13): [True: 0, False: 0]
  ------------------
 1325|      0|                level = NGX_LOG_ERR;
  ------------------
  |  |   20|      0|#define NGX_LOG_ERR               4
  ------------------
 1326|      0|                break;
 1327|       |
 1328|      0|            default:
  ------------------
  |  Branch (1328:13): [True: 0, False: 0]
  ------------------
 1329|      0|                level = NGX_LOG_CRIT;
  ------------------
  |  |   19|      0|#define NGX_LOG_CRIT              3
  ------------------
 1330|      0|            }
 1331|       |
 1332|      0|        } else {
 1333|      0|            level = NGX_LOG_CRIT;
  ------------------
  |  |   19|      0|#define NGX_LOG_CRIT              3
  ------------------
 1334|      0|        }
 1335|       |
 1336|      0|        ngx_log_error(level, c->log, err, ngx_close_socket_n " %d failed", fd);
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1337|      0|    }
 1338|      0|}
ngx_reusable_connection:
 1343|     39|{
 1344|     39|    ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0,
 1345|     39|                   "reusable connection: %ui", reusable);
 1346|       |
 1347|     39|    if (c->reusable) {
  ------------------
  |  Branch (1347:9): [True: 7, False: 32]
  ------------------
 1348|      7|        ngx_queue_remove(&c->queue);
  ------------------
  |  |   81|      7|    (x)->next->prev = (x)->prev;                                              \
  |  |   82|      7|    (x)->prev->next = (x)->next
  ------------------
 1349|      7|        ngx_cycle->reusable_connections_n--;
 1350|       |
 1351|       |#if (NGX_STAT_STUB)
 1352|       |        (void) ngx_atomic_fetch_add(ngx_stat_waiting, -1);
 1353|       |#endif
 1354|      7|    }
 1355|       |
 1356|     39|    c->reusable = reusable;
 1357|       |
 1358|     39|    if (reusable) {
  ------------------
  |  Branch (1358:9): [True: 7, False: 32]
  ------------------
 1359|       |        /* need cast as ngx_cycle is volatile */
 1360|       |
 1361|      7|        ngx_queue_insert_head(
  ------------------
  |  |   34|      7|    (x)->next = (h)->next;                                                    \
  |  |   35|      7|    (x)->next->prev = x;                                                      \
  |  |   36|      7|    (x)->prev = h;                                                            \
  |  |   37|      7|    (h)->next = x
  ------------------
 1362|      7|            (ngx_queue_t *) &ngx_cycle->reusable_connections_queue, &c->queue);
 1363|      7|        ngx_cycle->reusable_connections_n++;
 1364|       |
 1365|       |#if (NGX_STAT_STUB)
 1366|       |        (void) ngx_atomic_fetch_add(ngx_stat_waiting, 1);
 1367|       |#endif
 1368|      7|    }
 1369|     39|}
ngx_tcp_nodelay:
 1523|      5|{
 1524|      5|    int  tcp_nodelay;
 1525|       |
 1526|      5|    if (c->tcp_nodelay != NGX_TCP_NODELAY_UNSET) {
  ------------------
  |  Branch (1526:9): [True: 0, False: 5]
  ------------------
 1527|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1528|      0|    }
 1529|       |
 1530|      5|    ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0, "tcp_nodelay");
 1531|       |
 1532|      5|    tcp_nodelay = 1;
 1533|       |
 1534|      5|    if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY,
  ------------------
  |  Branch (1534:9): [True: 0, False: 5]
  ------------------
 1535|      5|                   (const void *) &tcp_nodelay, sizeof(int))
 1536|      5|        == -1)
 1537|      0|    {
 1538|       |#if (NGX_SOLARIS)
 1539|       |        if (c->log_error == NGX_ERROR_INFO) {
 1540|       |
 1541|       |            /* Solaris returns EINVAL if a socket has been shut down */
 1542|       |            c->log_error = NGX_ERROR_IGNORE_EINVAL;
 1543|       |
 1544|       |            ngx_connection_error(c, ngx_socket_errno,
 1545|       |                                 "setsockopt(TCP_NODELAY) failed");
 1546|       |
 1547|       |            c->log_error = NGX_ERROR_INFO;
 1548|       |
 1549|       |            return NGX_ERROR;
 1550|       |        }
 1551|       |#endif
 1552|       |
 1553|      0|        ngx_connection_error(c, ngx_socket_errno,
  ------------------
  |  |   70|      0|#define ngx_socket_errno           errno
  ------------------
 1554|      0|                             "setsockopt(TCP_NODELAY) failed");
 1555|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1556|      0|    }
 1557|       |
 1558|      5|    c->tcp_nodelay = NGX_TCP_NODELAY_SET;
 1559|       |
 1560|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 1561|      5|}
ngx_connection.c:ngx_drain_connections:
 1374|     21|{
 1375|     21|    ngx_uint_t         i, n;
 1376|     21|    ngx_queue_t       *q;
 1377|     21|    ngx_connection_t  *c;
 1378|       |
 1379|     21|    if (cycle->free_connection_n > cycle->connection_n / 16
  ------------------
  |  Branch (1379:9): [True: 21, False: 0]
  ------------------
 1380|     21|        || cycle->reusable_connections_n == 0)
  ------------------
  |  Branch (1380:12): [True: 0, False: 0]
  ------------------
 1381|     21|    {
 1382|     21|        return;
 1383|     21|    }
 1384|       |
 1385|      0|    if (cycle->connections_reuse_time != ngx_time()) {
  ------------------
  |  |   36|      0|#define ngx_time()           ngx_cached_time->sec
  ------------------
  |  Branch (1385:9): [True: 0, False: 0]
  ------------------
 1386|      0|        cycle->connections_reuse_time = ngx_time();
  ------------------
  |  |   36|      0|#define ngx_time()           ngx_cached_time->sec
  ------------------
 1387|       |
 1388|      0|        ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1389|      0|                      "%ui worker_connections are not enough, "
 1390|      0|                      "reusing connections",
 1391|      0|                      cycle->connection_n);
 1392|      0|    }
 1393|       |
 1394|      0|    c = NULL;
 1395|      0|    n = ngx_max(ngx_min(32, cycle->reusable_connections_n / 8), 1);
  ------------------
  |  |  109|      0|#define ngx_max(val1, val2)  ((val1 < val2) ? (val2) : (val1))
  |  |  ------------------
  |  |  |  Branch (109:31): [True: 0, False: 0]
  |  |  |  Branch (109:32): [True: 0, False: 0]
  |  |  |  Branch (109:57): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1396|       |
 1397|      0|    for (i = 0; i < n; i++) {
  ------------------
  |  Branch (1397:17): [True: 0, False: 0]
  ------------------
 1398|      0|        if (ngx_queue_empty(&cycle->reusable_connections_queue)) {
  ------------------
  |  |   30|      0|    (h == (h)->prev)
  |  |  ------------------
  |  |  |  Branch (30:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1399|      0|            break;
 1400|      0|        }
 1401|       |
 1402|      0|        q = ngx_queue_last(&cycle->reusable_connections_queue);
  ------------------
  |  |   55|      0|    (h)->prev
  ------------------
 1403|      0|        c = ngx_queue_data(q, ngx_connection_t, queue);
  ------------------
  |  |  104|      0|    (type *) ((u_char *) q - offsetof(type, link))
  ------------------
 1404|       |
 1405|      0|        ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0,
 1406|      0|                       "reusing connection");
 1407|       |
 1408|      0|        c->close = 1;
 1409|      0|        c->read->handler(c->read);
 1410|      0|    }
 1411|       |
 1412|      0|    if (cycle->free_connection_n == 0 && c && c->reusable) {
  ------------------
  |  Branch (1412:9): [True: 0, False: 0]
  |  Branch (1412:42): [True: 0, False: 0]
  |  Branch (1412:47): [True: 0, False: 0]
  ------------------
 1413|       |
 1414|       |        /*
 1415|       |         * if no connections were freed, try to reuse the last
 1416|       |         * connection again: this should free it as long as
 1417|       |         * previous reuse moved it to lingering close
 1418|       |         */
 1419|       |
 1420|      0|        ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0,
 1421|      0|                       "reusing connection again");
 1422|       |
 1423|      0|        c->close = 1;
 1424|      0|        c->read->handler(c->read);
 1425|      0|    }
 1426|      0|}

ngx_cpuinfo:
   74|      1|{
   75|      1|    u_char    *vendor;
   76|      1|    uint32_t   vbuf[5], cpu[4], model;
   77|       |
   78|      1|    vbuf[0] = 0;
   79|      1|    vbuf[1] = 0;
   80|      1|    vbuf[2] = 0;
   81|      1|    vbuf[3] = 0;
   82|      1|    vbuf[4] = 0;
   83|       |
   84|      1|    ngx_cpuid(0, vbuf);
   85|       |
   86|      1|    vendor = (u_char *) &vbuf[1];
   87|       |
   88|      1|    if (vbuf[0] == 0) {
  ------------------
  |  Branch (88:9): [True: 0, False: 1]
  ------------------
   89|      0|        return;
   90|      0|    }
   91|       |
   92|      1|    ngx_cpuid(1, cpu);
   93|       |
   94|      1|    if (ngx_strcmp(vendor, "GenuineIntel") == 0) {
  ------------------
  |  |   57|      1|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (94:9): [True: 1, False: 0]
  ------------------
   95|       |
   96|      1|        switch ((cpu[0] & 0xf00) >> 8) {
  ------------------
  |  Branch (96:17): [True: 0, False: 1]
  ------------------
   97|       |
   98|       |        /* Pentium */
   99|      0|        case 5:
  ------------------
  |  Branch (99:9): [True: 0, False: 1]
  ------------------
  100|      0|            ngx_cacheline_size = 32;
  101|      0|            break;
  102|       |
  103|       |        /* Pentium Pro, II, III */
  104|      1|        case 6:
  ------------------
  |  Branch (104:9): [True: 1, False: 0]
  ------------------
  105|      1|            ngx_cacheline_size = 32;
  106|       |
  107|      1|            model = ((cpu[0] & 0xf0000) >> 8) | (cpu[0] & 0xf0);
  108|       |
  109|      1|            if (model >= 0xd0) {
  ------------------
  |  Branch (109:17): [True: 1, False: 0]
  ------------------
  110|       |                /* Intel Core, Core 2, Atom */
  111|      1|                ngx_cacheline_size = 64;
  112|      1|            }
  113|       |
  114|      1|            break;
  115|       |
  116|       |        /*
  117|       |         * Pentium 4, although its cache line size is 64 bytes,
  118|       |         * it prefetches up to two cache lines during memory read
  119|       |         */
  120|      0|        case 15:
  ------------------
  |  Branch (120:9): [True: 0, False: 1]
  ------------------
  121|      0|            ngx_cacheline_size = 128;
  122|      0|            break;
  123|      1|        }
  124|       |
  125|      1|    } else if (ngx_strcmp(vendor, "AuthenticAMD") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (125:16): [True: 0, False: 0]
  ------------------
  126|      0|        ngx_cacheline_size = 64;
  127|      0|    }
  128|      1|}
ngx_cpuinfo.c:ngx_cpuid:
   51|      2|{
   52|      2|    uint32_t  eax, ebx, ecx, edx;
   53|       |
   54|      2|    __asm__ (
   55|       |
   56|      2|        "cpuid"
   57|       |
   58|      2|    : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (i) );
   59|       |
   60|      2|    buf[0] = eax;
   61|      2|    buf[1] = ebx;
   62|      2|    buf[2] = edx;
   63|      2|    buf[3] = ecx;
   64|      2|}

ngx_crc32_table_init:
  107|      1|{
  108|      1|    void  *p;
  109|       |
  110|      1|    if (((uintptr_t) ngx_crc32_table_short
  ------------------
  |  Branch (110:9): [True: 1, False: 0]
  ------------------
  111|      1|          & ~((uintptr_t) ngx_cacheline_size - 1))
  112|      1|        == (uintptr_t) ngx_crc32_table_short)
  113|      1|    {
  114|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  115|      1|    }
  116|       |
  117|      0|    p = ngx_alloc(16 * sizeof(uint32_t) + ngx_cacheline_size, ngx_cycle->log);
  118|      0|    if (p == NULL) {
  ------------------
  |  Branch (118:9): [True: 0, False: 0]
  ------------------
  119|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  120|      0|    }
  121|       |
  122|      0|    p = ngx_align_ptr(p, ngx_cacheline_size);
  ------------------
  |  |  102|      0|    (u_char *) (((uintptr_t) (p) + ((uintptr_t) a - 1)) & ~((uintptr_t) a - 1))
  ------------------
  123|       |
  124|      0|    ngx_memcpy(p, ngx_crc32_table16, 16 * sizeof(uint32_t));
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  125|       |
  126|      0|    ngx_crc32_table_short = p;
  127|       |
  128|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  129|      0|}

ngx_init_cycle:
   40|      1|{
   41|      1|    void                *rv;
   42|      1|    char               **senv;
   43|      1|    ngx_uint_t           i, n;
   44|      1|    ngx_log_t           *log;
   45|      1|    ngx_time_t          *tp;
   46|      1|    ngx_conf_t           conf;
   47|      1|    ngx_pool_t          *pool;
   48|      1|    ngx_cycle_t         *cycle, **old;
   49|      1|    ngx_shm_zone_t      *shm_zone, *oshm_zone;
   50|      1|    ngx_list_part_t     *part, *opart;
   51|      1|    ngx_open_file_t     *file;
   52|      1|    ngx_listening_t     *ls, *nls;
   53|      1|    ngx_core_conf_t     *ccf, *old_ccf;
   54|      1|    ngx_core_module_t   *module;
   55|      1|    char                 hostname[NGX_MAXHOSTNAMELEN];
   56|       |
   57|      1|    ngx_timezone_update();
   58|       |
   59|       |    /* force localtime update with a new timezone */
   60|       |
   61|      1|    tp = ngx_timeofday();
  ------------------
  |  |   37|      1|#define ngx_timeofday()      (ngx_time_t *) ngx_cached_time
  ------------------
   62|      1|    tp->sec = 0;
   63|       |
   64|      1|    ngx_time_update();
   65|       |
   66|       |
   67|      1|    log = old_cycle->log;
   68|       |
   69|      1|    pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log);
  ------------------
  |  |   17|      1|#define NGX_CYCLE_POOL_SIZE     NGX_DEFAULT_POOL_SIZE
  |  |  ------------------
  |  |  |  |   22|      1|#define NGX_DEFAULT_POOL_SIZE    (16 * 1024)
  |  |  ------------------
  ------------------
   70|      1|    if (pool == NULL) {
  ------------------
  |  Branch (70:9): [True: 0, False: 1]
  ------------------
   71|      0|        return NULL;
   72|      0|    }
   73|      1|    pool->log = log;
   74|       |
   75|      1|    cycle = ngx_pcalloc(pool, sizeof(ngx_cycle_t));
   76|      1|    if (cycle == NULL) {
  ------------------
  |  Branch (76:9): [True: 0, False: 1]
  ------------------
   77|      0|        ngx_destroy_pool(pool);
   78|      0|        return NULL;
   79|      0|    }
   80|       |
   81|      1|    cycle->pool = pool;
   82|      1|    cycle->log = log;
   83|      1|    cycle->old_cycle = old_cycle;
   84|       |
   85|      1|    cycle->conf_prefix.len = old_cycle->conf_prefix.len;
   86|      1|    cycle->conf_prefix.data = ngx_pstrdup(pool, &old_cycle->conf_prefix);
   87|      1|    if (cycle->conf_prefix.data == NULL) {
  ------------------
  |  Branch (87:9): [True: 0, False: 1]
  ------------------
   88|      0|        ngx_destroy_pool(pool);
   89|      0|        return NULL;
   90|      0|    }
   91|       |
   92|      1|    cycle->prefix.len = old_cycle->prefix.len;
   93|      1|    cycle->prefix.data = ngx_pstrdup(pool, &old_cycle->prefix);
   94|      1|    if (cycle->prefix.data == NULL) {
  ------------------
  |  Branch (94:9): [True: 0, False: 1]
  ------------------
   95|      0|        ngx_destroy_pool(pool);
   96|      0|        return NULL;
   97|      0|    }
   98|       |
   99|      1|    cycle->error_log.len = old_cycle->error_log.len;
  100|      1|    cycle->error_log.data = ngx_pnalloc(pool, old_cycle->error_log.len + 1);
  101|      1|    if (cycle->error_log.data == NULL) {
  ------------------
  |  Branch (101:9): [True: 0, False: 1]
  ------------------
  102|      0|        ngx_destroy_pool(pool);
  103|      0|        return NULL;
  104|      0|    }
  105|      1|    ngx_cpystrn(cycle->error_log.data, old_cycle->error_log.data,
  106|      1|                old_cycle->error_log.len + 1);
  107|       |
  108|      1|    cycle->conf_file.len = old_cycle->conf_file.len;
  109|      1|    cycle->conf_file.data = ngx_pnalloc(pool, old_cycle->conf_file.len + 1);
  110|      1|    if (cycle->conf_file.data == NULL) {
  ------------------
  |  Branch (110:9): [True: 0, False: 1]
  ------------------
  111|      0|        ngx_destroy_pool(pool);
  112|      0|        return NULL;
  113|      0|    }
  114|      1|    ngx_cpystrn(cycle->conf_file.data, old_cycle->conf_file.data,
  115|      1|                old_cycle->conf_file.len + 1);
  116|       |
  117|      1|    cycle->conf_param.len = old_cycle->conf_param.len;
  118|      1|    cycle->conf_param.data = ngx_pstrdup(pool, &old_cycle->conf_param);
  119|      1|    if (cycle->conf_param.data == NULL) {
  ------------------
  |  Branch (119:9): [True: 0, False: 1]
  ------------------
  120|      0|        ngx_destroy_pool(pool);
  121|      0|        return NULL;
  122|      0|    }
  123|       |
  124|       |
  125|      1|    n = old_cycle->paths.nelts ? old_cycle->paths.nelts : 10;
  ------------------
  |  Branch (125:9): [True: 0, False: 1]
  ------------------
  126|       |
  127|      1|    if (ngx_array_init(&cycle->paths, pool, n, sizeof(ngx_path_t *))
  ------------------
  |  Branch (127:9): [True: 0, False: 1]
  ------------------
  128|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  129|      0|    {
  130|      0|        ngx_destroy_pool(pool);
  131|      0|        return NULL;
  132|      0|    }
  133|       |
  134|      1|    ngx_memzero(cycle->paths.elts, n * sizeof(ngx_path_t *));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  135|       |
  136|       |
  137|      1|    if (ngx_array_init(&cycle->config_dump, pool, 1, sizeof(ngx_conf_dump_t))
  ------------------
  |  Branch (137:9): [True: 0, False: 1]
  ------------------
  138|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  139|      0|    {
  140|      0|        ngx_destroy_pool(pool);
  141|      0|        return NULL;
  142|      0|    }
  143|       |
  144|      1|    ngx_rbtree_init(&cycle->config_dump_rbtree, &cycle->config_dump_sentinel,
  ------------------
  |  |   45|      1|    ngx_rbtree_sentinel_init(s);                                              \
  |  |  ------------------
  |  |  |  |   73|      1|#define ngx_rbtree_sentinel_init(node)  ngx_rbt_black(node)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      1|#define ngx_rbt_black(node)             ((node)->color = 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   46|      1|    (tree)->root = s;                                                         \
  |  |   47|      1|    (tree)->sentinel = s;                                                     \
  |  |   48|      1|    (tree)->insert = i
  ------------------
  145|      1|                    ngx_str_rbtree_insert_value);
  146|       |
  147|      1|    if (old_cycle->open_files.part.nelts) {
  ------------------
  |  Branch (147:9): [True: 0, False: 1]
  ------------------
  148|      0|        n = old_cycle->open_files.part.nelts;
  149|      0|        for (part = old_cycle->open_files.part.next; part; part = part->next) {
  ------------------
  |  Branch (149:54): [True: 0, False: 0]
  ------------------
  150|      0|            n += part->nelts;
  151|      0|        }
  152|       |
  153|      1|    } else {
  154|      1|        n = 20;
  155|      1|    }
  156|       |
  157|      1|    if (ngx_list_init(&cycle->open_files, pool, n, sizeof(ngx_open_file_t))
  ------------------
  |  Branch (157:9): [True: 0, False: 1]
  ------------------
  158|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  159|      0|    {
  160|      0|        ngx_destroy_pool(pool);
  161|      0|        return NULL;
  162|      0|    }
  163|       |
  164|       |
  165|      1|    if (old_cycle->shared_memory.part.nelts) {
  ------------------
  |  Branch (165:9): [True: 0, False: 1]
  ------------------
  166|      0|        n = old_cycle->shared_memory.part.nelts;
  167|      0|        for (part = old_cycle->shared_memory.part.next; part; part = part->next)
  ------------------
  |  Branch (167:57): [True: 0, False: 0]
  ------------------
  168|      0|        {
  169|      0|            n += part->nelts;
  170|      0|        }
  171|       |
  172|      1|    } else {
  173|      1|        n = 1;
  174|      1|    }
  175|       |
  176|      1|    if (ngx_list_init(&cycle->shared_memory, pool, n, sizeof(ngx_shm_zone_t))
  ------------------
  |  Branch (176:9): [True: 0, False: 1]
  ------------------
  177|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  178|      0|    {
  179|      0|        ngx_destroy_pool(pool);
  180|      0|        return NULL;
  181|      0|    }
  182|       |
  183|      1|    n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10;
  ------------------
  |  Branch (183:9): [True: 0, False: 1]
  ------------------
  184|       |
  185|      1|    if (ngx_array_init(&cycle->listening, pool, n, sizeof(ngx_listening_t))
  ------------------
  |  Branch (185:9): [True: 0, False: 1]
  ------------------
  186|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  187|      0|    {
  188|      0|        ngx_destroy_pool(pool);
  189|      0|        return NULL;
  190|      0|    }
  191|       |
  192|      1|    ngx_memzero(cycle->listening.elts, n * sizeof(ngx_listening_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  193|       |
  194|       |
  195|      1|    ngx_queue_init(&cycle->reusable_connections_queue);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  196|       |
  197|       |
  198|      1|    cycle->conf_ctx = ngx_pcalloc(pool, ngx_max_module * sizeof(void *));
  199|      1|    if (cycle->conf_ctx == NULL) {
  ------------------
  |  Branch (199:9): [True: 0, False: 1]
  ------------------
  200|      0|        ngx_destroy_pool(pool);
  201|      0|        return NULL;
  202|      0|    }
  203|       |
  204|       |
  205|      1|    if (gethostname(hostname, NGX_MAXHOSTNAMELEN) == -1) {
  ------------------
  |  |  124|      1|#define NGX_MAXHOSTNAMELEN  256
  ------------------
  |  Branch (205:9): [True: 0, False: 1]
  ------------------
  206|      0|        ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "gethostname() failed");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  207|      0|        ngx_destroy_pool(pool);
  208|      0|        return NULL;
  209|      0|    }
  210|       |
  211|       |    /* on Linux gethostname() silently truncates name that does not fit */
  212|       |
  213|      1|    hostname[NGX_MAXHOSTNAMELEN - 1] = '\0';
  ------------------
  |  |  124|      1|#define NGX_MAXHOSTNAMELEN  256
  ------------------
  214|      1|    cycle->hostname.len = ngx_strlen(hostname);
  ------------------
  |  |   61|      1|#define ngx_strlen(s)       strlen((const char *) s)
  ------------------
  215|       |
  216|      1|    cycle->hostname.data = ngx_pnalloc(pool, cycle->hostname.len);
  217|      1|    if (cycle->hostname.data == NULL) {
  ------------------
  |  Branch (217:9): [True: 0, False: 1]
  ------------------
  218|      0|        ngx_destroy_pool(pool);
  219|      0|        return NULL;
  220|      0|    }
  221|       |
  222|      1|    ngx_strlow(cycle->hostname.data, (u_char *) hostname, cycle->hostname.len);
  223|       |
  224|       |
  225|      1|    if (ngx_cycle_modules(cycle) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (225:9): [True: 0, False: 1]
  ------------------
  226|      0|        ngx_destroy_pool(pool);
  227|      0|        return NULL;
  228|      0|    }
  229|       |
  230|       |
  231|     55|    for (i = 0; cycle->modules[i]; i++) {
  ------------------
  |  Branch (231:17): [True: 54, False: 1]
  ------------------
  232|     54|        if (cycle->modules[i]->type != NGX_CORE_MODULE) {
  ------------------
  |  |   70|     54|#define NGX_CORE_MODULE      0x45524F43  /* "CORE" */
  ------------------
  |  Branch (232:13): [True: 49, False: 5]
  ------------------
  233|     49|            continue;
  234|     49|        }
  235|       |
  236|      5|        module = cycle->modules[i]->ctx;
  237|       |
  238|      5|        if (module->create_conf) {
  ------------------
  |  Branch (238:13): [True: 2, False: 3]
  ------------------
  239|      2|            rv = module->create_conf(cycle);
  240|      2|            if (rv == NULL) {
  ------------------
  |  Branch (240:17): [True: 0, False: 2]
  ------------------
  241|      0|                ngx_destroy_pool(pool);
  242|      0|                return NULL;
  243|      0|            }
  244|      2|            cycle->conf_ctx[cycle->modules[i]->index] = rv;
  245|      2|        }
  246|      5|    }
  247|       |
  248|       |
  249|      1|    senv = environ;
  250|       |
  251|       |
  252|      1|    ngx_memzero(&conf, sizeof(ngx_conf_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  253|       |    /* STUB: init array ? */
  254|      1|    conf.args = ngx_array_create(pool, 10, sizeof(ngx_str_t));
  255|      1|    if (conf.args == NULL) {
  ------------------
  |  Branch (255:9): [True: 0, False: 1]
  ------------------
  256|      0|        ngx_destroy_pool(pool);
  257|      0|        return NULL;
  258|      0|    }
  259|       |
  260|      1|    conf.temp_pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log);
  ------------------
  |  |   17|      1|#define NGX_CYCLE_POOL_SIZE     NGX_DEFAULT_POOL_SIZE
  |  |  ------------------
  |  |  |  |   22|      1|#define NGX_DEFAULT_POOL_SIZE    (16 * 1024)
  |  |  ------------------
  ------------------
  261|      1|    if (conf.temp_pool == NULL) {
  ------------------
  |  Branch (261:9): [True: 0, False: 1]
  ------------------
  262|      0|        ngx_destroy_pool(pool);
  263|      0|        return NULL;
  264|      0|    }
  265|       |
  266|       |
  267|      1|    conf.ctx = cycle->conf_ctx;
  268|      1|    conf.cycle = cycle;
  269|      1|    conf.pool = pool;
  270|      1|    conf.log = log;
  271|      1|    conf.module_type = NGX_CORE_MODULE;
  ------------------
  |  |   70|      1|#define NGX_CORE_MODULE      0x45524F43  /* "CORE" */
  ------------------
  272|      1|    conf.cmd_type = NGX_MAIN_CONF;
  ------------------
  |  |   51|      1|#define NGX_MAIN_CONF        0x01000000
  ------------------
  273|       |
  274|       |#if 0
  275|       |    log->log_level = NGX_LOG_DEBUG_ALL;
  276|       |#endif
  277|       |
  278|      1|    if (ngx_conf_param(&conf) != NGX_CONF_OK) {
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (278:9): [True: 0, False: 1]
  ------------------
  279|      0|        environ = senv;
  280|      0|        ngx_destroy_cycle_pools(&conf);
  281|      0|        return NULL;
  282|      0|    }
  283|       |
  284|      1|    if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) {
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (284:9): [True: 0, False: 1]
  ------------------
  285|      0|        environ = senv;
  286|      0|        ngx_destroy_cycle_pools(&conf);
  287|      0|        return NULL;
  288|      0|    }
  289|       |
  290|      1|    if (ngx_test_config && !ngx_quiet_mode) {
  ------------------
  |  Branch (290:9): [True: 0, False: 1]
  |  Branch (290:28): [True: 0, False: 0]
  ------------------
  291|      0|        ngx_log_stderr(0, "the configuration file %s syntax is ok",
  292|      0|                       cycle->conf_file.data);
  293|      0|    }
  294|       |
  295|     55|    for (i = 0; cycle->modules[i]; i++) {
  ------------------
  |  Branch (295:17): [True: 54, False: 1]
  ------------------
  296|     54|        if (cycle->modules[i]->type != NGX_CORE_MODULE) {
  ------------------
  |  |   70|     54|#define NGX_CORE_MODULE      0x45524F43  /* "CORE" */
  ------------------
  |  Branch (296:13): [True: 49, False: 5]
  ------------------
  297|     49|            continue;
  298|     49|        }
  299|       |
  300|      5|        module = cycle->modules[i]->ctx;
  301|       |
  302|      5|        if (module->init_conf) {
  ------------------
  |  Branch (302:13): [True: 3, False: 2]
  ------------------
  303|      3|            if (module->init_conf(cycle,
  ------------------
  |  Branch (303:17): [True: 0, False: 3]
  ------------------
  304|      3|                                  cycle->conf_ctx[cycle->modules[i]->index])
  305|      3|                == NGX_CONF_ERROR)
  ------------------
  |  |   64|      3|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  306|      0|            {
  307|      0|                environ = senv;
  308|      0|                ngx_destroy_cycle_pools(&conf);
  309|      0|                return NULL;
  310|      0|            }
  311|      3|        }
  312|      5|    }
  313|       |
  314|      1|    if (ngx_process == NGX_PROCESS_SIGNALLER) {
  ------------------
  |  |   25|      1|#define NGX_PROCESS_SIGNALLER  2
  ------------------
  |  Branch (314:9): [True: 0, False: 1]
  ------------------
  315|      0|        return cycle;
  316|      0|    }
  317|       |
  318|      1|    ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
  ------------------
  |  |  176|      1|#define ngx_get_conf(conf_ctx, module)  conf_ctx[module.index]
  ------------------
  319|       |
  320|      1|    if (ngx_test_config) {
  ------------------
  |  Branch (320:9): [True: 0, False: 1]
  ------------------
  321|       |
  322|      0|        if (ngx_create_pidfile(&ccf->pid, log) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (322:13): [True: 0, False: 0]
  ------------------
  323|      0|            goto failed;
  324|      0|        }
  325|       |
  326|      1|    } else if (!ngx_is_init_cycle(old_cycle)) {
  ------------------
  |  |  125|      1|#define ngx_is_init_cycle(cycle)  (cycle->conf_ctx == NULL)
  ------------------
  |  Branch (326:16): [True: 0, False: 1]
  ------------------
  327|       |
  328|       |        /*
  329|       |         * we do not create the pid file in the first ngx_init_cycle() call
  330|       |         * because we need to write the demonized process pid
  331|       |         */
  332|       |
  333|      0|        old_ccf = (ngx_core_conf_t *) ngx_get_conf(old_cycle->conf_ctx,
  ------------------
  |  |  176|      0|#define ngx_get_conf(conf_ctx, module)  conf_ctx[module.index]
  ------------------
  334|      0|                                                   ngx_core_module);
  335|      0|        if (ccf->pid.len != old_ccf->pid.len
  ------------------
  |  Branch (335:13): [True: 0, False: 0]
  ------------------
  336|      0|            || ngx_strcmp(ccf->pid.data, old_ccf->pid.data) != 0)
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (336:16): [True: 0, False: 0]
  ------------------
  337|      0|        {
  338|       |            /* new pid file name */
  339|       |
  340|      0|            if (ngx_create_pidfile(&ccf->pid, log) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (340:17): [True: 0, False: 0]
  ------------------
  341|      0|                goto failed;
  342|      0|            }
  343|       |
  344|      0|            ngx_delete_pidfile(old_cycle);
  345|      0|        }
  346|      0|    }
  347|       |
  348|       |
  349|      1|    if (ngx_test_lockfile(cycle->lock_file.data, log) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (349:9): [True: 0, False: 1]
  ------------------
  350|      0|        goto failed;
  351|      0|    }
  352|       |
  353|       |
  354|      1|    if (ngx_create_paths(cycle, ccf->user) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (354:9): [True: 0, False: 1]
  ------------------
  355|      0|        goto failed;
  356|      0|    }
  357|       |
  358|       |
  359|      1|    if (ngx_log_open_default(cycle) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (359:9): [True: 0, False: 1]
  ------------------
  360|      0|        goto failed;
  361|      0|    }
  362|       |
  363|       |    /* open the new files */
  364|       |
  365|      1|    part = &cycle->open_files.part;
  366|      1|    file = part->elts;
  367|       |
  368|      3|    for (i = 0; /* void */ ; i++) {
  369|       |
  370|      3|        if (i >= part->nelts) {
  ------------------
  |  Branch (370:13): [True: 1, False: 2]
  ------------------
  371|      1|            if (part->next == NULL) {
  ------------------
  |  Branch (371:17): [True: 1, False: 0]
  ------------------
  372|      1|                break;
  373|      1|            }
  374|      0|            part = part->next;
  375|      0|            file = part->elts;
  376|      0|            i = 0;
  377|      0|        }
  378|       |
  379|      2|        if (file[i].name.len == 0) {
  ------------------
  |  Branch (379:13): [True: 2, False: 0]
  ------------------
  380|      2|            continue;
  381|      2|        }
  382|       |
  383|      0|        file[i].fd = ngx_open_file(file[i].name.data,
  ------------------
  |  |   66|      0|    open((const char *) name, mode|create, access)
  ------------------
  384|      0|                                   NGX_FILE_APPEND,
  385|      0|                                   NGX_FILE_CREATE_OR_OPEN,
  386|      0|                                   NGX_FILE_DEFAULT_ACCESS);
  387|       |
  388|      0|        ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
  389|      0|                       "log: %p %d \"%s\"",
  390|      0|                       &file[i], file[i].fd, file[i].name.data);
  391|       |
  392|      0|        if (file[i].fd == NGX_INVALID_FILE) {
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
  |  Branch (392:13): [True: 0, False: 0]
  ------------------
  393|      0|            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  394|      0|                          ngx_open_file_n " \"%s\" failed",
  395|      0|                          file[i].name.data);
  396|      0|            goto failed;
  397|      0|        }
  398|       |
  399|      0|#if !(NGX_WIN32)
  400|      0|        if (fcntl(file[i].fd, F_SETFD, FD_CLOEXEC) == -1) {
  ------------------
  |  Branch (400:13): [True: 0, False: 0]
  ------------------
  401|      0|            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  402|      0|                          "fcntl(FD_CLOEXEC) \"%s\" failed",
  403|      0|                          file[i].name.data);
  404|      0|            goto failed;
  405|      0|        }
  406|      0|#endif
  407|      0|    }
  408|       |
  409|      1|    cycle->log = &cycle->new_log;
  410|      1|    pool->log = &cycle->new_log;
  411|       |
  412|       |
  413|       |    /* create shared memory */
  414|       |
  415|      1|    part = &cycle->shared_memory.part;
  416|      1|    shm_zone = part->elts;
  417|       |
  418|      1|    for (i = 0; /* void */ ; i++) {
  419|       |
  420|      1|        if (i >= part->nelts) {
  ------------------
  |  Branch (420:13): [True: 1, False: 0]
  ------------------
  421|      1|            if (part->next == NULL) {
  ------------------
  |  Branch (421:17): [True: 1, False: 0]
  ------------------
  422|      1|                break;
  423|      1|            }
  424|      0|            part = part->next;
  425|      0|            shm_zone = part->elts;
  426|      0|            i = 0;
  427|      0|        }
  428|       |
  429|      0|        if (shm_zone[i].shm.size == 0) {
  ------------------
  |  Branch (429:13): [True: 0, False: 0]
  ------------------
  430|      0|            ngx_log_error(NGX_LOG_EMERG, log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  431|      0|                          "zero size shared memory zone \"%V\"",
  432|      0|                          &shm_zone[i].shm.name);
  433|      0|            goto failed;
  434|      0|        }
  435|       |
  436|      0|        shm_zone[i].shm.log = cycle->log;
  437|       |
  438|      0|        opart = &old_cycle->shared_memory.part;
  439|      0|        oshm_zone = opart->elts;
  440|       |
  441|      0|        for (n = 0; /* void */ ; n++) {
  442|       |
  443|      0|            if (n >= opart->nelts) {
  ------------------
  |  Branch (443:17): [True: 0, False: 0]
  ------------------
  444|      0|                if (opart->next == NULL) {
  ------------------
  |  Branch (444:21): [True: 0, False: 0]
  ------------------
  445|      0|                    break;
  446|      0|                }
  447|      0|                opart = opart->next;
  448|      0|                oshm_zone = opart->elts;
  449|      0|                n = 0;
  450|      0|            }
  451|       |
  452|      0|            if (shm_zone[i].shm.name.len != oshm_zone[n].shm.name.len) {
  ------------------
  |  Branch (452:17): [True: 0, False: 0]
  ------------------
  453|      0|                continue;
  454|      0|            }
  455|       |
  456|      0|            if (ngx_strncmp(shm_zone[i].shm.name.data,
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (456:17): [True: 0, False: 0]
  ------------------
  457|      0|                            oshm_zone[n].shm.name.data,
  458|      0|                            shm_zone[i].shm.name.len)
  459|      0|                != 0)
  460|      0|            {
  461|      0|                continue;
  462|      0|            }
  463|       |
  464|      0|            if (shm_zone[i].tag == oshm_zone[n].tag
  ------------------
  |  Branch (464:17): [True: 0, False: 0]
  ------------------
  465|      0|                && shm_zone[i].shm.size == oshm_zone[n].shm.size
  ------------------
  |  Branch (465:20): [True: 0, False: 0]
  ------------------
  466|      0|                && !shm_zone[i].noreuse)
  ------------------
  |  Branch (466:20): [True: 0, False: 0]
  ------------------
  467|      0|            {
  468|      0|                shm_zone[i].shm.addr = oshm_zone[n].shm.addr;
  469|       |#if (NGX_WIN32)
  470|       |                shm_zone[i].shm.handle = oshm_zone[n].shm.handle;
  471|       |#endif
  472|       |
  473|      0|                if (shm_zone[i].init(&shm_zone[i], oshm_zone[n].data)
  ------------------
  |  Branch (473:21): [True: 0, False: 0]
  ------------------
  474|      0|                    != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  475|      0|                {
  476|      0|                    goto failed;
  477|      0|                }
  478|       |
  479|      0|                goto shm_zone_found;
  480|      0|            }
  481|       |
  482|      0|            break;
  483|      0|        }
  484|       |
  485|      0|        if (ngx_shm_alloc(&shm_zone[i].shm) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (485:13): [True: 0, False: 0]
  ------------------
  486|      0|            goto failed;
  487|      0|        }
  488|       |
  489|      0|        if (ngx_init_zone_pool(cycle, &shm_zone[i]) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (489:13): [True: 0, False: 0]
  ------------------
  490|      0|            goto failed;
  491|      0|        }
  492|       |
  493|      0|        if (shm_zone[i].init(&shm_zone[i], NULL) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (493:13): [True: 0, False: 0]
  ------------------
  494|      0|            goto failed;
  495|      0|        }
  496|       |
  497|      0|    shm_zone_found:
  498|       |
  499|      0|        continue;
  500|      0|    }
  501|       |
  502|       |
  503|       |    /* handle the listening sockets */
  504|       |
  505|      1|    if (old_cycle->listening.nelts) {
  ------------------
  |  Branch (505:9): [True: 0, False: 1]
  ------------------
  506|      0|        ls = old_cycle->listening.elts;
  507|      0|        for (i = 0; i < old_cycle->listening.nelts; i++) {
  ------------------
  |  Branch (507:21): [True: 0, False: 0]
  ------------------
  508|      0|            ls[i].remain = 0;
  509|      0|        }
  510|       |
  511|      0|        nls = cycle->listening.elts;
  512|      0|        for (n = 0; n < cycle->listening.nelts; n++) {
  ------------------
  |  Branch (512:21): [True: 0, False: 0]
  ------------------
  513|       |
  514|      0|            for (i = 0; i < old_cycle->listening.nelts; i++) {
  ------------------
  |  Branch (514:25): [True: 0, False: 0]
  ------------------
  515|      0|                if (ls[i].ignore) {
  ------------------
  |  Branch (515:21): [True: 0, False: 0]
  ------------------
  516|      0|                    continue;
  517|      0|                }
  518|       |
  519|      0|                if (ls[i].remain) {
  ------------------
  |  Branch (519:21): [True: 0, False: 0]
  ------------------
  520|      0|                    continue;
  521|      0|                }
  522|       |
  523|      0|                if (ls[i].type != nls[n].type) {
  ------------------
  |  Branch (523:21): [True: 0, False: 0]
  ------------------
  524|      0|                    continue;
  525|      0|                }
  526|       |
  527|      0|                if (ngx_cmp_sockaddr(nls[n].sockaddr, nls[n].socklen,
  ------------------
  |  Branch (527:21): [True: 0, False: 0]
  ------------------
  528|      0|                                     ls[i].sockaddr, ls[i].socklen, 1)
  529|      0|                    == NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  530|      0|                {
  531|      0|                    nls[n].fd = ls[i].fd;
  532|      0|                    nls[n].inherited = ls[i].inherited;
  533|      0|                    nls[n].previous = &ls[i];
  534|      0|                    ls[i].remain = 1;
  535|       |
  536|      0|                    if (ls[i].backlog != nls[n].backlog) {
  ------------------
  |  Branch (536:25): [True: 0, False: 0]
  ------------------
  537|      0|                        nls[n].listen = 1;
  538|      0|                    }
  539|       |
  540|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
  541|       |
  542|       |                    /*
  543|       |                     * FreeBSD, except the most recent versions,
  544|       |                     * could not remove accept filter
  545|       |                     */
  546|       |                    nls[n].deferred_accept = ls[i].deferred_accept;
  547|       |
  548|       |                    if (ls[i].accept_filter && nls[n].accept_filter) {
  549|       |                        if (ngx_strcmp(ls[i].accept_filter,
  550|       |                                       nls[n].accept_filter)
  551|       |                            != 0)
  552|       |                        {
  553|       |                            nls[n].delete_deferred = 1;
  554|       |                            nls[n].add_deferred = 1;
  555|       |                        }
  556|       |
  557|       |                    } else if (ls[i].accept_filter) {
  558|       |                        nls[n].delete_deferred = 1;
  559|       |
  560|       |                    } else if (nls[n].accept_filter) {
  561|       |                        nls[n].add_deferred = 1;
  562|       |                    }
  563|       |#endif
  564|       |
  565|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
  566|       |
  567|       |                    if (ls[i].deferred_accept && !nls[n].deferred_accept) {
  568|       |                        nls[n].delete_deferred = 1;
  569|       |
  570|       |                    } else if (ls[i].deferred_accept != nls[n].deferred_accept)
  571|       |                    {
  572|       |                        nls[n].add_deferred = 1;
  573|       |                    }
  574|       |#endif
  575|       |
  576|       |#if (NGX_HAVE_REUSEPORT)
  577|       |                    if (nls[n].reuseport && !ls[i].reuseport) {
  578|       |                        nls[n].add_reuseport = 1;
  579|       |                    }
  580|       |#endif
  581|       |
  582|      0|                    break;
  583|      0|                }
  584|      0|            }
  585|       |
  586|      0|            if (nls[n].fd == (ngx_socket_t) -1) {
  ------------------
  |  Branch (586:17): [True: 0, False: 0]
  ------------------
  587|      0|                nls[n].open = 1;
  588|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
  589|       |                if (nls[n].accept_filter) {
  590|       |                    nls[n].add_deferred = 1;
  591|       |                }
  592|       |#endif
  593|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
  594|       |                if (nls[n].deferred_accept) {
  595|       |                    nls[n].add_deferred = 1;
  596|       |                }
  597|       |#endif
  598|      0|            }
  599|      0|        }
  600|       |
  601|      1|    } else {
  602|      1|        ls = cycle->listening.elts;
  603|      2|        for (i = 0; i < cycle->listening.nelts; i++) {
  ------------------
  |  Branch (603:21): [True: 1, False: 1]
  ------------------
  604|      1|            ls[i].open = 1;
  605|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
  606|       |            if (ls[i].accept_filter) {
  607|       |                ls[i].add_deferred = 1;
  608|       |            }
  609|       |#endif
  610|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
  611|       |            if (ls[i].deferred_accept) {
  612|       |                ls[i].add_deferred = 1;
  613|       |            }
  614|       |#endif
  615|      1|        }
  616|      1|    }
  617|       |
  618|      1|    if (ngx_open_listening_sockets(cycle) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (618:9): [True: 0, False: 1]
  ------------------
  619|      0|        goto failed;
  620|      0|    }
  621|       |
  622|      1|    if (!ngx_test_config) {
  ------------------
  |  Branch (622:9): [True: 1, False: 0]
  ------------------
  623|      1|        ngx_configure_listening_sockets(cycle);
  624|      1|    }
  625|       |
  626|       |
  627|       |    /* commit the new cycle configuration */
  628|       |
  629|      1|    if (!ngx_use_stderr) {
  ------------------
  |  Branch (629:9): [True: 0, False: 1]
  ------------------
  630|      0|        (void) ngx_log_redirect_stderr(cycle);
  631|      0|    }
  632|       |
  633|      1|    pool->log = cycle->log;
  634|       |
  635|      1|    if (ngx_init_modules(cycle) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (635:9): [True: 0, False: 1]
  ------------------
  636|       |        /* fatal */
  637|      0|        exit(1);
  638|      0|    }
  639|       |
  640|       |
  641|       |    /* close and delete stuff that lefts from an old cycle */
  642|       |
  643|       |    /* free the unnecessary shared memory */
  644|       |
  645|      1|    opart = &old_cycle->shared_memory.part;
  646|      1|    oshm_zone = opart->elts;
  647|       |
  648|      1|    for (i = 0; /* void */ ; i++) {
  649|       |
  650|      1|        if (i >= opart->nelts) {
  ------------------
  |  Branch (650:13): [True: 1, False: 0]
  ------------------
  651|      1|            if (opart->next == NULL) {
  ------------------
  |  Branch (651:17): [True: 1, False: 0]
  ------------------
  652|      1|                goto old_shm_zone_done;
  653|      1|            }
  654|      0|            opart = opart->next;
  655|      0|            oshm_zone = opart->elts;
  656|      0|            i = 0;
  657|      0|        }
  658|       |
  659|      0|        part = &cycle->shared_memory.part;
  660|      0|        shm_zone = part->elts;
  661|       |
  662|      0|        for (n = 0; /* void */ ; n++) {
  663|       |
  664|      0|            if (n >= part->nelts) {
  ------------------
  |  Branch (664:17): [True: 0, False: 0]
  ------------------
  665|      0|                if (part->next == NULL) {
  ------------------
  |  Branch (665:21): [True: 0, False: 0]
  ------------------
  666|      0|                    break;
  667|      0|                }
  668|      0|                part = part->next;
  669|      0|                shm_zone = part->elts;
  670|      0|                n = 0;
  671|      0|            }
  672|       |
  673|      0|            if (oshm_zone[i].shm.name.len != shm_zone[n].shm.name.len) {
  ------------------
  |  Branch (673:17): [True: 0, False: 0]
  ------------------
  674|      0|                continue;
  675|      0|            }
  676|       |
  677|      0|            if (ngx_strncmp(oshm_zone[i].shm.name.data,
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (677:17): [True: 0, False: 0]
  ------------------
  678|      0|                            shm_zone[n].shm.name.data,
  679|      0|                            oshm_zone[i].shm.name.len)
  680|      0|                != 0)
  681|      0|            {
  682|      0|                continue;
  683|      0|            }
  684|       |
  685|      0|            if (oshm_zone[i].tag == shm_zone[n].tag
  ------------------
  |  Branch (685:17): [True: 0, False: 0]
  ------------------
  686|      0|                && oshm_zone[i].shm.size == shm_zone[n].shm.size
  ------------------
  |  Branch (686:20): [True: 0, False: 0]
  ------------------
  687|      0|                && !oshm_zone[i].noreuse)
  ------------------
  |  Branch (687:20): [True: 0, False: 0]
  ------------------
  688|      0|            {
  689|      0|                goto live_shm_zone;
  690|      0|            }
  691|       |
  692|      0|            break;
  693|      0|        }
  694|       |
  695|      0|        ngx_shm_free(&oshm_zone[i].shm);
  696|       |
  697|      0|    live_shm_zone:
  698|       |
  699|      0|        continue;
  700|      0|    }
  701|       |
  702|      1|old_shm_zone_done:
  703|       |
  704|       |
  705|       |    /* close the unnecessary listening sockets */
  706|       |
  707|      1|    ls = old_cycle->listening.elts;
  708|      1|    for (i = 0; i < old_cycle->listening.nelts; i++) {
  ------------------
  |  Branch (708:17): [True: 0, False: 1]
  ------------------
  709|       |
  710|      0|        if (ls[i].remain || ls[i].fd == (ngx_socket_t) -1) {
  ------------------
  |  Branch (710:13): [True: 0, False: 0]
  |  Branch (710:29): [True: 0, False: 0]
  ------------------
  711|      0|            continue;
  712|      0|        }
  713|       |
  714|      0|        if (ngx_close_socket(ls[i].fd) == -1) {
  ------------------
  |  |   69|      0|#define ngx_close_socket    close
  ------------------
  |  Branch (714:13): [True: 0, False: 0]
  ------------------
  715|      0|            ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  716|      0|                          ngx_close_socket_n " listening socket on %V failed",
  717|      0|                          &ls[i].addr_text);
  718|      0|        }
  719|       |
  720|      0|#if (NGX_HAVE_UNIX_DOMAIN)
  721|       |
  722|      0|        if (ls[i].sockaddr->sa_family == AF_UNIX) {
  ------------------
  |  Branch (722:13): [True: 0, False: 0]
  ------------------
  723|      0|            u_char  *name;
  724|       |
  725|      0|            name = ls[i].addr_text.data + sizeof("unix:") - 1;
  726|       |
  727|      0|            ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  728|      0|                          "deleting socket %s", name);
  729|       |
  730|      0|            if (ngx_delete_file(name) == NGX_FILE_ERROR) {
  ------------------
  |  |  113|      0|#define ngx_delete_file(name)    unlink((const char *) name)
  ------------------
                          if (ngx_delete_file(name) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      0|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (730:17): [True: 0, False: 0]
  ------------------
  731|      0|                ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  732|      0|                              ngx_delete_file_n " %s failed", name);
  733|      0|            }
  734|      0|        }
  735|       |
  736|      0|#endif
  737|      0|    }
  738|       |
  739|       |
  740|       |    /* close the unnecessary open files */
  741|       |
  742|      1|    part = &old_cycle->open_files.part;
  743|      1|    file = part->elts;
  744|       |
  745|      1|    for (i = 0; /* void */ ; i++) {
  746|       |
  747|      1|        if (i >= part->nelts) {
  ------------------
  |  Branch (747:13): [True: 1, False: 0]
  ------------------
  748|      1|            if (part->next == NULL) {
  ------------------
  |  Branch (748:17): [True: 1, False: 0]
  ------------------
  749|      1|                break;
  750|      1|            }
  751|      0|            part = part->next;
  752|      0|            file = part->elts;
  753|      0|            i = 0;
  754|      0|        }
  755|       |
  756|      0|        if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) {
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
                      if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) {
  ------------------
  |  |  373|      0|#define ngx_stderr               STDERR_FILENO
  ------------------
  |  Branch (756:13): [True: 0, False: 0]
  |  Branch (756:47): [True: 0, False: 0]
  ------------------
  757|      0|            continue;
  758|      0|        }
  759|       |
  760|      0|        if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
  ------------------
  |  |  109|      0|#define ngx_close_file           close
  ------------------
                      if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      0|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (760:13): [True: 0, False: 0]
  ------------------
  761|      0|            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  762|      0|                          ngx_close_file_n " \"%s\" failed",
  763|      0|                          file[i].name.data);
  764|      0|        }
  765|      0|    }
  766|       |
  767|      1|    ngx_destroy_pool(conf.temp_pool);
  768|       |
  769|      1|    if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) {
  ------------------
  |  |   24|      2|#define NGX_PROCESS_MASTER     1
  ------------------
                  if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) {
  ------------------
  |  |  125|      1|#define ngx_is_init_cycle(cycle)  (cycle->conf_ctx == NULL)
  |  |  ------------------
  |  |  |  Branch (125:35): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (769:9): [True: 0, False: 1]
  ------------------
  770|       |
  771|      1|        ngx_destroy_pool(old_cycle->pool);
  772|      1|        cycle->old_cycle = NULL;
  773|       |
  774|      1|        return cycle;
  775|      1|    }
  776|       |
  777|       |
  778|      0|    if (ngx_temp_pool == NULL) {
  ------------------
  |  Branch (778:9): [True: 0, False: 0]
  ------------------
  779|      0|        ngx_temp_pool = ngx_create_pool(128, cycle->log);
  780|      0|        if (ngx_temp_pool == NULL) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|      0|            ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  782|      0|                          "could not create ngx_temp_pool");
  783|      0|            exit(1);
  784|      0|        }
  785|       |
  786|      0|        n = 10;
  787|       |
  788|      0|        if (ngx_array_init(&ngx_old_cycles, ngx_temp_pool, n,
  ------------------
  |  Branch (788:13): [True: 0, False: 0]
  ------------------
  789|      0|                           sizeof(ngx_cycle_t *))
  790|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  791|      0|        {
  792|      0|            exit(1);
  793|      0|        }
  794|       |
  795|      0|        ngx_memzero(ngx_old_cycles.elts, n * sizeof(ngx_cycle_t *));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  796|       |
  797|      0|        ngx_cleaner_event.handler = ngx_clean_old_cycles;
  798|      0|        ngx_cleaner_event.log = cycle->log;
  799|      0|        ngx_cleaner_event.data = &dumb;
  800|      0|        dumb.fd = (ngx_socket_t) -1;
  801|      0|    }
  802|       |
  803|      0|    ngx_temp_pool->log = cycle->log;
  804|       |
  805|      0|    old = ngx_array_push(&ngx_old_cycles);
  806|      0|    if (old == NULL) {
  ------------------
  |  Branch (806:9): [True: 0, False: 0]
  ------------------
  807|      0|        exit(1);
  808|      0|    }
  809|      0|    *old = old_cycle;
  810|       |
  811|      0|    if (!ngx_cleaner_event.timer_set) {
  ------------------
  |  Branch (811:9): [True: 0, False: 0]
  ------------------
  812|      0|        ngx_add_timer(&ngx_cleaner_event, 30000);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
  813|      0|        ngx_cleaner_event.timer_set = 1;
  814|      0|    }
  815|       |
  816|      0|    return cycle;
  817|       |
  818|       |
  819|      0|failed:
  820|       |
  821|      0|    if (!ngx_is_init_cycle(old_cycle)) {
  ------------------
  |  |  125|      0|#define ngx_is_init_cycle(cycle)  (cycle->conf_ctx == NULL)
  ------------------
  |  Branch (821:9): [True: 0, False: 0]
  ------------------
  822|      0|        old_ccf = (ngx_core_conf_t *) ngx_get_conf(old_cycle->conf_ctx,
  ------------------
  |  |  176|      0|#define ngx_get_conf(conf_ctx, module)  conf_ctx[module.index]
  ------------------
  823|      0|                                                   ngx_core_module);
  824|      0|        if (old_ccf->environment) {
  ------------------
  |  Branch (824:13): [True: 0, False: 0]
  ------------------
  825|      0|            environ = old_ccf->environment;
  826|      0|        }
  827|      0|    }
  828|       |
  829|       |    /* rollback the new cycle configuration */
  830|       |
  831|      0|    part = &cycle->open_files.part;
  832|      0|    file = part->elts;
  833|       |
  834|      0|    for (i = 0; /* void */ ; i++) {
  835|       |
  836|      0|        if (i >= part->nelts) {
  ------------------
  |  Branch (836:13): [True: 0, False: 0]
  ------------------
  837|      0|            if (part->next == NULL) {
  ------------------
  |  Branch (837:17): [True: 0, False: 0]
  ------------------
  838|      0|                break;
  839|      0|            }
  840|      0|            part = part->next;
  841|      0|            file = part->elts;
  842|      0|            i = 0;
  843|      0|        }
  844|       |
  845|      0|        if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) {
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
                      if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) {
  ------------------
  |  |  373|      0|#define ngx_stderr               STDERR_FILENO
  ------------------
  |  Branch (845:13): [True: 0, False: 0]
  |  Branch (845:47): [True: 0, False: 0]
  ------------------
  846|      0|            continue;
  847|      0|        }
  848|       |
  849|      0|        if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
  ------------------
  |  |  109|      0|#define ngx_close_file           close
  ------------------
                      if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      0|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (849:13): [True: 0, False: 0]
  ------------------
  850|      0|            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  851|      0|                          ngx_close_file_n " \"%s\" failed",
  852|      0|                          file[i].name.data);
  853|      0|        }
  854|      0|    }
  855|       |
  856|       |    /* free the newly created shared memory */
  857|       |
  858|      0|    part = &cycle->shared_memory.part;
  859|      0|    shm_zone = part->elts;
  860|       |
  861|      0|    for (i = 0; /* void */ ; i++) {
  862|       |
  863|      0|        if (i >= part->nelts) {
  ------------------
  |  Branch (863:13): [True: 0, False: 0]
  ------------------
  864|      0|            if (part->next == NULL) {
  ------------------
  |  Branch (864:17): [True: 0, False: 0]
  ------------------
  865|      0|                break;
  866|      0|            }
  867|      0|            part = part->next;
  868|      0|            shm_zone = part->elts;
  869|      0|            i = 0;
  870|      0|        }
  871|       |
  872|      0|        if (shm_zone[i].shm.addr == NULL) {
  ------------------
  |  Branch (872:13): [True: 0, False: 0]
  ------------------
  873|      0|            continue;
  874|      0|        }
  875|       |
  876|      0|        opart = &old_cycle->shared_memory.part;
  877|      0|        oshm_zone = opart->elts;
  878|       |
  879|      0|        for (n = 0; /* void */ ; n++) {
  880|       |
  881|      0|            if (n >= opart->nelts) {
  ------------------
  |  Branch (881:17): [True: 0, False: 0]
  ------------------
  882|      0|                if (opart->next == NULL) {
  ------------------
  |  Branch (882:21): [True: 0, False: 0]
  ------------------
  883|      0|                    break;
  884|      0|                }
  885|      0|                opart = opart->next;
  886|      0|                oshm_zone = opart->elts;
  887|      0|                n = 0;
  888|      0|            }
  889|       |
  890|      0|            if (shm_zone[i].shm.name.len != oshm_zone[n].shm.name.len) {
  ------------------
  |  Branch (890:17): [True: 0, False: 0]
  ------------------
  891|      0|                continue;
  892|      0|            }
  893|       |
  894|      0|            if (ngx_strncmp(shm_zone[i].shm.name.data,
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (894:17): [True: 0, False: 0]
  ------------------
  895|      0|                            oshm_zone[n].shm.name.data,
  896|      0|                            shm_zone[i].shm.name.len)
  897|      0|                != 0)
  898|      0|            {
  899|      0|                continue;
  900|      0|            }
  901|       |
  902|      0|            if (shm_zone[i].tag == oshm_zone[n].tag
  ------------------
  |  Branch (902:17): [True: 0, False: 0]
  ------------------
  903|      0|                && shm_zone[i].shm.size == oshm_zone[n].shm.size
  ------------------
  |  Branch (903:20): [True: 0, False: 0]
  ------------------
  904|      0|                && !shm_zone[i].noreuse)
  ------------------
  |  Branch (904:20): [True: 0, False: 0]
  ------------------
  905|      0|            {
  906|      0|                goto old_shm_zone_found;
  907|      0|            }
  908|       |
  909|      0|            break;
  910|      0|        }
  911|       |
  912|      0|        ngx_shm_free(&shm_zone[i].shm);
  913|       |
  914|      0|    old_shm_zone_found:
  915|       |
  916|      0|        continue;
  917|      0|    }
  918|       |
  919|      0|    if (ngx_test_config) {
  ------------------
  |  Branch (919:9): [True: 0, False: 0]
  ------------------
  920|      0|        ngx_destroy_cycle_pools(&conf);
  921|      0|        return NULL;
  922|      0|    }
  923|       |
  924|      0|    ls = cycle->listening.elts;
  925|      0|    for (i = 0; i < cycle->listening.nelts; i++) {
  ------------------
  |  Branch (925:17): [True: 0, False: 0]
  ------------------
  926|      0|        if (ls[i].fd == (ngx_socket_t) -1 || !ls[i].open) {
  ------------------
  |  Branch (926:13): [True: 0, False: 0]
  |  Branch (926:46): [True: 0, False: 0]
  ------------------
  927|      0|            continue;
  928|      0|        }
  929|       |
  930|      0|        if (ngx_close_socket(ls[i].fd) == -1) {
  ------------------
  |  |   69|      0|#define ngx_close_socket    close
  ------------------
  |  Branch (930:13): [True: 0, False: 0]
  ------------------
  931|      0|            ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  932|      0|                          ngx_close_socket_n " %V failed",
  933|      0|                          &ls[i].addr_text);
  934|      0|        }
  935|      0|    }
  936|       |
  937|      0|    ngx_destroy_cycle_pools(&conf);
  938|       |
  939|      0|    return NULL;
  940|      0|}
ngx_cycle.c:ngx_test_lockfile:
 1138|      1|{
 1139|       |#if !(NGX_HAVE_ATOMIC_OPS)
 1140|       |    ngx_fd_t  fd;
 1141|       |
 1142|       |    fd = ngx_open_file(file, NGX_FILE_RDWR, NGX_FILE_CREATE_OR_OPEN,
 1143|       |                       NGX_FILE_DEFAULT_ACCESS);
 1144|       |
 1145|       |    if (fd == NGX_INVALID_FILE) {
 1146|       |        ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
 1147|       |                      ngx_open_file_n " \"%s\" failed", file);
 1148|       |        return NGX_ERROR;
 1149|       |    }
 1150|       |
 1151|       |    if (ngx_close_file(fd) == NGX_FILE_ERROR) {
 1152|       |        ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
 1153|       |                      ngx_close_file_n " \"%s\" failed", file);
 1154|       |    }
 1155|       |
 1156|       |    if (ngx_delete_file(file) == NGX_FILE_ERROR) {
 1157|       |        ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
 1158|       |                      ngx_delete_file_n " \"%s\" failed", file);
 1159|       |    }
 1160|       |
 1161|       |#endif
 1162|       |
 1163|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1164|      1|}

ngx_get_full_name:
   22|      8|{
   23|      8|    size_t      len;
   24|      8|    u_char     *p, *n;
   25|      8|    ngx_int_t   rc;
   26|       |
   27|      8|    rc = ngx_test_full_name(name);
   28|       |
   29|      8|    if (rc == NGX_OK) {
  ------------------
  |  |   38|      8|#define  NGX_OK          0
  ------------------
  |  Branch (29:9): [True: 2, False: 6]
  ------------------
   30|      2|        return rc;
   31|      2|    }
   32|       |
   33|      6|    len = prefix->len;
   34|       |
   35|       |#if (NGX_WIN32)
   36|       |
   37|       |    if (rc == 2) {
   38|       |        len = rc;
   39|       |    }
   40|       |
   41|       |#endif
   42|       |
   43|      6|    n = ngx_pnalloc(pool, len + name->len + 1);
   44|      6|    if (n == NULL) {
  ------------------
  |  Branch (44:9): [True: 0, False: 6]
  ------------------
   45|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   46|      0|    }
   47|       |
   48|      6|    p = ngx_cpymem(n, prefix->data, len);
  ------------------
  |  |  107|      6|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
   49|      6|    ngx_cpystrn(p, name->data, name->len + 1);
   50|       |
   51|      6|    name->len += len;
   52|      6|    name->data = n;
   53|       |
   54|      6|    return NGX_OK;
  ------------------
  |  |   38|      6|#define  NGX_OK          0
  ------------------
   55|      6|}
ngx_write_chain_to_temp_file:
  110|     47|{
  111|     47|    ngx_int_t  rc;
  112|       |
  113|     47|    if (tf->file.fd == NGX_INVALID_FILE) {
  ------------------
  |  |   49|     47|#define NGX_INVALID_FILE         -1
  ------------------
  |  Branch (113:9): [True: 5, False: 42]
  ------------------
  114|      5|        rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
  115|      5|                                  tf->persistent, tf->clean, tf->access);
  116|       |
  117|      5|        if (rc != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (117:13): [True: 0, False: 5]
  ------------------
  118|      0|            return rc;
  119|      0|        }
  120|       |
  121|      5|        if (tf->log_level) {
  ------------------
  |  Branch (121:13): [True: 5, False: 0]
  ------------------
  122|      5|            ngx_log_error(tf->log_level, tf->file.log, 0, "%s %V",
  ------------------
  |  |   86|      5|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 5]
  |  |  ------------------
  ------------------
  123|      5|                          tf->warn, &tf->file.name);
  124|      5|        }
  125|      5|    }
  126|       |
  127|       |#if (NGX_THREADS && NGX_HAVE_PWRITEV)
  128|       |
  129|       |    if (tf->thread_write) {
  130|       |        return ngx_thread_write_chain_to_file(&tf->file, chain, tf->offset,
  131|       |                                              tf->pool);
  132|       |    }
  133|       |
  134|       |#endif
  135|       |
  136|     47|    return ngx_write_chain_to_file(&tf->file, chain, tf->offset, tf->pool);
  137|     47|}
ngx_create_temp_file:
  143|      5|{
  144|      5|    size_t                    levels;
  145|      5|    u_char                   *p;
  146|      5|    uint32_t                  n;
  147|      5|    ngx_err_t                 err;
  148|      5|    ngx_str_t                 name;
  149|      5|    ngx_uint_t                prefix;
  150|      5|    ngx_pool_cleanup_t       *cln;
  151|      5|    ngx_pool_cleanup_file_t  *clnf;
  152|       |
  153|      5|    if (file->name.len) {
  ------------------
  |  Branch (153:9): [True: 0, False: 5]
  ------------------
  154|      0|        name = file->name;
  155|      0|        levels = 0;
  156|      0|        prefix = 1;
  157|       |
  158|      5|    } else {
  159|      5|        name = path->name;
  160|      5|        levels = path->len;
  161|      5|        prefix = 0;
  162|      5|    }
  163|       |
  164|      5|    file->name.len = name.len + 1 + levels + 10;
  165|       |
  166|      5|    file->name.data = ngx_pnalloc(pool, file->name.len + 1);
  167|      5|    if (file->name.data == NULL) {
  ------------------
  |  Branch (167:9): [True: 0, False: 5]
  ------------------
  168|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  169|      0|    }
  170|       |
  171|       |#if 0
  172|       |    for (i = 0; i < file->name.len; i++) {
  173|       |        file->name.data[i] = 'X';
  174|       |    }
  175|       |#endif
  176|       |
  177|      5|    p = ngx_cpymem(file->name.data, name.data, name.len);
  ------------------
  |  |  107|      5|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  178|       |
  179|      5|    if (prefix) {
  ------------------
  |  Branch (179:9): [True: 0, False: 5]
  ------------------
  180|      0|        *p = '.';
  181|      0|    }
  182|       |
  183|      5|    p += 1 + levels;
  184|       |
  185|      5|    n = (uint32_t) ngx_next_temp_number(0);
  186|       |
  187|      5|    cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t));
  188|      5|    if (cln == NULL) {
  ------------------
  |  Branch (188:9): [True: 0, False: 5]
  ------------------
  189|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  190|      0|    }
  191|       |
  192|      5|    for ( ;; ) {
  193|      5|        (void) ngx_sprintf(p, "%010uD%Z", n);
  194|       |
  195|      5|        if (!prefix) {
  ------------------
  |  Branch (195:13): [True: 5, False: 0]
  ------------------
  196|      5|            ngx_create_hashed_filename(path, file->name.data, file->name.len);
  197|      5|        }
  198|       |
  199|      5|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
  200|      5|                       "hashed path: %s", file->name.data);
  201|       |
  202|      5|        file->fd = ngx_open_tempfile(file->name.data, persistent, access);
  203|       |
  204|      5|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
  205|      5|                       "temp fd:%d", file->fd);
  206|       |
  207|      5|        if (file->fd != NGX_INVALID_FILE) {
  ------------------
  |  |   49|      5|#define NGX_INVALID_FILE         -1
  ------------------
  |  Branch (207:13): [True: 5, False: 0]
  ------------------
  208|       |
  209|      5|            cln->handler = clean ? ngx_pool_delete_file : ngx_pool_cleanup_file;
  ------------------
  |  Branch (209:28): [True: 0, False: 5]
  ------------------
  210|      5|            clnf = cln->data;
  211|       |
  212|      5|            clnf->fd = file->fd;
  213|      5|            clnf->name = file->name.data;
  214|      5|            clnf->log = pool->log;
  215|       |
  216|      5|            return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  217|      5|        }
  218|       |
  219|      0|        err = ngx_errno;
  ------------------
  |  |   69|      0|#define ngx_errno                  errno
  ------------------
  220|       |
  221|      0|        if (err == NGX_EEXIST_FILE) {
  ------------------
  |  |   28|      0|#define NGX_EEXIST_FILE   EEXIST
  ------------------
  |  Branch (221:13): [True: 0, False: 0]
  ------------------
  222|      0|            n = (uint32_t) ngx_next_temp_number(1);
  223|      0|            continue;
  224|      0|        }
  225|       |
  226|      0|        if ((path->level[0] == 0) || (err != NGX_ENOPATH)) {
  ------------------
  |  |   20|      0|#define NGX_ENOPATH       ENOENT
  ------------------
  |  Branch (226:13): [True: 0, False: 0]
  |  Branch (226:38): [True: 0, False: 0]
  ------------------
  227|      0|            ngx_log_error(NGX_LOG_CRIT, file->log, err,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  228|      0|                          ngx_open_tempfile_n " \"%s\" failed",
  229|      0|                          file->name.data);
  230|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  231|      0|        }
  232|       |
  233|      0|        if (ngx_create_path(file, path) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (233:13): [True: 0, False: 0]
  ------------------
  234|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  235|      0|        }
  236|      0|    }
  237|      5|}
ngx_create_hashed_filename:
  242|      5|{
  243|      5|    size_t      i, level;
  244|      5|    ngx_uint_t  n;
  245|       |
  246|      5|    i = path->name.len + 1;
  247|       |
  248|      5|    file[path->name.len + path->len]  = '/';
  249|       |
  250|      5|    for (n = 0; n < NGX_MAX_PATH_LEVEL; n++) {
  ------------------
  |  |   42|      5|#define NGX_MAX_PATH_LEVEL  3
  ------------------
  |  Branch (250:17): [True: 5, False: 0]
  ------------------
  251|      5|        level = path->level[n];
  252|       |
  253|      5|        if (level == 0) {
  ------------------
  |  Branch (253:13): [True: 5, False: 0]
  ------------------
  254|      5|            break;
  255|      5|        }
  256|       |
  257|      0|        len -= level;
  258|      0|        file[i - 1] = '/';
  259|      0|        ngx_memcpy(&file[i], &file[len], level);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  260|      0|        i += level + 1;
  261|      0|    }
  262|      5|}
ngx_next_temp_number:
  349|      5|{
  350|      5|    ngx_atomic_uint_t  n, add;
  351|       |
  352|      5|    add = collision ? ngx_random_number : 1;
  ------------------
  |  Branch (352:11): [True: 0, False: 5]
  ------------------
  353|       |
  354|      5|    n = ngx_atomic_fetch_add(ngx_temp_number, add);
  ------------------
  |  |   63|      5|    __sync_fetch_and_add(value, add)
  ------------------
  355|       |
  356|      5|    return n + add;
  357|      5|}
ngx_conf_set_path_slot:
  362|      2|{
  363|      2|    char  *p = conf;
  364|       |
  365|      2|    ssize_t      level;
  366|      2|    ngx_str_t   *value;
  367|      2|    ngx_uint_t   i, n;
  368|      2|    ngx_path_t  *path, **slot;
  369|       |
  370|      2|    slot = (ngx_path_t **) (p + cmd->offset);
  371|       |
  372|      2|    if (*slot) {
  ------------------
  |  Branch (372:9): [True: 0, False: 2]
  ------------------
  373|      0|        return "is duplicate";
  374|      0|    }
  375|       |
  376|      2|    path = ngx_pcalloc(cf->pool, sizeof(ngx_path_t));
  377|      2|    if (path == NULL) {
  ------------------
  |  Branch (377:9): [True: 0, False: 2]
  ------------------
  378|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  379|      0|    }
  380|       |
  381|      2|    value = cf->args->elts;
  382|       |
  383|      2|    path->name = value[1];
  384|       |
  385|      2|    if (path->name.data[path->name.len - 1] == '/') {
  ------------------
  |  Branch (385:9): [True: 2, False: 0]
  ------------------
  386|      2|        path->name.len--;
  387|      2|    }
  388|       |
  389|      2|    if (ngx_conf_full_name(cf->cycle, &path->name, 0) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (389:9): [True: 0, False: 2]
  ------------------
  390|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  391|      0|    }
  392|       |
  393|      2|    path->conf_file = cf->conf_file->file.name.data;
  394|      2|    path->line = cf->conf_file->line;
  395|       |
  396|      2|    for (i = 0, n = 2; n < cf->args->nelts; i++, n++) {
  ------------------
  |  Branch (396:24): [True: 0, False: 2]
  ------------------
  397|      0|        level = ngx_atoi(value[n].data, value[n].len);
  398|      0|        if (level == NGX_ERROR || level == 0) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (398:13): [True: 0, False: 0]
  |  Branch (398:35): [True: 0, False: 0]
  ------------------
  399|      0|            return "invalid value";
  400|      0|        }
  401|       |
  402|      0|        path->level[i] = level;
  403|      0|        path->len += level + 1;
  404|      0|    }
  405|       |
  406|      2|    if (path->len > 10 + i) {
  ------------------
  |  Branch (406:9): [True: 0, False: 2]
  ------------------
  407|      0|        return "invalid value";
  408|      0|    }
  409|       |
  410|      2|    *slot = path;
  411|       |
  412|      2|    if (ngx_add_path(cf, slot) == NGX_ERROR) {
  ------------------
  |  |   39|      2|#define  NGX_ERROR      -1
  ------------------
  |  Branch (412:9): [True: 0, False: 2]
  ------------------
  413|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  414|      0|    }
  415|       |
  416|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  417|      2|}
ngx_conf_merge_path_value:
  423|     10|{
  424|     10|    ngx_uint_t  i;
  425|       |
  426|     10|    if (*path) {
  ------------------
  |  Branch (426:9): [True: 0, False: 10]
  ------------------
  427|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  428|      0|    }
  429|       |
  430|     10|    if (prev) {
  ------------------
  |  Branch (430:9): [True: 7, False: 3]
  ------------------
  431|      7|        *path = prev;
  432|      7|        return NGX_CONF_OK;
  ------------------
  |  |   63|      7|#define NGX_CONF_OK          NULL
  ------------------
  433|      7|    }
  434|       |
  435|      3|    *path = ngx_pcalloc(cf->pool, sizeof(ngx_path_t));
  436|      3|    if (*path == NULL) {
  ------------------
  |  Branch (436:9): [True: 0, False: 3]
  ------------------
  437|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  438|      0|    }
  439|       |
  440|      3|    (*path)->name = init->name;
  441|       |
  442|      3|    if (ngx_conf_full_name(cf->cycle, &(*path)->name, 0) != NGX_OK) {
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
  |  Branch (442:9): [True: 0, False: 3]
  ------------------
  443|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  444|      0|    }
  445|       |
  446|     12|    for (i = 0; i < NGX_MAX_PATH_LEVEL; i++) {
  ------------------
  |  |   42|     12|#define NGX_MAX_PATH_LEVEL  3
  ------------------
  |  Branch (446:17): [True: 9, False: 3]
  ------------------
  447|      9|        (*path)->level[i] = init->level[i];
  448|      9|        (*path)->len += init->level[i] + (init->level[i] ? 1 : 0);
  ------------------
  |  Branch (448:43): [True: 6, False: 3]
  ------------------
  449|      9|    }
  450|       |
  451|      3|    if (ngx_add_path(cf, path) != NGX_OK) {
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
  |  Branch (451:9): [True: 0, False: 3]
  ------------------
  452|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  453|      0|    }
  454|       |
  455|      3|    return NGX_CONF_OK;
  ------------------
  |  |   63|      3|#define NGX_CONF_OK          NULL
  ------------------
  456|      3|}
ngx_add_path:
  527|      5|{
  528|      5|    ngx_uint_t   i, n;
  529|      5|    ngx_path_t  *path, **p;
  530|       |
  531|      5|    path = *slot;
  532|       |
  533|      5|    p = cf->cycle->paths.elts;
  534|     11|    for (i = 0; i < cf->cycle->paths.nelts; i++) {
  ------------------
  |  Branch (534:17): [True: 7, False: 4]
  ------------------
  535|      7|        if (p[i]->name.len == path->name.len
  ------------------
  |  Branch (535:13): [True: 1, False: 6]
  ------------------
  536|      7|            && ngx_strcmp(p[i]->name.data, path->name.data) == 0)
  ------------------
  |  |   57|      1|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (536:16): [True: 1, False: 0]
  ------------------
  537|      1|        {
  538|      1|            if (p[i]->data != path->data) {
  ------------------
  |  Branch (538:17): [True: 0, False: 1]
  ------------------
  539|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  540|      0|                                   "the same path name \"%V\" "
  541|      0|                                   "used in %s:%ui and",
  542|      0|                                   &p[i]->name, p[i]->conf_file, p[i]->line);
  543|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  544|      0|            }
  545|       |
  546|      1|            for (n = 0; n < NGX_MAX_PATH_LEVEL; n++) {
  ------------------
  |  |   42|      1|#define NGX_MAX_PATH_LEVEL  3
  ------------------
  |  Branch (546:25): [True: 1, False: 0]
  ------------------
  547|      1|                if (p[i]->level[n] != path->level[n]) {
  ------------------
  |  Branch (547:21): [True: 0, False: 1]
  ------------------
  548|      0|                    if (path->conf_file == NULL) {
  ------------------
  |  Branch (548:25): [True: 0, False: 0]
  ------------------
  549|      0|                        if (p[i]->conf_file == NULL) {
  ------------------
  |  Branch (549:29): [True: 0, False: 0]
  ------------------
  550|      0|                            ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  551|      0|                                      "the default path name \"%V\" has "
  552|      0|                                      "the same name as another default path, "
  553|      0|                                      "but the different levels, you need to "
  554|      0|                                      "redefine one of them in http section",
  555|      0|                                      &p[i]->name);
  556|      0|                            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  557|      0|                        }
  558|       |
  559|      0|                        ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  560|      0|                                      "the path name \"%V\" in %s:%ui has "
  561|      0|                                      "the same name as default path, but "
  562|      0|                                      "the different levels, you need to "
  563|      0|                                      "define default path in http section",
  564|      0|                                      &p[i]->name, p[i]->conf_file, p[i]->line);
  565|      0|                        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  566|      0|                    }
  567|       |
  568|      0|                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  569|      0|                                      "the same path name \"%V\" in %s:%ui "
  570|      0|                                      "has the different levels than",
  571|      0|                                      &p[i]->name, p[i]->conf_file, p[i]->line);
  572|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  573|      0|                }
  574|       |
  575|      1|                if (p[i]->level[n] == 0) {
  ------------------
  |  Branch (575:21): [True: 1, False: 0]
  ------------------
  576|      1|                    break;
  577|      1|                }
  578|      1|            }
  579|       |
  580|      1|            *slot = p[i];
  581|       |
  582|      1|            return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  583|      1|        }
  584|      7|    }
  585|       |
  586|      4|    p = ngx_array_push(&cf->cycle->paths);
  587|      4|    if (p == NULL) {
  ------------------
  |  Branch (587:9): [True: 0, False: 4]
  ------------------
  588|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  589|      0|    }
  590|       |
  591|      4|    *p = path;
  592|       |
  593|      4|    return NGX_OK;
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
  594|      4|}
ngx_create_paths:
  599|      1|{
  600|      1|    ngx_err_t         err;
  601|      1|    ngx_uint_t        i;
  602|      1|    ngx_path_t      **path;
  603|       |
  604|      1|    path = cycle->paths.elts;
  605|      5|    for (i = 0; i < cycle->paths.nelts; i++) {
  ------------------
  |  Branch (605:17): [True: 4, False: 1]
  ------------------
  606|       |
  607|      4|        if (ngx_create_dir(path[i]->name.data, 0700) == NGX_FILE_ERROR) {
  ------------------
  |  |  231|      4|#define ngx_create_dir(name, access) mkdir((const char *) name, access)
  ------------------
                      if (ngx_create_dir(path[i]->name.data, 0700) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      4|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (607:13): [True: 4, False: 0]
  ------------------
  608|      4|            err = ngx_errno;
  ------------------
  |  |   69|      4|#define ngx_errno                  errno
  ------------------
  609|      4|            if (err != NGX_EEXIST) {
  ------------------
  |  |   27|      4|#define NGX_EEXIST        EEXIST
  ------------------
  |  Branch (609:17): [True: 0, False: 4]
  ------------------
  610|      0|                ngx_log_error(NGX_LOG_EMERG, cycle->log, err,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  611|      0|                              ngx_create_dir_n " \"%s\" failed",
  612|      0|                              path[i]->name.data);
  613|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  614|      0|            }
  615|      4|        }
  616|       |
  617|      4|        if (user == (ngx_uid_t) NGX_CONF_UNSET_UINT) {
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  |  Branch (617:13): [True: 0, False: 4]
  ------------------
  618|      0|            continue;
  619|      0|        }
  620|       |
  621|      4|#if !(NGX_WIN32)
  622|      4|        {
  623|      4|        ngx_file_info_t   fi;
  624|       |
  625|      4|        if (ngx_file_info(path[i]->name.data, &fi) == NGX_FILE_ERROR) {
  ------------------
  |  |  173|      4|#define ngx_file_info(file, sb)  stat((const char *) file, sb)
  ------------------
                      if (ngx_file_info(path[i]->name.data, &fi) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      4|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (625:13): [True: 0, False: 4]
  ------------------
  626|      0|            ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  627|      0|                          ngx_file_info_n " \"%s\" failed", path[i]->name.data);
  628|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  629|      0|        }
  630|       |
  631|      4|        if (fi.st_uid != user) {
  ------------------
  |  Branch (631:13): [True: 4, False: 0]
  ------------------
  632|      4|            if (chown((const char *) path[i]->name.data, user, -1) == -1) {
  ------------------
  |  Branch (632:17): [True: 0, False: 4]
  ------------------
  633|      0|                ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  634|      0|                              "chown(\"%s\", %d) failed",
  635|      0|                              path[i]->name.data, user);
  636|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  637|      0|            }
  638|      4|        }
  639|       |
  640|      4|        if ((fi.st_mode & (S_IRUSR|S_IWUSR|S_IXUSR))
  ------------------
  |  Branch (640:13): [True: 0, False: 4]
  ------------------
  641|      4|                                                  != (S_IRUSR|S_IWUSR|S_IXUSR))
  642|      0|        {
  643|      0|            fi.st_mode |= (S_IRUSR|S_IWUSR|S_IXUSR);
  644|       |
  645|      0|            if (chmod((const char *) path[i]->name.data, fi.st_mode) == -1) {
  ------------------
  |  Branch (645:17): [True: 0, False: 0]
  ------------------
  646|      0|                ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  647|      0|                              "chmod() \"%s\" failed", path[i]->name.data);
  648|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  649|      0|            }
  650|      0|        }
  651|      4|        }
  652|      4|#endif
  653|      4|    }
  654|       |
  655|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  656|      1|}
ngx_file.c:ngx_test_full_name:
   60|      8|{
   61|       |#if (NGX_WIN32)
   62|       |    u_char  c0, c1;
   63|       |
   64|       |    c0 = name->data[0];
   65|       |
   66|       |    if (name->len < 2) {
   67|       |        if (c0 == '/') {
   68|       |            return 2;
   69|       |        }
   70|       |
   71|       |        return NGX_DECLINED;
   72|       |    }
   73|       |
   74|       |    c1 = name->data[1];
   75|       |
   76|       |    if (c1 == ':') {
   77|       |        c0 |= 0x20;
   78|       |
   79|       |        if ((c0 >= 'a' && c0 <= 'z')) {
   80|       |            return NGX_OK;
   81|       |        }
   82|       |
   83|       |        return NGX_DECLINED;
   84|       |    }
   85|       |
   86|       |    if (c1 == '/') {
   87|       |        return NGX_OK;
   88|       |    }
   89|       |
   90|       |    if (c0 == '/') {
   91|       |        return 2;
   92|       |    }
   93|       |
   94|       |    return NGX_DECLINED;
   95|       |
   96|       |#else
   97|       |
   98|      8|    if (name->data[0] == '/') {
  ------------------
  |  Branch (98:9): [True: 2, False: 6]
  ------------------
   99|      2|        return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  100|      2|    }
  101|       |
  102|      6|    return NGX_DECLINED;
  ------------------
  |  |   43|      6|#define  NGX_DECLINED   -5
  ------------------
  103|       |
  104|      8|#endif
  105|      8|}

ngx_hash_find:
   14|     59|{
   15|     59|    ngx_uint_t       i;
   16|     59|    ngx_hash_elt_t  *elt;
   17|       |
   18|       |#if 0
   19|       |    ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, "hf:\"%*s\"", len, name);
   20|       |#endif
   21|       |
   22|     59|    elt = hash->buckets[key % hash->size];
   23|       |
   24|     59|    if (elt == NULL) {
  ------------------
  |  Branch (24:9): [True: 8, False: 51]
  ------------------
   25|      8|        return NULL;
   26|      8|    }
   27|       |
   28|     74|    while (elt->value) {
  ------------------
  |  Branch (28:12): [True: 54, False: 20]
  ------------------
   29|     54|        if (len != (size_t) elt->len) {
  ------------------
  |  Branch (29:13): [True: 19, False: 35]
  ------------------
   30|     19|            goto next;
   31|     19|        }
   32|       |
   33|    388|        for (i = 0; i < len; i++) {
  ------------------
  |  Branch (33:21): [True: 357, False: 31]
  ------------------
   34|    357|            if (name[i] != elt->name[i]) {
  ------------------
  |  Branch (34:17): [True: 4, False: 353]
  ------------------
   35|      4|                goto next;
   36|      4|            }
   37|    357|        }
   38|       |
   39|     31|        return elt->value;
   40|       |
   41|     23|    next:
   42|       |
   43|     23|        elt = (ngx_hash_elt_t *) ngx_align_ptr(&elt->name[0] + elt->len,
  ------------------
  |  |  102|     23|    (u_char *) (((uintptr_t) (p) + ((uintptr_t) a - 1)) & ~((uintptr_t) a - 1))
  ------------------
   44|     23|                                               sizeof(void *));
   45|     23|        continue;
   46|     35|    }
   47|       |
   48|     20|    return NULL;
   49|     51|}
ngx_hash_find_combined:
  213|     23|{
  214|     23|    void  *value;
  215|       |
  216|     23|    if (hash->hash.buckets) {
  ------------------
  |  Branch (216:9): [True: 0, False: 23]
  ------------------
  217|      0|        value = ngx_hash_find(&hash->hash, key, name, len);
  218|       |
  219|      0|        if (value) {
  ------------------
  |  Branch (219:13): [True: 0, False: 0]
  ------------------
  220|      0|            return value;
  221|      0|        }
  222|      0|    }
  223|       |
  224|     23|    if (len == 0) {
  ------------------
  |  Branch (224:9): [True: 20, False: 3]
  ------------------
  225|     20|        return NULL;
  226|     20|    }
  227|       |
  228|      3|    if (hash->wc_head && hash->wc_head->hash.buckets) {
  ------------------
  |  Branch (228:9): [True: 0, False: 3]
  |  Branch (228:26): [True: 0, False: 0]
  ------------------
  229|      0|        value = ngx_hash_find_wc_head(hash->wc_head, name, len);
  230|       |
  231|      0|        if (value) {
  ------------------
  |  Branch (231:13): [True: 0, False: 0]
  ------------------
  232|      0|            return value;
  233|      0|        }
  234|      0|    }
  235|       |
  236|      3|    if (hash->wc_tail && hash->wc_tail->hash.buckets) {
  ------------------
  |  Branch (236:9): [True: 0, False: 3]
  |  Branch (236:26): [True: 0, False: 0]
  ------------------
  237|      0|        value = ngx_hash_find_wc_tail(hash->wc_tail, name, len);
  238|       |
  239|      0|        if (value) {
  ------------------
  |  Branch (239:13): [True: 0, False: 0]
  ------------------
  240|      0|            return value;
  241|      0|        }
  242|      0|    }
  243|       |
  244|      3|    return NULL;
  245|      3|}
ngx_hash_init:
  253|     17|{
  254|     17|    u_char          *elts;
  255|     17|    size_t           len;
  256|     17|    u_short         *test;
  257|     17|    ngx_uint_t       i, n, key, size, start, bucket_size;
  258|     17|    ngx_hash_elt_t  *elt, **buckets;
  259|       |
  260|     17|    if (hinit->max_size == 0) {
  ------------------
  |  Branch (260:9): [True: 0, False: 17]
  ------------------
  261|      0|        ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  262|      0|                      "could not build %s, you should "
  263|      0|                      "increase %s_max_size: %i",
  264|      0|                      hinit->name, hinit->name, hinit->max_size);
  265|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  266|      0|    }
  267|       |
  268|     17|    if (hinit->bucket_size > 65536 - ngx_cacheline_size) {
  ------------------
  |  Branch (268:9): [True: 0, False: 17]
  ------------------
  269|      0|        ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  270|      0|                      "could not build %s, too large "
  271|      0|                      "%s_bucket_size: %i",
  272|      0|                      hinit->name, hinit->name, hinit->bucket_size);
  273|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  274|      0|    }
  275|       |
  276|    253|    for (n = 0; n < nelts; n++) {
  ------------------
  |  Branch (276:17): [True: 236, False: 17]
  ------------------
  277|    236|        if (names[n].key.data == NULL) {
  ------------------
  |  Branch (277:13): [True: 11, False: 225]
  ------------------
  278|     11|            continue;
  279|     11|        }
  280|       |
  281|    225|        if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *))
  ------------------
  |  |  249|    225|    (sizeof(void *) + ngx_align((name)->key.len + 2, sizeof(void *)))
  |  |  ------------------
  |  |  |  |  100|    225|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  |  |  ------------------
  ------------------
  |  Branch (281:13): [True: 0, False: 225]
  ------------------
  282|      0|        {
  283|      0|            ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  284|      0|                          "could not build %s, you should "
  285|      0|                          "increase %s_bucket_size: %i",
  286|      0|                          hinit->name, hinit->name, hinit->bucket_size);
  287|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  288|      0|        }
  289|    225|    }
  290|       |
  291|     17|    test = ngx_alloc(hinit->max_size * sizeof(u_short), hinit->pool->log);
  292|     17|    if (test == NULL) {
  ------------------
  |  Branch (292:9): [True: 0, False: 17]
  ------------------
  293|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  294|      0|    }
  295|       |
  296|     17|    bucket_size = hinit->bucket_size - sizeof(void *);
  297|       |
  298|     17|    start = nelts / (bucket_size / (2 * sizeof(void *)));
  299|     17|    start = start ? start : 1;
  ------------------
  |  Branch (299:13): [True: 14, False: 3]
  ------------------
  300|       |
  301|     17|    if (hinit->max_size > 10000 && nelts && hinit->max_size / nelts < 100) {
  ------------------
  |  Branch (301:9): [True: 0, False: 17]
  |  Branch (301:36): [True: 0, False: 0]
  |  Branch (301:45): [True: 0, False: 0]
  ------------------
  302|      0|        start = hinit->max_size - 1000;
  303|      0|    }
  304|       |
  305|    331|    for (size = start; size <= hinit->max_size; size++) {
  ------------------
  |  Branch (305:24): [True: 331, False: 0]
  ------------------
  306|       |
  307|    331|        ngx_memzero(test, size * sizeof(u_short));
  ------------------
  |  |   88|    331|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  308|       |
  309|  6.73k|        for (n = 0; n < nelts; n++) {
  ------------------
  |  Branch (309:21): [True: 6.72k, False: 17]
  ------------------
  310|  6.72k|            if (names[n].key.data == NULL) {
  ------------------
  |  Branch (310:17): [True: 11, False: 6.71k]
  ------------------
  311|     11|                continue;
  312|     11|            }
  313|       |
  314|  6.71k|            key = names[n].key_hash % size;
  315|  6.71k|            len = test[key] + NGX_HASH_ELT_SIZE(&names[n]);
  ------------------
  |  |  249|  6.71k|    (sizeof(void *) + ngx_align((name)->key.len + 2, sizeof(void *)))
  |  |  ------------------
  |  |  |  |  100|  6.71k|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  |  |  ------------------
  ------------------
  316|       |
  317|       |#if 0
  318|       |            ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0,
  319|       |                          "%ui: %ui %uz \"%V\"",
  320|       |                          size, key, len, &names[n].key);
  321|       |#endif
  322|       |
  323|  6.71k|            if (len > bucket_size) {
  ------------------
  |  Branch (323:17): [True: 314, False: 6.39k]
  ------------------
  324|    314|                goto next;
  325|    314|            }
  326|       |
  327|  6.39k|            test[key] = (u_short) len;
  328|  6.39k|        }
  329|       |
  330|     17|        goto found;
  331|       |
  332|    314|    next:
  333|       |
  334|    314|        continue;
  335|    331|    }
  336|       |
  337|      0|    size = hinit->max_size;
  338|       |
  339|      0|    ngx_log_error(NGX_LOG_WARN, hinit->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  340|      0|                  "could not build optimal %s, you should increase "
  341|      0|                  "either %s_max_size: %i or %s_bucket_size: %i; "
  342|      0|                  "ignoring %s_bucket_size",
  343|      0|                  hinit->name, hinit->name, hinit->max_size,
  344|      0|                  hinit->name, hinit->bucket_size, hinit->name);
  345|       |
  346|     17|found:
  347|       |
  348|    408|    for (i = 0; i < size; i++) {
  ------------------
  |  Branch (348:17): [True: 391, False: 17]
  ------------------
  349|    391|        test[i] = sizeof(void *);
  350|    391|    }
  351|       |
  352|    253|    for (n = 0; n < nelts; n++) {
  ------------------
  |  Branch (352:17): [True: 236, False: 17]
  ------------------
  353|    236|        if (names[n].key.data == NULL) {
  ------------------
  |  Branch (353:13): [True: 11, False: 225]
  ------------------
  354|     11|            continue;
  355|     11|        }
  356|       |
  357|    225|        key = names[n].key_hash % size;
  358|    225|        len = test[key] + NGX_HASH_ELT_SIZE(&names[n]);
  ------------------
  |  |  249|    225|    (sizeof(void *) + ngx_align((name)->key.len + 2, sizeof(void *)))
  |  |  ------------------
  |  |  |  |  100|    225|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  |  |  ------------------
  ------------------
  359|       |
  360|    225|        if (len > 65536 - ngx_cacheline_size) {
  ------------------
  |  Branch (360:13): [True: 0, False: 225]
  ------------------
  361|      0|            ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  362|      0|                          "could not build %s, you should "
  363|      0|                          "increase %s_max_size: %i",
  364|      0|                          hinit->name, hinit->name, hinit->max_size);
  365|      0|            ngx_free(test);
  ------------------
  |  |   19|      0|#define ngx_free          free
  ------------------
  366|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  367|      0|        }
  368|       |
  369|    225|        test[key] = (u_short) len;
  370|    225|    }
  371|       |
  372|     17|    len = 0;
  373|       |
  374|    408|    for (i = 0; i < size; i++) {
  ------------------
  |  Branch (374:17): [True: 391, False: 17]
  ------------------
  375|    391|        if (test[i] == sizeof(void *)) {
  ------------------
  |  Branch (375:13): [True: 214, False: 177]
  ------------------
  376|    214|            continue;
  377|    214|        }
  378|       |
  379|    177|        test[i] = (u_short) (ngx_align(test[i], ngx_cacheline_size));
  ------------------
  |  |  100|    177|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
  380|       |
  381|    177|        len += test[i];
  382|    177|    }
  383|       |
  384|     17|    if (hinit->hash == NULL) {
  ------------------
  |  Branch (384:9): [True: 0, False: 17]
  ------------------
  385|      0|        hinit->hash = ngx_pcalloc(hinit->pool, sizeof(ngx_hash_wildcard_t)
  386|      0|                                             + size * sizeof(ngx_hash_elt_t *));
  387|      0|        if (hinit->hash == NULL) {
  ------------------
  |  Branch (387:13): [True: 0, False: 0]
  ------------------
  388|      0|            ngx_free(test);
  ------------------
  |  |   19|      0|#define ngx_free          free
  ------------------
  389|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  390|      0|        }
  391|       |
  392|      0|        buckets = (ngx_hash_elt_t **)
  393|      0|                      ((u_char *) hinit->hash + sizeof(ngx_hash_wildcard_t));
  394|       |
  395|     17|    } else {
  396|     17|        buckets = ngx_pcalloc(hinit->pool, size * sizeof(ngx_hash_elt_t *));
  397|     17|        if (buckets == NULL) {
  ------------------
  |  Branch (397:13): [True: 0, False: 17]
  ------------------
  398|      0|            ngx_free(test);
  ------------------
  |  |   19|      0|#define ngx_free          free
  ------------------
  399|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  400|      0|        }
  401|     17|    }
  402|       |
  403|     17|    elts = ngx_palloc(hinit->pool, len + ngx_cacheline_size);
  404|     17|    if (elts == NULL) {
  ------------------
  |  Branch (404:9): [True: 0, False: 17]
  ------------------
  405|      0|        ngx_free(test);
  ------------------
  |  |   19|      0|#define ngx_free          free
  ------------------
  406|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  407|      0|    }
  408|       |
  409|     17|    elts = ngx_align_ptr(elts, ngx_cacheline_size);
  ------------------
  |  |  102|     17|    (u_char *) (((uintptr_t) (p) + ((uintptr_t) a - 1)) & ~((uintptr_t) a - 1))
  ------------------
  410|       |
  411|    408|    for (i = 0; i < size; i++) {
  ------------------
  |  Branch (411:17): [True: 391, False: 17]
  ------------------
  412|    391|        if (test[i] == sizeof(void *)) {
  ------------------
  |  Branch (412:13): [True: 214, False: 177]
  ------------------
  413|    214|            continue;
  414|    214|        }
  415|       |
  416|    177|        buckets[i] = (ngx_hash_elt_t *) elts;
  417|    177|        elts += test[i];
  418|    177|    }
  419|       |
  420|    408|    for (i = 0; i < size; i++) {
  ------------------
  |  Branch (420:17): [True: 391, False: 17]
  ------------------
  421|    391|        test[i] = 0;
  422|    391|    }
  423|       |
  424|    253|    for (n = 0; n < nelts; n++) {
  ------------------
  |  Branch (424:17): [True: 236, False: 17]
  ------------------
  425|    236|        if (names[n].key.data == NULL) {
  ------------------
  |  Branch (425:13): [True: 11, False: 225]
  ------------------
  426|     11|            continue;
  427|     11|        }
  428|       |
  429|    225|        key = names[n].key_hash % size;
  430|    225|        elt = (ngx_hash_elt_t *) ((u_char *) buckets[key] + test[key]);
  431|       |
  432|    225|        elt->value = names[n].value;
  433|    225|        elt->len = (u_short) names[n].key.len;
  434|       |
  435|    225|        ngx_strlow(elt->name, names[n].key.data, names[n].key.len);
  436|       |
  437|    225|        test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n]));
  ------------------
  |  |  249|    225|    (sizeof(void *) + ngx_align((name)->key.len + 2, sizeof(void *)))
  |  |  ------------------
  |  |  |  |  100|    225|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  |  |  ------------------
  ------------------
  438|    225|    }
  439|       |
  440|    408|    for (i = 0; i < size; i++) {
  ------------------
  |  Branch (440:17): [True: 391, False: 17]
  ------------------
  441|    391|        if (buckets[i] == NULL) {
  ------------------
  |  Branch (441:13): [True: 214, False: 177]
  ------------------
  442|    214|            continue;
  443|    214|        }
  444|       |
  445|    177|        elt = (ngx_hash_elt_t *) ((u_char *) buckets[i] + test[i]);
  446|       |
  447|    177|        elt->value = NULL;
  448|    177|    }
  449|       |
  450|     17|    ngx_free(test);
  ------------------
  |  |   19|     17|#define ngx_free          free
  ------------------
  451|       |
  452|     17|    hinit->hash->buckets = buckets;
  453|     17|    hinit->hash->size = size;
  454|       |
  455|       |#if 0
  456|       |
  457|       |    for (i = 0; i < size; i++) {
  458|       |        ngx_str_t   val;
  459|       |        ngx_uint_t  key;
  460|       |
  461|       |        elt = buckets[i];
  462|       |
  463|       |        if (elt == NULL) {
  464|       |            ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0,
  465|       |                          "%ui: NULL", i);
  466|       |            continue;
  467|       |        }
  468|       |
  469|       |        while (elt->value) {
  470|       |            val.len = elt->len;
  471|       |            val.data = &elt->name[0];
  472|       |
  473|       |            key = hinit->key(val.data, val.len);
  474|       |
  475|       |            ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0,
  476|       |                          "%ui: %p \"%V\" %ui", i, elt, &val, key);
  477|       |
  478|       |            elt = (ngx_hash_elt_t *) ngx_align_ptr(&elt->name[0] + elt->len,
  479|       |                                                   sizeof(void *));
  480|       |        }
  481|       |    }
  482|       |
  483|       |#endif
  484|       |
  485|     17|    return NGX_OK;
  ------------------
  |  |   38|     17|#define  NGX_OK          0
  ------------------
  486|     17|}
ngx_hash_key:
  636|    133|{
  637|    133|    ngx_uint_t  i, key;
  638|       |
  639|    133|    key = 0;
  640|       |
  641|  1.73k|    for (i = 0; i < len; i++) {
  ------------------
  |  Branch (641:17): [True: 1.60k, False: 133]
  ------------------
  642|  1.60k|        key = ngx_hash(key, data[i]);
  ------------------
  |  |  114|  1.60k|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
  643|  1.60k|    }
  644|       |
  645|    133|    return key;
  646|    133|}
ngx_hash_key_lc:
  651|    115|{
  652|    115|    ngx_uint_t  i, key;
  653|       |
  654|    115|    key = 0;
  655|       |
  656|  1.37k|    for (i = 0; i < len; i++) {
  ------------------
  |  Branch (656:17): [True: 1.26k, False: 115]
  ------------------
  657|  1.26k|        key = ngx_hash(key, ngx_tolower(data[i]));
  ------------------
  |  |  114|  4.94k|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  |  |  ------------------
  |  |  |  Branch (114:53): [True: 1.15k, False: 114]
  |  |  |  Branch (114:53): [True: 235, False: 915]
  |  |  ------------------
  ------------------
  658|  1.26k|    }
  659|       |
  660|    115|    return key;
  661|    115|}
ngx_hash_strlow:
  666|     11|{
  667|     11|    ngx_uint_t  key;
  668|       |
  669|     11|    key = 0;
  670|       |
  671|     11|    while (n--) {
  ------------------
  |  Branch (671:12): [True: 0, False: 11]
  ------------------
  672|      0|        *dst = ngx_tolower(*src);
  ------------------
  |  |   47|      0|#define ngx_tolower(c)      (u_char) ((c >= 'A' && c <= 'Z') ? (c | 0x20) : c)
  |  |  ------------------
  |  |  |  Branch (47:40): [True: 0, False: 0]
  |  |  |  Branch (47:52): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  673|      0|        key = ngx_hash(key, *dst);
  ------------------
  |  |  114|      0|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
  674|      0|        dst++;
  675|      0|        src++;
  676|      0|    }
  677|       |
  678|     11|    return key;
  679|     11|}
ngx_hash_keys_array_init:
  684|      5|{
  685|      5|    ngx_uint_t  asize;
  686|       |
  687|      5|    if (type == NGX_HASH_SMALL) {
  ------------------
  |  |   65|      5|#define NGX_HASH_SMALL            1
  ------------------
  |  Branch (687:9): [True: 2, False: 3]
  ------------------
  688|      2|        asize = 4;
  689|      2|        ha->hsize = 107;
  690|       |
  691|      3|    } else {
  692|      3|        asize = NGX_HASH_LARGE_ASIZE;
  ------------------
  |  |   68|      3|#define NGX_HASH_LARGE_ASIZE      16384
  ------------------
  693|      3|        ha->hsize = NGX_HASH_LARGE_HSIZE;
  ------------------
  |  |   69|      3|#define NGX_HASH_LARGE_HSIZE      10007
  ------------------
  694|      3|    }
  695|       |
  696|      5|    if (ngx_array_init(&ha->keys, ha->temp_pool, asize, sizeof(ngx_hash_key_t))
  ------------------
  |  Branch (696:9): [True: 0, False: 5]
  ------------------
  697|      5|        != NGX_OK)
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  698|      0|    {
  699|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  700|      0|    }
  701|       |
  702|      5|    if (ngx_array_init(&ha->dns_wc_head, ha->temp_pool, asize,
  ------------------
  |  Branch (702:9): [True: 0, False: 5]
  ------------------
  703|      5|                       sizeof(ngx_hash_key_t))
  704|      5|        != NGX_OK)
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  705|      0|    {
  706|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  707|      0|    }
  708|       |
  709|      5|    if (ngx_array_init(&ha->dns_wc_tail, ha->temp_pool, asize,
  ------------------
  |  Branch (709:9): [True: 0, False: 5]
  ------------------
  710|      5|                       sizeof(ngx_hash_key_t))
  711|      5|        != NGX_OK)
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  712|      0|    {
  713|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  714|      0|    }
  715|       |
  716|      5|    ha->keys_hash = ngx_pcalloc(ha->temp_pool, sizeof(ngx_array_t) * ha->hsize);
  717|      5|    if (ha->keys_hash == NULL) {
  ------------------
  |  Branch (717:9): [True: 0, False: 5]
  ------------------
  718|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  719|      0|    }
  720|       |
  721|      5|    ha->dns_wc_head_hash = ngx_pcalloc(ha->temp_pool,
  722|      5|                                       sizeof(ngx_array_t) * ha->hsize);
  723|      5|    if (ha->dns_wc_head_hash == NULL) {
  ------------------
  |  Branch (723:9): [True: 0, False: 5]
  ------------------
  724|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  725|      0|    }
  726|       |
  727|      5|    ha->dns_wc_tail_hash = ngx_pcalloc(ha->temp_pool,
  728|      5|                                       sizeof(ngx_array_t) * ha->hsize);
  729|      5|    if (ha->dns_wc_tail_hash == NULL) {
  ------------------
  |  Branch (729:9): [True: 0, False: 5]
  ------------------
  730|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  731|      0|    }
  732|       |
  733|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  734|      5|}
ngx_hash_add_key:
  740|    113|{
  741|    113|    size_t           len;
  742|    113|    u_char          *p;
  743|    113|    ngx_str_t       *name;
  744|    113|    ngx_uint_t       i, k, n, skip, last;
  745|    113|    ngx_array_t     *keys, *hwc;
  746|    113|    ngx_hash_key_t  *hk;
  747|       |
  748|    113|    last = key->len;
  749|       |
  750|    113|    if (flags & NGX_HASH_WILDCARD_KEY) {
  ------------------
  |  |   71|    113|#define NGX_HASH_WILDCARD_KEY     1
  ------------------
  |  Branch (750:9): [True: 0, False: 113]
  ------------------
  751|       |
  752|       |        /*
  753|       |         * supported wildcards:
  754|       |         *     "*.example.com", ".example.com", and "www.example.*"
  755|       |         */
  756|       |
  757|      0|        n = 0;
  758|       |
  759|      0|        for (i = 0; i < key->len; i++) {
  ------------------
  |  Branch (759:21): [True: 0, False: 0]
  ------------------
  760|       |
  761|      0|            if (key->data[i] == '*') {
  ------------------
  |  Branch (761:17): [True: 0, False: 0]
  ------------------
  762|      0|                if (++n > 1) {
  ------------------
  |  Branch (762:21): [True: 0, False: 0]
  ------------------
  763|      0|                    return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  764|      0|                }
  765|      0|            }
  766|       |
  767|      0|            if (key->data[i] == '.' && key->data[i + 1] == '.') {
  ------------------
  |  Branch (767:17): [True: 0, False: 0]
  |  Branch (767:40): [True: 0, False: 0]
  ------------------
  768|      0|                return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  769|      0|            }
  770|       |
  771|      0|            if (key->data[i] == '\0') {
  ------------------
  |  Branch (771:17): [True: 0, False: 0]
  ------------------
  772|      0|                return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  773|      0|            }
  774|      0|        }
  775|       |
  776|      0|        if (key->len > 1 && key->data[0] == '.') {
  ------------------
  |  Branch (776:13): [True: 0, False: 0]
  |  Branch (776:29): [True: 0, False: 0]
  ------------------
  777|      0|            skip = 1;
  778|      0|            goto wildcard;
  779|      0|        }
  780|       |
  781|      0|        if (key->len > 2) {
  ------------------
  |  Branch (781:13): [True: 0, False: 0]
  ------------------
  782|       |
  783|      0|            if (key->data[0] == '*' && key->data[1] == '.') {
  ------------------
  |  Branch (783:17): [True: 0, False: 0]
  |  Branch (783:40): [True: 0, False: 0]
  ------------------
  784|      0|                skip = 2;
  785|      0|                goto wildcard;
  786|      0|            }
  787|       |
  788|      0|            if (key->data[i - 2] == '.' && key->data[i - 1] == '*') {
  ------------------
  |  Branch (788:17): [True: 0, False: 0]
  |  Branch (788:44): [True: 0, False: 0]
  ------------------
  789|      0|                skip = 0;
  790|      0|                last -= 2;
  791|      0|                goto wildcard;
  792|      0|            }
  793|      0|        }
  794|       |
  795|      0|        if (n) {
  ------------------
  |  Branch (795:13): [True: 0, False: 0]
  ------------------
  796|      0|            return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  797|      0|        }
  798|      0|    }
  799|       |
  800|       |    /* exact hash */
  801|       |
  802|    113|    k = 0;
  803|       |
  804|  1.59k|    for (i = 0; i < last; i++) {
  ------------------
  |  Branch (804:17): [True: 1.47k, False: 113]
  ------------------
  805|  1.47k|        if (!(flags & NGX_HASH_READONLY_KEY)) {
  ------------------
  |  |   72|  1.47k|#define NGX_HASH_READONLY_KEY     2
  ------------------
  |  Branch (805:13): [True: 1.43k, False: 48]
  ------------------
  806|  1.43k|            key->data[i] = ngx_tolower(key->data[i]);
  ------------------
  |  |   47|  1.43k|#define ngx_tolower(c)      (u_char) ((c >= 'A' && c <= 'Z') ? (c | 0x20) : c)
  |  |  ------------------
  |  |  |  Branch (47:40): [True: 1.42k, False: 5]
  |  |  |  Branch (47:52): [True: 0, False: 1.42k]
  |  |  ------------------
  ------------------
  807|  1.43k|        }
  808|  1.47k|        k = ngx_hash(k, key->data[i]);
  ------------------
  |  |  114|  1.47k|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
  809|  1.47k|    }
  810|       |
  811|    113|    k %= ha->hsize;
  812|       |
  813|       |    /* check conflicts in exact hash */
  814|       |
  815|    113|    name = ha->keys_hash[k].elts;
  816|       |
  817|    113|    if (name) {
  ------------------
  |  Branch (817:9): [True: 35, False: 78]
  ------------------
  818|     83|        for (i = 0; i < ha->keys_hash[k].nelts; i++) {
  ------------------
  |  Branch (818:21): [True: 48, False: 35]
  ------------------
  819|     48|            if (last != name[i].len) {
  ------------------
  |  Branch (819:17): [True: 47, False: 1]
  ------------------
  820|     47|                continue;
  821|     47|            }
  822|       |
  823|      1|            if (ngx_strncmp(key->data, name[i].data, last) == 0) {
  ------------------
  |  |   53|      1|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (823:17): [True: 0, False: 1]
  ------------------
  824|      0|                return NGX_BUSY;
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  825|      0|            }
  826|      1|        }
  827|       |
  828|     78|    } else {
  829|     78|        if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
  ------------------
  |  Branch (829:13): [True: 0, False: 78]
  ------------------
  830|     78|                           sizeof(ngx_str_t))
  831|     78|            != NGX_OK)
  ------------------
  |  |   38|     78|#define  NGX_OK          0
  ------------------
  832|      0|        {
  833|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  834|      0|        }
  835|     78|    }
  836|       |
  837|    113|    name = ngx_array_push(&ha->keys_hash[k]);
  838|    113|    if (name == NULL) {
  ------------------
  |  Branch (838:9): [True: 0, False: 113]
  ------------------
  839|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  840|      0|    }
  841|       |
  842|    113|    *name = *key;
  843|       |
  844|    113|    hk = ngx_array_push(&ha->keys);
  845|    113|    if (hk == NULL) {
  ------------------
  |  Branch (845:9): [True: 0, False: 113]
  ------------------
  846|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  847|      0|    }
  848|       |
  849|    113|    hk->key = *key;
  850|    113|    hk->key_hash = ngx_hash_key(key->data, last);
  851|    113|    hk->value = value;
  852|       |
  853|    113|    return NGX_OK;
  ------------------
  |  |   38|    113|#define  NGX_OK          0
  ------------------
  854|       |
  855|       |
  856|      0|wildcard:
  857|       |
  858|       |    /* wildcard hash */
  859|       |
  860|      0|    k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip);
  861|       |
  862|      0|    k %= ha->hsize;
  863|       |
  864|      0|    if (skip == 1) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|       |
  866|       |        /* check conflicts in exact hash for ".example.com" */
  867|       |
  868|      0|        name = ha->keys_hash[k].elts;
  869|       |
  870|      0|        if (name) {
  ------------------
  |  Branch (870:13): [True: 0, False: 0]
  ------------------
  871|      0|            len = last - skip;
  872|       |
  873|      0|            for (i = 0; i < ha->keys_hash[k].nelts; i++) {
  ------------------
  |  Branch (873:25): [True: 0, False: 0]
  ------------------
  874|      0|                if (len != name[i].len) {
  ------------------
  |  Branch (874:21): [True: 0, False: 0]
  ------------------
  875|      0|                    continue;
  876|      0|                }
  877|       |
  878|      0|                if (ngx_strncmp(&key->data[1], name[i].data, len) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (878:21): [True: 0, False: 0]
  ------------------
  879|      0|                    return NGX_BUSY;
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  880|      0|                }
  881|      0|            }
  882|       |
  883|      0|        } else {
  884|      0|            if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
  ------------------
  |  Branch (884:17): [True: 0, False: 0]
  ------------------
  885|      0|                               sizeof(ngx_str_t))
  886|      0|                != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  887|      0|            {
  888|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  889|      0|            }
  890|      0|        }
  891|       |
  892|      0|        name = ngx_array_push(&ha->keys_hash[k]);
  893|      0|        if (name == NULL) {
  ------------------
  |  Branch (893:13): [True: 0, False: 0]
  ------------------
  894|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  895|      0|        }
  896|       |
  897|      0|        name->len = last - 1;
  898|      0|        name->data = ngx_pnalloc(ha->temp_pool, name->len);
  899|      0|        if (name->data == NULL) {
  ------------------
  |  Branch (899:13): [True: 0, False: 0]
  ------------------
  900|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  901|      0|        }
  902|       |
  903|      0|        ngx_memcpy(name->data, &key->data[1], name->len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  904|      0|    }
  905|       |
  906|       |
  907|      0|    if (skip) {
  ------------------
  |  Branch (907:9): [True: 0, False: 0]
  ------------------
  908|       |
  909|       |        /*
  910|       |         * convert "*.example.com" to "com.example.\0"
  911|       |         *      and ".example.com" to "com.example\0"
  912|       |         */
  913|       |
  914|      0|        p = ngx_pnalloc(ha->temp_pool, last);
  915|      0|        if (p == NULL) {
  ------------------
  |  Branch (915:13): [True: 0, False: 0]
  ------------------
  916|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  917|      0|        }
  918|       |
  919|      0|        len = 0;
  920|      0|        n = 0;
  921|       |
  922|      0|        for (i = last - 1; i; i--) {
  ------------------
  |  Branch (922:28): [True: 0, False: 0]
  ------------------
  923|      0|            if (key->data[i] == '.') {
  ------------------
  |  Branch (923:17): [True: 0, False: 0]
  ------------------
  924|      0|                ngx_memcpy(&p[n], &key->data[i + 1], len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  925|      0|                n += len;
  926|      0|                p[n++] = '.';
  927|      0|                len = 0;
  928|      0|                continue;
  929|      0|            }
  930|       |
  931|      0|            len++;
  932|      0|        }
  933|       |
  934|      0|        if (len) {
  ------------------
  |  Branch (934:13): [True: 0, False: 0]
  ------------------
  935|      0|            ngx_memcpy(&p[n], &key->data[1], len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  936|      0|            n += len;
  937|      0|        }
  938|       |
  939|      0|        p[n] = '\0';
  940|       |
  941|      0|        hwc = &ha->dns_wc_head;
  942|      0|        keys = &ha->dns_wc_head_hash[k];
  943|       |
  944|      0|    } else {
  945|       |
  946|       |        /* convert "www.example.*" to "www.example\0" */
  947|       |
  948|      0|        last++;
  949|       |
  950|      0|        p = ngx_pnalloc(ha->temp_pool, last);
  951|      0|        if (p == NULL) {
  ------------------
  |  Branch (951:13): [True: 0, False: 0]
  ------------------
  952|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  953|      0|        }
  954|       |
  955|      0|        ngx_cpystrn(p, key->data, last);
  956|       |
  957|      0|        hwc = &ha->dns_wc_tail;
  958|      0|        keys = &ha->dns_wc_tail_hash[k];
  959|      0|    }
  960|       |
  961|       |
  962|       |    /* check conflicts in wildcard hash */
  963|       |
  964|      0|    name = keys->elts;
  965|       |
  966|      0|    if (name) {
  ------------------
  |  Branch (966:9): [True: 0, False: 0]
  ------------------
  967|      0|        len = last - skip;
  968|       |
  969|      0|        for (i = 0; i < keys->nelts; i++) {
  ------------------
  |  Branch (969:21): [True: 0, False: 0]
  ------------------
  970|      0|            if (len != name[i].len) {
  ------------------
  |  Branch (970:17): [True: 0, False: 0]
  ------------------
  971|      0|                continue;
  972|      0|            }
  973|       |
  974|      0|            if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (974:17): [True: 0, False: 0]
  ------------------
  975|      0|                return NGX_BUSY;
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  976|      0|            }
  977|      0|        }
  978|       |
  979|      0|    } else {
  980|      0|        if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (980:13): [True: 0, False: 0]
  ------------------
  981|      0|        {
  982|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  983|      0|        }
  984|      0|    }
  985|       |
  986|      0|    name = ngx_array_push(keys);
  987|      0|    if (name == NULL) {
  ------------------
  |  Branch (987:9): [True: 0, False: 0]
  ------------------
  988|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  989|      0|    }
  990|       |
  991|      0|    name->len = last - skip;
  992|      0|    name->data = ngx_pnalloc(ha->temp_pool, name->len);
  993|      0|    if (name->data == NULL) {
  ------------------
  |  Branch (993:9): [True: 0, False: 0]
  ------------------
  994|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  995|      0|    }
  996|       |
  997|      0|    ngx_memcpy(name->data, key->data + skip, name->len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  998|       |
  999|       |
 1000|       |    /* add to wildcard hash */
 1001|       |
 1002|      0|    hk = ngx_array_push(hwc);
 1003|      0|    if (hk == NULL) {
  ------------------
  |  Branch (1003:9): [True: 0, False: 0]
  ------------------
 1004|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1005|      0|    }
 1006|       |
 1007|      0|    hk->key.len = last - 1;
 1008|      0|    hk->key.data = p;
 1009|      0|    hk->key_hash = 0;
 1010|      0|    hk->value = value;
 1011|       |
 1012|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1013|      0|}

ngx_inet_addr:
   21|     21|{
   22|     21|    u_char      *p, c;
   23|     21|    in_addr_t    addr;
   24|     21|    ngx_uint_t   octet, n;
   25|       |
   26|     21|    addr = 0;
   27|     21|    octet = 0;
   28|     21|    n = 0;
   29|       |
   30|    111|    for (p = text; p < text + len; p++) {
  ------------------
  |  Branch (30:20): [True: 101, False: 10]
  ------------------
   31|    101|        c = *p;
   32|       |
   33|    101|        if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (33:13): [True: 71, False: 30]
  |  Branch (33:25): [True: 60, False: 11]
  ------------------
   34|     60|            octet = octet * 10 + (c - '0');
   35|       |
   36|     60|            if (octet > 255) {
  ------------------
  |  Branch (36:17): [True: 0, False: 60]
  ------------------
   37|      0|                return INADDR_NONE;
   38|      0|            }
   39|       |
   40|     60|            continue;
   41|     60|        }
   42|       |
   43|     41|        if (c == '.') {
  ------------------
  |  Branch (43:13): [True: 30, False: 11]
  ------------------
   44|     30|            addr = (addr << 8) + octet;
   45|     30|            octet = 0;
   46|     30|            n++;
   47|     30|            continue;
   48|     30|        }
   49|       |
   50|     11|        return INADDR_NONE;
   51|     41|    }
   52|       |
   53|     10|    if (n == 3) {
  ------------------
  |  Branch (53:9): [True: 10, False: 0]
  ------------------
   54|     10|        addr = (addr << 8) + octet;
   55|     10|        return htonl(addr);
   56|     10|    }
   57|       |
   58|      0|    return INADDR_NONE;
   59|     10|}
ngx_sock_ntop:
  185|     11|{
  186|     11|    u_char               *p;
  187|     11|#if (NGX_HAVE_INET6 || NGX_HAVE_UNIX_DOMAIN)
  188|     11|    size_t                n;
  189|     11|#endif
  190|     11|    struct sockaddr_in   *sin;
  191|     11|#if (NGX_HAVE_INET6)
  192|     11|    struct sockaddr_in6  *sin6;
  193|     11|#endif
  194|     11|#if (NGX_HAVE_UNIX_DOMAIN)
  195|     11|    struct sockaddr_un   *saun;
  196|     11|#endif
  197|       |
  198|     11|    switch (sa->sa_family) {
  199|       |
  200|     10|    case AF_INET:
  ------------------
  |  Branch (200:5): [True: 10, False: 1]
  ------------------
  201|       |
  202|     10|        sin = (struct sockaddr_in *) sa;
  203|     10|        p = (u_char *) &sin->sin_addr;
  204|       |
  205|     10|        if (port) {
  ------------------
  |  Branch (205:13): [True: 10, False: 0]
  ------------------
  206|     10|            p = ngx_snprintf(text, len, "%ud.%ud.%ud.%ud:%d",
  207|     10|                             p[0], p[1], p[2], p[3], ntohs(sin->sin_port));
  208|     10|        } else {
  209|      0|            p = ngx_snprintf(text, len, "%ud.%ud.%ud.%ud",
  210|      0|                             p[0], p[1], p[2], p[3]);
  211|      0|        }
  212|       |
  213|     10|        return (p - text);
  214|       |
  215|      0|#if (NGX_HAVE_INET6)
  216|       |
  217|      0|    case AF_INET6:
  ------------------
  |  Branch (217:5): [True: 0, False: 11]
  ------------------
  218|       |
  219|      0|        sin6 = (struct sockaddr_in6 *) sa;
  220|       |
  221|      0|        n = 0;
  222|       |
  223|      0|        if (port) {
  ------------------
  |  Branch (223:13): [True: 0, False: 0]
  ------------------
  224|      0|            text[n++] = '[';
  225|      0|        }
  226|       |
  227|      0|        n = ngx_inet6_ntop(sin6->sin6_addr.s6_addr, &text[n], len);
  228|       |
  229|      0|        if (port) {
  ------------------
  |  Branch (229:13): [True: 0, False: 0]
  ------------------
  230|      0|            n = ngx_sprintf(&text[1 + n], "]:%d",
  231|      0|                            ntohs(sin6->sin6_port)) - text;
  232|      0|        }
  233|       |
  234|      0|        return n;
  235|      0|#endif
  236|       |
  237|      0|#if (NGX_HAVE_UNIX_DOMAIN)
  238|       |
  239|      1|    case AF_UNIX:
  ------------------
  |  Branch (239:5): [True: 1, False: 10]
  ------------------
  240|      1|        saun = (struct sockaddr_un *) sa;
  241|       |
  242|       |        /* on Linux sockaddr might not include sun_path at all */
  243|       |
  244|      1|        if (socklen <= (socklen_t) offsetof(struct sockaddr_un, sun_path)) {
  ------------------
  |  Branch (244:13): [True: 0, False: 1]
  ------------------
  245|      0|            p = ngx_snprintf(text, len, "unix:%Z");
  246|       |
  247|      1|        } else {
  248|      1|            n = ngx_strnlen((u_char *) saun->sun_path,
  249|      1|                            socklen - offsetof(struct sockaddr_un, sun_path));
  250|      1|            p = ngx_snprintf(text, len, "unix:%*s%Z", n, saun->sun_path);
  251|      1|        }
  252|       |
  253|       |        /* we do not include trailing zero in address length */
  254|       |
  255|      1|        return (p - text - 1);
  256|       |
  257|      0|#endif
  258|       |
  259|      0|    default:
  ------------------
  |  Branch (259:5): [True: 0, False: 11]
  ------------------
  260|      0|        return 0;
  261|     11|    }
  262|     11|}
ngx_parse_url:
  685|     22|{
  686|     22|    u_char  *p;
  687|     22|    size_t   len;
  688|       |
  689|     22|    p = u->url.data;
  690|     22|    len = u->url.len;
  691|       |
  692|     22|    if (len >= 5 && ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) {
  ------------------
  |  Branch (692:9): [True: 22, False: 0]
  |  Branch (692:21): [True: 1, False: 21]
  ------------------
  693|      1|        return ngx_parse_unix_domain_url(pool, u);
  694|      1|    }
  695|       |
  696|     21|    if (len && p[0] == '[') {
  ------------------
  |  Branch (696:9): [True: 21, False: 0]
  |  Branch (696:16): [True: 0, False: 21]
  ------------------
  697|      0|        return ngx_parse_inet6_url(pool, u);
  698|      0|    }
  699|       |
  700|     21|    return ngx_parse_inet_url(pool, u);
  701|     21|}
ngx_inet_get_port:
 1405|      6|{
 1406|      6|    struct sockaddr_in   *sin;
 1407|      6|#if (NGX_HAVE_INET6)
 1408|      6|    struct sockaddr_in6  *sin6;
 1409|      6|#endif
 1410|       |
 1411|      6|    switch (sa->sa_family) {
 1412|       |
 1413|      0|#if (NGX_HAVE_INET6)
 1414|      0|    case AF_INET6:
  ------------------
  |  Branch (1414:5): [True: 0, False: 6]
  ------------------
 1415|      0|        sin6 = (struct sockaddr_in6 *) sa;
 1416|      0|        return ntohs(sin6->sin6_port);
 1417|      0|#endif
 1418|       |
 1419|      0|#if (NGX_HAVE_UNIX_DOMAIN)
 1420|      6|    case AF_UNIX:
  ------------------
  |  Branch (1420:5): [True: 6, False: 0]
  ------------------
 1421|      6|        return 0;
 1422|      0|#endif
 1423|       |
 1424|      0|    default: /* AF_INET */
  ------------------
  |  Branch (1424:5): [True: 0, False: 6]
  ------------------
 1425|      0|        sin = (struct sockaddr_in *) sa;
 1426|      0|        return ntohs(sin->sin_port);
 1427|      6|    }
 1428|      6|}
ngx_inet_set_port:
 1433|     10|{
 1434|     10|    struct sockaddr_in   *sin;
 1435|     10|#if (NGX_HAVE_INET6)
 1436|     10|    struct sockaddr_in6  *sin6;
 1437|     10|#endif
 1438|       |
 1439|     10|    switch (sa->sa_family) {
 1440|       |
 1441|      0|#if (NGX_HAVE_INET6)
 1442|      0|    case AF_INET6:
  ------------------
  |  Branch (1442:5): [True: 0, False: 10]
  ------------------
 1443|      0|        sin6 = (struct sockaddr_in6 *) sa;
 1444|      0|        sin6->sin6_port = htons(port);
 1445|      0|        break;
 1446|      0|#endif
 1447|       |
 1448|      0|#if (NGX_HAVE_UNIX_DOMAIN)
 1449|      0|    case AF_UNIX:
  ------------------
  |  Branch (1449:5): [True: 0, False: 10]
  ------------------
 1450|      0|        break;
 1451|      0|#endif
 1452|       |
 1453|     10|    default: /* AF_INET */
  ------------------
  |  Branch (1453:5): [True: 10, False: 0]
  ------------------
 1454|     10|        sin = (struct sockaddr_in *) sa;
 1455|     10|        sin->sin_port = htons(port);
 1456|     10|        break;
 1457|     10|    }
 1458|     10|}
ngx_inet_wildcard:
 1463|      1|{
 1464|      1|    struct sockaddr_in   *sin;
 1465|      1|#if (NGX_HAVE_INET6)
 1466|      1|    struct sockaddr_in6  *sin6;
 1467|      1|#endif
 1468|       |
 1469|      1|    switch (sa->sa_family) {
  ------------------
  |  Branch (1469:13): [True: 1, False: 0]
  ------------------
 1470|       |
 1471|      0|    case AF_INET:
  ------------------
  |  Branch (1471:5): [True: 0, False: 1]
  ------------------
 1472|      0|        sin = (struct sockaddr_in *) sa;
 1473|       |
 1474|      0|        if (sin->sin_addr.s_addr == INADDR_ANY) {
  ------------------
  |  Branch (1474:13): [True: 0, False: 0]
  ------------------
 1475|      0|            return 1;
 1476|      0|        }
 1477|       |
 1478|      0|        break;
 1479|       |
 1480|      0|#if (NGX_HAVE_INET6)
 1481|       |
 1482|      0|    case AF_INET6:
  ------------------
  |  Branch (1482:5): [True: 0, False: 1]
  ------------------
 1483|      0|        sin6 = (struct sockaddr_in6 *) sa;
 1484|       |
 1485|      0|        if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
 1486|      0|            return 1;
 1487|      0|        }
 1488|       |
 1489|      0|        break;
 1490|       |
 1491|      1|#endif
 1492|      1|    }
 1493|       |
 1494|      1|    return 0;
 1495|      1|}
ngx_inet.c:ngx_parse_unix_domain_url:
  706|      1|{
  707|      1|#if (NGX_HAVE_UNIX_DOMAIN)
  708|      1|    u_char              *path, *uri, *last;
  709|      1|    size_t               len;
  710|      1|    struct sockaddr_un  *saun;
  711|       |
  712|      1|    len = u->url.len;
  713|      1|    path = u->url.data;
  714|       |
  715|      1|    path += 5;
  716|      1|    len -= 5;
  717|       |
  718|      1|    if (u->uri_part) {
  ------------------
  |  Branch (718:9): [True: 0, False: 1]
  ------------------
  719|       |
  720|      0|        last = path + len;
  721|      0|        uri = ngx_strlchr(path, last, ':');
  722|       |
  723|      0|        if (uri) {
  ------------------
  |  Branch (723:13): [True: 0, False: 0]
  ------------------
  724|      0|            len = uri - path;
  725|      0|            uri++;
  726|      0|            u->uri.len = last - uri;
  727|      0|            u->uri.data = uri;
  728|      0|        }
  729|      0|    }
  730|       |
  731|      1|    if (len == 0) {
  ------------------
  |  Branch (731:9): [True: 0, False: 1]
  ------------------
  732|      0|        u->err = "no path in the unix domain socket";
  733|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  734|      0|    }
  735|       |
  736|      1|    u->host.len = len++;
  737|      1|    u->host.data = path;
  738|       |
  739|      1|    if (len > sizeof(saun->sun_path)) {
  ------------------
  |  Branch (739:9): [True: 0, False: 1]
  ------------------
  740|      0|        u->err = "too long path in the unix domain socket";
  741|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  742|      0|    }
  743|       |
  744|      1|    u->socklen = sizeof(struct sockaddr_un);
  745|      1|    saun = (struct sockaddr_un *) &u->sockaddr;
  746|      1|    saun->sun_family = AF_UNIX;
  747|      1|    (void) ngx_cpystrn((u_char *) saun->sun_path, path, len);
  748|       |
  749|      1|    u->addrs = ngx_pcalloc(pool, sizeof(ngx_addr_t));
  750|      1|    if (u->addrs == NULL) {
  ------------------
  |  Branch (750:9): [True: 0, False: 1]
  ------------------
  751|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  752|      0|    }
  753|       |
  754|      1|    saun = ngx_pcalloc(pool, sizeof(struct sockaddr_un));
  755|      1|    if (saun == NULL) {
  ------------------
  |  Branch (755:9): [True: 0, False: 1]
  ------------------
  756|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  757|      0|    }
  758|       |
  759|      1|    u->family = AF_UNIX;
  760|      1|    u->naddrs = 1;
  761|       |
  762|      1|    saun->sun_family = AF_UNIX;
  763|      1|    (void) ngx_cpystrn((u_char *) saun->sun_path, path, len);
  764|       |
  765|      1|    u->addrs[0].sockaddr = (struct sockaddr *) saun;
  766|      1|    u->addrs[0].socklen = sizeof(struct sockaddr_un);
  767|      1|    u->addrs[0].name.len = len + 4;
  768|      1|    u->addrs[0].name.data = u->url.data;
  769|       |
  770|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  771|       |
  772|       |#else
  773|       |
  774|       |    u->err = "the unix domain sockets are not supported on this platform";
  775|       |
  776|       |    return NGX_ERROR;
  777|       |
  778|       |#endif
  779|      1|}
ngx_inet.c:ngx_parse_inet_url:
  784|     21|{
  785|     21|    u_char              *host, *port, *last, *uri, *args, *dash;
  786|     21|    size_t               len;
  787|     21|    ngx_int_t            n;
  788|     21|    struct sockaddr_in  *sin;
  789|       |
  790|     21|    u->socklen = sizeof(struct sockaddr_in);
  791|     21|    sin = (struct sockaddr_in *) &u->sockaddr;
  792|     21|    sin->sin_family = AF_INET;
  793|       |
  794|     21|    u->family = AF_INET;
  795|       |
  796|     21|    host = u->url.data;
  797|       |
  798|     21|    last = host + u->url.len;
  799|       |
  800|     21|    port = ngx_strlchr(host, last, ':');
  801|       |
  802|     21|    uri = ngx_strlchr(host, last, '/');
  803|       |
  804|     21|    args = ngx_strlchr(host, last, '?');
  805|       |
  806|     21|    if (args) {
  ------------------
  |  Branch (806:9): [True: 0, False: 21]
  ------------------
  807|      0|        if (uri == NULL || args < uri) {
  ------------------
  |  Branch (807:13): [True: 0, False: 0]
  |  Branch (807:28): [True: 0, False: 0]
  ------------------
  808|      0|            uri = args;
  809|      0|        }
  810|      0|    }
  811|       |
  812|     21|    if (uri) {
  ------------------
  |  Branch (812:9): [True: 0, False: 21]
  ------------------
  813|      0|        if (u->listen || !u->uri_part) {
  ------------------
  |  Branch (813:13): [True: 0, False: 0]
  |  Branch (813:26): [True: 0, False: 0]
  ------------------
  814|      0|            u->err = "invalid host";
  815|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  816|      0|        }
  817|       |
  818|      0|        u->uri.len = last - uri;
  819|      0|        u->uri.data = uri;
  820|       |
  821|      0|        last = uri;
  822|       |
  823|      0|        if (uri < port) {
  ------------------
  |  Branch (823:13): [True: 0, False: 0]
  ------------------
  824|      0|            port = NULL;
  825|      0|        }
  826|      0|    }
  827|       |
  828|     21|    if (port) {
  ------------------
  |  Branch (828:9): [True: 10, False: 11]
  ------------------
  829|     10|        port++;
  830|       |
  831|     10|        len = last - port;
  832|       |
  833|     10|        if (u->listen) {
  ------------------
  |  Branch (833:13): [True: 0, False: 10]
  ------------------
  834|      0|            dash = ngx_strlchr(port, last, '-');
  835|       |
  836|      0|            if (dash) {
  ------------------
  |  Branch (836:17): [True: 0, False: 0]
  ------------------
  837|      0|                dash++;
  838|       |
  839|      0|                n = ngx_atoi(dash, last - dash);
  840|       |
  841|      0|                if (n < 1 || n > 65535) {
  ------------------
  |  Branch (841:21): [True: 0, False: 0]
  |  Branch (841:30): [True: 0, False: 0]
  ------------------
  842|      0|                    u->err = "invalid port";
  843|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  844|      0|                }
  845|       |
  846|      0|                u->last_port = (in_port_t) n;
  847|       |
  848|      0|                len = dash - port - 1;
  849|      0|            }
  850|      0|        }
  851|       |
  852|     10|        n = ngx_atoi(port, len);
  853|       |
  854|     10|        if (n < 1 || n > 65535) {
  ------------------
  |  Branch (854:13): [True: 0, False: 10]
  |  Branch (854:22): [True: 0, False: 10]
  ------------------
  855|      0|            u->err = "invalid port";
  856|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  857|      0|        }
  858|       |
  859|     10|        if (u->last_port && n > u->last_port) {
  ------------------
  |  Branch (859:13): [True: 0, False: 10]
  |  Branch (859:29): [True: 0, False: 0]
  ------------------
  860|      0|            u->err = "invalid port range";
  861|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  862|      0|        }
  863|       |
  864|     10|        u->port = (in_port_t) n;
  865|     10|        sin->sin_port = htons((in_port_t) n);
  866|       |
  867|     10|        u->port_text.len = last - port;
  868|     10|        u->port_text.data = port;
  869|       |
  870|     10|        last = port - 1;
  871|       |
  872|     11|    } else {
  873|     11|        if (uri == NULL) {
  ------------------
  |  Branch (873:13): [True: 11, False: 0]
  ------------------
  874|       |
  875|     11|            if (u->listen) {
  ------------------
  |  Branch (875:17): [True: 0, False: 11]
  ------------------
  876|       |
  877|       |                /* test value as port only */
  878|       |
  879|      0|                len = last - host;
  880|       |
  881|      0|                dash = ngx_strlchr(host, last, '-');
  882|       |
  883|      0|                if (dash) {
  ------------------
  |  Branch (883:21): [True: 0, False: 0]
  ------------------
  884|      0|                    dash++;
  885|       |
  886|      0|                    n = ngx_atoi(dash, last - dash);
  887|       |
  888|      0|                    if (n == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (888:25): [True: 0, False: 0]
  ------------------
  889|      0|                        goto no_port;
  890|      0|                    }
  891|       |
  892|      0|                    if (n < 1 || n > 65535) {
  ------------------
  |  Branch (892:25): [True: 0, False: 0]
  |  Branch (892:34): [True: 0, False: 0]
  ------------------
  893|      0|                        u->err = "invalid port";
  894|       |
  895|      0|                    } else {
  896|      0|                        u->last_port = (in_port_t) n;
  897|      0|                    }
  898|       |
  899|      0|                    len = dash - host - 1;
  900|      0|                }
  901|       |
  902|      0|                n = ngx_atoi(host, len);
  903|       |
  904|      0|                if (n != NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (904:21): [True: 0, False: 0]
  ------------------
  905|       |
  906|      0|                    if (u->err) {
  ------------------
  |  Branch (906:25): [True: 0, False: 0]
  ------------------
  907|      0|                        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  908|      0|                    }
  909|       |
  910|      0|                    if (n < 1 || n > 65535) {
  ------------------
  |  Branch (910:25): [True: 0, False: 0]
  |  Branch (910:34): [True: 0, False: 0]
  ------------------
  911|      0|                        u->err = "invalid port";
  912|      0|                        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  913|      0|                    }
  914|       |
  915|      0|                    if (u->last_port && n > u->last_port) {
  ------------------
  |  Branch (915:25): [True: 0, False: 0]
  |  Branch (915:41): [True: 0, False: 0]
  ------------------
  916|      0|                        u->err = "invalid port range";
  917|      0|                        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  918|      0|                    }
  919|       |
  920|      0|                    u->port = (in_port_t) n;
  921|      0|                    sin->sin_port = htons((in_port_t) n);
  922|      0|                    sin->sin_addr.s_addr = INADDR_ANY;
  923|       |
  924|      0|                    u->port_text.len = last - host;
  925|      0|                    u->port_text.data = host;
  926|       |
  927|      0|                    u->wildcard = 1;
  928|       |
  929|      0|                    return ngx_inet_add_addr(pool, u, &u->sockaddr.sockaddr,
  930|      0|                                             u->socklen, 1);
  931|      0|                }
  932|      0|            }
  933|     11|        }
  934|       |
  935|     11|no_port:
  936|       |
  937|     11|        u->err = NULL;
  938|     11|        u->no_port = 1;
  939|     11|        u->port = u->default_port;
  940|     11|        sin->sin_port = htons(u->default_port);
  941|     11|        u->last_port = 0;
  942|     11|    }
  943|       |
  944|     21|    len = last - host;
  945|       |
  946|     21|    if (len == 0) {
  ------------------
  |  Branch (946:9): [True: 0, False: 21]
  ------------------
  947|      0|        u->err = "no host";
  948|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  949|      0|    }
  950|       |
  951|     21|    u->host.len = len;
  952|     21|    u->host.data = host;
  953|       |
  954|     21|    if (u->listen && len == 1 && *host == '*') {
  ------------------
  |  Branch (954:9): [True: 0, False: 21]
  |  Branch (954:22): [True: 0, False: 0]
  |  Branch (954:34): [True: 0, False: 0]
  ------------------
  955|      0|        sin->sin_addr.s_addr = INADDR_ANY;
  956|      0|        u->wildcard = 1;
  957|      0|        return ngx_inet_add_addr(pool, u, &u->sockaddr.sockaddr, u->socklen, 1);
  958|      0|    }
  959|       |
  960|     21|    sin->sin_addr.s_addr = ngx_inet_addr(host, len);
  961|       |
  962|     21|    if (sin->sin_addr.s_addr != INADDR_NONE) {
  ------------------
  |  Branch (962:9): [True: 10, False: 11]
  ------------------
  963|       |
  964|     10|        if (sin->sin_addr.s_addr == INADDR_ANY) {
  ------------------
  |  Branch (964:13): [True: 0, False: 10]
  ------------------
  965|      0|            u->wildcard = 1;
  966|      0|        }
  967|       |
  968|     10|        return ngx_inet_add_addr(pool, u, &u->sockaddr.sockaddr, u->socklen, 1);
  969|     10|    }
  970|       |
  971|     11|    if (u->no_resolve) {
  ------------------
  |  Branch (971:9): [True: 11, False: 0]
  ------------------
  972|     11|        return NGX_OK;
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  973|     11|    }
  974|       |
  975|      0|    if (ngx_inet_resolve_host(pool, u) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (975:9): [True: 0, False: 0]
  ------------------
  976|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  977|      0|    }
  978|       |
  979|      0|    u->family = u->addrs[0].sockaddr->sa_family;
  980|      0|    u->socklen = u->addrs[0].socklen;
  981|      0|    ngx_memcpy(&u->sockaddr, u->addrs[0].sockaddr, u->addrs[0].socklen);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  982|      0|    u->wildcard = ngx_inet_wildcard(&u->sockaddr.sockaddr);
  983|       |
  984|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  985|      0|}
ngx_inet.c:ngx_inet_add_addr:
 1265|     10|{
 1266|     10|    u_char           *p;
 1267|     10|    size_t            len;
 1268|     10|    ngx_uint_t        i, nports;
 1269|     10|    ngx_addr_t       *addr;
 1270|     10|    struct sockaddr  *sa;
 1271|       |
 1272|     10|    nports = u->last_port ? u->last_port - u->port + 1 : 1;
  ------------------
  |  Branch (1272:14): [True: 0, False: 10]
  ------------------
 1273|       |
 1274|     10|    if (u->addrs == NULL) {
  ------------------
  |  Branch (1274:9): [True: 10, False: 0]
  ------------------
 1275|     10|        u->addrs = ngx_palloc(pool, total * nports * sizeof(ngx_addr_t));
 1276|     10|        if (u->addrs == NULL) {
  ------------------
  |  Branch (1276:13): [True: 0, False: 10]
  ------------------
 1277|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1278|      0|        }
 1279|     10|    }
 1280|       |
 1281|     20|    for (i = 0; i < nports; i++) {
  ------------------
  |  Branch (1281:17): [True: 10, False: 10]
  ------------------
 1282|     10|        sa = ngx_pcalloc(pool, socklen);
 1283|     10|        if (sa == NULL) {
  ------------------
  |  Branch (1283:13): [True: 0, False: 10]
  ------------------
 1284|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1285|      0|        }
 1286|       |
 1287|     10|        ngx_memcpy(sa, sockaddr, socklen);
  ------------------
  |  |  106|     10|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1288|       |
 1289|     10|        ngx_inet_set_port(sa, u->port + i);
 1290|       |
 1291|     10|        switch (sa->sa_family) {
 1292|       |
 1293|      0|#if (NGX_HAVE_INET6)
 1294|      0|        case AF_INET6:
  ------------------
  |  Branch (1294:9): [True: 0, False: 10]
  ------------------
 1295|      0|            len = NGX_INET6_ADDRSTRLEN + sizeof("[]:65536") - 1;
  ------------------
  |  |   18|      0|    (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") - 1)
  ------------------
 1296|      0|            break;
 1297|      0|#endif
 1298|       |
 1299|     10|        default: /* AF_INET */
  ------------------
  |  Branch (1299:9): [True: 10, False: 0]
  ------------------
 1300|     10|            len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1;
  ------------------
  |  |   16|     10|#define NGX_INET_ADDRSTRLEN   (sizeof("255.255.255.255") - 1)
  ------------------
 1301|     10|        }
 1302|       |
 1303|     10|        p = ngx_pnalloc(pool, len);
 1304|     10|        if (p == NULL) {
  ------------------
  |  Branch (1304:13): [True: 0, False: 10]
  ------------------
 1305|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1306|      0|        }
 1307|       |
 1308|     10|        len = ngx_sock_ntop(sa, socklen, p, len, 1);
 1309|       |
 1310|     10|        addr = &u->addrs[u->naddrs++];
 1311|       |
 1312|     10|        addr->sockaddr = sa;
 1313|     10|        addr->socklen = socklen;
 1314|       |
 1315|     10|        addr->name.len = len;
 1316|     10|        addr->name.data = p;
 1317|     10|    }
 1318|       |
 1319|     10|    return NGX_OK;
  ------------------
  |  |   38|     10|#define  NGX_OK          0
  ------------------
 1320|     10|}

ngx_list_create:
   14|      1|{
   15|      1|    ngx_list_t  *list;
   16|       |
   17|      1|    list = ngx_palloc(pool, sizeof(ngx_list_t));
   18|      1|    if (list == NULL) {
  ------------------
  |  Branch (18:9): [True: 0, False: 1]
  ------------------
   19|      0|        return NULL;
   20|      0|    }
   21|       |
   22|      1|    if (ngx_list_init(list, pool, n, size) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (22:9): [True: 0, False: 1]
  ------------------
   23|      0|        return NULL;
   24|      0|    }
   25|       |
   26|      1|    return list;
   27|      1|}
ngx_list_push:
   32|     45|{
   33|     45|    void             *elt;
   34|     45|    ngx_list_part_t  *last;
   35|       |
   36|     45|    last = l->last;
   37|       |
   38|     45|    if (last->nelts == l->nalloc) {
  ------------------
  |  Branch (38:9): [True: 0, False: 45]
  ------------------
   39|       |
   40|       |        /* the last part is full, allocate a new list part */
   41|       |
   42|      0|        last = ngx_palloc(l->pool, sizeof(ngx_list_part_t));
   43|      0|        if (last == NULL) {
  ------------------
  |  Branch (43:13): [True: 0, False: 0]
  ------------------
   44|      0|            return NULL;
   45|      0|        }
   46|       |
   47|      0|        last->elts = ngx_palloc(l->pool, l->nalloc * l->size);
   48|      0|        if (last->elts == NULL) {
  ------------------
  |  Branch (48:13): [True: 0, False: 0]
  ------------------
   49|      0|            return NULL;
   50|      0|        }
   51|       |
   52|      0|        last->nelts = 0;
   53|      0|        last->next = NULL;
   54|       |
   55|      0|        l->last->next = last;
   56|      0|        l->last = last;
   57|      0|    }
   58|       |
   59|     45|    elt = (char *) last->elts + l->size * last->nelts;
   60|     45|    last->nelts++;
   61|       |
   62|     45|    return elt;
   63|     45|}

ngx_list.c:ngx_list_init:
   38|      1|{
   39|      1|    list->part.elts = ngx_palloc(pool, n * size);
   40|      1|    if (list->part.elts == NULL) {
  ------------------
  |  Branch (40:9): [True: 0, False: 1]
  ------------------
   41|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   42|      0|    }
   43|       |
   44|      1|    list->part.nelts = 0;
   45|      1|    list->part.next = NULL;
   46|      1|    list->last = &list->part;
   47|      1|    list->size = size;
   48|      1|    list->nalloc = n;
   49|      1|    list->pool = pool;
   50|       |
   51|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   52|      1|}
ngx_cycle.c:ngx_list_init:
   38|      2|{
   39|      2|    list->part.elts = ngx_palloc(pool, n * size);
   40|      2|    if (list->part.elts == NULL) {
  ------------------
  |  Branch (40:9): [True: 0, False: 2]
  ------------------
   41|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   42|      0|    }
   43|       |
   44|      2|    list->part.nelts = 0;
   45|      2|    list->part.next = NULL;
   46|      2|    list->last = &list->part;
   47|      2|    list->size = size;
   48|      2|    list->nalloc = n;
   49|      2|    list->pool = pool;
   50|       |
   51|      2|    return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
   52|      2|}
ngx_http_request.c:ngx_list_init:
   38|     40|{
   39|     40|    list->part.elts = ngx_palloc(pool, n * size);
   40|     40|    if (list->part.elts == NULL) {
  ------------------
  |  Branch (40:9): [True: 0, False: 40]
  ------------------
   41|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   42|      0|    }
   43|       |
   44|     40|    list->part.nelts = 0;
   45|     40|    list->part.next = NULL;
   46|     40|    list->last = &list->part;
   47|     40|    list->size = size;
   48|     40|    list->nalloc = n;
   49|     40|    list->pool = pool;
   50|       |
   51|     40|    return NGX_OK;
  ------------------
  |  |   38|     40|#define  NGX_OK          0
  ------------------
   52|     40|}
ngx_http_upstream.c:ngx_list_init:
   38|     10|{
   39|     10|    list->part.elts = ngx_palloc(pool, n * size);
   40|     10|    if (list->part.elts == NULL) {
  ------------------
  |  Branch (40:9): [True: 0, False: 10]
  ------------------
   41|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   42|      0|    }
   43|       |
   44|     10|    list->part.nelts = 0;
   45|     10|    list->part.next = NULL;
   46|     10|    list->last = &list->part;
   47|     10|    list->size = size;
   48|     10|    list->nalloc = n;
   49|     10|    list->pool = pool;
   50|       |
   51|     10|    return NGX_OK;
  ------------------
  |  |   38|     10|#define  NGX_OK          0
  ------------------
   52|     10|}

ngx_log_open_default:
  403|      1|{
  404|      1|    ngx_log_t  *log;
  405|       |
  406|      1|    if (ngx_log_get_file_log(&cycle->new_log) != NULL) {
  ------------------
  |  Branch (406:9): [True: 1, False: 0]
  ------------------
  407|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  408|      1|    }
  409|       |
  410|      0|    if (cycle->new_log.log_level != 0) {
  ------------------
  |  Branch (410:9): [True: 0, False: 0]
  ------------------
  411|       |        /* there are some error logs, but no files */
  412|       |
  413|      0|        log = ngx_pcalloc(cycle->pool, sizeof(ngx_log_t));
  414|      0|        if (log == NULL) {
  ------------------
  |  Branch (414:13): [True: 0, False: 0]
  ------------------
  415|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  416|      0|        }
  417|       |
  418|      0|    } else {
  419|       |        /* no error logs at all */
  420|      0|        log = &cycle->new_log;
  421|      0|    }
  422|       |
  423|      0|    log->log_level = NGX_LOG_ERR;
  ------------------
  |  |   20|      0|#define NGX_LOG_ERR               4
  ------------------
  424|       |
  425|      0|    log->file = ngx_conf_open_file(cycle, &cycle->error_log);
  426|      0|    if (log->file == NULL) {
  ------------------
  |  Branch (426:9): [True: 0, False: 0]
  ------------------
  427|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  428|      0|    }
  429|       |
  430|      0|    if (log != &cycle->new_log) {
  ------------------
  |  Branch (430:9): [True: 0, False: 0]
  ------------------
  431|      0|        ngx_log_insert(&cycle->new_log, log);
  432|      0|    }
  433|       |
  434|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  435|      0|}
ngx_log_get_file_log:
  465|      1|{
  466|      1|    ngx_log_t  *log;
  467|       |
  468|      1|    for (log = head; log; log = log->next) {
  ------------------
  |  Branch (468:22): [True: 1, False: 0]
  ------------------
  469|      1|        if (log->file != NULL) {
  ------------------
  |  Branch (469:13): [True: 1, False: 0]
  ------------------
  470|      1|            return log;
  471|      1|        }
  472|      1|    }
  473|       |
  474|      0|    return NULL;
  475|      1|}
ngx_log_set_log:
  554|      2|{
  555|      2|    ngx_log_t          *new_log;
  556|      2|    ngx_str_t          *value, name;
  557|      2|    ngx_syslog_peer_t  *peer;
  558|       |
  559|      2|    if (*head != NULL && (*head)->log_level == 0) {
  ------------------
  |  Branch (559:9): [True: 1, False: 1]
  |  Branch (559:26): [True: 1, False: 0]
  ------------------
  560|      1|        new_log = *head;
  561|       |
  562|      1|    } else {
  563|       |
  564|      1|        new_log = ngx_pcalloc(cf->pool, sizeof(ngx_log_t));
  565|      1|        if (new_log == NULL) {
  ------------------
  |  Branch (565:13): [True: 0, False: 1]
  ------------------
  566|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  567|      0|        }
  568|       |
  569|      1|        if (*head == NULL) {
  ------------------
  |  Branch (569:13): [True: 1, False: 0]
  ------------------
  570|      1|            *head = new_log;
  571|      1|        }
  572|      1|    }
  573|       |
  574|      2|    value = cf->args->elts;
  575|       |
  576|      2|    if (ngx_strcmp(value[1].data, "stderr") == 0) {
  ------------------
  |  |   57|      2|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (576:9): [True: 2, False: 0]
  ------------------
  577|      2|        ngx_str_null(&name);
  ------------------
  |  |   44|      2|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
  578|      2|        cf->cycle->log_use_stderr = 1;
  579|       |
  580|      2|        new_log->file = ngx_conf_open_file(cf->cycle, &name);
  581|      2|        if (new_log->file == NULL) {
  ------------------
  |  Branch (581:13): [True: 0, False: 2]
  ------------------
  582|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  583|      0|        }
  584|       |
  585|      2|    } else if (ngx_strncmp(value[1].data, "memory:", 7) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (585:16): [True: 0, False: 0]
  ------------------
  586|       |
  587|       |#if (NGX_DEBUG)
  588|       |        size_t                 size, needed;
  589|       |        ngx_pool_cleanup_t    *cln;
  590|       |        ngx_log_memory_buf_t  *buf;
  591|       |
  592|       |        value[1].len -= 7;
  593|       |        value[1].data += 7;
  594|       |
  595|       |        needed = sizeof("MEMLOG  :" NGX_LINEFEED)
  596|       |                 + cf->conf_file->file.name.len
  597|       |                 + NGX_SIZE_T_LEN
  598|       |                 + NGX_INT_T_LEN
  599|       |                 + NGX_MAX_ERROR_STR;
  600|       |
  601|       |        size = ngx_parse_size(&value[1]);
  602|       |
  603|       |        if (size == (size_t) NGX_ERROR || size < needed) {
  604|       |            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  605|       |                               "invalid buffer size \"%V\"", &value[1]);
  606|       |            return NGX_CONF_ERROR;
  607|       |        }
  608|       |
  609|       |        buf = ngx_pcalloc(cf->pool, sizeof(ngx_log_memory_buf_t));
  610|       |        if (buf == NULL) {
  611|       |            return NGX_CONF_ERROR;
  612|       |        }
  613|       |
  614|       |        buf->start = ngx_pnalloc(cf->pool, size);
  615|       |        if (buf->start == NULL) {
  616|       |            return NGX_CONF_ERROR;
  617|       |        }
  618|       |
  619|       |        buf->end = buf->start + size;
  620|       |
  621|       |        buf->pos = ngx_slprintf(buf->start, buf->end, "MEMLOG %uz %V:%ui%N",
  622|       |                                size, &cf->conf_file->file.name,
  623|       |                                cf->conf_file->line);
  624|       |
  625|       |        ngx_memset(buf->pos, ' ', buf->end - buf->pos);
  626|       |
  627|       |        cln = ngx_pool_cleanup_add(cf->pool, 0);
  628|       |        if (cln == NULL) {
  629|       |            return NGX_CONF_ERROR;
  630|       |        }
  631|       |
  632|       |        cln->data = new_log;
  633|       |        cln->handler = ngx_log_memory_cleanup;
  634|       |
  635|       |        new_log->writer = ngx_log_memory_writer;
  636|       |        new_log->wdata = buf;
  637|       |
  638|       |#else
  639|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  640|      0|                           "nginx was built without debug support");
  641|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  642|      0|#endif
  643|       |
  644|      0|    } else if (ngx_strncmp(value[1].data, "syslog:", 7) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (644:16): [True: 0, False: 0]
  ------------------
  645|      0|        peer = ngx_pcalloc(cf->pool, sizeof(ngx_syslog_peer_t));
  646|      0|        if (peer == NULL) {
  ------------------
  |  Branch (646:13): [True: 0, False: 0]
  ------------------
  647|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  648|      0|        }
  649|       |
  650|      0|        if (ngx_syslog_process_conf(cf, peer) != NGX_CONF_OK) {
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (650:13): [True: 0, False: 0]
  ------------------
  651|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  652|      0|        }
  653|       |
  654|      0|        new_log->writer = ngx_syslog_writer;
  655|      0|        new_log->wdata = peer;
  656|       |
  657|      0|    } else {
  658|      0|        new_log->file = ngx_conf_open_file(cf->cycle, &value[1]);
  659|      0|        if (new_log->file == NULL) {
  ------------------
  |  Branch (659:13): [True: 0, False: 0]
  ------------------
  660|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  661|      0|        }
  662|      0|    }
  663|       |
  664|      2|    if (ngx_log_set_levels(cf, new_log) != NGX_CONF_OK) {
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (664:9): [True: 0, False: 2]
  ------------------
  665|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  666|      0|    }
  667|       |
  668|      2|    if (*head != new_log) {
  ------------------
  |  Branch (668:9): [True: 0, False: 2]
  ------------------
  669|      0|        ngx_log_insert(*head, new_log);
  670|      0|    }
  671|       |
  672|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  673|      2|}
ngx_log.c:ngx_error_log:
  543|      1|{
  544|      1|    ngx_log_t  *dummy;
  545|       |
  546|      1|    dummy = &cf->cycle->new_log;
  547|       |
  548|      1|    return ngx_log_set_log(cf, &dummy);
  549|      1|}
ngx_log.c:ngx_log_set_levels:
  480|      2|{
  481|      2|    ngx_uint_t   i, n, d, found;
  482|      2|    ngx_str_t   *value;
  483|       |
  484|      2|    if (cf->args->nelts == 2) {
  ------------------
  |  Branch (484:9): [True: 0, False: 2]
  ------------------
  485|      0|        log->log_level = NGX_LOG_ERR;
  ------------------
  |  |   20|      0|#define NGX_LOG_ERR               4
  ------------------
  486|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  487|      0|    }
  488|       |
  489|      2|    value = cf->args->elts;
  490|       |
  491|      4|    for (i = 2; i < cf->args->nelts; i++) {
  ------------------
  |  Branch (491:17): [True: 2, False: 2]
  ------------------
  492|      2|        found = 0;
  493|       |
  494|      2|        for (n = 1; n <= NGX_LOG_DEBUG; n++) {
  ------------------
  |  |   24|      2|#define NGX_LOG_DEBUG             8
  ------------------
  |  Branch (494:21): [True: 2, False: 0]
  ------------------
  495|      2|            if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) {
  ------------------
  |  |   57|      2|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (495:17): [True: 2, False: 0]
  ------------------
  496|       |
  497|      2|                if (log->log_level != 0) {
  ------------------
  |  Branch (497:21): [True: 0, False: 2]
  ------------------
  498|      0|                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  499|      0|                                       "duplicate log level \"%V\"",
  500|      0|                                       &value[i]);
  501|      0|                    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  502|      0|                }
  503|       |
  504|      2|                log->log_level = n;
  505|      2|                found = 1;
  506|      2|                break;
  507|      2|            }
  508|      2|        }
  509|       |
  510|     16|        for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) {
  ------------------
  |  |   39|      2|#define NGX_LOG_DEBUG_FIRST       NGX_LOG_DEBUG_CORE
  |  |  ------------------
  |  |  |  |   26|      2|#define NGX_LOG_DEBUG_CORE        0x010
  |  |  ------------------
  ------------------
                      for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) {
  ------------------
  |  |   40|     16|#define NGX_LOG_DEBUG_LAST        NGX_LOG_DEBUG_STREAM
  |  |  ------------------
  |  |  |  |   32|     16|#define NGX_LOG_DEBUG_STREAM      0x400
  |  |  ------------------
  ------------------
  |  Branch (510:46): [True: 14, False: 2]
  ------------------
  511|     14|            if (ngx_strcmp(value[i].data, debug_levels[n++]) == 0) {
  ------------------
  |  |   57|     14|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (511:17): [True: 0, False: 14]
  ------------------
  512|      0|                if (log->log_level & ~NGX_LOG_DEBUG_ALL) {
  ------------------
  |  |   42|      0|#define NGX_LOG_DEBUG_ALL         0x7ffffff0
  ------------------
  |  Branch (512:21): [True: 0, False: 0]
  ------------------
  513|      0|                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  514|      0|                                       "invalid log level \"%V\"",
  515|      0|                                       &value[i]);
  516|      0|                    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  517|      0|                }
  518|       |
  519|      0|                log->log_level |= d;
  520|      0|                found = 1;
  521|      0|                break;
  522|      0|            }
  523|     14|        }
  524|       |
  525|       |
  526|      2|        if (!found) {
  ------------------
  |  Branch (526:13): [True: 0, False: 2]
  ------------------
  527|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  528|      0|                               "invalid log level \"%V\"", &value[i]);
  529|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  530|      0|        }
  531|      2|    }
  532|       |
  533|      2|    if (log->log_level == NGX_LOG_DEBUG) {
  ------------------
  |  |   24|      2|#define NGX_LOG_DEBUG             8
  ------------------
  |  Branch (533:9): [True: 0, False: 2]
  ------------------
  534|      0|        log->log_level = NGX_LOG_DEBUG_ALL;
  ------------------
  |  |   42|      0|#define NGX_LOG_DEBUG_ALL         0x7ffffff0
  ------------------
  535|      0|    }
  536|       |
  537|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  538|      2|}

ngx_preinit_modules:
   27|      1|{
   28|      1|    ngx_uint_t  i;
   29|       |
   30|     55|    for (i = 0; ngx_modules[i]; i++) {
  ------------------
  |  Branch (30:17): [True: 54, False: 1]
  ------------------
   31|     54|        ngx_modules[i]->index = i;
   32|     54|        ngx_modules[i]->name = ngx_module_names[i];
   33|     54|    }
   34|       |
   35|      1|    ngx_modules_n = i;
   36|      1|    ngx_max_module = ngx_modules_n + NGX_MAX_DYNAMIC_MODULES;
  ------------------
  |  |   13|      1|#define NGX_MAX_DYNAMIC_MODULES  128
  ------------------
   37|       |
   38|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   39|      1|}
ngx_cycle_modules:
   44|      1|{
   45|       |    /*
   46|       |     * create a list of modules to be used for this cycle,
   47|       |     * copy static modules to it
   48|       |     */
   49|       |
   50|      1|    cycle->modules = ngx_pcalloc(cycle->pool, (ngx_max_module + 1)
   51|      1|                                              * sizeof(ngx_module_t *));
   52|      1|    if (cycle->modules == NULL) {
  ------------------
  |  Branch (52:9): [True: 0, False: 1]
  ------------------
   53|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   54|      0|    }
   55|       |
   56|      1|    ngx_memcpy(cycle->modules, ngx_modules,
  ------------------
  |  |  106|      1|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
   57|      1|               ngx_modules_n * sizeof(ngx_module_t *));
   58|       |
   59|      1|    cycle->modules_n = ngx_modules_n;
   60|       |
   61|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   62|      1|}
ngx_init_modules:
   67|      1|{
   68|      1|    ngx_uint_t  i;
   69|       |
   70|     55|    for (i = 0; cycle->modules[i]; i++) {
  ------------------
  |  Branch (70:17): [True: 54, False: 1]
  ------------------
   71|     54|        if (cycle->modules[i]->init_module) {
  ------------------
  |  Branch (71:13): [True: 3, False: 51]
  ------------------
   72|      3|            if (cycle->modules[i]->init_module(cycle) != NGX_OK) {
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
  |  Branch (72:17): [True: 0, False: 3]
  ------------------
   73|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   74|      0|            }
   75|      3|        }
   76|     54|    }
   77|       |
   78|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   79|      1|}
ngx_count_modules:
   84|      2|{
   85|      2|    ngx_uint_t     i, next, max;
   86|      2|    ngx_module_t  *module;
   87|       |
   88|      2|    next = 0;
   89|      2|    max = 0;
   90|       |
   91|       |    /* count appropriate modules, set up their indices */
   92|       |
   93|    110|    for (i = 0; cycle->modules[i]; i++) {
  ------------------
  |  Branch (93:17): [True: 108, False: 2]
  ------------------
   94|    108|        module = cycle->modules[i];
   95|       |
   96|    108|        if (module->type != type) {
  ------------------
  |  Branch (96:13): [True: 60, False: 48]
  ------------------
   97|     60|            continue;
   98|     60|        }
   99|       |
  100|     48|        if (module->ctx_index != NGX_MODULE_UNSET_INDEX) {
  ------------------
  |  |   18|     48|#define NGX_MODULE_UNSET_INDEX  (ngx_uint_t) -1
  ------------------
  |  Branch (100:13): [True: 0, False: 48]
  ------------------
  101|       |
  102|       |            /* if ctx_index was assigned, preserve it */
  103|       |
  104|      0|            if (module->ctx_index > max) {
  ------------------
  |  Branch (104:17): [True: 0, False: 0]
  ------------------
  105|      0|                max = module->ctx_index;
  106|      0|            }
  107|       |
  108|      0|            if (module->ctx_index == next) {
  ------------------
  |  Branch (108:17): [True: 0, False: 0]
  ------------------
  109|      0|                next++;
  110|      0|            }
  111|       |
  112|      0|            continue;
  113|      0|        }
  114|       |
  115|       |        /* search for some free index */
  116|       |
  117|     48|        module->ctx_index = ngx_module_ctx_index(cycle, type, next);
  118|       |
  119|     48|        if (module->ctx_index > max) {
  ------------------
  |  Branch (119:13): [True: 46, False: 2]
  ------------------
  120|     46|            max = module->ctx_index;
  121|     46|        }
  122|       |
  123|     48|        next = module->ctx_index + 1;
  124|     48|    }
  125|       |
  126|       |    /*
  127|       |     * make sure the number returned is big enough for previous
  128|       |     * cycle as well, else there will be problems if the number
  129|       |     * will be stored in a global variable (as it's used to be)
  130|       |     * and we'll have to roll back to the previous cycle
  131|       |     */
  132|       |
  133|      2|    if (cycle->old_cycle && cycle->old_cycle->modules) {
  ------------------
  |  Branch (133:9): [True: 2, False: 0]
  |  Branch (133:29): [True: 0, False: 2]
  ------------------
  134|       |
  135|      0|        for (i = 0; cycle->old_cycle->modules[i]; i++) {
  ------------------
  |  Branch (135:21): [True: 0, False: 0]
  ------------------
  136|      0|            module = cycle->old_cycle->modules[i];
  137|       |
  138|      0|            if (module->type != type) {
  ------------------
  |  Branch (138:17): [True: 0, False: 0]
  ------------------
  139|      0|                continue;
  140|      0|            }
  141|       |
  142|      0|            if (module->ctx_index > max) {
  ------------------
  |  Branch (142:17): [True: 0, False: 0]
  ------------------
  143|      0|                max = module->ctx_index;
  144|      0|            }
  145|      0|        }
  146|      0|    }
  147|       |
  148|       |    /* prevent loading of additional modules */
  149|       |
  150|      2|    cycle->modules_used = 1;
  151|       |
  152|      2|    return max + 1;
  153|      2|}
ngx_module.c:ngx_module_ctx_index:
  320|     48|{
  321|     48|    ngx_uint_t     i;
  322|     48|    ngx_module_t  *module;
  323|       |
  324|     48|again:
  325|       |
  326|       |    /* find an unused ctx_index */
  327|       |
  328|  2.64k|    for (i = 0; cycle->modules[i]; i++) {
  ------------------
  |  Branch (328:17): [True: 2.59k, False: 48]
  ------------------
  329|  2.59k|        module = cycle->modules[i];
  330|       |
  331|  2.59k|        if (module->type != type) {
  ------------------
  |  Branch (331:13): [True: 472, False: 2.12k]
  ------------------
  332|    472|            continue;
  333|    472|        }
  334|       |
  335|  2.12k|        if (module->ctx_index == index) {
  ------------------
  |  Branch (335:13): [True: 0, False: 2.12k]
  ------------------
  336|      0|            index++;
  337|      0|            goto again;
  338|      0|        }
  339|  2.12k|    }
  340|       |
  341|       |    /* check previous cycle */
  342|       |
  343|     48|    if (cycle->old_cycle && cycle->old_cycle->modules) {
  ------------------
  |  Branch (343:9): [True: 48, False: 0]
  |  Branch (343:29): [True: 0, False: 48]
  ------------------
  344|       |
  345|      0|        for (i = 0; cycle->old_cycle->modules[i]; i++) {
  ------------------
  |  Branch (345:21): [True: 0, False: 0]
  ------------------
  346|      0|            module = cycle->old_cycle->modules[i];
  347|       |
  348|      0|            if (module->type != type) {
  ------------------
  |  Branch (348:17): [True: 0, False: 0]
  ------------------
  349|      0|                continue;
  350|      0|            }
  351|       |
  352|      0|            if (module->ctx_index == index) {
  ------------------
  |  Branch (352:17): [True: 0, False: 0]
  ------------------
  353|      0|                index++;
  354|      0|                goto again;
  355|      0|            }
  356|      0|        }
  357|      0|    }
  358|       |
  359|     48|    return index;
  360|     48|}

ngx_output_chain:
   43|     18|{
   44|     18|    off_t         bsize;
   45|     18|    ngx_int_t     rc, last;
   46|     18|    ngx_chain_t  *cl, *out, **last_out;
   47|       |
   48|     18|    if (ctx->in == NULL && ctx->busy == NULL
  ------------------
  |  Branch (48:9): [True: 18, False: 0]
  |  Branch (48:28): [True: 18, False: 0]
  ------------------
   49|       |#if (NGX_HAVE_FILE_AIO || NGX_THREADS)
   50|       |        && !ctx->aio
   51|       |#endif
   52|     18|       )
   53|     18|    {
   54|       |        /*
   55|       |         * the short path for the case when the ctx->in and ctx->busy chains
   56|       |         * are empty, the incoming chain is empty too or has the single buf
   57|       |         * that does not require the copy
   58|       |         */
   59|       |
   60|     18|        if (in == NULL) {
  ------------------
  |  Branch (60:13): [True: 9, False: 9]
  ------------------
   61|      9|            return ctx->output_filter(ctx->filter_ctx, in);
   62|      9|        }
   63|       |
   64|      9|        if (in->next == NULL
  ------------------
  |  Branch (64:13): [True: 7, False: 2]
  ------------------
   65|       |#if (NGX_SENDFILE_LIMIT)
   66|       |            && !(in->buf->in_file && in->buf->file_last > NGX_SENDFILE_LIMIT)
   67|       |#endif
   68|      9|            && ngx_output_chain_as_is(ctx, in->buf))
  ------------------
  |  Branch (68:16): [True: 7, False: 0]
  ------------------
   69|      7|        {
   70|      7|            return ctx->output_filter(ctx->filter_ctx, in);
   71|      7|        }
   72|      9|    }
   73|       |
   74|       |    /* add the incoming buf to the chain ctx->in */
   75|       |
   76|      2|    if (in) {
  ------------------
  |  Branch (76:9): [True: 2, False: 0]
  ------------------
   77|      2|        if (ngx_output_chain_add_copy(ctx->pool, &ctx->in, in) == NGX_ERROR) {
  ------------------
  |  |   39|      2|#define  NGX_ERROR      -1
  ------------------
  |  Branch (77:13): [True: 0, False: 2]
  ------------------
   78|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   79|      0|        }
   80|      2|    }
   81|       |
   82|      2|    out = NULL;
   83|      2|    last_out = &out;
   84|      2|    last = NGX_NONE;
  ------------------
  |  |   27|      2|#define NGX_NONE            1
  ------------------
   85|       |
   86|      4|    for ( ;; ) {
   87|       |
   88|       |#if (NGX_HAVE_FILE_AIO || NGX_THREADS)
   89|       |        if (ctx->aio) {
   90|       |            return NGX_AGAIN;
   91|       |        }
   92|       |#endif
   93|       |
   94|      8|        while (ctx->in) {
  ------------------
  |  Branch (94:16): [True: 4, False: 4]
  ------------------
   95|       |
   96|       |            /*
   97|       |             * cycle while there are the ctx->in bufs
   98|       |             * and there are the free output bufs to copy in
   99|       |             */
  100|       |
  101|      4|            bsize = ngx_buf_size(ctx->in->buf);
  ------------------
  |  |  137|      4|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      4|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 4]
  |  |  |  |  |  Branch (125:55): [True: 4, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      4|                            ((b)->file_last - (b)->file_pos))
  ------------------
  102|       |
  103|      4|            if (bsize == 0 && !ngx_buf_special(ctx->in->buf)) {
  ------------------
  |  |  129|      0|    (((b)->flush || (b)->last_buf || (b)->sync)                              \
  |  |  ------------------
  |  |  |  Branch (129:7): [True: 0, False: 0]
  |  |  |  Branch (129:21): [True: 0, False: 0]
  |  |  |  Branch (129:38): [True: 0, False: 0]
  |  |  ------------------
  |  |  130|      0|     && !ngx_buf_in_memory(b) && !(b)->in_file)
  |  |  ------------------
  |  |  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (130:34): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (103:17): [True: 0, False: 4]
  ------------------
  104|       |
  105|      0|                ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  106|      0|                              "zero size buf in output "
  107|      0|                              "t:%d r:%d f:%d %p %p-%p %p %O-%O",
  108|      0|                              ctx->in->buf->temporary,
  109|      0|                              ctx->in->buf->recycled,
  110|      0|                              ctx->in->buf->in_file,
  111|      0|                              ctx->in->buf->start,
  112|      0|                              ctx->in->buf->pos,
  113|      0|                              ctx->in->buf->last,
  114|      0|                              ctx->in->buf->file,
  115|      0|                              ctx->in->buf->file_pos,
  116|      0|                              ctx->in->buf->file_last);
  117|       |
  118|      0|                ngx_debug_point();
  119|       |
  120|      0|                ctx->in = ctx->in->next;
  121|       |
  122|      0|                continue;
  123|      0|            }
  124|       |
  125|      4|            if (bsize < 0) {
  ------------------
  |  Branch (125:17): [True: 0, False: 4]
  ------------------
  126|       |
  127|      0|                ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  128|      0|                              "negative size buf in output "
  129|      0|                              "t:%d r:%d f:%d %p %p-%p %p %O-%O",
  130|      0|                              ctx->in->buf->temporary,
  131|      0|                              ctx->in->buf->recycled,
  132|      0|                              ctx->in->buf->in_file,
  133|      0|                              ctx->in->buf->start,
  134|      0|                              ctx->in->buf->pos,
  135|      0|                              ctx->in->buf->last,
  136|      0|                              ctx->in->buf->file,
  137|      0|                              ctx->in->buf->file_pos,
  138|      0|                              ctx->in->buf->file_last);
  139|       |
  140|      0|                ngx_debug_point();
  141|       |
  142|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  143|      0|            }
  144|       |
  145|      4|            if (ngx_output_chain_as_is(ctx, ctx->in->buf)) {
  ------------------
  |  Branch (145:17): [True: 4, False: 0]
  ------------------
  146|       |
  147|       |                /* move the chain link to the output chain */
  148|       |
  149|      4|                cl = ctx->in;
  150|      4|                ctx->in = cl->next;
  151|       |
  152|      4|                *last_out = cl;
  153|      4|                last_out = &cl->next;
  154|      4|                cl->next = NULL;
  155|       |
  156|      4|                continue;
  157|      4|            }
  158|       |
  159|      0|            if (ctx->buf == NULL) {
  ------------------
  |  Branch (159:17): [True: 0, False: 0]
  ------------------
  160|       |
  161|      0|                rc = ngx_output_chain_align_file_buf(ctx, bsize);
  162|       |
  163|      0|                if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (163:21): [True: 0, False: 0]
  ------------------
  164|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  165|      0|                }
  166|       |
  167|      0|                if (rc != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (167:21): [True: 0, False: 0]
  ------------------
  168|       |
  169|      0|                    if (ctx->free) {
  ------------------
  |  Branch (169:25): [True: 0, False: 0]
  ------------------
  170|       |
  171|       |                        /* get the free buf */
  172|       |
  173|      0|                        cl = ctx->free;
  174|      0|                        ctx->buf = cl->buf;
  175|      0|                        ctx->free = cl->next;
  176|       |
  177|      0|                        ngx_free_chain(ctx->pool, cl);
  ------------------
  |  |  149|      0|    (cl)->next = (pool)->chain;                                              \
  |  |  150|      0|    (pool)->chain = (cl)
  ------------------
  178|       |
  179|      0|                    } else if (out || ctx->allocated == ctx->bufs.num) {
  ------------------
  |  Branch (179:32): [True: 0, False: 0]
  |  Branch (179:39): [True: 0, False: 0]
  ------------------
  180|       |
  181|      0|                        break;
  182|       |
  183|      0|                    } else if (ngx_output_chain_get_buf(ctx, bsize) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (183:32): [True: 0, False: 0]
  ------------------
  184|      0|                        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  185|      0|                    }
  186|      0|                }
  187|      0|            }
  188|       |
  189|      0|            rc = ngx_output_chain_copy_buf(ctx);
  190|       |
  191|      0|            if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (191:17): [True: 0, False: 0]
  ------------------
  192|      0|                return rc;
  193|      0|            }
  194|       |
  195|      0|            if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (195:17): [True: 0, False: 0]
  ------------------
  196|      0|                if (out) {
  ------------------
  |  Branch (196:21): [True: 0, False: 0]
  ------------------
  197|      0|                    break;
  198|      0|                }
  199|       |
  200|      0|                return rc;
  201|      0|            }
  202|       |
  203|       |            /* delete the completed buf from the ctx->in chain */
  204|       |
  205|      0|            if (ngx_buf_size(ctx->in->buf) == 0) {
  ------------------
  |  |  137|      0|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|                            ((b)->file_last - (b)->file_pos))
  ------------------
  |  Branch (205:17): [True: 0, False: 0]
  ------------------
  206|      0|                ctx->in = ctx->in->next;
  207|      0|            }
  208|       |
  209|      0|            cl = ngx_alloc_chain_link(ctx->pool);
  210|      0|            if (cl == NULL) {
  ------------------
  |  Branch (210:17): [True: 0, False: 0]
  ------------------
  211|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  212|      0|            }
  213|       |
  214|      0|            cl->buf = ctx->buf;
  215|      0|            cl->next = NULL;
  216|      0|            *last_out = cl;
  217|      0|            last_out = &cl->next;
  218|      0|            ctx->buf = NULL;
  219|      0|        }
  220|       |
  221|      4|        if (out == NULL && last != NGX_NONE) {
  ------------------
  |  |   27|      2|#define NGX_NONE            1
  ------------------
  |  Branch (221:13): [True: 2, False: 2]
  |  Branch (221:28): [True: 2, False: 0]
  ------------------
  222|       |
  223|      2|            if (ctx->in) {
  ------------------
  |  Branch (223:17): [True: 0, False: 2]
  ------------------
  224|      0|                return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  225|      0|            }
  226|       |
  227|      2|            return last;
  228|      2|        }
  229|       |
  230|      2|        last = ctx->output_filter(ctx->filter_ctx, out);
  231|       |
  232|      2|        if (last == NGX_ERROR || last == NGX_DONE) {
  ------------------
  |  |   39|      4|#define  NGX_ERROR      -1
  ------------------
                      if (last == NGX_ERROR || last == NGX_DONE) {
  ------------------
  |  |   42|      2|#define  NGX_DONE       -4
  ------------------
  |  Branch (232:13): [True: 0, False: 2]
  |  Branch (232:34): [True: 0, False: 2]
  ------------------
  233|      0|            return last;
  234|      0|        }
  235|       |
  236|      2|        ngx_chain_update_chains(ctx->pool, &ctx->free, &ctx->busy, &out,
  237|      2|                                ctx->tag);
  238|      2|        last_out = &out;
  239|      2|    }
  240|      2|}
ngx_chain_writer:
  654|      5|{
  655|      5|    ngx_chain_writer_ctx_t *ctx = data;
  656|       |
  657|      5|    off_t              size;
  658|      5|    ngx_chain_t       *cl, *ln, *chain;
  659|      5|    ngx_connection_t  *c;
  660|       |
  661|      5|    c = ctx->connection;
  662|       |
  663|     10|    for (size = 0; in; in = in->next) {
  ------------------
  |  Branch (663:20): [True: 5, False: 5]
  ------------------
  664|       |
  665|      5|        if (ngx_buf_size(in->buf) == 0 && !ngx_buf_special(in->buf)) {
  ------------------
  |  |  137|      5|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      5|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 5, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      5|                            ((b)->file_last - (b)->file_pos))
  ------------------
                      if (ngx_buf_size(in->buf) == 0 && !ngx_buf_special(in->buf)) {
  ------------------
  |  |  129|      0|    (((b)->flush || (b)->last_buf || (b)->sync)                              \
  |  |  ------------------
  |  |  |  Branch (129:7): [True: 0, False: 0]
  |  |  |  Branch (129:21): [True: 0, False: 0]
  |  |  |  Branch (129:38): [True: 0, False: 0]
  |  |  ------------------
  |  |  130|      0|     && !ngx_buf_in_memory(b) && !(b)->in_file)
  |  |  ------------------
  |  |  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (130:34): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (665:13): [True: 0, False: 5]
  ------------------
  666|       |
  667|      0|            ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  668|      0|                          "zero size buf in chain writer "
  669|      0|                          "t:%d r:%d f:%d %p %p-%p %p %O-%O",
  670|      0|                          in->buf->temporary,
  671|      0|                          in->buf->recycled,
  672|      0|                          in->buf->in_file,
  673|      0|                          in->buf->start,
  674|      0|                          in->buf->pos,
  675|      0|                          in->buf->last,
  676|      0|                          in->buf->file,
  677|      0|                          in->buf->file_pos,
  678|      0|                          in->buf->file_last);
  679|       |
  680|      0|            ngx_debug_point();
  681|       |
  682|      0|            continue;
  683|      0|        }
  684|       |
  685|      5|        if (ngx_buf_size(in->buf) < 0) {
  ------------------
  |  |  137|      5|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      5|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 5, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      5|                            ((b)->file_last - (b)->file_pos))
  ------------------
  |  Branch (685:13): [True: 0, False: 5]
  ------------------
  686|       |
  687|      0|            ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  688|      0|                          "negative size buf in chain writer "
  689|      0|                          "t:%d r:%d f:%d %p %p-%p %p %O-%O",
  690|      0|                          in->buf->temporary,
  691|      0|                          in->buf->recycled,
  692|      0|                          in->buf->in_file,
  693|      0|                          in->buf->start,
  694|      0|                          in->buf->pos,
  695|      0|                          in->buf->last,
  696|      0|                          in->buf->file,
  697|      0|                          in->buf->file_pos,
  698|      0|                          in->buf->file_last);
  699|       |
  700|      0|            ngx_debug_point();
  701|       |
  702|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  703|      0|        }
  704|       |
  705|      5|        size += ngx_buf_size(in->buf);
  ------------------
  |  |  137|      5|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      5|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 5, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      5|                            ((b)->file_last - (b)->file_pos))
  ------------------
  706|       |
  707|      5|        ngx_log_debug2(NGX_LOG_DEBUG_CORE, c->log, 0,
  708|      5|                       "chain writer buf fl:%d s:%uO",
  709|      5|                       in->buf->flush, ngx_buf_size(in->buf));
  710|       |
  711|      5|        cl = ngx_alloc_chain_link(ctx->pool);
  712|      5|        if (cl == NULL) {
  ------------------
  |  Branch (712:13): [True: 0, False: 5]
  ------------------
  713|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  714|      0|        }
  715|       |
  716|      5|        cl->buf = in->buf;
  717|      5|        cl->next = NULL;
  718|      5|        *ctx->last = cl;
  719|      5|        ctx->last = &cl->next;
  720|      5|    }
  721|       |
  722|      5|    ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0,
  723|      5|                   "chain writer in: %p", ctx->out);
  724|       |
  725|     10|    for (cl = ctx->out; cl; cl = cl->next) {
  ------------------
  |  Branch (725:25): [True: 5, False: 5]
  ------------------
  726|       |
  727|      5|        if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
  ------------------
  |  |  137|      5|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      5|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 5, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      5|                            ((b)->file_last - (b)->file_pos))
  ------------------
                      if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
  ------------------
  |  |  129|      0|    (((b)->flush || (b)->last_buf || (b)->sync)                              \
  |  |  ------------------
  |  |  |  Branch (129:7): [True: 0, False: 0]
  |  |  |  Branch (129:21): [True: 0, False: 0]
  |  |  |  Branch (129:38): [True: 0, False: 0]
  |  |  ------------------
  |  |  130|      0|     && !ngx_buf_in_memory(b) && !(b)->in_file)
  |  |  ------------------
  |  |  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (130:34): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (727:13): [True: 0, False: 5]
  ------------------
  728|       |
  729|      0|            ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  730|      0|                          "zero size buf in chain writer "
  731|      0|                          "t:%d r:%d f:%d %p %p-%p %p %O-%O",
  732|      0|                          cl->buf->temporary,
  733|      0|                          cl->buf->recycled,
  734|      0|                          cl->buf->in_file,
  735|      0|                          cl->buf->start,
  736|      0|                          cl->buf->pos,
  737|      0|                          cl->buf->last,
  738|      0|                          cl->buf->file,
  739|      0|                          cl->buf->file_pos,
  740|      0|                          cl->buf->file_last);
  741|       |
  742|      0|            ngx_debug_point();
  743|       |
  744|      0|            continue;
  745|      0|        }
  746|       |
  747|      5|        if (ngx_buf_size(cl->buf) < 0) {
  ------------------
  |  |  137|      5|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      5|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 5, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      5|                            ((b)->file_last - (b)->file_pos))
  ------------------
  |  Branch (747:13): [True: 0, False: 5]
  ------------------
  748|       |
  749|      0|            ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  750|      0|                          "negative size buf in chain writer "
  751|      0|                          "t:%d r:%d f:%d %p %p-%p %p %O-%O",
  752|      0|                          cl->buf->temporary,
  753|      0|                          cl->buf->recycled,
  754|      0|                          cl->buf->in_file,
  755|      0|                          cl->buf->start,
  756|      0|                          cl->buf->pos,
  757|      0|                          cl->buf->last,
  758|      0|                          cl->buf->file,
  759|      0|                          cl->buf->file_pos,
  760|      0|                          cl->buf->file_last);
  761|       |
  762|      0|            ngx_debug_point();
  763|       |
  764|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  765|      0|        }
  766|       |
  767|      5|        size += ngx_buf_size(cl->buf);
  ------------------
  |  |  137|      5|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      5|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 5, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      5|                            ((b)->file_last - (b)->file_pos))
  ------------------
  768|      5|    }
  769|       |
  770|      5|    if (size == 0 && !c->buffered) {
  ------------------
  |  Branch (770:9): [True: 0, False: 5]
  |  Branch (770:22): [True: 0, False: 0]
  ------------------
  771|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  772|      0|    }
  773|       |
  774|      5|    chain = c->send_chain(c, ctx->out, ctx->limit);
  775|       |
  776|      5|    ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0,
  777|      5|                   "chain writer out: %p", chain);
  778|       |
  779|      5|    if (chain == NGX_CHAIN_ERROR) {
  ------------------
  |  |  122|      5|#define NGX_CHAIN_ERROR     (ngx_chain_t *) NGX_ERROR
  |  |  ------------------
  |  |  |  |   39|      5|#define  NGX_ERROR      -1
  |  |  ------------------
  ------------------
  |  Branch (779:9): [True: 0, False: 5]
  ------------------
  780|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  781|      0|    }
  782|       |
  783|      5|    if (chain && c->write->ready) {
  ------------------
  |  Branch (783:9): [True: 0, False: 5]
  |  Branch (783:18): [True: 0, False: 0]
  ------------------
  784|      0|        ngx_post_event(c->write, &ngx_posted_next_events);
  ------------------
  |  |   19|      0|    if (!(ev)->posted) {                                                      \
  |  |  ------------------
  |  |  |  Branch (19:9): [True: 0, False: 0]
  |  |  ------------------
  |  |   20|      0|        (ev)->posted = 1;                                                     \
  |  |   21|      0|        ngx_queue_insert_tail(q, &(ev)->queue);                               \
  |  |  ------------------
  |  |  |  |   44|      0|    (x)->prev = (h)->prev;                                                    \
  |  |  |  |   45|      0|    (x)->prev->next = x;                                                      \
  |  |  |  |   46|      0|    (x)->next = h;                                                            \
  |  |  |  |   47|      0|    (h)->prev = x
  |  |  ------------------
  |  |   22|      0|                                                                              \
  |  |   23|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, "post event %p", ev);\
  |  |   24|      0|                                                                              \
  |  |   25|      0|    } else  {                                                                 \
  |  |   26|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                      \
  |  |   27|      0|                       "update posted event %p", ev);                         \
  |  |   28|      0|    }
  ------------------
  785|      0|    }
  786|       |
  787|     10|    for (cl = ctx->out; cl && cl != chain; /* void */) {
  ------------------
  |  Branch (787:25): [True: 5, False: 5]
  |  Branch (787:31): [True: 5, False: 0]
  ------------------
  788|      5|        ln = cl;
  789|      5|        cl = cl->next;
  790|      5|        ngx_free_chain(ctx->pool, ln);
  ------------------
  |  |  149|      5|    (cl)->next = (pool)->chain;                                              \
  |  |  150|      5|    (pool)->chain = (cl)
  ------------------
  791|      5|    }
  792|       |
  793|      5|    ctx->out = chain;
  794|       |
  795|      5|    if (ctx->out == NULL) {
  ------------------
  |  Branch (795:9): [True: 5, False: 0]
  ------------------
  796|      5|        ctx->last = &ctx->out;
  797|       |
  798|      5|        if (!c->buffered) {
  ------------------
  |  Branch (798:13): [True: 5, False: 0]
  ------------------
  799|      5|            return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  800|      5|        }
  801|      5|    }
  802|       |
  803|      0|    return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  804|      5|}
ngx_output_chain.c:ngx_output_chain_as_is:
  245|     11|{
  246|     11|    ngx_uint_t  sendfile;
  247|       |
  248|     11|    if (ngx_buf_special(buf)) {
  ------------------
  |  |  129|     11|    (((b)->flush || (b)->last_buf || (b)->sync)                              \
  |  |  ------------------
  |  |  |  Branch (129:7): [True: 7, False: 4]
  |  |  |  Branch (129:21): [True: 2, False: 2]
  |  |  |  Branch (129:38): [True: 0, False: 2]
  |  |  ------------------
  |  |  130|     11|     && !ngx_buf_in_memory(b) && !(b)->in_file)
  |  |  ------------------
  |  |  |  |  125|     20|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 5, False: 4]
  |  |  |  |  |  Branch (125:55): [True: 3, False: 1]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (130:34): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  249|      1|        return 1;
  250|      1|    }
  251|       |
  252|       |#if (NGX_THREADS)
  253|       |    if (buf->in_file) {
  254|       |        buf->file->thread_handler = ctx->thread_handler;
  255|       |        buf->file->thread_ctx = ctx->filter_ctx;
  256|       |    }
  257|       |#endif
  258|       |
  259|     10|    sendfile = ctx->sendfile;
  260|       |
  261|       |#if (NGX_SENDFILE_LIMIT)
  262|       |
  263|       |    if (buf->in_file && buf->file_pos >= NGX_SENDFILE_LIMIT) {
  264|       |        sendfile = 0;
  265|       |    }
  266|       |
  267|       |#endif
  268|       |
  269|     10|#if !(NGX_HAVE_SENDFILE_NODISKIO)
  270|       |
  271|       |    /*
  272|       |     * With DIRECTIO, disable sendfile() unless sendfile(SF_NOCACHE)
  273|       |     * is available.
  274|       |     */
  275|       |
  276|     10|    if (buf->in_file && buf->file->directio) {
  ------------------
  |  Branch (276:9): [True: 0, False: 10]
  |  Branch (276:25): [True: 0, False: 0]
  ------------------
  277|      0|        sendfile = 0;
  278|      0|    }
  279|       |
  280|     10|#endif
  281|       |
  282|     10|    if (!sendfile) {
  ------------------
  |  Branch (282:9): [True: 10, False: 0]
  ------------------
  283|       |
  284|     10|        if (!ngx_buf_in_memory(buf)) {
  ------------------
  |  |  125|     10|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  ------------------
  |  |  |  Branch (125:37): [True: 5, False: 5]
  |  |  |  Branch (125:55): [True: 5, False: 0]
  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  285|      0|            return 0;
  286|      0|        }
  287|       |
  288|     10|        buf->in_file = 0;
  289|     10|    }
  290|       |
  291|     10|    if (ctx->need_in_memory && !ngx_buf_in_memory(buf)) {
  ------------------
  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  ------------------
  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (291:9): [True: 0, False: 10]
  ------------------
  292|      0|        return 0;
  293|      0|    }
  294|       |
  295|     10|    if (ctx->need_in_temp && (buf->memory || buf->mmap)) {
  ------------------
  |  Branch (295:9): [True: 0, False: 10]
  |  Branch (295:31): [True: 0, False: 0]
  |  Branch (295:46): [True: 0, False: 0]
  ------------------
  296|      0|        return 0;
  297|      0|    }
  298|       |
  299|     10|    return 1;
  300|     10|}
ngx_output_chain.c:ngx_output_chain_add_copy:
  306|      2|{
  307|      2|    ngx_chain_t  *cl, **ll;
  308|       |#if (NGX_SENDFILE_LIMIT)
  309|       |    ngx_buf_t    *b, *buf;
  310|       |#endif
  311|       |
  312|      2|    ll = chain;
  313|       |
  314|      2|    for (cl = *chain; cl; cl = cl->next) {
  ------------------
  |  Branch (314:23): [True: 0, False: 2]
  ------------------
  315|      0|        ll = &cl->next;
  316|      0|    }
  317|       |
  318|      6|    while (in) {
  ------------------
  |  Branch (318:12): [True: 4, False: 2]
  ------------------
  319|       |
  320|      4|        cl = ngx_alloc_chain_link(pool);
  321|      4|        if (cl == NULL) {
  ------------------
  |  Branch (321:13): [True: 0, False: 4]
  ------------------
  322|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  323|      0|        }
  324|       |
  325|       |#if (NGX_SENDFILE_LIMIT)
  326|       |
  327|       |        buf = in->buf;
  328|       |
  329|       |        if (buf->in_file
  330|       |            && buf->file_pos < NGX_SENDFILE_LIMIT
  331|       |            && buf->file_last > NGX_SENDFILE_LIMIT)
  332|       |        {
  333|       |            /* split a file buf on two bufs by the sendfile limit */
  334|       |
  335|       |            b = ngx_calloc_buf(pool);
  336|       |            if (b == NULL) {
  337|       |                return NGX_ERROR;
  338|       |            }
  339|       |
  340|       |            ngx_memcpy(b, buf, sizeof(ngx_buf_t));
  341|       |
  342|       |            if (ngx_buf_in_memory(buf)) {
  343|       |                buf->pos += (ssize_t) (NGX_SENDFILE_LIMIT - buf->file_pos);
  344|       |                b->last = buf->pos;
  345|       |            }
  346|       |
  347|       |            buf->file_pos = NGX_SENDFILE_LIMIT;
  348|       |            b->file_last = NGX_SENDFILE_LIMIT;
  349|       |
  350|       |            cl->buf = b;
  351|       |
  352|       |        } else {
  353|       |            cl->buf = buf;
  354|       |            in = in->next;
  355|       |        }
  356|       |
  357|       |#else
  358|      4|        cl->buf = in->buf;
  359|      4|        in = in->next;
  360|       |
  361|      4|#endif
  362|       |
  363|      4|        cl->next = NULL;
  364|      4|        *ll = cl;
  365|      4|        ll = &cl->next;
  366|      4|    }
  367|       |
  368|      2|    return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  369|      2|}

ngx_create_pool:
   20|     43|{
   21|     43|    ngx_pool_t  *p;
   22|       |
   23|     43|    p = ngx_memalign(NGX_POOL_ALIGNMENT, size, log);
  ------------------
  |  |   24|     43|#define NGX_POOL_ALIGNMENT       16
  ------------------
   24|     43|    if (p == NULL) {
  ------------------
  |  Branch (24:9): [True: 0, False: 43]
  ------------------
   25|      0|        return NULL;
   26|      0|    }
   27|       |
   28|     43|    p->d.last = (u_char *) p + sizeof(ngx_pool_t);
   29|     43|    p->d.end = (u_char *) p + size;
   30|     43|    p->d.next = NULL;
   31|     43|    p->d.failed = 0;
   32|       |
   33|     43|    size = size - sizeof(ngx_pool_t);
   34|     43|    p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;
  ------------------
  |  |   20|     43|#define NGX_MAX_ALLOC_FROM_POOL  (ngx_pagesize - 1)
  ------------------
                  p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;
  ------------------
  |  |   20|     48|#define NGX_MAX_ALLOC_FROM_POOL  (ngx_pagesize - 1)
  ------------------
  |  Branch (34:14): [True: 38, False: 5]
  ------------------
   35|       |
   36|     43|    p->current = p;
   37|     43|    p->chain = NULL;
   38|     43|    p->large = NULL;
   39|     43|    p->cleanup = NULL;
   40|     43|    p->log = log;
   41|       |
   42|     43|    return p;
   43|     43|}
ngx_destroy_pool:
   48|     37|{
   49|     37|    ngx_pool_t          *p, *n;
   50|     37|    ngx_pool_large_t    *l;
   51|     37|    ngx_pool_cleanup_t  *c;
   52|       |
   53|     42|    for (c = pool->cleanup; c; c = c->next) {
  ------------------
  |  Branch (53:29): [True: 5, False: 37]
  ------------------
   54|      5|        if (c->handler) {
  ------------------
  |  Branch (54:13): [True: 5, False: 0]
  ------------------
   55|      5|            ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
   56|      5|                           "run cleanup: %p", c);
   57|      5|            c->handler(c->data);
   58|      5|        }
   59|      5|    }
   60|       |
   61|       |#if (NGX_DEBUG)
   62|       |
   63|       |    /*
   64|       |     * we could allocate the pool->log from this pool
   65|       |     * so we cannot use this log while free()ing the pool
   66|       |     */
   67|       |
   68|       |    for (l = pool->large; l; l = l->next) {
   69|       |        ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %p", l->alloc);
   70|       |    }
   71|       |
   72|       |    for (p = pool, n = pool->d.next; /* void */; p = n, n = n->d.next) {
   73|       |        ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
   74|       |                       "free: %p, unused: %uz", p, p->d.end - p->d.last);
   75|       |
   76|       |        if (n == NULL) {
   77|       |            break;
   78|       |        }
   79|       |    }
   80|       |
   81|       |#endif
   82|       |
   83|    565|    for (l = pool->large; l; l = l->next) {
  ------------------
  |  Branch (83:27): [True: 528, False: 37]
  ------------------
   84|    528|        if (l->alloc) {
  ------------------
  |  Branch (84:13): [True: 528, False: 0]
  ------------------
   85|    528|            ngx_free(l->alloc);
  ------------------
  |  |   19|    528|#define ngx_free          free
  ------------------
   86|    528|        }
   87|    528|    }
   88|       |
   89|     37|    for (p = pool, n = pool->d.next; /* void */; p = n, n = n->d.next) {
   90|     37|        ngx_free(p);
  ------------------
  |  |   19|     37|#define ngx_free          free
  ------------------
   91|       |
   92|     37|        if (n == NULL) {
  ------------------
  |  Branch (92:13): [True: 37, False: 0]
  ------------------
   93|     37|            break;
   94|     37|        }
   95|     37|    }
   96|     37|}
ngx_palloc:
  124|    959|{
  125|       |#if !(NGX_DEBUG_PALLOC)
  126|       |    if (size <= pool->max) {
  127|       |        return ngx_palloc_small(pool, size, 1);
  128|       |    }
  129|       |#endif
  130|       |
  131|    959|    return ngx_palloc_large(pool, size);
  132|    959|}
ngx_pnalloc:
  137|    348|{
  138|       |#if !(NGX_DEBUG_PALLOC)
  139|       |    if (size <= pool->max) {
  140|       |        return ngx_palloc_small(pool, size, 0);
  141|       |    }
  142|       |#endif
  143|       |
  144|    348|    return ngx_palloc_large(pool, size);
  145|    348|}
ngx_pcalloc:
  299|    380|{
  300|    380|    void *p;
  301|       |
  302|    380|    p = ngx_palloc(pool, size);
  303|    380|    if (p) {
  ------------------
  |  Branch (303:9): [True: 380, False: 0]
  ------------------
  304|    380|        ngx_memzero(p, size);
  ------------------
  |  |   88|    380|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  305|    380|    }
  306|       |
  307|    380|    return p;
  308|    380|}
ngx_pool_cleanup_add:
  313|      7|{
  314|      7|    ngx_pool_cleanup_t  *c;
  315|       |
  316|      7|    c = ngx_palloc(p, sizeof(ngx_pool_cleanup_t));
  317|      7|    if (c == NULL) {
  ------------------
  |  Branch (317:9): [True: 0, False: 7]
  ------------------
  318|      0|        return NULL;
  319|      0|    }
  320|       |
  321|      7|    if (size) {
  ------------------
  |  Branch (321:9): [True: 5, False: 2]
  ------------------
  322|      5|        c->data = ngx_palloc(p, size);
  323|      5|        if (c->data == NULL) {
  ------------------
  |  Branch (323:13): [True: 0, False: 5]
  ------------------
  324|      0|            return NULL;
  325|      0|        }
  326|       |
  327|      5|    } else {
  328|      2|        c->data = NULL;
  329|      2|    }
  330|       |
  331|      7|    c->handler = NULL;
  332|      7|    c->next = p->cleanup;
  333|       |
  334|      7|    p->cleanup = c;
  335|       |
  336|      7|    ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, p->log, 0, "add cleanup: %p", c);
  337|       |
  338|      7|    return c;
  339|      7|}
ngx_pool_cleanup_file:
  365|      5|{
  366|      5|    ngx_pool_cleanup_file_t  *c = data;
  367|       |
  368|      5|    ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, c->log, 0, "file cleanup: fd:%d",
  369|      5|                   c->fd);
  370|       |
  371|      5|    if (ngx_close_file(c->fd) == NGX_FILE_ERROR) {
  ------------------
  |  |  109|      5|#define ngx_close_file           close
  ------------------
                  if (ngx_close_file(c->fd) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      5|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (371:9): [True: 0, False: 5]
  ------------------
  372|      0|        ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  373|      0|                      ngx_close_file_n " \"%s\" failed", c->name);
  374|      0|    }
  375|      5|}
ngx_palloc.c:ngx_palloc_large:
  215|  1.30k|{
  216|  1.30k|    void              *p;
  217|  1.30k|    ngx_uint_t         n;
  218|  1.30k|    ngx_pool_large_t  *large;
  219|       |
  220|  1.30k|    p = ngx_alloc(size, pool->log);
  221|  1.30k|    if (p == NULL) {
  ------------------
  |  Branch (221:9): [True: 0, False: 1.30k]
  ------------------
  222|      0|        return NULL;
  223|      0|    }
  224|       |
  225|  1.30k|    n = 0;
  226|       |
  227|  6.16k|    for (large = pool->large; large; large = large->next) {
  ------------------
  |  Branch (227:31): [True: 5.99k, False: 171]
  ------------------
  228|  5.99k|        if (large->alloc == NULL) {
  ------------------
  |  Branch (228:13): [True: 0, False: 5.99k]
  ------------------
  229|      0|            large->alloc = p;
  230|      0|            return p;
  231|      0|        }
  232|       |
  233|  5.99k|        if (n++ > 3) {
  ------------------
  |  Branch (233:13): [True: 1.13k, False: 4.85k]
  ------------------
  234|  1.13k|            break;
  235|  1.13k|        }
  236|  5.99k|    }
  237|       |
  238|  1.30k|    large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1);
  239|  1.30k|    if (large == NULL) {
  ------------------
  |  Branch (239:9): [True: 0, False: 1.30k]
  ------------------
  240|      0|        ngx_free(p);
  ------------------
  |  |   19|      0|#define ngx_free          free
  ------------------
  241|      0|        return NULL;
  242|      0|    }
  243|       |
  244|  1.30k|    large->alloc = p;
  245|  1.30k|    large->next = pool->large;
  246|  1.30k|    pool->large = large;
  247|       |
  248|  1.30k|    return p;
  249|  1.30k|}
ngx_palloc.c:ngx_palloc_small:
  150|  1.30k|{
  151|  1.30k|    u_char      *m;
  152|  1.30k|    ngx_pool_t  *p;
  153|       |
  154|  1.30k|    p = pool->current;
  155|       |
  156|  1.30k|    do {
  157|  1.30k|        m = p->d.last;
  158|       |
  159|  1.30k|        if (align) {
  ------------------
  |  Branch (159:13): [True: 1.30k, False: 0]
  ------------------
  160|  1.30k|            m = ngx_align_ptr(m, NGX_ALIGNMENT);
  ------------------
  |  |  102|  1.30k|    (u_char *) (((uintptr_t) (p) + ((uintptr_t) a - 1)) & ~((uintptr_t) a - 1))
  ------------------
  161|  1.30k|        }
  162|       |
  163|  1.30k|        if ((size_t) (p->d.end - m) >= size) {
  ------------------
  |  Branch (163:13): [True: 1.30k, False: 0]
  ------------------
  164|  1.30k|            p->d.last = m + size;
  165|       |
  166|  1.30k|            return m;
  167|  1.30k|        }
  168|       |
  169|      0|        p = p->d.next;
  170|       |
  171|      0|    } while (p);
  ------------------
  |  Branch (171:14): [True: 0, False: 0]
  ------------------
  172|       |
  173|      0|    return ngx_palloc_block(pool, size);
  174|  1.30k|}

ngx_parse_size:
   14|      4|{
   15|      4|    u_char   unit;
   16|      4|    size_t   len;
   17|      4|    ssize_t  size, scale, max;
   18|       |
   19|      4|    len = line->len;
   20|       |
   21|      4|    if (len == 0) {
  ------------------
  |  Branch (21:9): [True: 0, False: 4]
  ------------------
   22|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   23|      0|    }
   24|       |
   25|      4|    unit = line->data[len - 1];
   26|       |
   27|      4|    switch (unit) {
   28|      3|    case 'K':
  ------------------
  |  Branch (28:5): [True: 3, False: 1]
  ------------------
   29|      3|    case 'k':
  ------------------
  |  Branch (29:5): [True: 0, False: 4]
  ------------------
   30|      3|        len--;
   31|      3|        max = NGX_MAX_SIZE_T_VALUE / 1024;
  ------------------
  |  |  187|      3|#define NGX_MAX_SIZE_T_VALUE  9223372036854775807LL
  ------------------
   32|      3|        scale = 1024;
   33|      3|        break;
   34|       |
   35|      0|    case 'M':
  ------------------
  |  Branch (35:5): [True: 0, False: 4]
  ------------------
   36|      0|    case 'm':
  ------------------
  |  Branch (36:5): [True: 0, False: 4]
  ------------------
   37|      0|        len--;
   38|      0|        max = NGX_MAX_SIZE_T_VALUE / (1024 * 1024);
  ------------------
  |  |  187|      0|#define NGX_MAX_SIZE_T_VALUE  9223372036854775807LL
  ------------------
   39|      0|        scale = 1024 * 1024;
   40|      0|        break;
   41|       |
   42|      1|    default:
  ------------------
  |  Branch (42:5): [True: 1, False: 3]
  ------------------
   43|      1|        max = NGX_MAX_SIZE_T_VALUE;
  ------------------
  |  |  187|      1|#define NGX_MAX_SIZE_T_VALUE  9223372036854775807LL
  ------------------
   44|      1|        scale = 1;
   45|      4|    }
   46|       |
   47|      4|    size = ngx_atosz(line->data, len);
   48|      4|    if (size == NGX_ERROR || size > max) {
  ------------------
  |  |   39|      8|#define  NGX_ERROR      -1
  ------------------
  |  Branch (48:9): [True: 0, False: 4]
  |  Branch (48:30): [True: 0, False: 4]
  ------------------
   49|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   50|      0|    }
   51|       |
   52|      4|    size *= scale;
   53|       |
   54|      4|    return size;
   55|      4|}
ngx_parse_offset:
   60|      1|{
   61|      1|    u_char  unit;
   62|      1|    off_t   offset, scale, max;
   63|      1|    size_t  len;
   64|       |
   65|      1|    len = line->len;
   66|       |
   67|      1|    if (len == 0) {
  ------------------
  |  Branch (67:9): [True: 0, False: 1]
  ------------------
   68|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   69|      0|    }
   70|       |
   71|      1|    unit = line->data[len - 1];
   72|       |
   73|      1|    switch (unit) {
   74|      0|    case 'K':
  ------------------
  |  Branch (74:5): [True: 0, False: 1]
  ------------------
   75|      0|    case 'k':
  ------------------
  |  Branch (75:5): [True: 0, False: 1]
  ------------------
   76|      0|        len--;
   77|      0|        max = NGX_MAX_OFF_T_VALUE / 1024;
  ------------------
  |  |  197|      0|#define NGX_MAX_OFF_T_VALUE  9223372036854775807LL
  ------------------
   78|      0|        scale = 1024;
   79|      0|        break;
   80|       |
   81|      1|    case 'M':
  ------------------
  |  Branch (81:5): [True: 1, False: 0]
  ------------------
   82|      1|    case 'm':
  ------------------
  |  Branch (82:5): [True: 0, False: 1]
  ------------------
   83|      1|        len--;
   84|      1|        max = NGX_MAX_OFF_T_VALUE / (1024 * 1024);
  ------------------
  |  |  197|      1|#define NGX_MAX_OFF_T_VALUE  9223372036854775807LL
  ------------------
   85|      1|        scale = 1024 * 1024;
   86|      1|        break;
   87|       |
   88|      0|    case 'G':
  ------------------
  |  Branch (88:5): [True: 0, False: 1]
  ------------------
   89|      0|    case 'g':
  ------------------
  |  Branch (89:5): [True: 0, False: 1]
  ------------------
   90|      0|        len--;
   91|      0|        max = NGX_MAX_OFF_T_VALUE / (1024 * 1024 * 1024);
  ------------------
  |  |  197|      0|#define NGX_MAX_OFF_T_VALUE  9223372036854775807LL
  ------------------
   92|      0|        scale = 1024 * 1024 * 1024;
   93|      0|        break;
   94|       |
   95|      0|    default:
  ------------------
  |  Branch (95:5): [True: 0, False: 1]
  ------------------
   96|      0|        max = NGX_MAX_OFF_T_VALUE;
  ------------------
  |  |  197|      0|#define NGX_MAX_OFF_T_VALUE  9223372036854775807LL
  ------------------
   97|      0|        scale = 1;
   98|      1|    }
   99|       |
  100|      1|    offset = ngx_atoof(line->data, len);
  101|      1|    if (offset == NGX_ERROR || offset > max) {
  ------------------
  |  |   39|      2|#define  NGX_ERROR      -1
  ------------------
  |  Branch (101:9): [True: 0, False: 1]
  |  Branch (101:32): [True: 0, False: 1]
  ------------------
  102|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  103|      0|    }
  104|       |
  105|      1|    offset *= scale;
  106|       |
  107|      1|    return offset;
  108|      1|}
ngx_parse_time:
  113|      1|{
  114|      1|    u_char      *p, *last;
  115|      1|    ngx_int_t    value, total, scale;
  116|      1|    ngx_int_t    max, cutoff, cutlim;
  117|      1|    ngx_uint_t   valid;
  118|      1|    enum {
  119|      1|        st_start = 0,
  120|      1|        st_year,
  121|      1|        st_month,
  122|      1|        st_week,
  123|      1|        st_day,
  124|      1|        st_hour,
  125|      1|        st_min,
  126|      1|        st_sec,
  127|      1|        st_msec,
  128|      1|        st_last
  129|      1|    } step;
  130|       |
  131|      1|    valid = 0;
  132|      1|    value = 0;
  133|      1|    total = 0;
  134|      1|    cutoff = NGX_MAX_INT_T_VALUE / 10;
  ------------------
  |  |   92|      1|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  135|      1|    cutlim = NGX_MAX_INT_T_VALUE % 10;
  ------------------
  |  |   92|      1|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  136|      1|    step = is_sec ? st_start : st_month;
  ------------------
  |  Branch (136:12): [True: 0, False: 1]
  ------------------
  137|       |
  138|      1|    p = line->data;
  139|      1|    last = p + line->len;
  140|       |
  141|      3|    while (p < last) {
  ------------------
  |  Branch (141:12): [True: 2, False: 1]
  ------------------
  142|       |
  143|      2|        if (*p >= '0' && *p <= '9') {
  ------------------
  |  Branch (143:13): [True: 2, False: 0]
  |  Branch (143:26): [True: 1, False: 1]
  ------------------
  144|      1|            if (value >= cutoff && (value > cutoff || *p - '0' > cutlim)) {
  ------------------
  |  Branch (144:17): [True: 0, False: 1]
  |  Branch (144:37): [True: 0, False: 0]
  |  Branch (144:55): [True: 0, False: 0]
  ------------------
  145|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  146|      0|            }
  147|       |
  148|      1|            value = value * 10 + (*p++ - '0');
  149|      1|            valid = 1;
  150|      1|            continue;
  151|      1|        }
  152|       |
  153|      1|        switch (*p++) {
  154|       |
  155|      0|        case 'y':
  ------------------
  |  Branch (155:9): [True: 0, False: 1]
  ------------------
  156|      0|            if (step > st_start) {
  ------------------
  |  Branch (156:17): [True: 0, False: 0]
  ------------------
  157|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  158|      0|            }
  159|      0|            step = st_year;
  160|      0|            max = NGX_MAX_INT_T_VALUE / (60 * 60 * 24 * 365);
  ------------------
  |  |   92|      0|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  161|      0|            scale = 60 * 60 * 24 * 365;
  162|      0|            break;
  163|       |
  164|      0|        case 'M':
  ------------------
  |  Branch (164:9): [True: 0, False: 1]
  ------------------
  165|      0|            if (step >= st_month) {
  ------------------
  |  Branch (165:17): [True: 0, False: 0]
  ------------------
  166|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  167|      0|            }
  168|      0|            step = st_month;
  169|      0|            max = NGX_MAX_INT_T_VALUE / (60 * 60 * 24 * 30);
  ------------------
  |  |   92|      0|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  170|      0|            scale = 60 * 60 * 24 * 30;
  171|      0|            break;
  172|       |
  173|      0|        case 'w':
  ------------------
  |  Branch (173:9): [True: 0, False: 1]
  ------------------
  174|      0|            if (step >= st_week) {
  ------------------
  |  Branch (174:17): [True: 0, False: 0]
  ------------------
  175|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  176|      0|            }
  177|      0|            step = st_week;
  178|      0|            max = NGX_MAX_INT_T_VALUE / (60 * 60 * 24 * 7);
  ------------------
  |  |   92|      0|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  179|      0|            scale = 60 * 60 * 24 * 7;
  180|      0|            break;
  181|       |
  182|      0|        case 'd':
  ------------------
  |  Branch (182:9): [True: 0, False: 1]
  ------------------
  183|      0|            if (step >= st_day) {
  ------------------
  |  Branch (183:17): [True: 0, False: 0]
  ------------------
  184|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  185|      0|            }
  186|      0|            step = st_day;
  187|      0|            max = NGX_MAX_INT_T_VALUE / (60 * 60 * 24);
  ------------------
  |  |   92|      0|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  188|      0|            scale = 60 * 60 * 24;
  189|      0|            break;
  190|       |
  191|      0|        case 'h':
  ------------------
  |  Branch (191:9): [True: 0, False: 1]
  ------------------
  192|      0|            if (step >= st_hour) {
  ------------------
  |  Branch (192:17): [True: 0, False: 0]
  ------------------
  193|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  194|      0|            }
  195|      0|            step = st_hour;
  196|      0|            max = NGX_MAX_INT_T_VALUE / (60 * 60);
  ------------------
  |  |   92|      0|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  197|      0|            scale = 60 * 60;
  198|      0|            break;
  199|       |
  200|      1|        case 'm':
  ------------------
  |  Branch (200:9): [True: 1, False: 0]
  ------------------
  201|      1|            if (p < last && *p == 's') {
  ------------------
  |  Branch (201:17): [True: 0, False: 1]
  |  Branch (201:29): [True: 0, False: 0]
  ------------------
  202|      0|                if (is_sec || step >= st_msec) {
  ------------------
  |  Branch (202:21): [True: 0, False: 0]
  |  Branch (202:31): [True: 0, False: 0]
  ------------------
  203|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  204|      0|                }
  205|      0|                p++;
  206|      0|                step = st_msec;
  207|      0|                max = NGX_MAX_INT_T_VALUE;
  ------------------
  |  |   92|      0|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  208|      0|                scale = 1;
  209|      0|                break;
  210|      0|            }
  211|       |
  212|      1|            if (step >= st_min) {
  ------------------
  |  Branch (212:17): [True: 0, False: 1]
  ------------------
  213|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  214|      0|            }
  215|      1|            step = st_min;
  216|      1|            max = NGX_MAX_INT_T_VALUE / 60;
  ------------------
  |  |   92|      1|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  217|      1|            scale = 60;
  218|      1|            break;
  219|       |
  220|      0|        case 's':
  ------------------
  |  Branch (220:9): [True: 0, False: 1]
  ------------------
  221|      0|            if (step >= st_sec) {
  ------------------
  |  Branch (221:17): [True: 0, False: 0]
  ------------------
  222|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  223|      0|            }
  224|      0|            step = st_sec;
  225|      0|            max = NGX_MAX_INT_T_VALUE;
  ------------------
  |  |   92|      0|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  226|      0|            scale = 1;
  227|      0|            break;
  228|       |
  229|      0|        case ' ':
  ------------------
  |  Branch (229:9): [True: 0, False: 1]
  ------------------
  230|      0|            if (step >= st_sec) {
  ------------------
  |  Branch (230:17): [True: 0, False: 0]
  ------------------
  231|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  232|      0|            }
  233|      0|            step = st_last;
  234|      0|            max = NGX_MAX_INT_T_VALUE;
  ------------------
  |  |   92|      0|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  235|      0|            scale = 1;
  236|      0|            break;
  237|       |
  238|      0|        default:
  ------------------
  |  Branch (238:9): [True: 0, False: 1]
  ------------------
  239|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  240|      1|        }
  241|       |
  242|      1|        if (step != st_msec && !is_sec) {
  ------------------
  |  Branch (242:13): [True: 1, False: 0]
  |  Branch (242:32): [True: 1, False: 0]
  ------------------
  243|      1|            scale *= 1000;
  244|      1|            max /= 1000;
  245|      1|        }
  246|       |
  247|      1|        if (value > max) {
  ------------------
  |  Branch (247:13): [True: 0, False: 1]
  ------------------
  248|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  249|      0|        }
  250|       |
  251|      1|        value *= scale;
  252|       |
  253|      1|        if (total > NGX_MAX_INT_T_VALUE - value) {
  ------------------
  |  |   92|      1|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  |  Branch (253:13): [True: 0, False: 1]
  ------------------
  254|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  255|      0|        }
  256|       |
  257|      1|        total += value;
  258|       |
  259|      1|        value = 0;
  260|       |
  261|      1|        while (p < last && *p == ' ') {
  ------------------
  |  Branch (261:16): [True: 0, False: 1]
  |  Branch (261:28): [True: 0, False: 0]
  ------------------
  262|      0|            p++;
  263|      0|        }
  264|      1|    }
  265|       |
  266|      1|    if (!valid) {
  ------------------
  |  Branch (266:9): [True: 0, False: 1]
  ------------------
  267|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  268|      0|    }
  269|       |
  270|      1|    if (!is_sec) {
  ------------------
  |  Branch (270:9): [True: 1, False: 0]
  ------------------
  271|      1|        if (value > NGX_MAX_INT_T_VALUE / 1000) {
  ------------------
  |  |   92|      1|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  |  Branch (271:13): [True: 0, False: 1]
  ------------------
  272|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  273|      0|        }
  274|       |
  275|      1|        value *= 1000;
  276|      1|    }
  277|       |
  278|      1|    if (total > NGX_MAX_INT_T_VALUE - value) {
  ------------------
  |  |   92|      1|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  |  Branch (278:9): [True: 0, False: 1]
  ------------------
  279|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  280|      0|    }
  281|       |
  282|      1|    return total + value;
  283|      1|}

ngx_parse_http_time:
   16|      2|{
   17|      2|    u_char      *p, *end;
   18|      2|    ngx_int_t    month;
   19|      2|    ngx_uint_t   day, year, hour, min, sec;
   20|      2|    uint64_t     time;
   21|      2|    enum {
   22|      2|        no = 0,
   23|      2|        rfc822,   /* Tue, 10 Nov 2002 23:50:13   */
   24|      2|        rfc850,   /* Tuesday, 10-Dec-02 23:50:13 */
   25|      2|        isoc      /* Tue Dec 10 23:50:13 2002    */
   26|      2|    } fmt;
   27|       |
   28|      2|    fmt = 0;
   29|      2|    end = value + len;
   30|       |
   31|      2|#if (NGX_SUPPRESS_WARN)
   32|      2|    day = 32;
   33|      2|    year = 2038;
   34|      2|#endif
   35|       |
   36|      4|    for (p = value; p < end; p++) {
  ------------------
  |  Branch (36:21): [True: 4, False: 0]
  ------------------
   37|      4|        if (*p == ',') {
  ------------------
  |  Branch (37:13): [True: 0, False: 4]
  ------------------
   38|      0|            break;
   39|      0|        }
   40|       |
   41|      4|        if (*p == ' ') {
  ------------------
  |  Branch (41:13): [True: 2, False: 2]
  ------------------
   42|      2|            fmt = isoc;
   43|      2|            break;
   44|      2|        }
   45|      4|    }
   46|       |
   47|      2|    for (p++; p < end; p++) {
  ------------------
  |  Branch (47:15): [True: 2, False: 0]
  ------------------
   48|      2|        if (*p != ' ') {
  ------------------
  |  Branch (48:13): [True: 2, False: 0]
  ------------------
   49|      2|            break;
   50|      2|        }
   51|      2|    }
   52|       |
   53|      2|    if (end - p < 18) {
  ------------------
  |  Branch (53:9): [True: 0, False: 2]
  ------------------
   54|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   55|      0|    }
   56|       |
   57|      2|    if (fmt != isoc) {
  ------------------
  |  Branch (57:9): [True: 0, False: 2]
  ------------------
   58|      0|        if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') {
  ------------------
  |  Branch (58:13): [True: 0, False: 0]
  |  Branch (58:25): [True: 0, False: 0]
  |  Branch (58:37): [True: 0, False: 0]
  |  Branch (58:55): [True: 0, False: 0]
  ------------------
   59|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   60|      0|        }
   61|       |
   62|      0|        day = (*p - '0') * 10 + (*(p + 1) - '0');
   63|      0|        p += 2;
   64|       |
   65|      0|        if (*p == ' ') {
  ------------------
  |  Branch (65:13): [True: 0, False: 0]
  ------------------
   66|      0|            if (end - p < 18) {
  ------------------
  |  Branch (66:17): [True: 0, False: 0]
  ------------------
   67|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   68|      0|            }
   69|      0|            fmt = rfc822;
   70|       |
   71|      0|        } else if (*p == '-') {
  ------------------
  |  Branch (71:20): [True: 0, False: 0]
  ------------------
   72|      0|            fmt = rfc850;
   73|       |
   74|      0|        } else {
   75|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   76|      0|        }
   77|       |
   78|      0|        p++;
   79|      0|    }
   80|       |
   81|      2|    switch (*p) {
   82|       |
   83|      0|    case 'J':
  ------------------
  |  Branch (83:5): [True: 0, False: 2]
  ------------------
   84|      0|        month = *(p + 1) == 'a' ? 0 : *(p + 2) == 'n' ? 5 : 6;
  ------------------
  |  Branch (84:17): [True: 0, False: 0]
  |  Branch (84:39): [True: 0, False: 0]
  ------------------
   85|      0|        break;
   86|       |
   87|      0|    case 'F':
  ------------------
  |  Branch (87:5): [True: 0, False: 2]
  ------------------
   88|      0|        month = 1;
   89|      0|        break;
   90|       |
   91|      0|    case 'M':
  ------------------
  |  Branch (91:5): [True: 0, False: 2]
  ------------------
   92|      0|        month = *(p + 2) == 'r' ? 2 : 4;
  ------------------
  |  Branch (92:17): [True: 0, False: 0]
  ------------------
   93|      0|        break;
   94|       |
   95|      0|    case 'A':
  ------------------
  |  Branch (95:5): [True: 0, False: 2]
  ------------------
   96|      0|        month = *(p + 1) == 'p' ? 3 : 7;
  ------------------
  |  Branch (96:17): [True: 0, False: 0]
  ------------------
   97|      0|        break;
   98|       |
   99|      2|    case 'S':
  ------------------
  |  Branch (99:5): [True: 2, False: 0]
  ------------------
  100|      2|        month = 8;
  101|      2|        break;
  102|       |
  103|      0|    case 'O':
  ------------------
  |  Branch (103:5): [True: 0, False: 2]
  ------------------
  104|      0|        month = 9;
  105|      0|        break;
  106|       |
  107|      0|    case 'N':
  ------------------
  |  Branch (107:5): [True: 0, False: 2]
  ------------------
  108|      0|        month = 10;
  109|      0|        break;
  110|       |
  111|      0|    case 'D':
  ------------------
  |  Branch (111:5): [True: 0, False: 2]
  ------------------
  112|      0|        month = 11;
  113|      0|        break;
  114|       |
  115|      0|    default:
  ------------------
  |  Branch (115:5): [True: 0, False: 2]
  ------------------
  116|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  117|      2|    }
  118|       |
  119|      2|    p += 3;
  120|       |
  121|      2|    if ((fmt == rfc822 && *p != ' ') || (fmt == rfc850 && *p != '-')) {
  ------------------
  |  Branch (121:10): [True: 0, False: 2]
  |  Branch (121:27): [True: 0, False: 0]
  |  Branch (121:42): [True: 0, False: 2]
  |  Branch (121:59): [True: 0, False: 0]
  ------------------
  122|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  123|      0|    }
  124|       |
  125|      2|    p++;
  126|       |
  127|      2|    if (fmt == rfc822) {
  ------------------
  |  Branch (127:9): [True: 0, False: 2]
  ------------------
  128|      0|        if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9'
  ------------------
  |  Branch (128:13): [True: 0, False: 0]
  |  Branch (128:25): [True: 0, False: 0]
  |  Branch (128:37): [True: 0, False: 0]
  |  Branch (128:55): [True: 0, False: 0]
  ------------------
  129|      0|            || *(p + 2) < '0' || *(p + 2) > '9'
  ------------------
  |  Branch (129:16): [True: 0, False: 0]
  |  Branch (129:34): [True: 0, False: 0]
  ------------------
  130|      0|            || *(p + 3) < '0' || *(p + 3) > '9')
  ------------------
  |  Branch (130:16): [True: 0, False: 0]
  |  Branch (130:34): [True: 0, False: 0]
  ------------------
  131|      0|        {
  132|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  133|      0|        }
  134|       |
  135|      0|        year = (*p - '0') * 1000 + (*(p + 1) - '0') * 100
  136|      0|               + (*(p + 2) - '0') * 10 + (*(p + 3) - '0');
  137|      0|        p += 4;
  138|       |
  139|      2|    } else if (fmt == rfc850) {
  ------------------
  |  Branch (139:16): [True: 0, False: 2]
  ------------------
  140|      0|        if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') {
  ------------------
  |  Branch (140:13): [True: 0, False: 0]
  |  Branch (140:25): [True: 0, False: 0]
  |  Branch (140:37): [True: 0, False: 0]
  |  Branch (140:55): [True: 0, False: 0]
  ------------------
  141|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  142|      0|        }
  143|       |
  144|      0|        year = (*p - '0') * 10 + (*(p + 1) - '0');
  145|      0|        year += (year < 70) ? 2000 : 1900;
  ------------------
  |  Branch (145:17): [True: 0, False: 0]
  ------------------
  146|      0|        p += 2;
  147|      0|    }
  148|       |
  149|      2|    if (fmt == isoc) {
  ------------------
  |  Branch (149:9): [True: 2, False: 0]
  ------------------
  150|      2|        if (*p == ' ') {
  ------------------
  |  Branch (150:13): [True: 0, False: 2]
  ------------------
  151|      0|            p++;
  152|      0|        }
  153|       |
  154|      2|        if (*p < '0' || *p > '9') {
  ------------------
  |  Branch (154:13): [True: 0, False: 2]
  |  Branch (154:25): [True: 2, False: 0]
  ------------------
  155|      2|            return NGX_ERROR;
  ------------------
  |  |   39|      2|#define  NGX_ERROR      -1
  ------------------
  156|      2|        }
  157|       |
  158|      0|        day = *p++ - '0';
  159|       |
  160|      0|        if (*p != ' ') {
  ------------------
  |  Branch (160:13): [True: 0, False: 0]
  ------------------
  161|      0|            if (*p < '0' || *p > '9') {
  ------------------
  |  Branch (161:17): [True: 0, False: 0]
  |  Branch (161:29): [True: 0, False: 0]
  ------------------
  162|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  163|      0|            }
  164|       |
  165|      0|            day = day * 10 + (*p++ - '0');
  166|      0|        }
  167|       |
  168|      0|        if (end - p < 14) {
  ------------------
  |  Branch (168:13): [True: 0, False: 0]
  ------------------
  169|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  170|      0|        }
  171|      0|    }
  172|       |
  173|      0|    if (*p++ != ' ') {
  ------------------
  |  Branch (173:9): [True: 0, False: 0]
  ------------------
  174|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  175|      0|    }
  176|       |
  177|      0|    if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') {
  ------------------
  |  Branch (177:9): [True: 0, False: 0]
  |  Branch (177:21): [True: 0, False: 0]
  |  Branch (177:33): [True: 0, False: 0]
  |  Branch (177:51): [True: 0, False: 0]
  ------------------
  178|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  179|      0|    }
  180|       |
  181|      0|    hour = (*p - '0') * 10 + (*(p + 1) - '0');
  182|      0|    p += 2;
  183|       |
  184|      0|    if (*p++ != ':') {
  ------------------
  |  Branch (184:9): [True: 0, False: 0]
  ------------------
  185|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  186|      0|    }
  187|       |
  188|      0|    if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') {
  ------------------
  |  Branch (188:9): [True: 0, False: 0]
  |  Branch (188:21): [True: 0, False: 0]
  |  Branch (188:33): [True: 0, False: 0]
  |  Branch (188:51): [True: 0, False: 0]
  ------------------
  189|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  190|      0|    }
  191|       |
  192|      0|    min = (*p - '0') * 10 + (*(p + 1) - '0');
  193|      0|    p += 2;
  194|       |
  195|      0|    if (*p++ != ':') {
  ------------------
  |  Branch (195:9): [True: 0, False: 0]
  ------------------
  196|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  197|      0|    }
  198|       |
  199|      0|    if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') {
  ------------------
  |  Branch (199:9): [True: 0, False: 0]
  |  Branch (199:21): [True: 0, False: 0]
  |  Branch (199:33): [True: 0, False: 0]
  |  Branch (199:51): [True: 0, False: 0]
  ------------------
  200|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  201|      0|    }
  202|       |
  203|      0|    sec = (*p - '0') * 10 + (*(p + 1) - '0');
  204|       |
  205|      0|    if (fmt == isoc) {
  ------------------
  |  Branch (205:9): [True: 0, False: 0]
  ------------------
  206|      0|        p += 2;
  207|       |
  208|      0|        if (*p++ != ' ') {
  ------------------
  |  Branch (208:13): [True: 0, False: 0]
  ------------------
  209|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  210|      0|        }
  211|       |
  212|      0|        if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9'
  ------------------
  |  Branch (212:13): [True: 0, False: 0]
  |  Branch (212:25): [True: 0, False: 0]
  |  Branch (212:37): [True: 0, False: 0]
  |  Branch (212:55): [True: 0, False: 0]
  ------------------
  213|      0|            || *(p + 2) < '0' || *(p + 2) > '9'
  ------------------
  |  Branch (213:16): [True: 0, False: 0]
  |  Branch (213:34): [True: 0, False: 0]
  ------------------
  214|      0|            || *(p + 3) < '0' || *(p + 3) > '9')
  ------------------
  |  Branch (214:16): [True: 0, False: 0]
  |  Branch (214:34): [True: 0, False: 0]
  ------------------
  215|      0|        {
  216|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  217|      0|        }
  218|       |
  219|      0|        year = (*p - '0') * 1000 + (*(p + 1) - '0') * 100
  220|      0|               + (*(p + 2) - '0') * 10 + (*(p + 3) - '0');
  221|      0|    }
  222|       |
  223|      0|    if (hour > 23 || min > 59 || sec > 59) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  |  Branch (223:22): [True: 0, False: 0]
  |  Branch (223:34): [True: 0, False: 0]
  ------------------
  224|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  225|      0|    }
  226|       |
  227|      0|    if (day == 29 && month == 1) {
  ------------------
  |  Branch (227:9): [True: 0, False: 0]
  |  Branch (227:22): [True: 0, False: 0]
  ------------------
  228|      0|        if ((year & 3) || ((year % 100 == 0) && (year % 400) != 0)) {
  ------------------
  |  Branch (228:13): [True: 0, False: 0]
  |  Branch (228:28): [True: 0, False: 0]
  |  Branch (228:49): [True: 0, False: 0]
  ------------------
  229|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  230|      0|        }
  231|       |
  232|      0|    } else if (day > mday[month]) {
  ------------------
  |  Branch (232:16): [True: 0, False: 0]
  ------------------
  233|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  234|      0|    }
  235|       |
  236|       |    /*
  237|       |     * shift new year to March 1 and start months from 1 (not 0),
  238|       |     * it is needed for Gauss' formula
  239|       |     */
  240|       |
  241|      0|    if (--month <= 0) {
  ------------------
  |  Branch (241:9): [True: 0, False: 0]
  ------------------
  242|      0|        month += 12;
  243|      0|        year -= 1;
  244|      0|    }
  245|       |
  246|       |    /* Gauss' formula for Gregorian days since March 1, 1 BC */
  247|       |
  248|      0|    time = (uint64_t) (
  249|       |            /* days in years including leap years since March 1, 1 BC */
  250|       |
  251|      0|            365 * year + year / 4 - year / 100 + year / 400
  252|       |
  253|       |            /* days before the month */
  254|       |
  255|      0|            + 367 * month / 12 - 30
  256|       |
  257|       |            /* days before the day */
  258|       |
  259|      0|            + day - 1
  260|       |
  261|       |            /*
  262|       |             * 719527 days were between March 1, 1 BC and March 1, 1970,
  263|       |             * 31 and 28 days were in January and February 1970
  264|       |             */
  265|       |
  266|      0|            - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec;
  267|       |
  268|       |#if (NGX_TIME_T_SIZE <= 4)
  269|       |
  270|       |    if (time > 0x7fffffff) {
  271|       |        return NGX_ERROR;
  272|       |    }
  273|       |
  274|       |#endif
  275|       |
  276|      0|    return (time_t) time;
  277|      0|}

ngx_queue_middle:
   19|      1|{
   20|      1|    ngx_queue_t  *middle, *next;
   21|       |
   22|      1|    middle = ngx_queue_head(queue);
  ------------------
  |  |   51|      1|    (h)->next
  ------------------
   23|       |
   24|      1|    if (middle == ngx_queue_last(queue)) {
  ------------------
  |  |   55|      1|    (h)->prev
  ------------------
  |  Branch (24:9): [True: 1, False: 0]
  ------------------
   25|      1|        return middle;
   26|      1|    }
   27|       |
   28|      0|    next = ngx_queue_head(queue);
  ------------------
  |  |   51|      0|    (h)->next
  ------------------
   29|       |
   30|      0|    for ( ;; ) {
   31|      0|        middle = ngx_queue_next(middle);
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
   32|       |
   33|      0|        next = ngx_queue_next(next);
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
   34|       |
   35|      0|        if (next == ngx_queue_last(queue)) {
  ------------------
  |  |   55|      0|    (h)->prev
  ------------------
  |  Branch (35:13): [True: 0, False: 0]
  ------------------
   36|      0|            return middle;
   37|      0|        }
   38|       |
   39|      0|        next = ngx_queue_next(next);
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
   40|       |
   41|      0|        if (next == ngx_queue_last(queue)) {
  ------------------
  |  |   55|      0|    (h)->prev
  ------------------
  |  Branch (41:13): [True: 0, False: 0]
  ------------------
   42|      0|            return middle;
   43|      0|        }
   44|      0|    }
   45|      0|}
ngx_queue_sort:
   53|      1|{
   54|      1|    ngx_queue_t  *q, *prev, *next;
   55|       |
   56|      1|    q = ngx_queue_head(queue);
  ------------------
  |  |   51|      1|    (h)->next
  ------------------
   57|       |
   58|      1|    if (q == ngx_queue_last(queue)) {
  ------------------
  |  |   55|      1|    (h)->prev
  ------------------
  |  Branch (58:9): [True: 1, False: 0]
  ------------------
   59|      1|        return;
   60|      1|    }
   61|       |
   62|      0|    for (q = ngx_queue_next(q); q != ngx_queue_sentinel(queue); q = next) {
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
                  for (q = ngx_queue_next(q); q != ngx_queue_sentinel(queue); q = next) {
  ------------------
  |  |   59|      0|    (h)
  ------------------
  |  Branch (62:33): [True: 0, False: 0]
  ------------------
   63|       |
   64|      0|        prev = ngx_queue_prev(q);
  ------------------
  |  |   67|      0|    (q)->prev
  ------------------
   65|      0|        next = ngx_queue_next(q);
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
   66|       |
   67|      0|        ngx_queue_remove(q);
  ------------------
  |  |   81|      0|    (x)->next->prev = (x)->prev;                                              \
  |  |   82|      0|    (x)->prev->next = (x)->next
  ------------------
   68|       |
   69|      0|        do {
   70|      0|            if (cmp(prev, q) <= 0) {
  ------------------
  |  Branch (70:17): [True: 0, False: 0]
  ------------------
   71|      0|                break;
   72|      0|            }
   73|       |
   74|      0|            prev = ngx_queue_prev(prev);
  ------------------
  |  |   67|      0|    (q)->prev
  ------------------
   75|       |
   76|      0|        } while (prev != ngx_queue_sentinel(queue));
  ------------------
  |  |   59|      0|    (h)
  ------------------
  |  Branch (76:18): [True: 0, False: 0]
  ------------------
   77|       |
   78|      0|        ngx_queue_insert_after(prev, q);
  ------------------
  |  |   40|      0|#define ngx_queue_insert_after   ngx_queue_insert_head
  |  |  ------------------
  |  |  |  |   34|      0|    (x)->next = (h)->next;                                                    \
  |  |  |  |   35|      0|    (x)->next->prev = x;                                                      \
  |  |  |  |   36|      0|    (x)->prev = h;                                                            \
  |  |  |  |   37|      0|    (h)->next = x
  |  |  ------------------
  ------------------
   79|      0|    }
   80|      0|}

ngx_rbtree_insert:
   26|     12|{
   27|     12|    ngx_rbtree_node_t  **root, *temp, *sentinel;
   28|       |
   29|       |    /* a binary tree insert */
   30|       |
   31|     12|    root = &tree->root;
   32|     12|    sentinel = tree->sentinel;
   33|       |
   34|     12|    if (*root == sentinel) {
  ------------------
  |  Branch (34:9): [True: 12, False: 0]
  ------------------
   35|     12|        node->parent = NULL;
   36|     12|        node->left = sentinel;
   37|     12|        node->right = sentinel;
   38|     12|        ngx_rbt_black(node);
  ------------------
  |  |   65|     12|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
   39|     12|        *root = node;
   40|       |
   41|     12|        return;
   42|     12|    }
   43|       |
   44|      0|    tree->insert(*root, node, sentinel);
   45|       |
   46|       |    /* re-balance tree */
   47|       |
   48|      0|    while (node != *root && ngx_rbt_is_red(node->parent)) {
  ------------------
  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (66:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (48:12): [True: 0, False: 0]
  ------------------
   49|       |
   50|      0|        if (node->parent == node->parent->parent->left) {
  ------------------
  |  Branch (50:13): [True: 0, False: 0]
  ------------------
   51|      0|            temp = node->parent->parent->right;
   52|       |
   53|      0|            if (ngx_rbt_is_red(temp)) {
  ------------------
  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (66:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   54|      0|                ngx_rbt_black(node->parent);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
   55|      0|                ngx_rbt_black(temp);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
   56|      0|                ngx_rbt_red(node->parent->parent);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
   57|      0|                node = node->parent->parent;
   58|       |
   59|      0|            } else {
   60|      0|                if (node == node->parent->right) {
  ------------------
  |  Branch (60:21): [True: 0, False: 0]
  ------------------
   61|      0|                    node = node->parent;
   62|      0|                    ngx_rbtree_left_rotate(root, sentinel, node);
   63|      0|                }
   64|       |
   65|      0|                ngx_rbt_black(node->parent);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
   66|      0|                ngx_rbt_red(node->parent->parent);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
   67|      0|                ngx_rbtree_right_rotate(root, sentinel, node->parent->parent);
   68|      0|            }
   69|       |
   70|      0|        } else {
   71|      0|            temp = node->parent->parent->left;
   72|       |
   73|      0|            if (ngx_rbt_is_red(temp)) {
  ------------------
  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (66:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   74|      0|                ngx_rbt_black(node->parent);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
   75|      0|                ngx_rbt_black(temp);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
   76|      0|                ngx_rbt_red(node->parent->parent);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
   77|      0|                node = node->parent->parent;
   78|       |
   79|      0|            } else {
   80|      0|                if (node == node->parent->left) {
  ------------------
  |  Branch (80:21): [True: 0, False: 0]
  ------------------
   81|      0|                    node = node->parent;
   82|      0|                    ngx_rbtree_right_rotate(root, sentinel, node);
   83|      0|                }
   84|       |
   85|      0|                ngx_rbt_black(node->parent);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
   86|      0|                ngx_rbt_red(node->parent->parent);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
   87|      0|                ngx_rbtree_left_rotate(root, sentinel, node->parent->parent);
   88|      0|            }
   89|      0|        }
   90|      0|    }
   91|       |
   92|      0|    ngx_rbt_black(*root);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
   93|      0|}
ngx_rbtree_delete:
  158|     12|{
  159|     12|    ngx_uint_t           red;
  160|     12|    ngx_rbtree_node_t  **root, *sentinel, *subst, *temp, *w;
  161|       |
  162|       |    /* a binary tree delete */
  163|       |
  164|     12|    root = &tree->root;
  165|     12|    sentinel = tree->sentinel;
  166|       |
  167|     12|    if (node->left == sentinel) {
  ------------------
  |  Branch (167:9): [True: 12, False: 0]
  ------------------
  168|     12|        temp = node->right;
  169|     12|        subst = node;
  170|       |
  171|     12|    } else if (node->right == sentinel) {
  ------------------
  |  Branch (171:16): [True: 0, False: 0]
  ------------------
  172|      0|        temp = node->left;
  173|      0|        subst = node;
  174|       |
  175|      0|    } else {
  176|      0|        subst = ngx_rbtree_min(node->right, sentinel);
  177|      0|        temp = subst->right;
  178|      0|    }
  179|       |
  180|     12|    if (subst == *root) {
  ------------------
  |  Branch (180:9): [True: 12, False: 0]
  ------------------
  181|     12|        *root = temp;
  182|     12|        ngx_rbt_black(temp);
  ------------------
  |  |   65|     12|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  183|       |
  184|       |        /* DEBUG stuff */
  185|     12|        node->left = NULL;
  186|     12|        node->right = NULL;
  187|     12|        node->parent = NULL;
  188|     12|        node->key = 0;
  189|       |
  190|     12|        return;
  191|     12|    }
  192|       |
  193|      0|    red = ngx_rbt_is_red(subst);
  ------------------
  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  ------------------
  194|       |
  195|      0|    if (subst == subst->parent->left) {
  ------------------
  |  Branch (195:9): [True: 0, False: 0]
  ------------------
  196|      0|        subst->parent->left = temp;
  197|       |
  198|      0|    } else {
  199|      0|        subst->parent->right = temp;
  200|      0|    }
  201|       |
  202|      0|    if (subst == node) {
  ------------------
  |  Branch (202:9): [True: 0, False: 0]
  ------------------
  203|       |
  204|      0|        temp->parent = subst->parent;
  205|       |
  206|      0|    } else {
  207|       |
  208|      0|        if (subst->parent == node) {
  ------------------
  |  Branch (208:13): [True: 0, False: 0]
  ------------------
  209|      0|            temp->parent = subst;
  210|       |
  211|      0|        } else {
  212|      0|            temp->parent = subst->parent;
  213|      0|        }
  214|       |
  215|      0|        subst->left = node->left;
  216|      0|        subst->right = node->right;
  217|      0|        subst->parent = node->parent;
  218|      0|        ngx_rbt_copy_color(subst, node);
  ------------------
  |  |   68|      0|#define ngx_rbt_copy_color(n1, n2)      (n1->color = n2->color)
  ------------------
  219|       |
  220|      0|        if (node == *root) {
  ------------------
  |  Branch (220:13): [True: 0, False: 0]
  ------------------
  221|      0|            *root = subst;
  222|       |
  223|      0|        } else {
  224|      0|            if (node == node->parent->left) {
  ------------------
  |  Branch (224:17): [True: 0, False: 0]
  ------------------
  225|      0|                node->parent->left = subst;
  226|      0|            } else {
  227|      0|                node->parent->right = subst;
  228|      0|            }
  229|      0|        }
  230|       |
  231|      0|        if (subst->left != sentinel) {
  ------------------
  |  Branch (231:13): [True: 0, False: 0]
  ------------------
  232|      0|            subst->left->parent = subst;
  233|      0|        }
  234|       |
  235|      0|        if (subst->right != sentinel) {
  ------------------
  |  Branch (235:13): [True: 0, False: 0]
  ------------------
  236|      0|            subst->right->parent = subst;
  237|      0|        }
  238|      0|    }
  239|       |
  240|       |    /* DEBUG stuff */
  241|      0|    node->left = NULL;
  242|      0|    node->right = NULL;
  243|      0|    node->parent = NULL;
  244|      0|    node->key = 0;
  245|       |
  246|      0|    if (red) {
  ------------------
  |  Branch (246:9): [True: 0, False: 0]
  ------------------
  247|      0|        return;
  248|      0|    }
  249|       |
  250|       |    /* a delete fixup */
  251|       |
  252|      0|    while (temp != *root && ngx_rbt_is_black(temp)) {
  ------------------
  |  |   67|      0|#define ngx_rbt_is_black(node)          (!ngx_rbt_is_red(node))
  |  |  ------------------
  |  |  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (67:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (252:12): [True: 0, False: 0]
  ------------------
  253|       |
  254|      0|        if (temp == temp->parent->left) {
  ------------------
  |  Branch (254:13): [True: 0, False: 0]
  ------------------
  255|      0|            w = temp->parent->right;
  256|       |
  257|      0|            if (ngx_rbt_is_red(w)) {
  ------------------
  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (66:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  258|      0|                ngx_rbt_black(w);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  259|      0|                ngx_rbt_red(temp->parent);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
  260|      0|                ngx_rbtree_left_rotate(root, sentinel, temp->parent);
  261|      0|                w = temp->parent->right;
  262|      0|            }
  263|       |
  264|      0|            if (ngx_rbt_is_black(w->left) && ngx_rbt_is_black(w->right)) {
  ------------------
  |  |   67|      0|#define ngx_rbt_is_black(node)          (!ngx_rbt_is_red(node))
  |  |  ------------------
  |  |  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (67:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          if (ngx_rbt_is_black(w->left) && ngx_rbt_is_black(w->right)) {
  ------------------
  |  |   67|      0|#define ngx_rbt_is_black(node)          (!ngx_rbt_is_red(node))
  |  |  ------------------
  |  |  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (67:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  265|      0|                ngx_rbt_red(w);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
  266|      0|                temp = temp->parent;
  267|       |
  268|      0|            } else {
  269|      0|                if (ngx_rbt_is_black(w->right)) {
  ------------------
  |  |   67|      0|#define ngx_rbt_is_black(node)          (!ngx_rbt_is_red(node))
  |  |  ------------------
  |  |  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (67:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  270|      0|                    ngx_rbt_black(w->left);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  271|      0|                    ngx_rbt_red(w);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
  272|      0|                    ngx_rbtree_right_rotate(root, sentinel, w);
  273|      0|                    w = temp->parent->right;
  274|      0|                }
  275|       |
  276|      0|                ngx_rbt_copy_color(w, temp->parent);
  ------------------
  |  |   68|      0|#define ngx_rbt_copy_color(n1, n2)      (n1->color = n2->color)
  ------------------
  277|      0|                ngx_rbt_black(temp->parent);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  278|      0|                ngx_rbt_black(w->right);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  279|      0|                ngx_rbtree_left_rotate(root, sentinel, temp->parent);
  280|      0|                temp = *root;
  281|      0|            }
  282|       |
  283|      0|        } else {
  284|      0|            w = temp->parent->left;
  285|       |
  286|      0|            if (ngx_rbt_is_red(w)) {
  ------------------
  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (66:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  287|      0|                ngx_rbt_black(w);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  288|      0|                ngx_rbt_red(temp->parent);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
  289|      0|                ngx_rbtree_right_rotate(root, sentinel, temp->parent);
  290|      0|                w = temp->parent->left;
  291|      0|            }
  292|       |
  293|      0|            if (ngx_rbt_is_black(w->left) && ngx_rbt_is_black(w->right)) {
  ------------------
  |  |   67|      0|#define ngx_rbt_is_black(node)          (!ngx_rbt_is_red(node))
  |  |  ------------------
  |  |  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (67:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                          if (ngx_rbt_is_black(w->left) && ngx_rbt_is_black(w->right)) {
  ------------------
  |  |   67|      0|#define ngx_rbt_is_black(node)          (!ngx_rbt_is_red(node))
  |  |  ------------------
  |  |  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (67:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  294|      0|                ngx_rbt_red(w);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
  295|      0|                temp = temp->parent;
  296|       |
  297|      0|            } else {
  298|      0|                if (ngx_rbt_is_black(w->left)) {
  ------------------
  |  |   67|      0|#define ngx_rbt_is_black(node)          (!ngx_rbt_is_red(node))
  |  |  ------------------
  |  |  |  |   66|      0|#define ngx_rbt_is_red(node)            ((node)->color)
  |  |  ------------------
  |  |  |  Branch (67:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  299|      0|                    ngx_rbt_black(w->right);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  300|      0|                    ngx_rbt_red(w);
  ------------------
  |  |   64|      0|#define ngx_rbt_red(node)               ((node)->color = 1)
  ------------------
  301|      0|                    ngx_rbtree_left_rotate(root, sentinel, w);
  302|      0|                    w = temp->parent->left;
  303|      0|                }
  304|       |
  305|      0|                ngx_rbt_copy_color(w, temp->parent);
  ------------------
  |  |   68|      0|#define ngx_rbt_copy_color(n1, n2)      (n1->color = n2->color)
  ------------------
  306|      0|                ngx_rbt_black(temp->parent);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  307|      0|                ngx_rbt_black(w->left);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  308|      0|                ngx_rbtree_right_rotate(root, sentinel, temp->parent);
  309|      0|                temp = *root;
  310|      0|            }
  311|      0|        }
  312|      0|    }
  313|       |
  314|      0|    ngx_rbt_black(temp);
  ------------------
  |  |   65|      0|#define ngx_rbt_black(node)             ((node)->color = 0)
  ------------------
  315|      0|}

ngx_regex_init:
   88|      1|{
   89|      1|#if !(NGX_PCRE2)
   90|      1|    pcre_malloc = ngx_regex_malloc;
   91|      1|    pcre_free = ngx_regex_free;
   92|      1|#endif
   93|      1|}
ngx_regex_compile:
  268|      1|{
  269|      1|    int               n, erroff;
  270|      1|    char             *p;
  271|      1|    pcre             *re;
  272|      1|    const char       *errstr;
  273|      1|    ngx_uint_t        options;
  274|      1|    ngx_regex_elt_t  *elt;
  275|       |
  276|      1|    options = 0;
  277|       |
  278|      1|    if (rc->options & NGX_REGEX_CASELESS) {
  ------------------
  |  |   39|      1|#define NGX_REGEX_CASELESS     0x00000001
  ------------------
  |  Branch (278:9): [True: 0, False: 1]
  ------------------
  279|      0|        options |= PCRE_CASELESS;
  280|      0|    }
  281|       |
  282|      1|    if (rc->options & NGX_REGEX_MULTILINE) {
  ------------------
  |  |   40|      1|#define NGX_REGEX_MULTILINE    0x00000002
  ------------------
  |  Branch (282:9): [True: 0, False: 1]
  ------------------
  283|      0|        options |= PCRE_MULTILINE;
  284|      0|    }
  285|       |
  286|      1|    if (rc->options & ~(NGX_REGEX_CASELESS|NGX_REGEX_MULTILINE)) {
  ------------------
  |  |   39|      1|#define NGX_REGEX_CASELESS     0x00000001
  ------------------
                  if (rc->options & ~(NGX_REGEX_CASELESS|NGX_REGEX_MULTILINE)) {
  ------------------
  |  |   40|      1|#define NGX_REGEX_MULTILINE    0x00000002
  ------------------
  |  Branch (286:9): [True: 0, False: 1]
  ------------------
  287|      0|        rc->err.len = ngx_snprintf(rc->err.data, rc->err.len,
  288|      0|                            "regex \"%V\" compilation failed: invalid options",
  289|      0|                            &rc->pattern)
  290|      0|                      - rc->err.data;
  291|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  292|      0|    }
  293|       |
  294|      1|    ngx_regex_malloc_init(rc->pool);
  295|       |
  296|      1|    re = pcre_compile((const char *) rc->pattern.data, (int) options,
  297|      1|                      &errstr, &erroff, NULL);
  298|       |
  299|       |    /* ensure that there is no current pool */
  300|      1|    ngx_regex_malloc_done();
  301|       |
  302|      1|    if (re == NULL) {
  ------------------
  |  Branch (302:9): [True: 0, False: 1]
  ------------------
  303|      0|        if ((size_t) erroff == rc->pattern.len) {
  ------------------
  |  Branch (303:13): [True: 0, False: 0]
  ------------------
  304|      0|           rc->err.len = ngx_snprintf(rc->err.data, rc->err.len,
  305|      0|                              "pcre_compile() failed: %s in \"%V\"",
  306|      0|                               errstr, &rc->pattern)
  307|      0|                         - rc->err.data;
  308|       |
  309|      0|        } else {
  310|      0|           rc->err.len = ngx_snprintf(rc->err.data, rc->err.len,
  311|      0|                              "pcre_compile() failed: %s in \"%V\" at \"%s\"",
  312|      0|                               errstr, &rc->pattern, rc->pattern.data + erroff)
  313|      0|                         - rc->err.data;
  314|      0|        }
  315|       |
  316|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  317|      0|    }
  318|       |
  319|      1|    rc->regex = ngx_pcalloc(rc->pool, sizeof(ngx_regex_t));
  320|      1|    if (rc->regex == NULL) {
  ------------------
  |  Branch (320:9): [True: 0, False: 1]
  ------------------
  321|      0|        goto nomem;
  322|      0|    }
  323|       |
  324|      1|    rc->regex->code = re;
  325|       |
  326|       |    /* do not study at runtime */
  327|       |
  328|      1|    if (ngx_regex_studies != NULL) {
  ------------------
  |  Branch (328:9): [True: 1, False: 0]
  ------------------
  329|      1|        elt = ngx_list_push(ngx_regex_studies);
  330|      1|        if (elt == NULL) {
  ------------------
  |  Branch (330:13): [True: 0, False: 1]
  ------------------
  331|      0|            goto nomem;
  332|      0|        }
  333|       |
  334|      1|        elt->regex = rc->regex;
  335|      1|        elt->name = rc->pattern.data;
  336|      1|    }
  337|       |
  338|      1|    n = pcre_fullinfo(re, NULL, PCRE_INFO_CAPTURECOUNT, &rc->captures);
  339|      1|    if (n < 0) {
  ------------------
  |  Branch (339:9): [True: 0, False: 1]
  ------------------
  340|      0|        p = "pcre_fullinfo(\"%V\", PCRE_INFO_CAPTURECOUNT) failed: %d";
  341|      0|        goto failed;
  342|      0|    }
  343|       |
  344|      1|    if (rc->captures == 0) {
  ------------------
  |  Branch (344:9): [True: 0, False: 1]
  ------------------
  345|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  346|      0|    }
  347|       |
  348|      1|    n = pcre_fullinfo(re, NULL, PCRE_INFO_NAMECOUNT, &rc->named_captures);
  349|      1|    if (n < 0) {
  ------------------
  |  Branch (349:9): [True: 0, False: 1]
  ------------------
  350|      0|        p = "pcre_fullinfo(\"%V\", PCRE_INFO_NAMECOUNT) failed: %d";
  351|      0|        goto failed;
  352|      0|    }
  353|       |
  354|      1|    if (rc->named_captures == 0) {
  ------------------
  |  Branch (354:9): [True: 0, False: 1]
  ------------------
  355|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  356|      0|    }
  357|       |
  358|      1|    n = pcre_fullinfo(re, NULL, PCRE_INFO_NAMEENTRYSIZE, &rc->name_size);
  359|      1|    if (n < 0) {
  ------------------
  |  Branch (359:9): [True: 0, False: 1]
  ------------------
  360|      0|        p = "pcre_fullinfo(\"%V\", PCRE_INFO_NAMEENTRYSIZE) failed: %d";
  361|      0|        goto failed;
  362|      0|    }
  363|       |
  364|      1|    n = pcre_fullinfo(re, NULL, PCRE_INFO_NAMETABLE, &rc->names);
  365|      1|    if (n < 0) {
  ------------------
  |  Branch (365:9): [True: 0, False: 1]
  ------------------
  366|      0|        p = "pcre_fullinfo(\"%V\", PCRE_INFO_NAMETABLE) failed: %d";
  367|      0|        goto failed;
  368|      0|    }
  369|       |
  370|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  371|       |
  372|      0|failed:
  373|       |
  374|      0|    rc->err.len = ngx_snprintf(rc->err.data, rc->err.len, p, &rc->pattern, n)
  375|      0|                  - rc->err.data;
  376|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  377|       |
  378|      0|nomem:
  379|       |
  380|      0|    rc->err.len = ngx_snprintf(rc->err.data, rc->err.len,
  381|      0|                               "regex \"%V\" compilation failed: no memory",
  382|      0|                               &rc->pattern)
  383|      0|                  - rc->err.data;
  384|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  385|      1|}
ngx_regex_exec:
  457|      3|{
  458|      3|    return pcre_exec(re->code, re->extra, (const char *) s->data, s->len,
  459|      3|                     0, 0, captures, size);
  460|      3|}
ngx_regex.c:ngx_regex_create_conf:
  719|      1|{
  720|      1|    ngx_regex_conf_t    *rcf;
  721|      1|    ngx_pool_cleanup_t  *cln;
  722|       |
  723|      1|    rcf = ngx_pcalloc(cycle->pool, sizeof(ngx_regex_conf_t));
  724|      1|    if (rcf == NULL) {
  ------------------
  |  Branch (724:9): [True: 0, False: 1]
  ------------------
  725|      0|        return NULL;
  726|      0|    }
  727|       |
  728|      1|    rcf->pcre_jit = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
  729|       |
  730|      1|    cln = ngx_pool_cleanup_add(cycle->pool, 0);
  731|      1|    if (cln == NULL) {
  ------------------
  |  Branch (731:9): [True: 0, False: 1]
  ------------------
  732|      0|        return NULL;
  733|      0|    }
  734|       |
  735|      1|    rcf->studies = ngx_list_create(cycle->pool, 8, sizeof(ngx_regex_elt_t));
  736|      1|    if (rcf->studies == NULL) {
  ------------------
  |  Branch (736:9): [True: 0, False: 1]
  ------------------
  737|      0|        return NULL;
  738|      0|    }
  739|       |
  740|      1|    cln->handler = ngx_regex_cleanup;
  741|      1|    cln->data = rcf;
  742|       |
  743|      1|    ngx_regex_studies = rcf->studies;
  744|       |
  745|      1|    return rcf;
  746|      1|}
ngx_regex.c:ngx_regex_init_conf:
  751|      1|{
  752|      1|    ngx_regex_conf_t *rcf = conf;
  753|       |
  754|      1|    ngx_conf_init_value(rcf->pcre_jit, 0);
  ------------------
  |  |  181|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (181:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  182|      1|        conf = default;                                                      \
  |  |  183|      1|    }
  ------------------
  755|       |
  756|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  757|      1|}
ngx_regex.c:ngx_regex_malloc_init:
   98|      2|{
   99|      2|    ngx_regex_pool = pool;
  100|      2|    ngx_regex_direct_alloc = (pool == NULL) ? 1 : 0;
  ------------------
  |  Branch (100:30): [True: 0, False: 2]
  ------------------
  101|      2|}
ngx_regex.c:ngx_regex_malloc_done:
  106|      2|{
  107|      2|    ngx_regex_pool = NULL;
  108|      2|    ngx_regex_direct_alloc = 0;
  109|      2|}
ngx_regex.c:ngx_regex_malloc:
  529|      2|{
  530|      2|    if (ngx_regex_pool) {
  ------------------
  |  Branch (530:9): [True: 2, False: 0]
  ------------------
  531|      2|        return ngx_palloc(ngx_regex_pool, size);
  532|      2|    }
  533|       |
  534|      0|    return NULL;
  535|      2|}
ngx_regex.c:ngx_regex_module_init:
  620|      1|{
  621|      1|    int                opt;
  622|      1|#if !(NGX_PCRE2)
  623|      1|    const char        *errstr;
  624|      1|#endif
  625|      1|    ngx_uint_t         i;
  626|      1|    ngx_list_part_t   *part;
  627|      1|    ngx_regex_elt_t   *elts;
  628|      1|    ngx_regex_conf_t  *rcf;
  629|       |
  630|      1|    opt = 0;
  631|       |
  632|      1|    rcf = (ngx_regex_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_regex_module);
  ------------------
  |  |  176|      1|#define ngx_get_conf(conf_ctx, module)  conf_ctx[module.index]
  ------------------
  633|       |
  634|      1|#if (NGX_PCRE2 || NGX_HAVE_PCRE_JIT)
  635|       |
  636|      1|    if (rcf->pcre_jit) {
  ------------------
  |  Branch (636:9): [True: 0, False: 1]
  ------------------
  637|       |#if (NGX_PCRE2)
  638|       |        opt = 1;
  639|       |#else
  640|      0|        opt = PCRE_STUDY_JIT_COMPILE;
  641|      0|#endif
  642|      0|    }
  643|       |
  644|      1|#endif
  645|       |
  646|      1|    ngx_regex_malloc_init(cycle->pool);
  647|       |
  648|      1|    part = &rcf->studies->part;
  649|      1|    elts = part->elts;
  650|       |
  651|      2|    for (i = 0; /* void */ ; i++) {
  652|       |
  653|      2|        if (i >= part->nelts) {
  ------------------
  |  Branch (653:13): [True: 1, False: 1]
  ------------------
  654|      1|            if (part->next == NULL) {
  ------------------
  |  Branch (654:17): [True: 1, False: 0]
  ------------------
  655|      1|                break;
  656|      1|            }
  657|       |
  658|      0|            part = part->next;
  659|      0|            elts = part->elts;
  660|      0|            i = 0;
  661|      0|        }
  662|       |
  663|       |#if (NGX_PCRE2)
  664|       |
  665|       |        if (opt) {
  666|       |            int  n;
  667|       |
  668|       |            n = pcre2_jit_compile(elts[i].regex, PCRE2_JIT_COMPLETE);
  669|       |
  670|       |            if (n != 0) {
  671|       |                ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
  672|       |                              "pcre2_jit_compile() failed: %d in \"%s\", "
  673|       |                              "ignored",
  674|       |                              n, elts[i].name);
  675|       |            }
  676|       |        }
  677|       |
  678|       |#else
  679|       |
  680|      1|        elts[i].regex->extra = pcre_study(elts[i].regex->code, opt, &errstr);
  681|       |
  682|      1|        if (errstr != NULL) {
  ------------------
  |  Branch (682:13): [True: 0, False: 1]
  ------------------
  683|      0|            ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  684|      0|                          "pcre_study() failed: %s in \"%s\"",
  685|      0|                          errstr, elts[i].name);
  686|      0|        }
  687|       |
  688|      1|#if (NGX_HAVE_PCRE_JIT)
  689|      1|        if (opt & PCRE_STUDY_JIT_COMPILE) {
  ------------------
  |  Branch (689:13): [True: 0, False: 1]
  ------------------
  690|      0|            int jit, n;
  691|       |
  692|      0|            jit = 0;
  693|      0|            n = pcre_fullinfo(elts[i].regex->code, elts[i].regex->extra,
  694|      0|                              PCRE_INFO_JIT, &jit);
  695|       |
  696|      0|            if (n != 0 || jit != 1) {
  ------------------
  |  Branch (696:17): [True: 0, False: 0]
  |  Branch (696:27): [True: 0, False: 0]
  ------------------
  697|      0|                ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  698|      0|                              "JIT compiler does not support pattern: \"%s\"",
  699|      0|                              elts[i].name);
  700|      0|            }
  701|      0|        }
  702|      1|#endif
  703|      1|#endif
  704|      1|    }
  705|       |
  706|      1|    ngx_regex_malloc_done();
  707|       |
  708|      1|    ngx_regex_studies = NULL;
  709|       |#if (NGX_PCRE2)
  710|       |    ngx_regex_compile_context = NULL;
  711|       |#endif
  712|       |
  713|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  714|      1|}

ngx_resolver_create:
  134|      1|{
  135|      1|    ngx_str_t                   s;
  136|      1|    ngx_url_t                   u;
  137|      1|    ngx_uint_t                  i, j;
  138|      1|    ngx_resolver_t             *r;
  139|      1|    ngx_pool_cleanup_t         *cln;
  140|      1|    ngx_resolver_connection_t  *rec;
  141|       |
  142|      1|    r = ngx_pcalloc(cf->pool, sizeof(ngx_resolver_t));
  143|      1|    if (r == NULL) {
  ------------------
  |  Branch (143:9): [True: 0, False: 1]
  ------------------
  144|      0|        return NULL;
  145|      0|    }
  146|       |
  147|      1|    r->event = ngx_pcalloc(cf->pool, sizeof(ngx_event_t));
  148|      1|    if (r->event == NULL) {
  ------------------
  |  Branch (148:9): [True: 0, False: 1]
  ------------------
  149|      0|        return NULL;
  150|      0|    }
  151|       |
  152|      1|    cln = ngx_pool_cleanup_add(cf->pool, 0);
  153|      1|    if (cln == NULL) {
  ------------------
  |  Branch (153:9): [True: 0, False: 1]
  ------------------
  154|      0|        return NULL;
  155|      0|    }
  156|       |
  157|      1|    cln->handler = ngx_resolver_cleanup;
  158|      1|    cln->data = r;
  159|       |
  160|      1|    r->ipv4 = 1;
  161|       |
  162|      1|    ngx_rbtree_init(&r->name_rbtree, &r->name_sentinel,
  ------------------
  |  |   45|      1|    ngx_rbtree_sentinel_init(s);                                              \
  |  |  ------------------
  |  |  |  |   73|      1|#define ngx_rbtree_sentinel_init(node)  ngx_rbt_black(node)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      1|#define ngx_rbt_black(node)             ((node)->color = 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   46|      1|    (tree)->root = s;                                                         \
  |  |   47|      1|    (tree)->sentinel = s;                                                     \
  |  |   48|      1|    (tree)->insert = i
  ------------------
  163|      1|                    ngx_resolver_rbtree_insert_value);
  164|       |
  165|      1|    ngx_rbtree_init(&r->srv_rbtree, &r->srv_sentinel,
  ------------------
  |  |   45|      1|    ngx_rbtree_sentinel_init(s);                                              \
  |  |  ------------------
  |  |  |  |   73|      1|#define ngx_rbtree_sentinel_init(node)  ngx_rbt_black(node)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      1|#define ngx_rbt_black(node)             ((node)->color = 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   46|      1|    (tree)->root = s;                                                         \
  |  |   47|      1|    (tree)->sentinel = s;                                                     \
  |  |   48|      1|    (tree)->insert = i
  ------------------
  166|      1|                    ngx_resolver_rbtree_insert_value);
  167|       |
  168|      1|    ngx_rbtree_init(&r->addr_rbtree, &r->addr_sentinel,
  ------------------
  |  |   45|      1|    ngx_rbtree_sentinel_init(s);                                              \
  |  |  ------------------
  |  |  |  |   73|      1|#define ngx_rbtree_sentinel_init(node)  ngx_rbt_black(node)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      1|#define ngx_rbt_black(node)             ((node)->color = 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   46|      1|    (tree)->root = s;                                                         \
  |  |   47|      1|    (tree)->sentinel = s;                                                     \
  |  |   48|      1|    (tree)->insert = i
  ------------------
  169|      1|                    ngx_rbtree_insert_value);
  170|       |
  171|      1|    ngx_queue_init(&r->name_resend_queue);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  172|      1|    ngx_queue_init(&r->srv_resend_queue);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  173|      1|    ngx_queue_init(&r->addr_resend_queue);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  174|       |
  175|      1|    ngx_queue_init(&r->name_expire_queue);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  176|      1|    ngx_queue_init(&r->srv_expire_queue);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  177|      1|    ngx_queue_init(&r->addr_expire_queue);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  178|       |
  179|      1|#if (NGX_HAVE_INET6)
  180|      1|    r->ipv6 = 1;
  181|       |
  182|      1|    ngx_rbtree_init(&r->addr6_rbtree, &r->addr6_sentinel,
  ------------------
  |  |   45|      1|    ngx_rbtree_sentinel_init(s);                                              \
  |  |  ------------------
  |  |  |  |   73|      1|#define ngx_rbtree_sentinel_init(node)  ngx_rbt_black(node)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      1|#define ngx_rbt_black(node)             ((node)->color = 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   46|      1|    (tree)->root = s;                                                         \
  |  |   47|      1|    (tree)->sentinel = s;                                                     \
  |  |   48|      1|    (tree)->insert = i
  ------------------
  183|      1|                    ngx_resolver_rbtree_insert_addr6_value);
  184|       |
  185|      1|    ngx_queue_init(&r->addr6_resend_queue);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  186|       |
  187|      1|    ngx_queue_init(&r->addr6_expire_queue);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  188|      1|#endif
  189|       |
  190|      1|    r->event->handler = ngx_resolver_resend_handler;
  191|      1|    r->event->data = r;
  192|      1|    r->event->log = &cf->cycle->new_log;
  193|      1|    r->event->cancelable = 1;
  194|      1|    r->ident = -1;
  195|       |
  196|      1|    r->resend_timeout = 5;
  197|      1|    r->tcp_timeout = 5;
  198|      1|    r->expire = 30;
  199|      1|    r->valid = 0;
  200|       |
  201|      1|    r->log = &cf->cycle->new_log;
  202|      1|    r->log_level = NGX_LOG_ERR;
  ------------------
  |  |   20|      1|#define NGX_LOG_ERR               4
  ------------------
  203|       |
  204|      1|    if (n) {
  ------------------
  |  Branch (204:9): [True: 0, False: 1]
  ------------------
  205|      0|        if (ngx_array_init(&r->connections, cf->pool, n,
  ------------------
  |  Branch (205:13): [True: 0, False: 0]
  ------------------
  206|      0|                           sizeof(ngx_resolver_connection_t))
  207|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  208|      0|        {
  209|      0|            return NULL;
  210|      0|        }
  211|      0|    }
  212|       |
  213|      1|    for (i = 0; i < n; i++) {
  ------------------
  |  Branch (213:17): [True: 0, False: 1]
  ------------------
  214|      0|        if (ngx_strncmp(names[i].data, "valid=", 6) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (214:13): [True: 0, False: 0]
  ------------------
  215|      0|            s.len = names[i].len - 6;
  216|      0|            s.data = names[i].data + 6;
  217|       |
  218|      0|            r->valid = ngx_parse_time(&s, 1);
  219|       |
  220|      0|            if (r->valid == (time_t) NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (220:17): [True: 0, False: 0]
  ------------------
  221|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  222|      0|                                   "invalid parameter: %V", &names[i]);
  223|      0|                return NULL;
  224|      0|            }
  225|       |
  226|      0|            continue;
  227|      0|        }
  228|       |
  229|      0|#if (NGX_HAVE_INET6)
  230|      0|        if (ngx_strncmp(names[i].data, "ipv4=", 5) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|       |
  232|      0|            if (ngx_strcmp(&names[i].data[5], "on") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (232:17): [True: 0, False: 0]
  ------------------
  233|      0|                r->ipv4 = 1;
  234|       |
  235|      0|            } else if (ngx_strcmp(&names[i].data[5], "off") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (235:24): [True: 0, False: 0]
  ------------------
  236|      0|                r->ipv4 = 0;
  237|       |
  238|      0|            } else {
  239|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  240|      0|                                   "invalid parameter: %V", &names[i]);
  241|      0|                return NULL;
  242|      0|            }
  243|       |
  244|      0|            continue;
  245|      0|        }
  246|       |
  247|      0|        if (ngx_strncmp(names[i].data, "ipv6=", 5) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (247:13): [True: 0, False: 0]
  ------------------
  248|       |
  249|      0|            if (ngx_strcmp(&names[i].data[5], "on") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (249:17): [True: 0, False: 0]
  ------------------
  250|      0|                r->ipv6 = 1;
  251|       |
  252|      0|            } else if (ngx_strcmp(&names[i].data[5], "off") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (252:24): [True: 0, False: 0]
  ------------------
  253|      0|                r->ipv6 = 0;
  254|       |
  255|      0|            } else {
  256|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  257|      0|                                   "invalid parameter: %V", &names[i]);
  258|      0|                return NULL;
  259|      0|            }
  260|       |
  261|      0|            continue;
  262|      0|        }
  263|      0|#endif
  264|       |
  265|      0|        ngx_memzero(&u, sizeof(ngx_url_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  266|       |
  267|      0|        u.url = names[i];
  268|      0|        u.default_port = 53;
  269|       |
  270|      0|        if (ngx_parse_url(cf->pool, &u) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (270:13): [True: 0, False: 0]
  ------------------
  271|      0|            if (u.err) {
  ------------------
  |  Branch (271:17): [True: 0, False: 0]
  ------------------
  272|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  273|      0|                                   "%s in resolver \"%V\"",
  274|      0|                                   u.err, &u.url);
  275|      0|            }
  276|       |
  277|      0|            return NULL;
  278|      0|        }
  279|       |
  280|      0|        rec = ngx_array_push_n(&r->connections, u.naddrs);
  281|      0|        if (rec == NULL) {
  ------------------
  |  Branch (281:13): [True: 0, False: 0]
  ------------------
  282|      0|            return NULL;
  283|      0|        }
  284|       |
  285|      0|        ngx_memzero(rec, u.naddrs * sizeof(ngx_resolver_connection_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  286|       |
  287|      0|        for (j = 0; j < u.naddrs; j++) {
  ------------------
  |  Branch (287:21): [True: 0, False: 0]
  ------------------
  288|      0|            rec[j].sockaddr = u.addrs[j].sockaddr;
  289|      0|            rec[j].socklen = u.addrs[j].socklen;
  290|      0|            rec[j].server = u.addrs[j].name;
  291|      0|            rec[j].resolver = r;
  292|      0|        }
  293|      0|    }
  294|       |
  295|      1|#if (NGX_HAVE_INET6)
  296|      1|    if (r->ipv4 + r->ipv6 == 0) {
  ------------------
  |  Branch (296:9): [True: 0, False: 1]
  ------------------
  297|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  298|      0|                           "\"ipv4\" and \"ipv6\" cannot both be \"off\"");
  299|      0|        return NULL;
  300|      0|    }
  301|      1|#endif
  302|       |
  303|      1|    if (n && r->connections.nelts == 0) {
  ------------------
  |  Branch (303:9): [True: 0, False: 1]
  |  Branch (303:14): [True: 0, False: 0]
  ------------------
  304|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "no name servers defined");
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  305|      0|        return NULL;
  306|      0|    }
  307|       |
  308|      1|    return r;
  309|      1|}

ngx_shmtx_create:
   20|      1|{
   21|      1|    mtx->lock = &addr->lock;
   22|       |
   23|      1|    if (mtx->spin == (ngx_uint_t) -1) {
  ------------------
  |  Branch (23:9): [True: 1, False: 0]
  ------------------
   24|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   25|      1|    }
   26|       |
   27|      0|    mtx->spin = 2048;
   28|       |
   29|      0|#if (NGX_HAVE_POSIX_SEM)
   30|       |
   31|      0|    mtx->wait = &addr->wait;
   32|       |
   33|      0|    if (sem_init(&mtx->sem, 1, 0) == -1) {
  ------------------
  |  Branch (33:9): [True: 0, False: 0]
  ------------------
   34|      0|        ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   35|      0|                      "sem_init() failed");
   36|      0|    } else {
   37|      0|        mtx->semaphore = 1;
   38|      0|    }
   39|       |
   40|      0|#endif
   41|       |
   42|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
   43|      1|}

ngx_strlow:
   24|    357|{
   25|  12.2k|    while (n) {
  ------------------
  |  Branch (25:12): [True: 11.9k, False: 357]
  ------------------
   26|  11.9k|        *dst = ngx_tolower(*src);
  ------------------
  |  |   47|  11.9k|#define ngx_tolower(c)      (u_char) ((c >= 'A' && c <= 'Z') ? (c | 0x20) : c)
  |  |  ------------------
  |  |  |  Branch (47:40): [True: 11.0k, False: 920]
  |  |  |  Branch (47:52): [True: 6.91k, False: 4.09k]
  |  |  ------------------
  ------------------
   27|  11.9k|        dst++;
   28|  11.9k|        src++;
   29|  11.9k|        n--;
   30|  11.9k|    }
   31|    357|}
ngx_strnlen:
   36|      1|{
   37|      1|    size_t  i;
   38|       |
   39|     11|    for (i = 0; i < n; i++) {
  ------------------
  |  Branch (39:17): [True: 11, False: 0]
  ------------------
   40|       |
   41|     11|        if (p[i] == '\0') {
  ------------------
  |  Branch (41:13): [True: 1, False: 10]
  ------------------
   42|      1|            return i;
   43|      1|        }
   44|     11|    }
   45|       |
   46|      0|    return n;
   47|      1|}
ngx_cpystrn:
   52|     13|{
   53|     13|    if (n == 0) {
  ------------------
  |  Branch (53:9): [True: 0, False: 13]
  ------------------
   54|      0|        return dst;
   55|      0|    }
   56|       |
   57|    145|    while (--n) {
  ------------------
  |  Branch (57:12): [True: 134, False: 11]
  ------------------
   58|    134|        *dst = *src;
   59|       |
   60|    134|        if (*dst == '\0') {
  ------------------
  |  Branch (60:13): [True: 2, False: 132]
  ------------------
   61|      2|            return dst;
   62|      2|        }
   63|       |
   64|    132|        dst++;
   65|    132|        src++;
   66|    132|    }
   67|       |
   68|     11|    *dst = '\0';
   69|       |
   70|     11|    return dst;
   71|     13|}
ngx_pstrdup:
   76|      7|{
   77|      7|    u_char  *dst;
   78|       |
   79|      7|    dst = ngx_pnalloc(pool, src->len);
   80|      7|    if (dst == NULL) {
  ------------------
  |  Branch (80:9): [True: 0, False: 7]
  ------------------
   81|      0|        return NULL;
   82|      0|    }
   83|       |
   84|      7|    ngx_memcpy(dst, src->data, src->len);
  ------------------
  |  |  106|      7|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
   85|       |
   86|      7|    return dst;
   87|      7|}
ngx_sprintf:
  124|     17|{
  125|     17|    u_char   *p;
  126|     17|    va_list   args;
  127|       |
  128|     17|    va_start(args, fmt);
  129|     17|    p = ngx_vslprintf(buf, (void *) -1, fmt, args);
  130|     17|    va_end(args);
  131|       |
  132|     17|    return p;
  133|     17|}
ngx_snprintf:
  138|     11|{
  139|     11|    u_char   *p;
  140|     11|    va_list   args;
  141|       |
  142|     11|    va_start(args, fmt);
  143|     11|    p = ngx_vslprintf(buf, buf + max, fmt, args);
  144|     11|    va_end(args);
  145|       |
  146|     11|    return p;
  147|     11|}
ngx_vslprintf:
  166|     28|{
  167|     28|    u_char                *p, zero;
  168|     28|    int                    d;
  169|     28|    double                 f;
  170|     28|    size_t                 slen;
  171|     28|    int64_t                i64;
  172|     28|    uint64_t               ui64, frac;
  173|     28|    ngx_msec_t             ms;
  174|     28|    ngx_uint_t             width, sign, hex, max_width, frac_width, scale, n;
  175|     28|    ngx_str_t             *v;
  176|     28|    ngx_variable_value_t  *vv;
  177|       |
  178|    309|    while (*fmt && buf < last) {
  ------------------
  |  Branch (178:12): [True: 281, False: 28]
  |  Branch (178:20): [True: 281, False: 0]
  ------------------
  179|       |
  180|       |        /*
  181|       |         * "buf < last" means that we could copy at least one character:
  182|       |         * the plain character, "%%", "%c", and minus without the checking
  183|       |         */
  184|       |
  185|    281|        if (*fmt == '%') {
  ------------------
  |  Branch (185:13): [True: 136, False: 145]
  ------------------
  186|       |
  187|    136|            i64 = 0;
  188|    136|            ui64 = 0;
  189|       |
  190|    136|            zero = (u_char) ((*++fmt == '0') ? '0' : ' ');
  ------------------
  |  Branch (190:30): [True: 55, False: 81]
  ------------------
  191|    136|            width = 0;
  192|    136|            sign = 1;
  193|    136|            hex = 0;
  194|    136|            max_width = 0;
  195|    136|            frac_width = 0;
  196|    136|            slen = (size_t) -1;
  197|       |
  198|    259|            while (*fmt >= '0' && *fmt <= '9') {
  ------------------
  |  Branch (198:20): [True: 258, False: 1]
  |  Branch (198:35): [True: 123, False: 135]
  ------------------
  199|    123|                width = width * 10 + (*fmt++ - '0');
  200|    123|            }
  201|       |
  202|       |
  203|    182|            for ( ;; ) {
  204|    182|                switch (*fmt) {
  205|       |
  206|     45|                case 'u':
  ------------------
  |  Branch (206:17): [True: 45, False: 137]
  ------------------
  207|     45|                    sign = 0;
  208|     45|                    fmt++;
  209|     45|                    continue;
  210|       |
  211|      0|                case 'm':
  ------------------
  |  Branch (211:17): [True: 0, False: 182]
  ------------------
  212|      0|                    max_width = 1;
  213|      0|                    fmt++;
  214|      0|                    continue;
  215|       |
  216|      0|                case 'X':
  ------------------
  |  Branch (216:17): [True: 0, False: 182]
  ------------------
  217|      0|                    hex = 2;
  218|      0|                    sign = 0;
  219|      0|                    fmt++;
  220|      0|                    continue;
  221|       |
  222|      0|                case 'x':
  ------------------
  |  Branch (222:17): [True: 0, False: 182]
  ------------------
  223|      0|                    hex = 1;
  224|      0|                    sign = 0;
  225|      0|                    fmt++;
  226|      0|                    continue;
  227|       |
  228|      0|                case '.':
  ------------------
  |  Branch (228:17): [True: 0, False: 182]
  ------------------
  229|      0|                    fmt++;
  230|       |
  231|      0|                    while (*fmt >= '0' && *fmt <= '9') {
  ------------------
  |  Branch (231:28): [True: 0, False: 0]
  |  Branch (231:43): [True: 0, False: 0]
  ------------------
  232|      0|                        frac_width = frac_width * 10 + (*fmt++ - '0');
  233|      0|                    }
  234|       |
  235|      0|                    break;
  236|       |
  237|      1|                case '*':
  ------------------
  |  Branch (237:17): [True: 1, False: 181]
  ------------------
  238|      1|                    slen = va_arg(args, size_t);
  239|      1|                    fmt++;
  240|      1|                    continue;
  241|       |
  242|    136|                default:
  ------------------
  |  Branch (242:17): [True: 136, False: 46]
  ------------------
  243|    136|                    break;
  244|    182|                }
  245|       |
  246|    136|                break;
  247|    182|            }
  248|       |
  249|       |
  250|    136|            switch (*fmt) {
  251|       |
  252|      0|            case 'V':
  ------------------
  |  Branch (252:13): [True: 0, False: 136]
  ------------------
  253|      0|                v = va_arg(args, ngx_str_t *);
  254|       |
  255|      0|                buf = ngx_sprintf_str(buf, last, v->data, v->len, hex);
  256|      0|                fmt++;
  257|       |
  258|      0|                continue;
  259|       |
  260|      0|            case 'v':
  ------------------
  |  Branch (260:13): [True: 0, False: 136]
  ------------------
  261|      0|                vv = va_arg(args, ngx_variable_value_t *);
  262|       |
  263|      0|                buf = ngx_sprintf_str(buf, last, vv->data, vv->len, hex);
  264|      0|                fmt++;
  265|       |
  266|      0|                continue;
  267|       |
  268|      9|            case 's':
  ------------------
  |  Branch (268:13): [True: 9, False: 127]
  ------------------
  269|      9|                p = va_arg(args, u_char *);
  270|       |
  271|      9|                buf = ngx_sprintf_str(buf, last, p, slen, hex);
  272|      9|                fmt++;
  273|       |
  274|      9|                continue;
  275|       |
  276|      2|            case 'O':
  ------------------
  |  Branch (276:13): [True: 2, False: 134]
  ------------------
  277|      2|                i64 = (int64_t) va_arg(args, off_t);
  278|      2|                sign = 1;
  279|      2|                break;
  280|       |
  281|      0|            case 'P':
  ------------------
  |  Branch (281:13): [True: 0, False: 136]
  ------------------
  282|      0|                i64 = (int64_t) va_arg(args, ngx_pid_t);
  283|      0|                sign = 1;
  284|      0|                break;
  285|       |
  286|      0|            case 'T':
  ------------------
  |  Branch (286:13): [True: 0, False: 136]
  ------------------
  287|      0|                i64 = (int64_t) va_arg(args, time_t);
  288|      0|                sign = 1;
  289|      0|                break;
  290|       |
  291|      0|            case 'M':
  ------------------
  |  Branch (291:13): [True: 0, False: 136]
  ------------------
  292|      0|                ms = (ngx_msec_t) va_arg(args, ngx_msec_t);
  293|      0|                if ((ngx_msec_int_t) ms == -1) {
  ------------------
  |  Branch (293:21): [True: 0, False: 0]
  ------------------
  294|      0|                    sign = 1;
  295|      0|                    i64 = -1;
  296|      0|                } else {
  297|      0|                    sign = 0;
  298|      0|                    ui64 = (uint64_t) ms;
  299|      0|                }
  300|      0|                break;
  301|       |
  302|      0|            case 'z':
  ------------------
  |  Branch (302:13): [True: 0, False: 136]
  ------------------
  303|      0|                if (sign) {
  ------------------
  |  Branch (303:21): [True: 0, False: 0]
  ------------------
  304|      0|                    i64 = (int64_t) va_arg(args, ssize_t);
  305|      0|                } else {
  306|      0|                    ui64 = (uint64_t) va_arg(args, size_t);
  307|      0|                }
  308|      0|                break;
  309|       |
  310|      8|            case 'i':
  ------------------
  |  Branch (310:13): [True: 8, False: 128]
  ------------------
  311|      8|                if (sign) {
  ------------------
  |  Branch (311:21): [True: 8, False: 0]
  ------------------
  312|      8|                    i64 = (int64_t) va_arg(args, ngx_int_t);
  313|      8|                } else {
  314|      0|                    ui64 = (uint64_t) va_arg(args, ngx_uint_t);
  315|      0|                }
  316|       |
  317|      8|                if (max_width) {
  ------------------
  |  Branch (317:21): [True: 0, False: 8]
  ------------------
  318|      0|                    width = NGX_INT_T_LEN;
  ------------------
  |  |   91|      0|#define NGX_INT_T_LEN   NGX_INT64_LEN
  |  |  ------------------
  |  |  |  |   84|      0|#define NGX_INT64_LEN   (sizeof("-9223372036854775808") - 1)
  |  |  ------------------
  ------------------
  319|      0|                }
  320|       |
  321|      8|                break;
  322|       |
  323|    102|            case 'd':
  ------------------
  |  Branch (323:13): [True: 102, False: 34]
  ------------------
  324|    102|                if (sign) {
  ------------------
  |  Branch (324:21): [True: 62, False: 40]
  ------------------
  325|     62|                    i64 = (int64_t) va_arg(args, int);
  326|     62|                } else {
  327|     40|                    ui64 = (uint64_t) va_arg(args, u_int);
  328|     40|                }
  329|    102|                break;
  330|       |
  331|      0|            case 'l':
  ------------------
  |  Branch (331:13): [True: 0, False: 136]
  ------------------
  332|      0|                if (sign) {
  ------------------
  |  Branch (332:21): [True: 0, False: 0]
  ------------------
  333|      0|                    i64 = (int64_t) va_arg(args, long);
  334|      0|                } else {
  335|      0|                    ui64 = (uint64_t) va_arg(args, u_long);
  336|      0|                }
  337|      0|                break;
  338|       |
  339|      5|            case 'D':
  ------------------
  |  Branch (339:13): [True: 5, False: 131]
  ------------------
  340|      5|                if (sign) {
  ------------------
  |  Branch (340:21): [True: 0, False: 5]
  ------------------
  341|      0|                    i64 = (int64_t) va_arg(args, int32_t);
  342|      5|                } else {
  343|      5|                    ui64 = (uint64_t) va_arg(args, uint32_t);
  344|      5|                }
  345|      5|                break;
  346|       |
  347|      0|            case 'L':
  ------------------
  |  Branch (347:13): [True: 0, False: 136]
  ------------------
  348|      0|                if (sign) {
  ------------------
  |  Branch (348:21): [True: 0, False: 0]
  ------------------
  349|      0|                    i64 = va_arg(args, int64_t);
  350|      0|                } else {
  351|      0|                    ui64 = va_arg(args, uint64_t);
  352|      0|                }
  353|      0|                break;
  354|       |
  355|      0|            case 'A':
  ------------------
  |  Branch (355:13): [True: 0, False: 136]
  ------------------
  356|      0|                if (sign) {
  ------------------
  |  Branch (356:21): [True: 0, False: 0]
  ------------------
  357|      0|                    i64 = (int64_t) va_arg(args, ngx_atomic_int_t);
  358|      0|                } else {
  359|      0|                    ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);
  360|      0|                }
  361|       |
  362|      0|                if (max_width) {
  ------------------
  |  Branch (362:21): [True: 0, False: 0]
  ------------------
  363|      0|                    width = NGX_ATOMIC_T_LEN;
  ------------------
  |  |   51|      0|#define NGX_ATOMIC_T_LEN            (sizeof("-9223372036854775808") - 1)
  ------------------
  364|      0|                }
  365|       |
  366|      0|                break;
  367|       |
  368|      0|            case 'f':
  ------------------
  |  Branch (368:13): [True: 0, False: 136]
  ------------------
  369|      0|                f = va_arg(args, double);
  370|       |
  371|      0|                if (f < 0) {
  ------------------
  |  Branch (371:21): [True: 0, False: 0]
  ------------------
  372|      0|                    *buf++ = '-';
  373|      0|                    f = -f;
  374|      0|                }
  375|       |
  376|      0|                ui64 = (int64_t) f;
  377|      0|                frac = 0;
  378|       |
  379|      0|                if (frac_width) {
  ------------------
  |  Branch (379:21): [True: 0, False: 0]
  ------------------
  380|       |
  381|      0|                    scale = 1;
  382|      0|                    for (n = frac_width; n; n--) {
  ------------------
  |  Branch (382:42): [True: 0, False: 0]
  ------------------
  383|      0|                        scale *= 10;
  384|      0|                    }
  385|       |
  386|      0|                    frac = (uint64_t) ((f - (double) ui64) * scale + 0.5);
  387|       |
  388|      0|                    if (frac == scale) {
  ------------------
  |  Branch (388:25): [True: 0, False: 0]
  ------------------
  389|      0|                        ui64++;
  390|      0|                        frac = 0;
  391|      0|                    }
  392|      0|                }
  393|       |
  394|      0|                buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);
  395|       |
  396|      0|                if (frac_width) {
  ------------------
  |  Branch (396:21): [True: 0, False: 0]
  ------------------
  397|      0|                    if (buf < last) {
  ------------------
  |  Branch (397:25): [True: 0, False: 0]
  ------------------
  398|      0|                        *buf++ = '.';
  399|      0|                    }
  400|       |
  401|      0|                    buf = ngx_sprintf_num(buf, last, frac, '0', 0, frac_width);
  402|      0|                }
  403|       |
  404|      0|                fmt++;
  405|       |
  406|      0|                continue;
  407|       |
  408|      0|#if !(NGX_WIN32)
  409|      0|            case 'r':
  ------------------
  |  Branch (409:13): [True: 0, False: 136]
  ------------------
  410|      0|                i64 = (int64_t) va_arg(args, rlim_t);
  411|      0|                sign = 1;
  412|      0|                break;
  413|      0|#endif
  414|       |
  415|      0|            case 'p':
  ------------------
  |  Branch (415:13): [True: 0, False: 136]
  ------------------
  416|      0|                ui64 = (uintptr_t) va_arg(args, void *);
  417|      0|                hex = 2;
  418|      0|                sign = 0;
  419|      0|                zero = '0';
  420|      0|                width = 2 * sizeof(void *);
  421|      0|                break;
  422|       |
  423|      4|            case 'c':
  ------------------
  |  Branch (423:13): [True: 4, False: 132]
  ------------------
  424|      4|                d = va_arg(args, int);
  425|      4|                *buf++ = (u_char) (d & 0xff);
  426|      4|                fmt++;
  427|       |
  428|      4|                continue;
  429|       |
  430|      6|            case 'Z':
  ------------------
  |  Branch (430:13): [True: 6, False: 130]
  ------------------
  431|      6|                *buf++ = '\0';
  432|      6|                fmt++;
  433|       |
  434|      6|                continue;
  435|       |
  436|      0|            case 'N':
  ------------------
  |  Branch (436:13): [True: 0, False: 136]
  ------------------
  437|       |#if (NGX_WIN32)
  438|       |                *buf++ = CR;
  439|       |                if (buf < last) {
  440|       |                    *buf++ = LF;
  441|       |                }
  442|       |#else
  443|      0|                *buf++ = LF;
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  444|      0|#endif
  445|      0|                fmt++;
  446|       |
  447|      0|                continue;
  448|       |
  449|      0|            case '%':
  ------------------
  |  Branch (449:13): [True: 0, False: 136]
  ------------------
  450|      0|                *buf++ = '%';
  451|      0|                fmt++;
  452|       |
  453|      0|                continue;
  454|       |
  455|      0|            default:
  ------------------
  |  Branch (455:13): [True: 0, False: 136]
  ------------------
  456|      0|                *buf++ = *fmt++;
  457|       |
  458|      0|                continue;
  459|    136|            }
  460|       |
  461|    117|            if (sign) {
  ------------------
  |  Branch (461:17): [True: 72, False: 45]
  ------------------
  462|     72|                if (i64 < 0) {
  ------------------
  |  Branch (462:21): [True: 0, False: 72]
  ------------------
  463|      0|                    *buf++ = '-';
  464|      0|                    ui64 = (uint64_t) -i64;
  465|       |
  466|     72|                } else {
  467|     72|                    ui64 = (uint64_t) i64;
  468|     72|                }
  469|     72|            }
  470|       |
  471|    117|            buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);
  472|       |
  473|    117|            fmt++;
  474|       |
  475|    145|        } else {
  476|    145|            *buf++ = *fmt++;
  477|    145|        }
  478|    281|    }
  479|       |
  480|     28|    return buf;
  481|     28|}
ngx_strcasecmp:
  637|    130|{
  638|    130|    ngx_uint_t  c1, c2;
  639|       |
  640|    191|    for ( ;; ) {
  641|    191|        c1 = (ngx_uint_t) *s1++;
  642|    191|        c2 = (ngx_uint_t) *s2++;
  643|       |
  644|    191|        c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
  ------------------
  |  Branch (644:15): [True: 174, False: 17]
  |  Branch (644:28): [True: 117, False: 57]
  ------------------
  645|    191|        c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
  ------------------
  |  Branch (645:15): [True: 173, False: 18]
  |  Branch (645:28): [True: 116, False: 57]
  ------------------
  646|       |
  647|    191|        if (c1 == c2) {
  ------------------
  |  Branch (647:13): [True: 72, False: 119]
  ------------------
  648|       |
  649|     72|            if (c1) {
  ------------------
  |  Branch (649:17): [True: 61, False: 11]
  ------------------
  650|     61|                continue;
  651|     61|            }
  652|       |
  653|     11|            return 0;
  654|     72|        }
  655|       |
  656|    119|        return c1 - c2;
  657|    191|    }
  658|    130|}
ngx_strncasecmp:
  663|    272|{
  664|    272|    ngx_uint_t  c1, c2;
  665|       |
  666|    745|    while (n) {
  ------------------
  |  Branch (666:12): [True: 715, False: 30]
  ------------------
  667|    715|        c1 = (ngx_uint_t) *s1++;
  668|    715|        c2 = (ngx_uint_t) *s2++;
  669|       |
  670|    715|        c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
  ------------------
  |  Branch (670:15): [True: 670, False: 45]
  |  Branch (670:28): [True: 4, False: 666]
  ------------------
  671|    715|        c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
  ------------------
  |  Branch (671:15): [True: 681, False: 34]
  |  Branch (671:28): [True: 0, False: 681]
  ------------------
  672|       |
  673|    715|        if (c1 == c2) {
  ------------------
  |  Branch (673:13): [True: 473, False: 242]
  ------------------
  674|       |
  675|    473|            if (c1) {
  ------------------
  |  Branch (675:17): [True: 473, False: 0]
  ------------------
  676|    473|                n--;
  677|    473|                continue;
  678|    473|            }
  679|       |
  680|      0|            return 0;
  681|    473|        }
  682|       |
  683|    242|        return c1 - c2;
  684|    715|    }
  685|       |
  686|     30|    return 0;
  687|    272|}
ngx_filename_cmp:
  928|     11|{
  929|     11|    ngx_uint_t  c1, c2;
  930|       |
  931|     22|    while (n) {
  ------------------
  |  Branch (931:12): [True: 11, False: 11]
  ------------------
  932|     11|        c1 = (ngx_uint_t) *s1++;
  933|     11|        c2 = (ngx_uint_t) *s2++;
  934|       |
  935|       |#if (NGX_HAVE_CASELESS_FILESYSTEM)
  936|       |        c1 = tolower(c1);
  937|       |        c2 = tolower(c2);
  938|       |#endif
  939|       |
  940|     11|        if (c1 == c2) {
  ------------------
  |  Branch (940:13): [True: 11, False: 0]
  ------------------
  941|       |
  942|     11|            if (c1) {
  ------------------
  |  Branch (942:17): [True: 11, False: 0]
  ------------------
  943|     11|                n--;
  944|     11|                continue;
  945|     11|            }
  946|       |
  947|      0|            return 0;
  948|     11|        }
  949|       |
  950|       |        /* we need '/' to be the lowest character */
  951|       |
  952|      0|        if (c1 == 0 || c2 == 0) {
  ------------------
  |  Branch (952:13): [True: 0, False: 0]
  |  Branch (952:24): [True: 0, False: 0]
  ------------------
  953|      0|            return c1 - c2;
  954|      0|        }
  955|       |
  956|      0|        c1 = (c1 == '/') ? 0 : c1;
  ------------------
  |  Branch (956:14): [True: 0, False: 0]
  ------------------
  957|      0|        c2 = (c2 == '/') ? 0 : c2;
  ------------------
  |  Branch (957:14): [True: 0, False: 0]
  ------------------
  958|       |
  959|      0|        return c1 - c2;
  960|      0|    }
  961|       |
  962|     11|    return 0;
  963|     11|}
ngx_atoi:
  968|     23|{
  969|     23|    ngx_int_t  value, cutoff, cutlim;
  970|       |
  971|     23|    if (n == 0) {
  ------------------
  |  Branch (971:9): [True: 0, False: 23]
  ------------------
  972|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  973|      0|    }
  974|       |
  975|     23|    cutoff = NGX_MAX_INT_T_VALUE / 10;
  ------------------
  |  |   92|     23|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  976|     23|    cutlim = NGX_MAX_INT_T_VALUE % 10;
  ------------------
  |  |   92|     23|#define NGX_MAX_INT_T_VALUE  9223372036854775807
  ------------------
  977|       |
  978|     79|    for (value = 0; n--; line++) {
  ------------------
  |  Branch (978:21): [True: 56, False: 23]
  ------------------
  979|     56|        if (*line < '0' || *line > '9') {
  ------------------
  |  Branch (979:13): [True: 0, False: 56]
  |  Branch (979:28): [True: 0, False: 56]
  ------------------
  980|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  981|      0|        }
  982|       |
  983|     56|        if (value >= cutoff && (value > cutoff || *line - '0' > cutlim)) {
  ------------------
  |  Branch (983:13): [True: 0, False: 56]
  |  Branch (983:33): [True: 0, False: 0]
  |  Branch (983:51): [True: 0, False: 0]
  ------------------
  984|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  985|      0|        }
  986|       |
  987|     56|        value = value * 10 + (*line - '0');
  988|     56|    }
  989|       |
  990|     23|    return value;
  991|     23|}
ngx_atosz:
 1052|      4|{
 1053|      4|    ssize_t  value, cutoff, cutlim;
 1054|       |
 1055|      4|    if (n == 0) {
  ------------------
  |  Branch (1055:9): [True: 0, False: 4]
  ------------------
 1056|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1057|      0|    }
 1058|       |
 1059|      4|    cutoff = NGX_MAX_SIZE_T_VALUE / 10;
  ------------------
  |  |  187|      4|#define NGX_MAX_SIZE_T_VALUE  9223372036854775807LL
  ------------------
 1060|      4|    cutlim = NGX_MAX_SIZE_T_VALUE % 10;
  ------------------
  |  |  187|      4|#define NGX_MAX_SIZE_T_VALUE  9223372036854775807LL
  ------------------
 1061|       |
 1062|     10|    for (value = 0; n--; line++) {
  ------------------
  |  Branch (1062:21): [True: 6, False: 4]
  ------------------
 1063|      6|        if (*line < '0' || *line > '9') {
  ------------------
  |  Branch (1063:13): [True: 0, False: 6]
  |  Branch (1063:28): [True: 0, False: 6]
  ------------------
 1064|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1065|      0|        }
 1066|       |
 1067|      6|        if (value >= cutoff && (value > cutoff || *line - '0' > cutlim)) {
  ------------------
  |  Branch (1067:13): [True: 0, False: 6]
  |  Branch (1067:33): [True: 0, False: 0]
  |  Branch (1067:51): [True: 0, False: 0]
  ------------------
 1068|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1069|      0|        }
 1070|       |
 1071|      6|        value = value * 10 + (*line - '0');
 1072|      6|    }
 1073|       |
 1074|      4|    return value;
 1075|      4|}
ngx_atoof:
 1080|      5|{
 1081|      5|    off_t  value, cutoff, cutlim;
 1082|       |
 1083|      5|    if (n == 0) {
  ------------------
  |  Branch (1083:9): [True: 0, False: 5]
  ------------------
 1084|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1085|      0|    }
 1086|       |
 1087|      5|    cutoff = NGX_MAX_OFF_T_VALUE / 10;
  ------------------
  |  |  197|      5|#define NGX_MAX_OFF_T_VALUE  9223372036854775807LL
  ------------------
 1088|      5|    cutlim = NGX_MAX_OFF_T_VALUE % 10;
  ------------------
  |  |  197|      5|#define NGX_MAX_OFF_T_VALUE  9223372036854775807LL
  ------------------
 1089|       |
 1090|     42|    for (value = 0; n--; line++) {
  ------------------
  |  Branch (1090:21): [True: 37, False: 5]
  ------------------
 1091|     37|        if (*line < '0' || *line > '9') {
  ------------------
  |  Branch (1091:13): [True: 0, False: 37]
  |  Branch (1091:28): [True: 0, False: 37]
  ------------------
 1092|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1093|      0|        }
 1094|       |
 1095|     37|        if (value >= cutoff && (value > cutoff || *line - '0' > cutlim)) {
  ------------------
  |  Branch (1095:13): [True: 0, False: 37]
  |  Branch (1095:33): [True: 0, False: 0]
  |  Branch (1095:51): [True: 0, False: 0]
  ------------------
 1096|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1097|      0|        }
 1098|       |
 1099|     37|        value = value * 10 + (*line - '0');
 1100|     37|    }
 1101|       |
 1102|      5|    return value;
 1103|      5|}
ngx_escape_uri:
 1496|      1|{
 1497|      1|    ngx_uint_t      n;
 1498|      1|    uint32_t       *escape;
 1499|      1|    static u_char   hex[] = "0123456789ABCDEF";
 1500|       |
 1501|       |    /*
 1502|       |     * Per RFC 3986 only the following chars are allowed in URIs unescaped:
 1503|       |     *
 1504|       |     * unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
 1505|       |     * gen-delims    = ":" / "/" / "?" / "#" / "[" / "]" / "@"
 1506|       |     * sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
 1507|       |     *               / "*" / "+" / "," / ";" / "="
 1508|       |     *
 1509|       |     * And "%" can appear as a part of escaping itself.  The following
 1510|       |     * characters are not allowed and need to be escaped: %00-%1F, %7F-%FF,
 1511|       |     * " ", """, "<", ">", "\", "^", "`", "{", "|", "}".
 1512|       |     */
 1513|       |
 1514|       |                    /* " ", "#", "%", "?", not allowed */
 1515|       |
 1516|      1|    static uint32_t   uri[] = {
 1517|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1518|       |
 1519|       |                    /* ?>=< ;:98 7654 3210  /.-, +*)( '&%$ #"!  */
 1520|      1|        0xd000002d, /* 1101 0000 0000 0000  0000 0000 0010 1101 */
 1521|       |
 1522|       |                    /* _^]\ [ZYX WVUT SRQP  ONML KJIH GFED CBA@ */
 1523|      1|        0x50000000, /* 0101 0000 0000 0000  0000 0000 0000 0000 */
 1524|       |
 1525|       |                    /*  ~}| {zyx wvut srqp  onml kjih gfed cba` */
 1526|      1|        0xb8000001, /* 1011 1000 0000 0000  0000 0000 0000 0001 */
 1527|       |
 1528|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1529|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1530|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1531|      1|        0xffffffff  /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1532|      1|    };
 1533|       |
 1534|       |                    /* " ", "#", "%", "&", "+", ";", "?", not allowed */
 1535|       |
 1536|      1|    static uint32_t   args[] = {
 1537|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1538|       |
 1539|       |                    /* ?>=< ;:98 7654 3210  /.-, +*)( '&%$ #"!  */
 1540|      1|        0xd800086d, /* 1101 1000 0000 0000  0000 1000 0110 1101 */
 1541|       |
 1542|       |                    /* _^]\ [ZYX WVUT SRQP  ONML KJIH GFED CBA@ */
 1543|      1|        0x50000000, /* 0101 0000 0000 0000  0000 0000 0000 0000 */
 1544|       |
 1545|       |                    /*  ~}| {zyx wvut srqp  onml kjih gfed cba` */
 1546|      1|        0xb8000001, /* 1011 1000 0000 0000  0000 0000 0000 0001 */
 1547|       |
 1548|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1549|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1550|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1551|      1|        0xffffffff  /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1552|      1|    };
 1553|       |
 1554|       |                    /* not ALPHA, DIGIT, "-", ".", "_", "~" */
 1555|       |
 1556|      1|    static uint32_t   uri_component[] = {
 1557|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1558|       |
 1559|       |                    /* ?>=< ;:98 7654 3210  /.-, +*)( '&%$ #"!  */
 1560|      1|        0xfc009fff, /* 1111 1100 0000 0000  1001 1111 1111 1111 */
 1561|       |
 1562|       |                    /* _^]\ [ZYX WVUT SRQP  ONML KJIH GFED CBA@ */
 1563|      1|        0x78000001, /* 0111 1000 0000 0000  0000 0000 0000 0001 */
 1564|       |
 1565|       |                    /*  ~}| {zyx wvut srqp  onml kjih gfed cba` */
 1566|      1|        0xb8000001, /* 1011 1000 0000 0000  0000 0000 0000 0001 */
 1567|       |
 1568|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1569|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1570|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1571|      1|        0xffffffff  /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1572|      1|    };
 1573|       |
 1574|       |                    /* " ", "#", """, "%", "'", not allowed */
 1575|       |
 1576|      1|    static uint32_t   html[] = {
 1577|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1578|       |
 1579|       |                    /* ?>=< ;:98 7654 3210  /.-, +*)( '&%$ #"!  */
 1580|      1|        0x500000ad, /* 0101 0000 0000 0000  0000 0000 1010 1101 */
 1581|       |
 1582|       |                    /* _^]\ [ZYX WVUT SRQP  ONML KJIH GFED CBA@ */
 1583|      1|        0x50000000, /* 0101 0000 0000 0000  0000 0000 0000 0000 */
 1584|       |
 1585|       |                    /*  ~}| {zyx wvut srqp  onml kjih gfed cba` */
 1586|      1|        0xb8000001, /* 1011 1000 0000 0000  0000 0000 0000 0001 */
 1587|       |
 1588|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1589|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1590|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1591|      1|        0xffffffff  /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1592|      1|    };
 1593|       |
 1594|       |                    /* " ", """, "'", not allowed */
 1595|       |
 1596|      1|    static uint32_t   refresh[] = {
 1597|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1598|       |
 1599|       |                    /* ?>=< ;:98 7654 3210  /.-, +*)( '&%$ #"!  */
 1600|      1|        0x50000085, /* 0101 0000 0000 0000  0000 0000 1000 0101 */
 1601|       |
 1602|       |                    /* _^]\ [ZYX WVUT SRQP  ONML KJIH GFED CBA@ */
 1603|      1|        0x50000000, /* 0101 0000 0000 0000  0000 0000 0000 0000 */
 1604|       |
 1605|       |                    /*  ~}| {zyx wvut srqp  onml kjih gfed cba` */
 1606|      1|        0xd8000001, /* 1011 1000 0000 0000  0000 0000 0000 0001 */
 1607|       |
 1608|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1609|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1610|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1611|      1|        0xffffffff  /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1612|      1|    };
 1613|       |
 1614|       |                    /* " ", "%", %00-%1F */
 1615|       |
 1616|      1|    static uint32_t   memcached[] = {
 1617|      1|        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
 1618|       |
 1619|       |                    /* ?>=< ;:98 7654 3210  /.-, +*)( '&%$ #"!  */
 1620|      1|        0x00000021, /* 0000 0000 0000 0000  0000 0000 0010 0001 */
 1621|       |
 1622|       |                    /* _^]\ [ZYX WVUT SRQP  ONML KJIH GFED CBA@ */
 1623|      1|        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
 1624|       |
 1625|       |                    /*  ~}| {zyx wvut srqp  onml kjih gfed cba` */
 1626|      1|        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
 1627|       |
 1628|      1|        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
 1629|      1|        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
 1630|      1|        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
 1631|      1|        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
 1632|      1|    };
 1633|       |
 1634|       |                    /* mail_auth is the same as memcached */
 1635|       |
 1636|      1|    static uint32_t  *map[] =
 1637|      1|        { uri, args, uri_component, html, refresh, memcached, memcached };
 1638|       |
 1639|       |
 1640|      1|    escape = map[type];
 1641|       |
 1642|      1|    if (dst == NULL) {
  ------------------
  |  Branch (1642:9): [True: 1, False: 0]
  ------------------
 1643|       |
 1644|       |        /* find the number of the characters to be escaped */
 1645|       |
 1646|      1|        n = 0;
 1647|       |
 1648|      2|        while (size) {
  ------------------
  |  Branch (1648:16): [True: 1, False: 1]
  ------------------
 1649|      1|            if (escape[*src >> 5] & (1U << (*src & 0x1f))) {
  ------------------
  |  Branch (1649:17): [True: 0, False: 1]
  ------------------
 1650|      0|                n++;
 1651|      0|            }
 1652|      1|            src++;
 1653|      1|            size--;
 1654|      1|        }
 1655|       |
 1656|      1|        return (uintptr_t) n;
 1657|      1|    }
 1658|       |
 1659|      0|    while (size) {
  ------------------
  |  Branch (1659:12): [True: 0, False: 0]
  ------------------
 1660|      0|        if (escape[*src >> 5] & (1U << (*src & 0x1f))) {
  ------------------
  |  Branch (1660:13): [True: 0, False: 0]
  ------------------
 1661|      0|            *dst++ = '%';
 1662|      0|            *dst++ = hex[*src >> 4];
 1663|      0|            *dst++ = hex[*src & 0xf];
 1664|      0|            src++;
 1665|       |
 1666|      0|        } else {
 1667|      0|            *dst++ = *src++;
 1668|      0|        }
 1669|      0|        size--;
 1670|      0|    }
 1671|       |
 1672|      0|    return (uintptr_t) dst;
 1673|      1|}
ngx_sort:
 2055|      1|{
 2056|      1|    u_char  *p1, *p2, *p;
 2057|       |
 2058|      1|    p = ngx_alloc(size, ngx_cycle->log);
 2059|      1|    if (p == NULL) {
  ------------------
  |  Branch (2059:9): [True: 0, False: 1]
  ------------------
 2060|      0|        return;
 2061|      0|    }
 2062|       |
 2063|      1|    for (p1 = (u_char *) base + size;
 2064|      1|         p1 < (u_char *) base + n * size;
  ------------------
  |  Branch (2064:10): [True: 0, False: 1]
  ------------------
 2065|      1|         p1 += size)
 2066|      0|    {
 2067|      0|        ngx_memcpy(p, p1, size);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 2068|       |
 2069|      0|        for (p2 = p1;
 2070|      0|             p2 > (u_char *) base && cmp(p2 - size, p) > 0;
  ------------------
  |  Branch (2070:14): [True: 0, False: 0]
  |  Branch (2070:38): [True: 0, False: 0]
  ------------------
 2071|      0|             p2 -= size)
 2072|      0|        {
 2073|      0|            ngx_memcpy(p2, p2 - size, size);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 2074|      0|        }
 2075|       |
 2076|      0|        ngx_memcpy(p2, p, size);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 2077|      0|    }
 2078|       |
 2079|      1|    ngx_free(p);
  ------------------
  |  |   19|      1|#define ngx_free          free
  ------------------
 2080|      1|}
ngx_string.c:ngx_sprintf_num:
  487|    117|{
  488|    117|    u_char         *p, temp[NGX_INT64_LEN + 1];
  489|       |                       /*
  490|       |                        * we need temp[NGX_INT64_LEN] only,
  491|       |                        * but icc issues the warning
  492|       |                        */
  493|    117|    size_t          len;
  494|    117|    uint32_t        ui32;
  495|    117|    static u_char   hex[] = "0123456789abcdef";
  496|    117|    static u_char   HEX[] = "0123456789ABCDEF";
  497|       |
  498|    117|    p = temp + NGX_INT64_LEN;
  ------------------
  |  |   84|    117|#define NGX_INT64_LEN   (sizeof("-9223372036854775808") - 1)
  ------------------
  499|       |
  500|    117|    if (hexadecimal == 0) {
  ------------------
  |  Branch (500:9): [True: 117, False: 0]
  ------------------
  501|       |
  502|    117|        if (ui64 <= (uint64_t) NGX_MAX_UINT32_VALUE) {
  ------------------
  |  |  128|    117|#define NGX_MAX_UINT32_VALUE  (uint32_t) 0xffffffff
  ------------------
  |  Branch (502:13): [True: 117, False: 0]
  ------------------
  503|       |
  504|       |            /*
  505|       |             * To divide 64-bit numbers and to find remainders
  506|       |             * on the x86 platform gcc and icc call the libc functions
  507|       |             * [u]divdi3() and [u]moddi3(), they call another function
  508|       |             * in its turn.  On FreeBSD it is the qdivrem() function,
  509|       |             * its source code is about 170 lines of the code.
  510|       |             * The glibc counterpart is about 150 lines of the code.
  511|       |             *
  512|       |             * For 32-bit numbers and some divisors gcc and icc use
  513|       |             * a inlined multiplication and shifts.  For example,
  514|       |             * unsigned "i32 / 10" is compiled to
  515|       |             *
  516|       |             *     (i32 * 0xCCCCCCCD) >> 35
  517|       |             */
  518|       |
  519|    117|            ui32 = (uint32_t) ui64;
  520|       |
  521|    195|            do {
  522|    195|                *--p = (u_char) (ui32 % 10 + '0');
  523|    195|            } while (ui32 /= 10);
  ------------------
  |  Branch (523:22): [True: 78, False: 117]
  ------------------
  524|       |
  525|    117|        } else {
  526|      0|            do {
  527|      0|                *--p = (u_char) (ui64 % 10 + '0');
  528|      0|            } while (ui64 /= 10);
  ------------------
  |  Branch (528:22): [True: 0, False: 0]
  ------------------
  529|      0|        }
  530|       |
  531|    117|    } else if (hexadecimal == 1) {
  ------------------
  |  Branch (531:16): [True: 0, False: 0]
  ------------------
  532|       |
  533|      0|        do {
  534|       |
  535|       |            /* the "(uint32_t)" cast disables the BCC's warning */
  536|      0|            *--p = hex[(uint32_t) (ui64 & 0xf)];
  537|       |
  538|      0|        } while (ui64 >>= 4);
  ------------------
  |  Branch (538:18): [True: 0, False: 0]
  ------------------
  539|       |
  540|      0|    } else { /* hexadecimal == 2 */
  541|       |
  542|      0|        do {
  543|       |
  544|       |            /* the "(uint32_t)" cast disables the BCC's warning */
  545|      0|            *--p = HEX[(uint32_t) (ui64 & 0xf)];
  546|       |
  547|      0|        } while (ui64 >>= 4);
  ------------------
  |  Branch (547:18): [True: 0, False: 0]
  ------------------
  548|      0|    }
  549|       |
  550|       |    /* zero or space padding */
  551|       |
  552|    117|    len = (temp + NGX_INT64_LEN) - p;
  ------------------
  |  |   84|    117|#define NGX_INT64_LEN   (sizeof("-9223372036854775808") - 1)
  ------------------
  553|       |
  554|    214|    while (len++ < width && buf < last) {
  ------------------
  |  Branch (554:12): [True: 97, False: 117]
  |  Branch (554:29): [True: 97, False: 0]
  ------------------
  555|     97|        *buf++ = zero;
  556|     97|    }
  557|       |
  558|       |    /* number safe copy */
  559|       |
  560|    117|    len = (temp + NGX_INT64_LEN) - p;
  ------------------
  |  |   84|    117|#define NGX_INT64_LEN   (sizeof("-9223372036854775808") - 1)
  ------------------
  561|       |
  562|    117|    if (buf + len > last) {
  ------------------
  |  Branch (562:9): [True: 0, False: 117]
  ------------------
  563|      0|        len = last - buf;
  564|      0|    }
  565|       |
  566|    117|    return ngx_cpymem(buf, p, len);
  ------------------
  |  |  107|    117|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  567|    117|}
ngx_string.c:ngx_sprintf_str:
  573|      9|{
  574|      9|    static u_char   hex[] = "0123456789abcdef";
  575|      9|    static u_char   HEX[] = "0123456789ABCDEF";
  576|       |
  577|      9|    if (hexadecimal == 0) {
  ------------------
  |  Branch (577:9): [True: 9, False: 0]
  ------------------
  578|       |
  579|      9|        if (len == (size_t) -1) {
  ------------------
  |  Branch (579:13): [True: 8, False: 1]
  ------------------
  580|     32|            while (*src && buf < last) {
  ------------------
  |  Branch (580:20): [True: 24, False: 8]
  |  Branch (580:28): [True: 24, False: 0]
  ------------------
  581|     24|                *buf++ = *src++;
  582|     24|            }
  583|       |
  584|      8|        } else {
  585|      1|            len = ngx_min((size_t) (last - buf), len);
  ------------------
  |  |  110|      1|#define ngx_min(val1, val2)  ((val1 > val2) ? (val2) : (val1))
  |  |  ------------------
  |  |  |  Branch (110:31): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  586|      1|            buf = ngx_cpymem(buf, src, len);
  ------------------
  |  |  107|      1|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  587|      1|        }
  588|       |
  589|      9|    } else if (hexadecimal == 1) {
  ------------------
  |  Branch (589:16): [True: 0, False: 0]
  ------------------
  590|       |
  591|      0|        if (len == (size_t) -1) {
  ------------------
  |  Branch (591:13): [True: 0, False: 0]
  ------------------
  592|       |
  593|      0|            while (*src && buf < last - 1) {
  ------------------
  |  Branch (593:20): [True: 0, False: 0]
  |  Branch (593:28): [True: 0, False: 0]
  ------------------
  594|      0|                *buf++ = hex[*src >> 4];
  595|      0|                *buf++ = hex[*src++ & 0xf];
  596|      0|            }
  597|       |
  598|      0|        } else {
  599|       |
  600|      0|            while (len-- && buf < last - 1) {
  ------------------
  |  Branch (600:20): [True: 0, False: 0]
  |  Branch (600:29): [True: 0, False: 0]
  ------------------
  601|      0|                *buf++ = hex[*src >> 4];
  602|      0|                *buf++ = hex[*src++ & 0xf];
  603|      0|            }
  604|      0|        }
  605|       |
  606|      0|    } else { /* hexadecimal == 2 */
  607|       |
  608|      0|        if (len == (size_t) -1) {
  ------------------
  |  Branch (608:13): [True: 0, False: 0]
  ------------------
  609|       |
  610|      0|            while (*src && buf < last - 1) {
  ------------------
  |  Branch (610:20): [True: 0, False: 0]
  |  Branch (610:28): [True: 0, False: 0]
  ------------------
  611|      0|                *buf++ = HEX[*src >> 4];
  612|      0|                *buf++ = HEX[*src++ & 0xf];
  613|      0|            }
  614|       |
  615|      0|        } else {
  616|       |
  617|      0|            while (len-- && buf < last - 1) {
  ------------------
  |  Branch (617:20): [True: 0, False: 0]
  |  Branch (617:29): [True: 0, False: 0]
  ------------------
  618|      0|                *buf++ = HEX[*src >> 4];
  619|      0|                *buf++ = HEX[*src++ & 0xf];
  620|      0|            }
  621|      0|        }
  622|      0|    }
  623|       |
  624|      9|    return buf;
  625|      9|}

ngx_inet.c:ngx_strlchr:
   69|     63|{
   70|    895|    while (p < last) {
  ------------------
  |  Branch (70:12): [True: 842, False: 53]
  ------------------
   71|       |
   72|    842|        if (*p == c) {
  ------------------
  |  Branch (72:13): [True: 10, False: 832]
  ------------------
   73|     10|            return p;
   74|     10|        }
   75|       |
   76|    832|        p++;
   77|    832|    }
   78|       |
   79|     53|    return NULL;
   80|     63|}

ngx_time_init:
   67|      1|{
   68|      1|    ngx_cached_err_log_time.len = sizeof("1970/09/28 12:00:00") - 1;
   69|      1|    ngx_cached_http_time.len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT") - 1;
   70|      1|    ngx_cached_http_log_time.len = sizeof("28/Sep/1970:12:00:00 +0600") - 1;
   71|      1|    ngx_cached_http_log_iso8601.len = sizeof("1970-09-28T12:00:00+06:00") - 1;
   72|      1|    ngx_cached_syslog_time.len = sizeof("Sep 28 12:00:00") - 1;
   73|       |
   74|      1|    ngx_cached_time = &cached_time[0];
   75|       |
   76|      1|    ngx_time_update();
   77|      1|}
ngx_time_update:
   82|      2|{
   83|      2|    u_char          *p0, *p1, *p2, *p3, *p4;
   84|      2|    ngx_tm_t         tm, gmt;
   85|      2|    time_t           sec;
   86|      2|    ngx_uint_t       msec;
   87|      2|    ngx_time_t      *tp;
   88|      2|    struct timeval   tv;
   89|       |
   90|      2|    if (!ngx_trylock(&ngx_time_lock)) {
  ------------------
  |  |  309|      2|#define ngx_trylock(lock)  (*(lock) == 0 && ngx_atomic_cmp_set(lock, 0, 1))
  |  |  ------------------
  |  |  |  |   60|      2|    __sync_bool_compare_and_swap(lock, old, set)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:5): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (309:29): [True: 2, False: 0]
  |  |  ------------------
  ------------------
   91|      0|        return;
   92|      0|    }
   93|       |
   94|      2|    ngx_gettimeofday(&tv);
  ------------------
  |  |   61|      2|#define ngx_gettimeofday(tp)  (void) gettimeofday(tp, NULL);
  ------------------
   95|       |
   96|      2|    sec = tv.tv_sec;
   97|      2|    msec = tv.tv_usec / 1000;
   98|       |
   99|      2|    ngx_current_msec = ngx_monotonic_time(sec, msec);
  100|       |
  101|      2|    tp = &cached_time[slot];
  102|       |
  103|      2|    if (tp->sec == sec) {
  ------------------
  |  Branch (103:9): [True: 0, False: 2]
  ------------------
  104|      0|        tp->msec = msec;
  105|      0|        ngx_unlock(&ngx_time_lock);
  ------------------
  |  |  310|      0|#define ngx_unlock(lock)    *(lock) = 0
  ------------------
  106|      0|        return;
  107|      0|    }
  108|       |
  109|      2|    if (slot == NGX_TIME_SLOTS - 1) {
  ------------------
  |  |   24|      2|#define NGX_TIME_SLOTS   64
  ------------------
  |  Branch (109:9): [True: 0, False: 2]
  ------------------
  110|      0|        slot = 0;
  111|      2|    } else {
  112|      2|        slot++;
  113|      2|    }
  114|       |
  115|      2|    tp = &cached_time[slot];
  116|       |
  117|      2|    tp->sec = sec;
  118|      2|    tp->msec = msec;
  119|       |
  120|      2|    ngx_gmtime(sec, &gmt);
  121|       |
  122|       |
  123|      2|    p0 = &cached_http_time[slot][0];
  124|       |
  125|      2|    (void) ngx_sprintf(p0, "%s, %02d %s %4d %02d:%02d:%02d GMT",
  126|      2|                       week[gmt.ngx_tm_wday], gmt.ngx_tm_mday,
  ------------------
  |  |   27|      2|#define ngx_tm_wday           tm_wday
  ------------------
                                     week[gmt.ngx_tm_wday], gmt.ngx_tm_mday,
  ------------------
  |  |   24|      2|#define ngx_tm_mday           tm_mday
  ------------------
  127|      2|                       months[gmt.ngx_tm_mon - 1], gmt.ngx_tm_year,
  ------------------
  |  |   25|      2|#define ngx_tm_mon            tm_mon
  ------------------
                                     months[gmt.ngx_tm_mon - 1], gmt.ngx_tm_year,
  ------------------
  |  |   26|      2|#define ngx_tm_year           tm_year
  ------------------
  128|      2|                       gmt.ngx_tm_hour, gmt.ngx_tm_min, gmt.ngx_tm_sec);
  ------------------
  |  |   23|      2|#define ngx_tm_hour           tm_hour
  ------------------
                                     gmt.ngx_tm_hour, gmt.ngx_tm_min, gmt.ngx_tm_sec);
  ------------------
  |  |   22|      2|#define ngx_tm_min            tm_min
  ------------------
                                     gmt.ngx_tm_hour, gmt.ngx_tm_min, gmt.ngx_tm_sec);
  ------------------
  |  |   21|      2|#define ngx_tm_sec            tm_sec
  ------------------
  129|       |
  130|       |#if (NGX_HAVE_GETTIMEZONE)
  131|       |
  132|       |    tp->gmtoff = ngx_gettimezone();
  133|       |    ngx_gmtime(sec + tp->gmtoff * 60, &tm);
  134|       |
  135|       |#elif (NGX_HAVE_GMTOFF)
  136|       |
  137|      2|    ngx_localtime(sec, &tm);
  138|      2|    cached_gmtoff = (ngx_int_t) (tm.ngx_tm_gmtoff / 60);
  ------------------
  |  |   40|      2|#define ngx_tm_gmtoff         tm_gmtoff
  ------------------
  139|      2|    tp->gmtoff = cached_gmtoff;
  140|       |
  141|       |#else
  142|       |
  143|       |    ngx_localtime(sec, &tm);
  144|       |    cached_gmtoff = ngx_timezone(tm.ngx_tm_isdst);
  145|       |    tp->gmtoff = cached_gmtoff;
  146|       |
  147|       |#endif
  148|       |
  149|       |
  150|      2|    p1 = &cached_err_log_time[slot][0];
  151|       |
  152|      2|    (void) ngx_sprintf(p1, "%4d/%02d/%02d %02d:%02d:%02d",
  153|      2|                       tm.ngx_tm_year, tm.ngx_tm_mon,
  ------------------
  |  |   26|      2|#define ngx_tm_year           tm_year
  ------------------
                                     tm.ngx_tm_year, tm.ngx_tm_mon,
  ------------------
  |  |   25|      2|#define ngx_tm_mon            tm_mon
  ------------------
  154|      2|                       tm.ngx_tm_mday, tm.ngx_tm_hour,
  ------------------
  |  |   24|      2|#define ngx_tm_mday           tm_mday
  ------------------
                                     tm.ngx_tm_mday, tm.ngx_tm_hour,
  ------------------
  |  |   23|      2|#define ngx_tm_hour           tm_hour
  ------------------
  155|      2|                       tm.ngx_tm_min, tm.ngx_tm_sec);
  ------------------
  |  |   22|      2|#define ngx_tm_min            tm_min
  ------------------
                                     tm.ngx_tm_min, tm.ngx_tm_sec);
  ------------------
  |  |   21|      2|#define ngx_tm_sec            tm_sec
  ------------------
  156|       |
  157|       |
  158|      2|    p2 = &cached_http_log_time[slot][0];
  159|       |
  160|      2|    (void) ngx_sprintf(p2, "%02d/%s/%d:%02d:%02d:%02d %c%02i%02i",
  161|      2|                       tm.ngx_tm_mday, months[tm.ngx_tm_mon - 1],
  ------------------
  |  |   24|      2|#define ngx_tm_mday           tm_mday
  ------------------
                                     tm.ngx_tm_mday, months[tm.ngx_tm_mon - 1],
  ------------------
  |  |   25|      2|#define ngx_tm_mon            tm_mon
  ------------------
  162|      2|                       tm.ngx_tm_year, tm.ngx_tm_hour,
  ------------------
  |  |   26|      2|#define ngx_tm_year           tm_year
  ------------------
                                     tm.ngx_tm_year, tm.ngx_tm_hour,
  ------------------
  |  |   23|      2|#define ngx_tm_hour           tm_hour
  ------------------
  163|      2|                       tm.ngx_tm_min, tm.ngx_tm_sec,
  ------------------
  |  |   22|      2|#define ngx_tm_min            tm_min
  ------------------
                                     tm.ngx_tm_min, tm.ngx_tm_sec,
  ------------------
  |  |   21|      2|#define ngx_tm_sec            tm_sec
  ------------------
  164|      2|                       tp->gmtoff < 0 ? '-' : '+',
  ------------------
  |  Branch (164:24): [True: 0, False: 2]
  ------------------
  165|      2|                       ngx_abs(tp->gmtoff / 60), ngx_abs(tp->gmtoff % 60));
  ------------------
  |  |  108|      2|#define ngx_abs(value)       (((value) >= 0) ? (value) : - (value))
  |  |  ------------------
  |  |  |  Branch (108:31): [True: 2, False: 0]
  |  |  ------------------
  ------------------
                                     ngx_abs(tp->gmtoff / 60), ngx_abs(tp->gmtoff % 60));
  ------------------
  |  |  108|      2|#define ngx_abs(value)       (((value) >= 0) ? (value) : - (value))
  |  |  ------------------
  |  |  |  Branch (108:31): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  166|       |
  167|      2|    p3 = &cached_http_log_iso8601[slot][0];
  168|       |
  169|      2|    (void) ngx_sprintf(p3, "%4d-%02d-%02dT%02d:%02d:%02d%c%02i:%02i",
  170|      2|                       tm.ngx_tm_year, tm.ngx_tm_mon,
  ------------------
  |  |   26|      2|#define ngx_tm_year           tm_year
  ------------------
                                     tm.ngx_tm_year, tm.ngx_tm_mon,
  ------------------
  |  |   25|      2|#define ngx_tm_mon            tm_mon
  ------------------
  171|      2|                       tm.ngx_tm_mday, tm.ngx_tm_hour,
  ------------------
  |  |   24|      2|#define ngx_tm_mday           tm_mday
  ------------------
                                     tm.ngx_tm_mday, tm.ngx_tm_hour,
  ------------------
  |  |   23|      2|#define ngx_tm_hour           tm_hour
  ------------------
  172|      2|                       tm.ngx_tm_min, tm.ngx_tm_sec,
  ------------------
  |  |   22|      2|#define ngx_tm_min            tm_min
  ------------------
                                     tm.ngx_tm_min, tm.ngx_tm_sec,
  ------------------
  |  |   21|      2|#define ngx_tm_sec            tm_sec
  ------------------
  173|      2|                       tp->gmtoff < 0 ? '-' : '+',
  ------------------
  |  Branch (173:24): [True: 0, False: 2]
  ------------------
  174|      2|                       ngx_abs(tp->gmtoff / 60), ngx_abs(tp->gmtoff % 60));
  ------------------
  |  |  108|      2|#define ngx_abs(value)       (((value) >= 0) ? (value) : - (value))
  |  |  ------------------
  |  |  |  Branch (108:31): [True: 2, False: 0]
  |  |  ------------------
  ------------------
                                     ngx_abs(tp->gmtoff / 60), ngx_abs(tp->gmtoff % 60));
  ------------------
  |  |  108|      2|#define ngx_abs(value)       (((value) >= 0) ? (value) : - (value))
  |  |  ------------------
  |  |  |  Branch (108:31): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  175|       |
  176|      2|    p4 = &cached_syslog_time[slot][0];
  177|       |
  178|      2|    (void) ngx_sprintf(p4, "%s %2d %02d:%02d:%02d",
  179|      2|                       months[tm.ngx_tm_mon - 1], tm.ngx_tm_mday,
  ------------------
  |  |   25|      2|#define ngx_tm_mon            tm_mon
  ------------------
                                     months[tm.ngx_tm_mon - 1], tm.ngx_tm_mday,
  ------------------
  |  |   24|      2|#define ngx_tm_mday           tm_mday
  ------------------
  180|      2|                       tm.ngx_tm_hour, tm.ngx_tm_min, tm.ngx_tm_sec);
  ------------------
  |  |   23|      2|#define ngx_tm_hour           tm_hour
  ------------------
                                     tm.ngx_tm_hour, tm.ngx_tm_min, tm.ngx_tm_sec);
  ------------------
  |  |   22|      2|#define ngx_tm_min            tm_min
  ------------------
                                     tm.ngx_tm_hour, tm.ngx_tm_min, tm.ngx_tm_sec);
  ------------------
  |  |   21|      2|#define ngx_tm_sec            tm_sec
  ------------------
  181|       |
  182|      2|    ngx_memory_barrier();
  ------------------
  |  |   65|      2|#define ngx_memory_barrier()        __sync_synchronize()
  ------------------
  183|       |
  184|      2|    ngx_cached_time = tp;
  185|      2|    ngx_cached_http_time.data = p0;
  186|      2|    ngx_cached_err_log_time.data = p1;
  187|      2|    ngx_cached_http_log_time.data = p2;
  188|      2|    ngx_cached_http_log_iso8601.data = p3;
  189|      2|    ngx_cached_syslog_time.data = p4;
  190|       |
  191|      2|    ngx_unlock(&ngx_time_lock);
  ------------------
  |  |  310|      2|#define ngx_unlock(lock)    *(lock) = 0
  ------------------
  192|      2|}
ngx_gmtime:
  325|      2|{
  326|      2|    ngx_int_t   yday;
  327|      2|    ngx_uint_t  sec, min, hour, mday, mon, year, wday, days, leap;
  328|       |
  329|       |    /* the calculation is valid for positive time_t only */
  330|       |
  331|      2|    if (t < 0) {
  ------------------
  |  Branch (331:9): [True: 0, False: 2]
  ------------------
  332|      0|        t = 0;
  333|      0|    }
  334|       |
  335|      2|    days = t / 86400;
  336|      2|    sec = t % 86400;
  337|       |
  338|       |    /*
  339|       |     * no more than 4 year digits supported,
  340|       |     * truncate to December 31, 9999, 23:59:59
  341|       |     */
  342|       |
  343|      2|    if (days > 2932896) {
  ------------------
  |  Branch (343:9): [True: 0, False: 2]
  ------------------
  344|      0|        days = 2932896;
  345|      0|        sec = 86399;
  346|      0|    }
  347|       |
  348|       |    /* January 1, 1970 was Thursday */
  349|       |
  350|      2|    wday = (4 + days) % 7;
  351|       |
  352|      2|    hour = sec / 3600;
  353|      2|    sec %= 3600;
  354|      2|    min = sec / 60;
  355|      2|    sec %= 60;
  356|       |
  357|       |    /*
  358|       |     * the algorithm based on Gauss' formula,
  359|       |     * see src/core/ngx_parse_time.c
  360|       |     */
  361|       |
  362|       |    /* days since March 1, 1 BC */
  363|      2|    days = days - (31 + 28) + 719527;
  364|       |
  365|       |    /*
  366|       |     * The "days" should be adjusted to 1 only, however, some March 1st's go
  367|       |     * to previous year, so we adjust them to 2.  This causes also shift of the
  368|       |     * last February days to next year, but we catch the case when "yday"
  369|       |     * becomes negative.
  370|       |     */
  371|       |
  372|      2|    year = (days + 2) * 400 / (365 * 400 + 100 - 4 + 1);
  373|       |
  374|      2|    yday = days - (365 * year + year / 4 - year / 100 + year / 400);
  375|       |
  376|      2|    if (yday < 0) {
  ------------------
  |  Branch (376:9): [True: 0, False: 2]
  ------------------
  377|      0|        leap = (year % 4 == 0) && (year % 100 || (year % 400 == 0));
  ------------------
  |  Branch (377:16): [True: 0, False: 0]
  |  Branch (377:36): [True: 0, False: 0]
  |  Branch (377:50): [True: 0, False: 0]
  ------------------
  378|      0|        yday = 365 + leap + yday;
  379|      0|        year--;
  380|      0|    }
  381|       |
  382|       |    /*
  383|       |     * The empirical formula that maps "yday" to month.
  384|       |     * There are at least 10 variants, some of them are:
  385|       |     *     mon = (yday + 31) * 15 / 459
  386|       |     *     mon = (yday + 31) * 17 / 520
  387|       |     *     mon = (yday + 31) * 20 / 612
  388|       |     */
  389|       |
  390|      2|    mon = (yday + 31) * 10 / 306;
  391|       |
  392|       |    /* the Gauss' formula that evaluates days before the month */
  393|       |
  394|      2|    mday = yday - (367 * mon / 12 - 30) + 1;
  395|       |
  396|      2|    if (yday >= 306) {
  ------------------
  |  Branch (396:9): [True: 0, False: 2]
  ------------------
  397|       |
  398|      0|        year++;
  399|      0|        mon -= 10;
  400|       |
  401|       |        /*
  402|       |         * there is no "yday" in Win32 SYSTEMTIME
  403|       |         *
  404|       |         * yday -= 306;
  405|       |         */
  406|       |
  407|      2|    } else {
  408|       |
  409|      2|        mon += 2;
  410|       |
  411|       |        /*
  412|       |         * there is no "yday" in Win32 SYSTEMTIME
  413|       |         *
  414|       |         * yday += 31 + 28 + leap;
  415|       |         */
  416|      2|    }
  417|       |
  418|      2|    tp->ngx_tm_sec = (ngx_tm_sec_t) sec;
  ------------------
  |  |   21|      2|#define ngx_tm_sec            tm_sec
  ------------------
  419|      2|    tp->ngx_tm_min = (ngx_tm_min_t) min;
  ------------------
  |  |   22|      2|#define ngx_tm_min            tm_min
  ------------------
  420|      2|    tp->ngx_tm_hour = (ngx_tm_hour_t) hour;
  ------------------
  |  |   23|      2|#define ngx_tm_hour           tm_hour
  ------------------
  421|      2|    tp->ngx_tm_mday = (ngx_tm_mday_t) mday;
  ------------------
  |  |   24|      2|#define ngx_tm_mday           tm_mday
  ------------------
  422|      2|    tp->ngx_tm_mon = (ngx_tm_mon_t) mon;
  ------------------
  |  |   25|      2|#define ngx_tm_mon            tm_mon
  ------------------
  423|      2|    tp->ngx_tm_year = (ngx_tm_year_t) year;
  ------------------
  |  |   26|      2|#define ngx_tm_year           tm_year
  ------------------
  424|      2|    tp->ngx_tm_wday = (ngx_tm_wday_t) wday;
  ------------------
  |  |   27|      2|#define ngx_tm_wday           tm_wday
  ------------------
  425|      2|}
ngx_times.c:ngx_monotonic_time:
  197|      2|{
  198|      2|#if (NGX_HAVE_CLOCK_MONOTONIC)
  199|      2|    struct timespec  ts;
  200|       |
  201|       |#if defined(CLOCK_MONOTONIC_FAST)
  202|       |    clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
  203|       |#else
  204|      2|    clock_gettime(CLOCK_MONOTONIC, &ts);
  205|      2|#endif
  206|       |
  207|      2|    sec = ts.tv_sec;
  208|      2|    msec = ts.tv_nsec / 1000000;
  209|       |
  210|      2|#endif
  211|       |
  212|      2|    return (ngx_msec_t) sec * 1000 + msec;
  213|      2|}

ngx_epoll_module.c:ngx_epoll_create_conf:
 1027|      1|{
 1028|      1|    ngx_epoll_conf_t  *epcf;
 1029|       |
 1030|      1|    epcf = ngx_palloc(cycle->pool, sizeof(ngx_epoll_conf_t));
 1031|      1|    if (epcf == NULL) {
  ------------------
  |  Branch (1031:9): [True: 0, False: 1]
  ------------------
 1032|      0|        return NULL;
 1033|      0|    }
 1034|       |
 1035|      1|    epcf->events = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1036|      1|    epcf->aio_requests = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1037|       |
 1038|      1|    return epcf;
 1039|      1|}
ngx_epoll_module.c:ngx_epoll_init_conf:
 1044|      1|{
 1045|      1|    ngx_epoll_conf_t *epcf = conf;
 1046|       |
 1047|      1|    ngx_conf_init_uint_value(epcf->events, 512);
  ------------------
  |  |  191|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (191:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  192|      1|        conf = default;                                                      \
  |  |  193|      1|    }
  ------------------
 1048|      1|    ngx_conf_init_uint_value(epcf->aio_requests, 32);
  ------------------
  |  |  191|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (191:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  192|      1|        conf = default;                                                      \
  |  |  193|      1|    }
  ------------------
 1049|       |
 1050|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1051|      1|}

ngx_handle_read_event:
  269|     12|{
  270|       |#if (NGX_QUIC)
  271|       |
  272|       |    ngx_connection_t  *c;
  273|       |
  274|       |    c = rev->data;
  275|       |
  276|       |    if (c->quic) {
  277|       |        return NGX_OK;
  278|       |    }
  279|       |
  280|       |#endif
  281|       |
  282|     12|    if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
  ------------------
  |  |  208|     12|#define NGX_USE_CLEAR_EVENT      0x00000004
  ------------------
  |  Branch (282:9): [True: 0, False: 12]
  ------------------
  283|       |
  284|       |        /* kqueue, epoll */
  285|       |
  286|      0|        if (!rev->active && !rev->ready) {
  ------------------
  |  Branch (286:13): [True: 0, False: 0]
  |  Branch (286:29): [True: 0, False: 0]
  ------------------
  287|      0|            if (ngx_add_event(rev, NGX_READ_EVENT, NGX_CLEAR_EVENT)
  ------------------
  |  |  403|      0|#define ngx_add_event        ngx_event_actions.add
  ------------------
                          if (ngx_add_event(rev, NGX_READ_EVENT, NGX_CLEAR_EVENT)
  ------------------
  |  |  349|      0|#define NGX_READ_EVENT     (EPOLLIN|EPOLLRDHUP)
  ------------------
                          if (ngx_add_event(rev, NGX_READ_EVENT, NGX_CLEAR_EVENT)
  ------------------
  |  |  353|      0|#define NGX_CLEAR_EVENT    EPOLLET
  ------------------
  |  Branch (287:17): [True: 0, False: 0]
  ------------------
  288|      0|                == NGX_ERROR)
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  289|      0|            {
  290|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  291|      0|            }
  292|      0|        }
  293|       |
  294|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  295|       |
  296|     12|    } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) {
  ------------------
  |  |  196|     12|#define NGX_USE_LEVEL_EVENT      0x00000001
  ------------------
  |  Branch (296:16): [True: 12, False: 0]
  ------------------
  297|       |
  298|       |        /* select, poll, /dev/poll */
  299|       |
  300|     12|        if (!rev->active && !rev->ready) {
  ------------------
  |  Branch (300:13): [True: 12, False: 0]
  |  Branch (300:29): [True: 4, False: 8]
  ------------------
  301|      4|            if (ngx_add_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT)
  ------------------
  |  |  403|      4|#define ngx_add_event        ngx_event_actions.add
  ------------------
                          if (ngx_add_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT)
  ------------------
  |  |  349|      4|#define NGX_READ_EVENT     (EPOLLIN|EPOLLRDHUP)
  ------------------
                          if (ngx_add_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT)
  ------------------
  |  |  352|      4|#define NGX_LEVEL_EVENT    0
  ------------------
  |  Branch (301:17): [True: 0, False: 4]
  ------------------
  302|      4|                == NGX_ERROR)
  ------------------
  |  |   39|      4|#define  NGX_ERROR      -1
  ------------------
  303|      0|            {
  304|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  305|      0|            }
  306|       |
  307|      4|            return NGX_OK;
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
  308|      4|        }
  309|       |
  310|      8|        if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) {
  ------------------
  |  |  281|      0|#define NGX_CLOSE_EVENT    1
  ------------------
  |  Branch (310:13): [True: 0, False: 8]
  |  Branch (310:29): [True: 0, False: 0]
  |  Branch (310:43): [True: 0, False: 0]
  ------------------
  311|      0|            if (ngx_del_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT | flags)
  ------------------
  |  |  404|      0|#define ngx_del_event        ngx_event_actions.del
  ------------------
                          if (ngx_del_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT | flags)
  ------------------
  |  |  349|      0|#define NGX_READ_EVENT     (EPOLLIN|EPOLLRDHUP)
  ------------------
                          if (ngx_del_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT | flags)
  ------------------
  |  |  352|      0|#define NGX_LEVEL_EVENT    0
  ------------------
  |  Branch (311:17): [True: 0, False: 0]
  ------------------
  312|      0|                == NGX_ERROR)
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  313|      0|            {
  314|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  315|      0|            }
  316|       |
  317|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  318|      0|        }
  319|       |
  320|      8|    } else if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) {
  ------------------
  |  |  263|      0|#define NGX_USE_EVENTPORT_EVENT  0x00001000
  ------------------
  |  Branch (320:16): [True: 0, False: 0]
  ------------------
  321|       |
  322|       |        /* event ports */
  323|       |
  324|      0|        if (!rev->active && !rev->ready) {
  ------------------
  |  Branch (324:13): [True: 0, False: 0]
  |  Branch (324:29): [True: 0, False: 0]
  ------------------
  325|      0|            if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |  403|      0|#define ngx_add_event        ngx_event_actions.add
  ------------------
                          if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |  349|      0|#define NGX_READ_EVENT     (EPOLLIN|EPOLLRDHUP)
  ------------------
                          if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (325:17): [True: 0, False: 0]
  ------------------
  326|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  327|      0|            }
  328|       |
  329|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  330|      0|        }
  331|       |
  332|      0|        if (rev->oneshot && rev->ready) {
  ------------------
  |  Branch (332:13): [True: 0, False: 0]
  |  Branch (332:29): [True: 0, False: 0]
  ------------------
  333|      0|            if (ngx_del_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |  404|      0|#define ngx_del_event        ngx_event_actions.del
  ------------------
                          if (ngx_del_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |  349|      0|#define NGX_READ_EVENT     (EPOLLIN|EPOLLRDHUP)
  ------------------
                          if (ngx_del_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (333:17): [True: 0, False: 0]
  ------------------
  334|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  335|      0|            }
  336|       |
  337|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  338|      0|        }
  339|      0|    }
  340|       |
  341|       |    /* iocp */
  342|       |
  343|      8|    return NGX_OK;
  ------------------
  |  |   38|      8|#define  NGX_OK          0
  ------------------
  344|     12|}
ngx_handle_write_event:
  349|     10|{
  350|     10|    ngx_connection_t  *c;
  351|       |
  352|     10|    c = wev->data;
  353|       |
  354|       |#if (NGX_QUIC)
  355|       |    if (c->quic) {
  356|       |        return NGX_OK;
  357|       |    }
  358|       |#endif
  359|       |
  360|     10|    if (lowat) {
  ------------------
  |  Branch (360:9): [True: 0, False: 10]
  ------------------
  361|      0|        if (ngx_send_lowat(c, lowat) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (361:13): [True: 0, False: 0]
  ------------------
  362|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  363|      0|        }
  364|      0|    }
  365|       |
  366|     10|    if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
  ------------------
  |  |  208|     10|#define NGX_USE_CLEAR_EVENT      0x00000004
  ------------------
  |  Branch (366:9): [True: 0, False: 10]
  ------------------
  367|       |
  368|       |        /* kqueue, epoll */
  369|       |
  370|      0|        if (!wev->active && !wev->ready) {
  ------------------
  |  Branch (370:13): [True: 0, False: 0]
  |  Branch (370:29): [True: 0, False: 0]
  ------------------
  371|      0|            if (ngx_add_event(wev, NGX_WRITE_EVENT,
  ------------------
  |  |  403|      0|#define ngx_add_event        ngx_event_actions.add
  ------------------
                          if (ngx_add_event(wev, NGX_WRITE_EVENT,
  ------------------
  |  |  350|      0|#define NGX_WRITE_EVENT    EPOLLOUT
  ------------------
  |  Branch (371:17): [True: 0, False: 0]
  ------------------
  372|      0|                              NGX_CLEAR_EVENT | (lowat ? NGX_LOWAT_EVENT : 0))
  ------------------
  |  |  353|      0|#define NGX_CLEAR_EVENT    EPOLLET
  ------------------
                                            NGX_CLEAR_EVENT | (lowat ? NGX_LOWAT_EVENT : 0))
  ------------------
  |  |  296|      0|#define NGX_LOWAT_EVENT    0
  ------------------
  |  Branch (372:50): [True: 0, False: 0]
  ------------------
  373|      0|                == NGX_ERROR)
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  374|      0|            {
  375|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  376|      0|            }
  377|      0|        }
  378|       |
  379|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  380|       |
  381|     10|    } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) {
  ------------------
  |  |  196|     10|#define NGX_USE_LEVEL_EVENT      0x00000001
  ------------------
  |  Branch (381:16): [True: 10, False: 0]
  ------------------
  382|       |
  383|       |        /* select, poll, /dev/poll */
  384|       |
  385|     10|        if (!wev->active && !wev->ready) {
  ------------------
  |  Branch (385:13): [True: 10, False: 0]
  |  Branch (385:29): [True: 0, False: 10]
  ------------------
  386|      0|            if (ngx_add_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT)
  ------------------
  |  |  403|      0|#define ngx_add_event        ngx_event_actions.add
  ------------------
                          if (ngx_add_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT)
  ------------------
  |  |  350|      0|#define NGX_WRITE_EVENT    EPOLLOUT
  ------------------
                          if (ngx_add_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT)
  ------------------
  |  |  352|      0|#define NGX_LEVEL_EVENT    0
  ------------------
  |  Branch (386:17): [True: 0, False: 0]
  ------------------
  387|      0|                == NGX_ERROR)
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  388|      0|            {
  389|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  390|      0|            }
  391|       |
  392|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  393|      0|        }
  394|       |
  395|     10|        if (wev->active && wev->ready) {
  ------------------
  |  Branch (395:13): [True: 0, False: 10]
  |  Branch (395:28): [True: 0, False: 0]
  ------------------
  396|      0|            if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT)
  ------------------
  |  |  404|      0|#define ngx_del_event        ngx_event_actions.del
  ------------------
                          if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT)
  ------------------
  |  |  350|      0|#define NGX_WRITE_EVENT    EPOLLOUT
  ------------------
                          if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT)
  ------------------
  |  |  352|      0|#define NGX_LEVEL_EVENT    0
  ------------------
  |  Branch (396:17): [True: 0, False: 0]
  ------------------
  397|      0|                == NGX_ERROR)
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  398|      0|            {
  399|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  400|      0|            }
  401|       |
  402|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  403|      0|        }
  404|       |
  405|     10|    } else if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) {
  ------------------
  |  |  263|      0|#define NGX_USE_EVENTPORT_EVENT  0x00001000
  ------------------
  |  Branch (405:16): [True: 0, False: 0]
  ------------------
  406|       |
  407|       |        /* event ports */
  408|       |
  409|      0|        if (!wev->active && !wev->ready) {
  ------------------
  |  Branch (409:13): [True: 0, False: 0]
  |  Branch (409:29): [True: 0, False: 0]
  ------------------
  410|      0|            if (ngx_add_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |  403|      0|#define ngx_add_event        ngx_event_actions.add
  ------------------
                          if (ngx_add_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |  350|      0|#define NGX_WRITE_EVENT    EPOLLOUT
  ------------------
                          if (ngx_add_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (410:17): [True: 0, False: 0]
  ------------------
  411|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  412|      0|            }
  413|       |
  414|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  415|      0|        }
  416|       |
  417|      0|        if (wev->oneshot && wev->ready) {
  ------------------
  |  Branch (417:13): [True: 0, False: 0]
  |  Branch (417:29): [True: 0, False: 0]
  ------------------
  418|      0|            if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |  404|      0|#define ngx_del_event        ngx_event_actions.del
  ------------------
                          if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |  350|      0|#define NGX_WRITE_EVENT    EPOLLOUT
  ------------------
                          if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (418:17): [True: 0, False: 0]
  ------------------
  419|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  420|      0|            }
  421|       |
  422|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  423|      0|        }
  424|      0|    }
  425|       |
  426|       |    /* iocp */
  427|       |
  428|     10|    return NGX_OK;
  ------------------
  |  |   38|     10|#define  NGX_OK          0
  ------------------
  429|     10|}
ngx_event.c:ngx_event_init_conf:
  434|      1|{
  435|       |#if (NGX_HAVE_REUSEPORT)
  436|       |    ngx_uint_t        i;
  437|       |    ngx_core_conf_t  *ccf;
  438|       |    ngx_listening_t  *ls;
  439|       |#endif
  440|       |
  441|      1|    if (ngx_get_conf(cycle->conf_ctx, ngx_events_module) == NULL) {
  ------------------
  |  |  176|      1|#define ngx_get_conf(conf_ctx, module)  conf_ctx[module.index]
  ------------------
  |  Branch (441:9): [True: 0, False: 1]
  ------------------
  442|      0|        ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  443|      0|                      "no \"events\" section in configuration");
  444|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  445|      0|    }
  446|       |
  447|      1|    if (cycle->connection_n < cycle->listening.nelts + 1) {
  ------------------
  |  Branch (447:9): [True: 0, False: 1]
  ------------------
  448|       |
  449|       |        /*
  450|       |         * there should be at least one connection for each listening
  451|       |         * socket, plus an additional connection for channel
  452|       |         */
  453|       |
  454|      0|        ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  455|      0|                      "%ui worker_connections are not enough "
  456|      0|                      "for %ui listening sockets",
  457|      0|                      cycle->connection_n, cycle->listening.nelts);
  458|       |
  459|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  460|      0|    }
  461|       |
  462|       |#if (NGX_HAVE_REUSEPORT)
  463|       |
  464|       |    ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
  465|       |
  466|       |    if (!ngx_test_config && ccf->master) {
  467|       |
  468|       |        ls = cycle->listening.elts;
  469|       |        for (i = 0; i < cycle->listening.nelts; i++) {
  470|       |
  471|       |            if (!ls[i].reuseport || ls[i].worker != 0) {
  472|       |                continue;
  473|       |            }
  474|       |
  475|       |            if (ngx_clone_listening(cycle, &ls[i]) != NGX_OK) {
  476|       |                return NGX_CONF_ERROR;
  477|       |            }
  478|       |
  479|       |            /* cloning may change cycle->listening.elts */
  480|       |
  481|       |            ls = cycle->listening.elts;
  482|       |        }
  483|       |    }
  484|       |
  485|       |#endif
  486|       |
  487|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  488|      1|}
ngx_event.c:ngx_events_block:
  988|      1|{
  989|      1|    char                 *rv;
  990|      1|    void               ***ctx;
  991|      1|    ngx_uint_t            i;
  992|      1|    ngx_conf_t            pcf;
  993|      1|    ngx_event_module_t   *m;
  994|       |
  995|      1|    if (*(void **) conf) {
  ------------------
  |  Branch (995:9): [True: 0, False: 1]
  ------------------
  996|      0|        return "is duplicate";
  997|      0|    }
  998|       |
  999|       |    /* count the number of the event modules and set up their indices */
 1000|       |
 1001|      1|    ngx_event_max_module = ngx_count_modules(cf->cycle, NGX_EVENT_MODULE);
  ------------------
  |  |  425|      1|#define NGX_EVENT_MODULE      0x544E5645  /* "EVNT" */
  ------------------
 1002|       |
 1003|      1|    ctx = ngx_pcalloc(cf->pool, sizeof(void *));
 1004|      1|    if (ctx == NULL) {
  ------------------
  |  Branch (1004:9): [True: 0, False: 1]
  ------------------
 1005|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1006|      0|    }
 1007|       |
 1008|      1|    *ctx = ngx_pcalloc(cf->pool, ngx_event_max_module * sizeof(void *));
 1009|      1|    if (*ctx == NULL) {
  ------------------
  |  Branch (1009:9): [True: 0, False: 1]
  ------------------
 1010|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1011|      0|    }
 1012|       |
 1013|      1|    *(void **) conf = ctx;
 1014|       |
 1015|     55|    for (i = 0; cf->cycle->modules[i]; i++) {
  ------------------
  |  Branch (1015:17): [True: 54, False: 1]
  ------------------
 1016|     54|        if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) {
  ------------------
  |  |  425|     54|#define NGX_EVENT_MODULE      0x544E5645  /* "EVNT" */
  ------------------
  |  Branch (1016:13): [True: 52, False: 2]
  ------------------
 1017|     52|            continue;
 1018|     52|        }
 1019|       |
 1020|      2|        m = cf->cycle->modules[i]->ctx;
 1021|       |
 1022|      2|        if (m->create_conf) {
  ------------------
  |  Branch (1022:13): [True: 2, False: 0]
  ------------------
 1023|      2|            (*ctx)[cf->cycle->modules[i]->ctx_index] =
 1024|      2|                                                     m->create_conf(cf->cycle);
 1025|      2|            if ((*ctx)[cf->cycle->modules[i]->ctx_index] == NULL) {
  ------------------
  |  Branch (1025:17): [True: 0, False: 2]
  ------------------
 1026|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1027|      0|            }
 1028|      2|        }
 1029|      2|    }
 1030|       |
 1031|      1|    pcf = *cf;
 1032|      1|    cf->ctx = ctx;
 1033|      1|    cf->module_type = NGX_EVENT_MODULE;
  ------------------
  |  |  425|      1|#define NGX_EVENT_MODULE      0x544E5645  /* "EVNT" */
  ------------------
 1034|      1|    cf->cmd_type = NGX_EVENT_CONF;
  ------------------
  |  |  426|      1|#define NGX_EVENT_CONF        0x02000000
  ------------------
 1035|       |
 1036|      1|    rv = ngx_conf_parse(cf, NULL);
 1037|       |
 1038|      1|    *cf = pcf;
 1039|       |
 1040|      1|    if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (1040:9): [True: 0, False: 1]
  ------------------
 1041|      0|        return rv;
 1042|      0|    }
 1043|       |
 1044|     55|    for (i = 0; cf->cycle->modules[i]; i++) {
  ------------------
  |  Branch (1044:17): [True: 54, False: 1]
  ------------------
 1045|     54|        if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) {
  ------------------
  |  |  425|     54|#define NGX_EVENT_MODULE      0x544E5645  /* "EVNT" */
  ------------------
  |  Branch (1045:13): [True: 52, False: 2]
  ------------------
 1046|     52|            continue;
 1047|     52|        }
 1048|       |
 1049|      2|        m = cf->cycle->modules[i]->ctx;
 1050|       |
 1051|      2|        if (m->init_conf) {
  ------------------
  |  Branch (1051:13): [True: 2, False: 0]
  ------------------
 1052|      2|            rv = m->init_conf(cf->cycle,
 1053|      2|                              (*ctx)[cf->cycle->modules[i]->ctx_index]);
 1054|      2|            if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (1054:17): [True: 0, False: 2]
  ------------------
 1055|      0|                return rv;
 1056|      0|            }
 1057|      2|        }
 1058|      2|    }
 1059|       |
 1060|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1061|      1|}
ngx_event.c:ngx_event_core_create_conf:
 1259|      1|{
 1260|      1|    ngx_event_conf_t  *ecf;
 1261|       |
 1262|      1|    ecf = ngx_palloc(cycle->pool, sizeof(ngx_event_conf_t));
 1263|      1|    if (ecf == NULL) {
  ------------------
  |  Branch (1263:9): [True: 0, False: 1]
  ------------------
 1264|      0|        return NULL;
 1265|      0|    }
 1266|       |
 1267|      1|    ecf->connections = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1268|      1|    ecf->use = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1269|      1|    ecf->multi_accept = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1270|      1|    ecf->accept_mutex = NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1271|      1|    ecf->accept_mutex_delay = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      1|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1272|      1|    ecf->name = (void *) NGX_CONF_UNSET;
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
 1273|       |
 1274|       |#if (NGX_DEBUG)
 1275|       |
 1276|       |    if (ngx_array_init(&ecf->debug_connection, cycle->pool, 4,
 1277|       |                       sizeof(ngx_cidr_t)) == NGX_ERROR)
 1278|       |    {
 1279|       |        return NULL;
 1280|       |    }
 1281|       |
 1282|       |#endif
 1283|       |
 1284|      1|    return ecf;
 1285|      1|}
ngx_event.c:ngx_event_core_init_conf:
 1290|      1|{
 1291|      1|    ngx_event_conf_t  *ecf = conf;
 1292|       |
 1293|      1|#if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL)
 1294|      1|    int                  fd;
 1295|      1|#endif
 1296|      1|    ngx_int_t            i;
 1297|      1|    ngx_module_t        *module;
 1298|      1|    ngx_event_module_t  *event_module;
 1299|       |
 1300|      1|    module = NULL;
 1301|       |
 1302|      1|#if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL)
 1303|       |
 1304|      1|    fd = epoll_create(100);
 1305|       |
 1306|      1|    if (fd != -1) {
  ------------------
  |  Branch (1306:9): [True: 1, False: 0]
  ------------------
 1307|      1|        (void) close(fd);
 1308|      1|        module = &ngx_epoll_module;
 1309|       |
 1310|      1|    } else if (ngx_errno != NGX_ENOSYS) {
  ------------------
  |  |   69|      0|#define ngx_errno                  errno
  ------------------
                  } else if (ngx_errno != NGX_ENOSYS) {
  ------------------
  |  |   51|      0|#define NGX_ENOSYS        ENOSYS
  ------------------
  |  Branch (1310:16): [True: 0, False: 0]
  ------------------
 1311|      0|        module = &ngx_epoll_module;
 1312|      0|    }
 1313|       |
 1314|      1|#endif
 1315|       |
 1316|       |#if (NGX_HAVE_DEVPOLL) && !(NGX_TEST_BUILD_DEVPOLL)
 1317|       |
 1318|       |    module = &ngx_devpoll_module;
 1319|       |
 1320|       |#endif
 1321|       |
 1322|       |#if (NGX_HAVE_KQUEUE)
 1323|       |
 1324|       |    module = &ngx_kqueue_module;
 1325|       |
 1326|       |#endif
 1327|       |
 1328|       |#if (NGX_HAVE_SELECT)
 1329|       |
 1330|       |    if (module == NULL) {
 1331|       |        module = &ngx_select_module;
 1332|       |    }
 1333|       |
 1334|       |#endif
 1335|       |
 1336|      1|    if (module == NULL) {
  ------------------
  |  Branch (1336:9): [True: 0, False: 1]
  ------------------
 1337|      0|        for (i = 0; cycle->modules[i]; i++) {
  ------------------
  |  Branch (1337:21): [True: 0, False: 0]
  ------------------
 1338|       |
 1339|      0|            if (cycle->modules[i]->type != NGX_EVENT_MODULE) {
  ------------------
  |  |  425|      0|#define NGX_EVENT_MODULE      0x544E5645  /* "EVNT" */
  ------------------
  |  Branch (1339:17): [True: 0, False: 0]
  ------------------
 1340|      0|                continue;
 1341|      0|            }
 1342|       |
 1343|      0|            event_module = cycle->modules[i]->ctx;
 1344|       |
 1345|      0|            if (ngx_strcmp(event_module->name->data, event_core_name.data) == 0)
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (1345:17): [True: 0, False: 0]
  ------------------
 1346|      0|            {
 1347|      0|                continue;
 1348|      0|            }
 1349|       |
 1350|      0|            module = cycle->modules[i];
 1351|      0|            break;
 1352|      0|        }
 1353|      0|    }
 1354|       |
 1355|      1|    if (module == NULL) {
  ------------------
  |  Branch (1355:9): [True: 0, False: 1]
  ------------------
 1356|      0|        ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "no events module found");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1357|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1358|      0|    }
 1359|       |
 1360|      1|    ngx_conf_init_uint_value(ecf->connections, DEFAULT_CONNECTIONS);
  ------------------
  |  |  191|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (191:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  192|      0|        conf = default;                                                      \
  |  |  193|      0|    }
  ------------------
 1361|      1|    cycle->connection_n = ecf->connections;
 1362|       |
 1363|      1|    ngx_conf_init_uint_value(ecf->use, module->ctx_index);
  ------------------
  |  |  191|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (191:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  192|      0|        conf = default;                                                      \
  |  |  193|      0|    }
  ------------------
 1364|       |
 1365|      1|    event_module = module->ctx;
 1366|      1|    ngx_conf_init_ptr_value(ecf->name, event_module->name->data);
  ------------------
  |  |  186|      1|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (186:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  187|      0|        conf = default;                                                      \
  |  |  188|      0|    }
  ------------------
 1367|       |
 1368|      1|    ngx_conf_init_value(ecf->multi_accept, 0);
  ------------------
  |  |  181|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (181:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  182|      0|        conf = default;                                                      \
  |  |  183|      0|    }
  ------------------
 1369|      1|    ngx_conf_init_value(ecf->accept_mutex, 0);
  ------------------
  |  |  181|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (181:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  182|      0|        conf = default;                                                      \
  |  |  183|      0|    }
  ------------------
 1370|      1|    ngx_conf_init_msec_value(ecf->accept_mutex_delay, 500);
  ------------------
  |  |  201|      1|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (201:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  202|      1|        conf = default;                                                      \
  |  |  203|      1|    }
  ------------------
 1371|       |
 1372|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1373|      1|}
ngx_event.c:ngx_event_connections:
 1066|      1|{
 1067|      1|    ngx_event_conf_t  *ecf = conf;
 1068|       |
 1069|      1|    ngx_str_t  *value;
 1070|       |
 1071|      1|    if (ecf->connections != NGX_CONF_UNSET_UINT) {
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  |  Branch (1071:9): [True: 0, False: 1]
  ------------------
 1072|      0|        return "is duplicate";
 1073|      0|    }
 1074|       |
 1075|      1|    value = cf->args->elts;
 1076|      1|    ecf->connections = ngx_atoi(value[1].data, value[1].len);
 1077|      1|    if (ecf->connections == (ngx_uint_t) NGX_ERROR) {
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1077:9): [True: 0, False: 1]
  ------------------
 1078|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1079|      0|                           "invalid number \"%V\"", &value[1]);
 1080|       |
 1081|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1082|      0|    }
 1083|       |
 1084|      1|    cf->cycle->connection_n = ecf->connections;
 1085|       |
 1086|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1087|      1|}
ngx_event.c:ngx_event_use:
 1092|      1|{
 1093|      1|    ngx_event_conf_t  *ecf = conf;
 1094|       |
 1095|      1|    ngx_int_t             m;
 1096|      1|    ngx_str_t            *value;
 1097|      1|    ngx_event_conf_t     *old_ecf;
 1098|      1|    ngx_event_module_t   *module;
 1099|       |
 1100|      1|    if (ecf->use != NGX_CONF_UNSET_UINT) {
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  |  Branch (1100:9): [True: 0, False: 1]
  ------------------
 1101|      0|        return "is duplicate";
 1102|      0|    }
 1103|       |
 1104|      1|    value = cf->args->elts;
 1105|       |
 1106|      1|    if (cf->cycle->old_cycle->conf_ctx) {
  ------------------
  |  Branch (1106:9): [True: 0, False: 1]
  ------------------
 1107|      0|        old_ecf = ngx_event_get_conf(cf->cycle->old_cycle->conf_ctx,
  ------------------
  |  |  492|      0|             (*(ngx_get_conf(conf_ctx, ngx_events_module))) [module.ctx_index]
  |  |  ------------------
  |  |  |  |  176|      0|#define ngx_get_conf(conf_ctx, module)  conf_ctx[module.index]
  |  |  ------------------
  ------------------
 1108|      0|                                     ngx_event_core_module);
 1109|      1|    } else {
 1110|      1|        old_ecf = NULL;
 1111|      1|    }
 1112|       |
 1113|       |
 1114|      7|    for (m = 0; cf->cycle->modules[m]; m++) {
  ------------------
  |  Branch (1114:17): [True: 7, False: 0]
  ------------------
 1115|      7|        if (cf->cycle->modules[m]->type != NGX_EVENT_MODULE) {
  ------------------
  |  |  425|      7|#define NGX_EVENT_MODULE      0x544E5645  /* "EVNT" */
  ------------------
  |  Branch (1115:13): [True: 5, False: 2]
  ------------------
 1116|      5|            continue;
 1117|      5|        }
 1118|       |
 1119|      2|        module = cf->cycle->modules[m]->ctx;
 1120|      2|        if (module->name->len == value[1].len) {
  ------------------
  |  Branch (1120:13): [True: 1, False: 1]
  ------------------
 1121|      1|            if (ngx_strcmp(module->name->data, value[1].data) == 0) {
  ------------------
  |  |   57|      1|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (1121:17): [True: 1, False: 0]
  ------------------
 1122|      1|                ecf->use = cf->cycle->modules[m]->ctx_index;
 1123|      1|                ecf->name = module->name->data;
 1124|       |
 1125|      1|                if (ngx_process == NGX_PROCESS_SINGLE
  ------------------
  |  |   23|      2|#define NGX_PROCESS_SINGLE     0
  ------------------
  |  Branch (1125:21): [True: 1, False: 0]
  ------------------
 1126|      1|                    && old_ecf
  ------------------
  |  Branch (1126:24): [True: 0, False: 1]
  ------------------
 1127|      1|                    && old_ecf->use != ecf->use)
  ------------------
  |  Branch (1127:24): [True: 0, False: 0]
  ------------------
 1128|      0|                {
 1129|      0|                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1130|      0|                               "when the server runs without a master process "
 1131|      0|                               "the \"%V\" event type must be the same as "
 1132|      0|                               "in previous configuration - \"%s\" "
 1133|      0|                               "and it cannot be changed on the fly, "
 1134|      0|                               "to change it you need to stop server "
 1135|      0|                               "and start it again",
 1136|      0|                               &value[1], old_ecf->name);
 1137|       |
 1138|      0|                    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1139|      0|                }
 1140|       |
 1141|      1|                return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1142|      1|            }
 1143|      1|        }
 1144|      2|    }
 1145|       |
 1146|      0|    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1147|      0|                       "invalid event type \"%V\"", &value[1]);
 1148|       |
 1149|      0|    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1150|      1|}
ngx_event.c:ngx_event_module_init:
  493|      1|{
  494|      1|    void              ***cf;
  495|      1|    u_char              *shared;
  496|      1|    size_t               size, cl;
  497|      1|    ngx_shm_t            shm;
  498|      1|    ngx_time_t          *tp;
  499|      1|    ngx_core_conf_t     *ccf;
  500|      1|    ngx_event_conf_t    *ecf;
  501|       |
  502|      1|    cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module);
  ------------------
  |  |  176|      1|#define ngx_get_conf(conf_ctx, module)  conf_ctx[module.index]
  ------------------
  503|      1|    ecf = (*cf)[ngx_event_core_module.ctx_index];
  504|       |
  505|      1|    if (!ngx_test_config && ngx_process <= NGX_PROCESS_MASTER) {
  ------------------
  |  |   24|      1|#define NGX_PROCESS_MASTER     1
  ------------------
  |  Branch (505:9): [True: 1, False: 0]
  |  Branch (505:29): [True: 1, False: 0]
  ------------------
  506|      1|        ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
  ------------------
  |  |   86|      1|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  507|      1|                      "using the \"%s\" event method", ecf->name);
  508|      1|    }
  509|       |
  510|      1|    ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
  ------------------
  |  |  176|      1|#define ngx_get_conf(conf_ctx, module)  conf_ctx[module.index]
  ------------------
  511|       |
  512|      1|    ngx_timer_resolution = ccf->timer_resolution;
  513|       |
  514|      1|#if !(NGX_WIN32)
  515|      1|    {
  516|      1|    ngx_int_t      limit;
  517|      1|    struct rlimit  rlmt;
  518|       |
  519|      1|    if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
  ------------------
  |  Branch (519:9): [True: 0, False: 1]
  ------------------
  520|      0|        ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  521|      0|                      "getrlimit(RLIMIT_NOFILE) failed, ignored");
  522|       |
  523|      1|    } else {
  524|      1|        if (ecf->connections > (ngx_uint_t) rlmt.rlim_cur
  ------------------
  |  Branch (524:13): [True: 0, False: 1]
  ------------------
  525|      1|            && (ccf->rlimit_nofile == NGX_CONF_UNSET
  ------------------
  |  |   56|      0|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (525:17): [True: 0, False: 0]
  ------------------
  526|      0|                || ecf->connections > (ngx_uint_t) ccf->rlimit_nofile))
  ------------------
  |  Branch (526:20): [True: 0, False: 0]
  ------------------
  527|      0|        {
  528|      0|            limit = (ccf->rlimit_nofile == NGX_CONF_UNSET) ?
  ------------------
  |  |   56|      0|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (528:21): [True: 0, False: 0]
  ------------------
  529|      0|                         (ngx_int_t) rlmt.rlim_cur : ccf->rlimit_nofile;
  530|       |
  531|      0|            ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  532|      0|                          "%ui worker_connections exceed "
  533|      0|                          "open file resource limit: %i",
  534|      0|                          ecf->connections, limit);
  535|      0|        }
  536|      1|    }
  537|      1|    }
  538|      1|#endif /* !(NGX_WIN32) */
  539|       |
  540|       |
  541|      1|    if (ccf->master == 0) {
  ------------------
  |  Branch (541:9): [True: 0, False: 1]
  ------------------
  542|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  543|      0|    }
  544|       |
  545|      1|    if (ngx_accept_mutex_ptr) {
  ------------------
  |  Branch (545:9): [True: 0, False: 1]
  ------------------
  546|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  547|      0|    }
  548|       |
  549|       |
  550|       |    /* cl should be equal to or greater than cache line size */
  551|       |
  552|      1|    cl = 128;
  553|       |
  554|      1|    size = cl            /* ngx_accept_mutex */
  555|      1|           + cl          /* ngx_connection_counter */
  556|      1|           + cl;         /* ngx_temp_number */
  557|       |
  558|       |#if (NGX_STAT_STUB)
  559|       |
  560|       |    size += cl           /* ngx_stat_accepted */
  561|       |           + cl          /* ngx_stat_handled */
  562|       |           + cl          /* ngx_stat_requests */
  563|       |           + cl          /* ngx_stat_active */
  564|       |           + cl          /* ngx_stat_reading */
  565|       |           + cl          /* ngx_stat_writing */
  566|       |           + cl;         /* ngx_stat_waiting */
  567|       |
  568|       |#endif
  569|       |
  570|      1|    shm.size = size;
  571|      1|    ngx_str_set(&shm.name, "nginx_shared_zone");
  ------------------
  |  |   43|      1|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
  572|      1|    shm.log = cycle->log;
  573|       |
  574|      1|    if (ngx_shm_alloc(&shm) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (574:9): [True: 0, False: 1]
  ------------------
  575|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  576|      0|    }
  577|       |
  578|      1|    shared = shm.addr;
  579|       |
  580|      1|    ngx_accept_mutex_ptr = (ngx_atomic_t *) shared;
  581|      1|    ngx_accept_mutex.spin = (ngx_uint_t) -1;
  582|       |
  583|      1|    if (ngx_shmtx_create(&ngx_accept_mutex, (ngx_shmtx_sh_t *) shared,
  ------------------
  |  Branch (583:9): [True: 0, False: 1]
  ------------------
  584|      1|                         cycle->lock_file.data)
  585|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  586|      0|    {
  587|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  588|      0|    }
  589|       |
  590|      1|    ngx_connection_counter = (ngx_atomic_t *) (shared + 1 * cl);
  591|       |
  592|      1|    (void) ngx_atomic_cmp_set(ngx_connection_counter, 0, 1);
  ------------------
  |  |   60|      1|    __sync_bool_compare_and_swap(lock, old, set)
  ------------------
  593|       |
  594|      1|    ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
  595|      1|                   "counter: %p, %uA",
  596|      1|                   ngx_connection_counter, *ngx_connection_counter);
  597|       |
  598|      1|    ngx_temp_number = (ngx_atomic_t *) (shared + 2 * cl);
  599|       |
  600|      1|    tp = ngx_timeofday();
  ------------------
  |  |   37|      1|#define ngx_timeofday()      (ngx_time_t *) ngx_cached_time
  ------------------
  601|       |
  602|      1|    ngx_random_number = (tp->msec << 16) + ngx_pid;
  603|       |
  604|       |#if (NGX_STAT_STUB)
  605|       |
  606|       |    ngx_stat_accepted = (ngx_atomic_t *) (shared + 3 * cl);
  607|       |    ngx_stat_handled = (ngx_atomic_t *) (shared + 4 * cl);
  608|       |    ngx_stat_requests = (ngx_atomic_t *) (shared + 5 * cl);
  609|       |    ngx_stat_active = (ngx_atomic_t *) (shared + 6 * cl);
  610|       |    ngx_stat_reading = (ngx_atomic_t *) (shared + 7 * cl);
  611|       |    ngx_stat_writing = (ngx_atomic_t *) (shared + 8 * cl);
  612|       |    ngx_stat_waiting = (ngx_atomic_t *) (shared + 9 * cl);
  613|       |
  614|       |#endif
  615|       |
  616|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  617|      1|}

ngx_event_connect_peer:
   22|      5|{
   23|      5|    int                rc, type, value;
   24|      5|#if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT || NGX_LINUX)
   25|      5|    in_port_t          port;
   26|      5|#endif
   27|      5|    ngx_int_t          event;
   28|      5|    ngx_err_t          err;
   29|      5|    ngx_uint_t         level;
   30|      5|    ngx_socket_t       s;
   31|      5|    ngx_event_t       *rev, *wev;
   32|      5|    ngx_connection_t  *c;
   33|       |
   34|      5|    rc = pc->get(pc, pc->data);
   35|      5|    if (rc != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (35:9): [True: 0, False: 5]
  ------------------
   36|      0|        return rc;
   37|      0|    }
   38|       |
   39|      5|    type = (pc->type ? pc->type : SOCK_STREAM);
  ------------------
  |  Branch (39:13): [True: 0, False: 5]
  ------------------
   40|       |
   41|      5|    s = ngx_socket(pc->sockaddr->sa_family, type, 0);
  ------------------
  |  |   21|      5|#define ngx_socket          socket
  ------------------
   42|       |
   43|      5|    ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pc->log, 0, "%s socket %d",
   44|      5|                   (type == SOCK_STREAM) ? "stream" : "dgram", s);
   45|       |
   46|      5|    if (s == (ngx_socket_t) -1) {
  ------------------
  |  Branch (46:9): [True: 0, False: 5]
  ------------------
   47|      0|        ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   48|      0|                      ngx_socket_n " failed");
   49|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   50|      0|    }
   51|       |
   52|       |
   53|      5|    c = ngx_get_connection(s, pc->log);
   54|       |
   55|      5|    if (c == NULL) {
  ------------------
  |  Branch (55:9): [True: 0, False: 5]
  ------------------
   56|      0|        if (ngx_close_socket(s) == -1) {
  ------------------
  |  |   69|      0|#define ngx_close_socket    close
  ------------------
  |  Branch (56:13): [True: 0, False: 0]
  ------------------
   57|      0|            ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   58|      0|                          ngx_close_socket_n " failed");
   59|      0|        }
   60|       |
   61|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   62|      0|    }
   63|       |
   64|      5|    c->type = type;
   65|       |
   66|      5|    if (pc->rcvbuf) {
  ------------------
  |  Branch (66:9): [True: 0, False: 5]
  ------------------
   67|      0|        if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
  ------------------
  |  Branch (67:13): [True: 0, False: 0]
  ------------------
   68|      0|                       (const void *) &pc->rcvbuf, sizeof(int)) == -1)
   69|      0|        {
   70|      0|            ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   71|      0|                          "setsockopt(SO_RCVBUF) failed");
   72|      0|            goto failed;
   73|      0|        }
   74|      0|    }
   75|       |
   76|      5|    if (pc->so_keepalive) {
  ------------------
  |  Branch (76:9): [True: 0, False: 5]
  ------------------
   77|      0|        value = 1;
   78|       |
   79|      0|        if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,
  ------------------
  |  Branch (79:13): [True: 0, False: 0]
  ------------------
   80|      0|                       (const void *) &value, sizeof(int))
   81|      0|            == -1)
   82|      0|        {
   83|      0|            ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   84|      0|                          "setsockopt(SO_KEEPALIVE) failed, ignored");
   85|      0|        }
   86|      0|    }
   87|       |
   88|      5|    if (ngx_nonblocking(s) == -1) {
  ------------------
  |  Branch (88:9): [True: 0, False: 5]
  ------------------
   89|      0|        ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   90|      0|                      ngx_nonblocking_n " failed");
   91|       |
   92|      0|        goto failed;
   93|      0|    }
   94|       |
   95|      5|    if (pc->local) {
  ------------------
  |  Branch (95:9): [True: 0, False: 5]
  ------------------
   96|       |
   97|       |#if (NGX_HAVE_TRANSPARENT_PROXY)
   98|       |        if (pc->transparent) {
   99|       |            if (ngx_event_connect_set_transparent(pc, s) != NGX_OK) {
  100|       |                goto failed;
  101|       |            }
  102|       |        }
  103|       |#endif
  104|       |
  105|      0|#if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT || NGX_LINUX)
  106|      0|        port = ngx_inet_get_port(pc->local->sockaddr);
  107|      0|#endif
  108|       |
  109|       |#if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT)
  110|       |
  111|       |        if (pc->sockaddr->sa_family != AF_UNIX && port == 0) {
  112|       |            static int  bind_address_no_port = 1;
  113|       |
  114|       |            if (bind_address_no_port) {
  115|       |                if (setsockopt(s, IPPROTO_IP, IP_BIND_ADDRESS_NO_PORT,
  116|       |                               (const void *) &bind_address_no_port,
  117|       |                               sizeof(int)) == -1)
  118|       |                {
  119|       |                    err = ngx_socket_errno;
  120|       |
  121|       |                    if (err != NGX_EOPNOTSUPP && err != NGX_ENOPROTOOPT) {
  122|       |                        ngx_log_error(NGX_LOG_ALERT, pc->log, err,
  123|       |                                      "setsockopt(IP_BIND_ADDRESS_NO_PORT) "
  124|       |                                      "failed, ignored");
  125|       |
  126|       |                    } else {
  127|       |                        bind_address_no_port = 0;
  128|       |                    }
  129|       |                }
  130|       |            }
  131|       |        }
  132|       |
  133|       |#endif
  134|       |
  135|      0|#if (NGX_LINUX)
  136|       |
  137|      0|        if (pc->type == SOCK_DGRAM && port != 0) {
  ------------------
  |  Branch (137:13): [True: 0, False: 0]
  |  Branch (137:39): [True: 0, False: 0]
  ------------------
  138|      0|            int  reuse_addr = 1;
  139|       |
  140|      0|            if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
  ------------------
  |  Branch (140:17): [True: 0, False: 0]
  ------------------
  141|      0|                           (const void *) &reuse_addr, sizeof(int))
  142|      0|                 == -1)
  143|      0|            {
  144|      0|                ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  145|      0|                              "setsockopt(SO_REUSEADDR) failed");
  146|      0|                goto failed;
  147|      0|            }
  148|      0|        }
  149|       |
  150|      0|#endif
  151|       |
  152|      0|        if (bind(s, pc->local->sockaddr, pc->local->socklen) == -1) {
  ------------------
  |  Branch (152:13): [True: 0, False: 0]
  ------------------
  153|      0|            ngx_log_error(NGX_LOG_CRIT, pc->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  154|      0|                          "bind(%V) failed", &pc->local->name);
  155|       |
  156|      0|            goto failed;
  157|      0|        }
  158|      0|    }
  159|       |
  160|      5|    if (type == SOCK_STREAM) {
  ------------------
  |  Branch (160:9): [True: 5, False: 0]
  ------------------
  161|      5|        c->recv = ngx_recv;
  ------------------
  |  |  416|      5|#define ngx_recv             ngx_io.recv
  ------------------
  162|      5|        c->send = ngx_send;
  ------------------
  |  |  419|      5|#define ngx_send             ngx_io.send
  ------------------
  163|      5|        c->recv_chain = ngx_recv_chain;
  ------------------
  |  |  417|      5|#define ngx_recv_chain       ngx_io.recv_chain
  ------------------
  164|      5|        c->send_chain = ngx_send_chain;
  ------------------
  |  |  420|      5|#define ngx_send_chain       ngx_io.send_chain
  ------------------
  165|       |
  166|      5|        c->sendfile = 1;
  167|       |
  168|      5|        if (pc->sockaddr->sa_family == AF_UNIX) {
  ------------------
  |  Branch (168:13): [True: 0, False: 5]
  ------------------
  169|      0|            c->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
  170|      0|            c->tcp_nodelay = NGX_TCP_NODELAY_DISABLED;
  171|       |
  172|       |#if (NGX_SOLARIS)
  173|       |            /* Solaris's sendfilev() supports AF_NCA, AF_INET, and AF_INET6 */
  174|       |            c->sendfile = 0;
  175|       |#endif
  176|      0|        }
  177|       |
  178|      5|    } else { /* type == SOCK_DGRAM */
  179|      0|        c->recv = ngx_udp_recv;
  ------------------
  |  |  418|      0|#define ngx_udp_recv         ngx_io.udp_recv
  ------------------
  180|      0|        c->send = ngx_send;
  ------------------
  |  |  419|      0|#define ngx_send             ngx_io.send
  ------------------
  181|      0|        c->send_chain = ngx_udp_send_chain;
  ------------------
  |  |  422|      0|#define ngx_udp_send_chain   ngx_io.udp_send_chain
  ------------------
  182|       |
  183|      0|        c->need_flush_buf = 1;
  184|      0|    }
  185|       |
  186|      5|    c->log_error = pc->log_error;
  187|       |
  188|      5|    rev = c->read;
  189|      5|    wev = c->write;
  190|       |
  191|      5|    rev->log = pc->log;
  192|      5|    wev->log = pc->log;
  193|       |
  194|      5|    pc->connection = c;
  195|       |
  196|      5|    c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1);
  ------------------
  |  |   63|      5|    __sync_fetch_and_add(value, add)
  ------------------
  197|       |
  198|      5|    c->start_time = ngx_current_msec;
  199|       |
  200|      5|    if (ngx_add_conn) {
  ------------------
  |  |  405|      5|#define ngx_add_conn         ngx_event_actions.add_conn
  |  |  ------------------
  |  |  |  Branch (405:30): [True: 0, False: 5]
  |  |  ------------------
  ------------------
  201|      0|        if (ngx_add_conn(c) == NGX_ERROR) {
  ------------------
  |  |  405|      0|#define ngx_add_conn         ngx_event_actions.add_conn
  ------------------
                      if (ngx_add_conn(c) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (201:13): [True: 0, False: 0]
  ------------------
  202|      0|            goto failed;
  203|      0|        }
  204|      0|    }
  205|       |
  206|      5|    ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pc->log, 0,
  207|      5|                   "connect to %V, fd:%d #%uA", pc->name, s, c->number);
  208|       |
  209|      5|    rc = connect(s, pc->sockaddr, pc->socklen);
  210|       |
  211|      5|    if (rc == -1) {
  ------------------
  |  Branch (211:9): [True: 0, False: 5]
  ------------------
  212|      0|        err = ngx_socket_errno;
  ------------------
  |  |   70|      0|#define ngx_socket_errno           errno
  ------------------
  213|       |
  214|       |
  215|      0|        if (err != NGX_EINPROGRESS
  ------------------
  |  |   37|      0|#define NGX_EINPROGRESS   EINPROGRESS
  ------------------
  |  Branch (215:13): [True: 0, False: 0]
  ------------------
  216|       |#if (NGX_WIN32)
  217|       |            /* Winsock returns WSAEWOULDBLOCK (NGX_EAGAIN) */
  218|       |            && err != NGX_EAGAIN
  219|       |#endif
  220|      0|            )
  221|      0|        {
  222|      0|            if (err == NGX_ECONNREFUSED
  ------------------
  |  |   45|      0|#define NGX_ECONNREFUSED  ECONNREFUSED
  ------------------
  |  Branch (222:17): [True: 0, False: 0]
  ------------------
  223|      0|#if (NGX_LINUX)
  224|       |                /*
  225|       |                 * Linux returns EAGAIN instead of ECONNREFUSED
  226|       |                 * for unix sockets if listen queue is full
  227|       |                 */
  228|      0|                || err == NGX_EAGAIN
  ------------------
  |  |   65|      0|#define NGX_EAGAIN        EAGAIN
  ------------------
  |  Branch (228:20): [True: 0, False: 0]
  ------------------
  229|      0|#endif
  230|      0|                || err == NGX_ECONNRESET
  ------------------
  |  |   42|      0|#define NGX_ECONNRESET    ECONNRESET
  ------------------
  |  Branch (230:20): [True: 0, False: 0]
  ------------------
  231|      0|                || err == NGX_ENETDOWN
  ------------------
  |  |   47|      0|#define NGX_ENETDOWN      ENETDOWN
  ------------------
  |  Branch (231:20): [True: 0, False: 0]
  ------------------
  232|      0|                || err == NGX_ENETUNREACH
  ------------------
  |  |   48|      0|#define NGX_ENETUNREACH   ENETUNREACH
  ------------------
  |  Branch (232:20): [True: 0, False: 0]
  ------------------
  233|      0|                || err == NGX_EHOSTDOWN
  ------------------
  |  |   49|      0|#define NGX_EHOSTDOWN     EHOSTDOWN
  ------------------
  |  Branch (233:20): [True: 0, False: 0]
  ------------------
  234|      0|                || err == NGX_EHOSTUNREACH)
  ------------------
  |  |   50|      0|#define NGX_EHOSTUNREACH  EHOSTUNREACH
  ------------------
  |  Branch (234:20): [True: 0, False: 0]
  ------------------
  235|      0|            {
  236|      0|                level = NGX_LOG_ERR;
  ------------------
  |  |   20|      0|#define NGX_LOG_ERR               4
  ------------------
  237|       |
  238|      0|            } else {
  239|      0|                level = NGX_LOG_CRIT;
  ------------------
  |  |   19|      0|#define NGX_LOG_CRIT              3
  ------------------
  240|      0|            }
  241|       |
  242|      0|            ngx_log_error(level, c->log, err, "connect() to %V failed",
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  243|      0|                          pc->name);
  244|       |
  245|      0|            ngx_close_connection(c);
  246|      0|            pc->connection = NULL;
  247|       |
  248|      0|            return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  249|      0|        }
  250|      0|    }
  251|       |
  252|      5|    if (ngx_add_conn) {
  ------------------
  |  |  405|      5|#define ngx_add_conn         ngx_event_actions.add_conn
  |  |  ------------------
  |  |  |  Branch (405:30): [True: 0, False: 5]
  |  |  ------------------
  ------------------
  253|      0|        if (rc == -1) {
  ------------------
  |  Branch (253:13): [True: 0, False: 0]
  ------------------
  254|       |
  255|       |            /* NGX_EINPROGRESS */
  256|       |
  257|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  258|      0|        }
  259|       |
  260|      0|        ngx_log_debug0(NGX_LOG_DEBUG_EVENT, pc->log, 0, "connected");
  261|       |
  262|      0|        wev->ready = 1;
  263|       |
  264|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  265|      0|    }
  266|       |
  267|      5|    if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
  ------------------
  |  |  245|      5|#define NGX_USE_IOCP_EVENT       0x00000200
  ------------------
  |  Branch (267:9): [True: 0, False: 5]
  ------------------
  268|       |
  269|      0|        ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pc->log, ngx_socket_errno,
  270|      0|                       "connect(): %d", rc);
  271|       |
  272|      0|        if (ngx_blocking(s) == -1) {
  ------------------
  |  Branch (272:13): [True: 0, False: 0]
  ------------------
  273|      0|            ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  274|      0|                          ngx_blocking_n " failed");
  275|      0|            goto failed;
  276|      0|        }
  277|       |
  278|       |        /*
  279|       |         * FreeBSD's aio allows to post an operation on non-connected socket.
  280|       |         * NT does not support it.
  281|       |         *
  282|       |         * TODO: check in Win32, etc. As workaround we can use NGX_ONESHOT_EVENT
  283|       |         */
  284|       |
  285|      0|        rev->ready = 1;
  286|      0|        wev->ready = 1;
  287|       |
  288|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  289|      0|    }
  290|       |
  291|      5|    if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
  ------------------
  |  |  208|      5|#define NGX_USE_CLEAR_EVENT      0x00000004
  ------------------
  |  Branch (291:9): [True: 0, False: 5]
  ------------------
  292|       |
  293|       |        /* kqueue */
  294|       |
  295|      0|        event = NGX_CLEAR_EVENT;
  ------------------
  |  |  353|      0|#define NGX_CLEAR_EVENT    EPOLLET
  ------------------
  296|       |
  297|      5|    } else {
  298|       |
  299|       |        /* select, poll, /dev/poll */
  300|       |
  301|      5|        event = NGX_LEVEL_EVENT;
  ------------------
  |  |  352|      5|#define NGX_LEVEL_EVENT    0
  ------------------
  302|      5|    }
  303|       |
  304|      5|    if (ngx_add_event(rev, NGX_READ_EVENT, event) != NGX_OK) {
  ------------------
  |  |  403|      5|#define ngx_add_event        ngx_event_actions.add
  ------------------
                  if (ngx_add_event(rev, NGX_READ_EVENT, event) != NGX_OK) {
  ------------------
  |  |  349|      5|#define NGX_READ_EVENT     (EPOLLIN|EPOLLRDHUP)
  ------------------
                  if (ngx_add_event(rev, NGX_READ_EVENT, event) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (304:9): [True: 0, False: 5]
  ------------------
  305|      0|        goto failed;
  306|      0|    }
  307|       |
  308|      5|    if (rc == -1) {
  ------------------
  |  Branch (308:9): [True: 0, False: 5]
  ------------------
  309|       |
  310|       |        /* NGX_EINPROGRESS */
  311|       |
  312|      0|        if (ngx_add_event(wev, NGX_WRITE_EVENT, event) != NGX_OK) {
  ------------------
  |  |  403|      0|#define ngx_add_event        ngx_event_actions.add
  ------------------
                      if (ngx_add_event(wev, NGX_WRITE_EVENT, event) != NGX_OK) {
  ------------------
  |  |  350|      0|#define NGX_WRITE_EVENT    EPOLLOUT
  ------------------
                      if (ngx_add_event(wev, NGX_WRITE_EVENT, event) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (312:13): [True: 0, False: 0]
  ------------------
  313|      0|            goto failed;
  314|      0|        }
  315|       |
  316|      0|        return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  317|      0|    }
  318|       |
  319|      5|    ngx_log_debug0(NGX_LOG_DEBUG_EVENT, pc->log, 0, "connected");
  320|       |
  321|      5|    wev->ready = 1;
  322|       |
  323|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  324|       |
  325|      0|failed:
  326|       |
  327|      0|    ngx_close_connection(c);
  328|      0|    pc->connection = NULL;
  329|       |
  330|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  331|      5|}

ngx_event_timer_init:
   24|      1|{
   25|      1|    ngx_rbtree_init(&ngx_event_timer_rbtree, &ngx_event_timer_sentinel,
  ------------------
  |  |   45|      1|    ngx_rbtree_sentinel_init(s);                                              \
  |  |  ------------------
  |  |  |  |   73|      1|#define ngx_rbtree_sentinel_init(node)  ngx_rbt_black(node)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      1|#define ngx_rbt_black(node)             ((node)->color = 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   46|      1|    (tree)->root = s;                                                         \
  |  |   47|      1|    (tree)->sentinel = s;                                                     \
  |  |   48|      1|    (tree)->insert = i
  ------------------
   26|      1|                    ngx_rbtree_insert_timer_value);
   27|       |
   28|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   29|      1|}

ngx_connection.c:ngx_event_del_timer:
   33|      7|{
   34|      7|    ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
   35|      7|                   "event timer del: %d: %M",
   36|      7|                    ngx_event_ident(ev->data), ev->timer.key);
   37|       |
   38|      7|    ngx_rbtree_delete(&ngx_event_timer_rbtree, &ev->timer);
   39|       |
   40|       |#if (NGX_DEBUG)
   41|       |    ev->timer.left = NULL;
   42|       |    ev->timer.right = NULL;
   43|       |    ev->timer.parent = NULL;
   44|       |#endif
   45|       |
   46|      7|    ev->timer_set = 0;
   47|      7|}
ngx_http_request.c:ngx_event_add_timer:
   52|      7|{
   53|      7|    ngx_msec_t      key;
   54|      7|    ngx_msec_int_t  diff;
   55|       |
   56|      7|    key = ngx_current_msec + timer;
   57|       |
   58|      7|    if (ev->timer_set) {
  ------------------
  |  Branch (58:9): [True: 0, False: 7]
  ------------------
   59|       |
   60|       |        /*
   61|       |         * Use a previous timer value if difference between it and a new
   62|       |         * value is less than NGX_TIMER_LAZY_DELAY milliseconds: this allows
   63|       |         * to minimize the rbtree operations for fast connections.
   64|       |         */
   65|       |
   66|      0|        diff = (ngx_msec_int_t) (key - ev->timer.key);
   67|       |
   68|      0|        if (ngx_abs(diff) < NGX_TIMER_LAZY_DELAY) {
  ------------------
  |  |  108|      0|#define ngx_abs(value)       (((value) >= 0) ? (value) : - (value))
  |  |  ------------------
  |  |  |  Branch (108:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                      if (ngx_abs(diff) < NGX_TIMER_LAZY_DELAY) {
  ------------------
  |  |   19|      0|#define NGX_TIMER_LAZY_DELAY  300
  ------------------
  |  Branch (68:13): [True: 0, False: 0]
  ------------------
   69|      0|            ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,
   70|      0|                           "event timer: %d, old: %M, new: %M",
   71|      0|                            ngx_event_ident(ev->data), ev->timer.key, key);
   72|      0|            return;
   73|      0|        }
   74|       |
   75|      0|        ngx_del_timer(ev);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
   76|      0|    }
   77|       |
   78|      7|    ev->timer.key = key;
   79|       |
   80|      7|    ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,
   81|      7|                   "event timer add: %d: %M:%M",
   82|      7|                    ngx_event_ident(ev->data), timer, ev->timer.key);
   83|       |
   84|      7|    ngx_rbtree_insert(&ngx_event_timer_rbtree, &ev->timer);
   85|       |
   86|      7|    ev->timer_set = 1;
   87|      7|}
ngx_http_upstream.c:ngx_event_del_timer:
   33|      5|{
   34|      5|    ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
   35|      5|                   "event timer del: %d: %M",
   36|      5|                    ngx_event_ident(ev->data), ev->timer.key);
   37|       |
   38|      5|    ngx_rbtree_delete(&ngx_event_timer_rbtree, &ev->timer);
   39|       |
   40|       |#if (NGX_DEBUG)
   41|       |    ev->timer.left = NULL;
   42|       |    ev->timer.right = NULL;
   43|       |    ev->timer.parent = NULL;
   44|       |#endif
   45|       |
   46|      5|    ev->timer_set = 0;
   47|      5|}
ngx_http_upstream.c:ngx_event_add_timer:
   52|      5|{
   53|      5|    ngx_msec_t      key;
   54|      5|    ngx_msec_int_t  diff;
   55|       |
   56|      5|    key = ngx_current_msec + timer;
   57|       |
   58|      5|    if (ev->timer_set) {
  ------------------
  |  Branch (58:9): [True: 0, False: 5]
  ------------------
   59|       |
   60|       |        /*
   61|       |         * Use a previous timer value if difference between it and a new
   62|       |         * value is less than NGX_TIMER_LAZY_DELAY milliseconds: this allows
   63|       |         * to minimize the rbtree operations for fast connections.
   64|       |         */
   65|       |
   66|      0|        diff = (ngx_msec_int_t) (key - ev->timer.key);
   67|       |
   68|      0|        if (ngx_abs(diff) < NGX_TIMER_LAZY_DELAY) {
  ------------------
  |  |  108|      0|#define ngx_abs(value)       (((value) >= 0) ? (value) : - (value))
  |  |  ------------------
  |  |  |  Branch (108:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                      if (ngx_abs(diff) < NGX_TIMER_LAZY_DELAY) {
  ------------------
  |  |   19|      0|#define NGX_TIMER_LAZY_DELAY  300
  ------------------
  |  Branch (68:13): [True: 0, False: 0]
  ------------------
   69|      0|            ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,
   70|      0|                           "event timer: %d, old: %M, new: %M",
   71|      0|                            ngx_event_ident(ev->data), ev->timer.key, key);
   72|      0|            return;
   73|      0|        }
   74|       |
   75|      0|        ngx_del_timer(ev);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
   76|      0|    }
   77|       |
   78|      5|    ev->timer.key = key;
   79|       |
   80|      5|    ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,
   81|      5|                   "event timer add: %d: %M:%M",
   82|      5|                    ngx_event_ident(ev->data), timer, ev->timer.key);
   83|       |
   84|      5|    ngx_rbtree_insert(&ngx_event_timer_rbtree, &ev->timer);
   85|       |
   86|      5|    ev->timer_set = 1;
   87|      5|}

_Z54descriptor_table_http_5frequest_5fproto_2eproto_getterv:
  106|      1|PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_http_5frequest_5fproto_2eproto_getter() {
  107|      1|  return &descriptor_table_http_5frequest_5fproto_2eproto;
  108|      1|}
_ZN9HttpProtoC2EPN6google8protobuf5ArenaE:
  131|     16|  : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
  132|     16|  SharedCtor(arena);
  133|       |  // @@protoc_insertion_point(arena_constructor:HttpProto)
  134|     16|}
_ZN9HttpProtoD2Ev:
  184|     16|HttpProto::~HttpProto() {
  185|       |  // @@protoc_insertion_point(destructor:HttpProto)
  186|     16|  if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
  ------------------
  |  Branch (186:13): [True: 0, False: 16]
  ------------------
  187|      0|  (void)arena;
  188|      0|    return;
  189|      0|  }
  190|     16|  SharedDtor();
  191|     16|}
_ZN9HttpProto5ClearEv:
  203|     32|void HttpProto::Clear() {
  204|       |// @@protoc_insertion_point(message_clear_start:HttpProto)
  205|     32|  ::uint32_t cached_has_bits = 0;
  206|       |  // Prevent compiler warnings about cached_has_bits being unused
  207|     32|  (void) cached_has_bits;
  208|       |
  209|     32|  cached_has_bits = _impl_._has_bits_[0];
  210|     32|  if (cached_has_bits & 0x00000003u) {
  ------------------
  |  Branch (210:7): [True: 0, False: 32]
  ------------------
  211|      0|    if (cached_has_bits & 0x00000001u) {
  ------------------
  |  Branch (211:9): [True: 0, False: 0]
  ------------------
  212|      0|      _impl_.request_.ClearNonDefaultToEmpty();
  213|      0|    }
  214|      0|    if (cached_has_bits & 0x00000002u) {
  ------------------
  |  Branch (214:9): [True: 0, False: 0]
  ------------------
  215|      0|      _impl_.reply_.ClearNonDefaultToEmpty();
  216|      0|    }
  217|      0|  }
  218|     32|  _impl_._has_bits_.Clear();
  219|     32|  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
  220|     32|}
_ZNK9HttpProto11GetMetadataEv:
  402|    208|::PROTOBUF_NAMESPACE_ID::Metadata HttpProto::GetMetadata() const {
  403|    208|  return ::_pbi::AssignDescriptors(
  404|    208|      &descriptor_table_http_5frequest_5fproto_2eproto_getter, &descriptor_table_http_5frequest_5fproto_2eproto_once,
  405|    208|      file_level_metadata_http_5frequest_5fproto_2eproto[0]);
  406|    208|}
_ZN9HttpProto10SharedCtorEPN6google8protobuf5ArenaE:
  164|     16|inline void HttpProto::SharedCtor(::_pb::Arena* arena) {
  165|     16|  (void)arena;
  166|     16|  new (&_impl_) Impl_{
  167|     16|      decltype(_impl_._has_bits_){}
  168|     16|    , /*decltype(_impl_._cached_size_)*/{}
  169|     16|    , decltype(_impl_.request_) {}
  170|       |
  171|     16|    , decltype(_impl_.reply_) {}
  172|       |
  173|     16|  };
  174|     16|  _impl_.request_.InitDefault();
  175|       |  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  176|       |        _impl_.request_.Set("", GetArenaForAllocation());
  177|       |  #endif  // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  178|     16|  _impl_.reply_.InitDefault();
  179|       |  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  180|       |        _impl_.reply_.Set("", GetArenaForAllocation());
  181|       |  #endif  // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  182|     16|}
_ZN9HttpProto10SharedDtorEv:
  193|     16|inline void HttpProto::SharedDtor() {
  194|     16|  ABSL_DCHECK(GetArenaForAllocation() == nullptr);
  ------------------
  |  |   43|     16|#define ABSL_DCHECK(condition) ABSL_DCHECK_IMPL((condition), #condition)
  |  |  ------------------
  |  |  |  |   43|     16|  ABSL_CHECK_IMPL(true || (condition), "true")
  |  |  |  |  ------------------
  |  |  |  |  |  |   26|     16|  ABSL_LOG_INTERNAL_CONDITION_FATAL(STATELESS,                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|     16|  ABSL_LOG_INTERNAL_##type##_CONDITION(condition)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   27|     16|                                    ABSL_PREDICT_FALSE(!(condition))) \
  |  |  |  |  |  |   28|     16|  ABSL_LOG_INTERNAL_CHECK(condition_text).InternalStream()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   65|      0|  ::absl::log_internal::LogMessageFatal(__FILE__, __LINE__, failure_message)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  195|     16|  _impl_.request_.Destroy();
  196|     16|  _impl_.reply_.Destroy();
  197|     16|}

_ZN9HttpProtoC2Ev:
   70|     16|  inline HttpProto() : HttpProto(nullptr) {}
_ZNK9HttpProto7requestEv:
  284|     32|inline const std::string& HttpProto::request() const {
  285|       |  // @@protoc_insertion_point(field_get:HttpProto.request)
  286|     32|  return _internal_request();
  287|     32|}
_ZNK9HttpProto17_internal_requestEv:
  300|     32|inline const std::string& HttpProto::_internal_request() const {
  301|     32|  return _impl_.request_.Get();
  302|     32|}
_ZNK9HttpProto5replyEv:
  349|     32|inline const std::string& HttpProto::reply() const {
  350|       |  // @@protoc_insertion_point(field_get:HttpProto.reply)
  351|     32|  return _internal_reply();
  352|     32|}
_ZNK9HttpProto15_internal_replyEv:
  365|     32|inline const std::string& HttpProto::_internal_reply() const {
  366|     32|  return _impl_.reply_.Get();
  367|     32|}

InitializeNginx:
  176|      1|extern "C" int InitializeNginx(void) {
  177|      1|  ngx_log_t *log;
  178|      1|  ngx_cycle_t init_cycle;
  179|       |
  180|      1|  if (access("nginx.sock", F_OK) != -1) {
  ------------------
  |  Branch (180:7): [True: 0, False: 1]
  ------------------
  181|      0|    remove("nginx.sock");
  182|      0|  }
  183|       |
  184|      1|  ngx_debug_init();
  185|      1|  ngx_strerror_init();
  186|      1|  ngx_time_init();
  187|      1|  ngx_regex_init();
  188|       |
  189|       |  // Just output logs to stderr
  190|      1|  ngx_log.file = &ngx_log_file;
  191|      1|  ngx_log.log_level = NGX_LOG_EMERG;
  ------------------
  |  |   17|      1|#define NGX_LOG_EMERG             1
  ------------------
  192|      1|  ngx_log_file.fd = ngx_stderr;
  ------------------
  |  |  373|      1|#define ngx_stderr               STDERR_FILENO
  ------------------
  193|      1|  log = &ngx_log;
  194|       |
  195|      1|  ngx_memzero(&init_cycle, sizeof(ngx_cycle_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  196|      1|  init_cycle.log = log;
  197|      1|  ngx_cycle = &init_cycle;
  198|       |
  199|      1|  init_cycle.pool = ngx_create_pool(1024, log);
  200|       |
  201|       |  // Set custom argv/argc
  202|      1|  my_argv[0] = arg1;
  203|      1|  my_argv[1] = NULL;
  204|      1|  ngx_argv = ngx_os_argv = my_argv;
  205|      1|  ngx_argc = 0;
  206|       |
  207|       |  // Weird trick to free a leaking buffer always caught by ASAN
  208|       |  // We basically let ngx overwrite the environment variable, free the leak and
  209|       |  // restore the environment as before.
  210|      1|  char *env_before = environ[0];
  211|      1|  environ[0] = my_argv[0] + 1;
  212|      1|  ngx_os_init(log);
  213|      1|  free(environ[0]);
  214|      1|  environ[0] = env_before;
  215|       |
  216|      1|  ngx_crc32_table_init();
  217|      1|  ngx_preinit_modules();
  218|       |
  219|      1|  FILE *fptr = fopen(config_file, "w");
  220|      1|  fprintf(fptr, "%s", configuration);
  221|      1|  fclose(fptr);
  222|      1|  init_cycle.conf_file.len = strlen(config_file);
  223|      1|  init_cycle.conf_file.data = (unsigned char *) config_file;
  224|       |
  225|      1|  cycle = ngx_init_cycle(&init_cycle);
  226|       |
  227|      1|  ngx_os_status(cycle->log);
  228|      1|  ngx_cycle = cycle;
  229|       |
  230|      1|  ngx_event_actions.add = add_event;
  231|      1|  ngx_event_actions.init = init_event;
  232|      1|  ngx_io.send_chain = send_chain;
  233|      1|  ngx_event_flags = 1;
  234|      1|  ngx_queue_init(&ngx_posted_accept_events);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  235|      1|  ngx_queue_init(&ngx_posted_next_events);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  236|      1|  ngx_queue_init(&ngx_posted_events);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  237|      1|  ngx_event_timer_init(cycle->log);
  238|      1|  return 0;
  239|      1|}
http_request_fuzzer.cc:_ZL9add_eventP11ngx_event_slm:
  159|      9|static ngx_int_t add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags) {
  160|      9|  return NGX_OK;
  ------------------
  |  |   38|      9|#define  NGX_OK          0
  ------------------
  161|      9|}
http_request_fuzzer.cc:_ZL10send_chainP16ngx_connection_sP11ngx_chain_sl:
  169|      5|                               off_t limit) {
  170|      5|  c->read->ready = 1;
  171|      5|  c->recv = reply_recv_handler;
  172|      5|  return in->next;
  173|      5|}
http_request_fuzzer.cc:_ZL18reply_recv_handlerP16ngx_connection_sPhm:
  137|     22|                                  size_t size) {
  138|     22|  req_reply = (ngx_http_request_t *)(c->data);
  139|     22|  if (!cln_added) { // add cleanup so that we know whether everything is cleanup
  ------------------
  |  Branch (139:7): [True: 5, False: 17]
  ------------------
  140|       |                    // correctly
  141|      5|    cln_added = 1;
  142|      5|    cln_new.handler = cleanup_reply;
  143|      5|    cln_new.next = req_reply->cleanup;
  144|      5|    cln_new.data = NULL;
  145|      5|    req_reply->cleanup = &cln_new;
  146|      5|  }
  147|     22|  upstream = req_reply->upstream;
  148|       |
  149|     22|  if (reply.data_len < size)
  ------------------
  |  Branch (149:7): [True: 8, False: 14]
  ------------------
  150|      8|    size = reply.data_len;
  151|     22|  memcpy(buf, reply.data, size);
  152|     22|  reply.data += size;
  153|     22|  reply.data_len -= size;
  154|     22|  if (size == 0)
  ------------------
  |  Branch (154:7): [True: 4, False: 18]
  ------------------
  155|      4|    c->read->ready = 0;
  156|     22|  return size;
  157|     22|}
http_request_fuzzer.cc:_ZL17TestOneProtoInputRK9HttpProto:
  246|     16|DEFINE_PROTO_FUZZER(const HttpProto &input) {
  247|     16|  static int init = InitializeNginx();
  248|     16|  assert(init == 0);
  249|       |
  250|       |  // have two free connections, one for client, one for upstream
  251|     16|  ngx_event_t read_event1 = {};
  252|     16|  ngx_event_t write_event1 = {};
  253|     16|  ngx_connection_t local1 = {};
  254|     16|  ngx_event_t read_event2 = {};
  255|     16|  ngx_event_t write_event2 = {};
  256|     16|  ngx_connection_t local2 = {};
  257|     16|  ngx_connection_t *c;
  258|     16|  ngx_listening_t *ls;
  259|       |
  260|     16|  req_reply = NULL;
  261|     16|  upstream = NULL;
  262|     16|  cln_added = 0;
  263|       |
  264|     16|  const char *req_string = input.request().c_str();
  265|     16|  size_t req_len = input.request().size();
  266|     16|  const char *rep_string = input.reply().c_str();
  267|     16|  size_t rep_len = input.reply().size();
  268|     16|  request.data = (const uint8_t *)req_string;
  269|     16|  request.data_len = req_len;
  270|     16|  reply.data = (const uint8_t *)rep_string;
  271|     16|  reply.data_len = rep_len;
  272|       |
  273|       |  // Use listening entry created from configuration
  274|     16|  ls = (ngx_listening_t *)ngx_cycle->listening.elts;
  275|       |
  276|       |  // Fake event ready for dispatch on read
  277|     16|  local1.read = &read_event1;
  278|     16|  local1.write = &write_event1;
  279|     16|  local2.read = &read_event2;
  280|     16|  local2.write = &write_event2;
  281|     16|  local2.send_chain = send_chain;
  282|       |
  283|       |  // Create fake free connection to feed the http handler
  284|     16|  ngx_cycle->free_connections = &local1;
  285|     16|  local1.data = &local2;
  286|     16|  ngx_cycle->free_connection_n = 2;
  287|       |
  288|       |  // Initialize connection
  289|     16|  c = ngx_get_connection(
  290|     16|      255, &ngx_log); // 255 - (hopefully unused) socket descriptor
  291|       |
  292|     16|  c->shared = 1;
  293|     16|  c->destroyed = 0;
  294|     16|  c->type = SOCK_STREAM;
  295|     16|  c->pool = ngx_create_pool(256, ngx_cycle->log);
  296|     16|  c->sockaddr = ls->sockaddr;
  297|     16|  c->listening = ls;
  298|     16|  c->recv = request_recv_handler; // Where the input will be read
  299|     16|  c->send_chain = send_chain;
  300|     16|  c->send = (ngx_send_pt)invalid_call;
  301|     16|  c->recv_chain = (ngx_recv_chain_pt)invalid_call;
  302|     16|  c->log = &ngx_log;
  303|     16|  c->pool->log = &ngx_log;
  304|     16|  c->read->log = &ngx_log;
  305|     16|  c->write->log = &ngx_log;
  306|     16|  c->socklen = ls->socklen;
  307|     16|  c->local_sockaddr = ls->sockaddr;
  308|     16|  c->local_socklen = ls->socklen;
  309|     16|  c->data = NULL;
  310|       |
  311|     16|  read_event1.ready = 1;
  312|     16|  write_event1.ready = write_event1.delayed = 1;
  313|       |
  314|       |  // Will redirect to http parser
  315|     16|  ngx_http_init_connection(c);
  316|       |
  317|       |  // We do not provide working timers or events, and thus we have to manually
  318|       |  // clean up the requests we created. We do this here.
  319|       |  // Cross-referencing: https://trac.nginx.org/nginx/ticket/2080#no1).I
  320|       |  // This is a fix that should be bettered in the future, by creating proper
  321|       |  // timers and events.
  322|     16|  if (c->destroyed != 1) {
  ------------------
  |  Branch (322:7): [True: 7, False: 9]
  ------------------
  323|      7|    if (c->read->data != NULL) {
  ------------------
  |  Branch (323:9): [True: 7, False: 0]
  ------------------
  324|      7|      ngx_connection_t *c2 = (ngx_connection_t*)c->read->data;
  325|      7|        ngx_http_request_t *req_tmp = (ngx_http_request_t*)c2->data;
  326|      7|        req_tmp->cleanup = NULL;
  327|      7|        ngx_http_finalize_request(req_tmp, NGX_DONE);
  ------------------
  |  |   42|      7|#define  NGX_DONE       -4
  ------------------
  328|      7|    }
  329|      7|    ngx_close_connection(c);
  330|      7|  }
  331|     16|}
http_request_fuzzer.cc:_ZL20request_recv_handlerP16ngx_connection_sPhm:
  126|    221|                                    size_t size) {
  127|    221|  if (request.data_len < size)
  ------------------
  |  Branch (127:7): [True: 33, False: 188]
  ------------------
  128|     33|    size = request.data_len;
  129|    221|  memcpy(buf, request.data, size);
  130|    221|  request.data += size;
  131|    221|  request.data_len -= size;
  132|    221|  return size;
  133|    221|}

__wrap_connect:
   22|      5|int __wrap_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
   23|      5|  return 0;
   24|      5|}
__wrap_bind:
   26|      1|int __wrap_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
   27|      1|  return 0;
   28|      1|}
__wrap_shutdown:
   30|      7|int __wrap_shutdown(int socket, int how) { return 0; }
__wrap_listen:
   32|      2|ssize_t __wrap_listen(int fd, void *buf, size_t bytes) { return 0; }
__wrap_setsockopt:
   35|      6|                      socklen_t optlen) {
   36|      6|  return 0;
   37|      6|}
__wrap_chmod:
   39|      1|int __wrap_chmod(const char *pathname, mode_t mode){
   40|      1|  return 0;
   41|      1|}
__wrap_chown:
   43|      4|int __wrap_chown(const char *pathname, uid_t owner, gid_t group){
   44|      4|  return 0;
   45|      4|}
__wrap_getpwnam:
   50|      1|struct passwd *__wrap_getpwnam(const char *name){
   51|      1|  pwd.pw_uid = 1;
   52|      1|  return &pwd;
   53|      1|}
__wrap_getgrnam:
   55|      1|struct group *__wrap_getgrnam(const char *name){
   56|      1|  grp.gr_gid = 1;
   57|      1|  return &grp;
   58|      1|}

ngx_http_access_module.c:ngx_http_access_init:
  449|      1|{
  450|      1|    ngx_http_handler_pt        *h;
  451|      1|    ngx_http_core_main_conf_t  *cmcf;
  452|       |
  453|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  454|       |
  455|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers);
  456|      1|    if (h == NULL) {
  ------------------
  |  Branch (456:9): [True: 0, False: 1]
  ------------------
  457|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  458|      0|    }
  459|       |
  460|      1|    *h = ngx_http_access_handler;
  461|       |
  462|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  463|      1|}
ngx_http_access_module.c:ngx_http_access_handler:
  124|     11|{
  125|     11|    struct sockaddr_in          *sin;
  126|     11|    ngx_http_access_loc_conf_t  *alcf;
  127|     11|#if (NGX_HAVE_INET6)
  128|     11|    u_char                      *p;
  129|     11|    in_addr_t                    addr;
  130|     11|    struct sockaddr_in6         *sin6;
  131|     11|#endif
  132|       |
  133|     11|    alcf = ngx_http_get_module_loc_conf(r, ngx_http_access_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  134|       |
  135|     11|    switch (r->connection->sockaddr->sa_family) {
  ------------------
  |  Branch (135:13): [True: 0, False: 11]
  ------------------
  136|       |
  137|      0|    case AF_INET:
  ------------------
  |  Branch (137:5): [True: 0, False: 11]
  ------------------
  138|      0|        if (alcf->rules) {
  ------------------
  |  Branch (138:13): [True: 0, False: 0]
  ------------------
  139|      0|            sin = (struct sockaddr_in *) r->connection->sockaddr;
  140|      0|            return ngx_http_access_inet(r, alcf, sin->sin_addr.s_addr);
  141|      0|        }
  142|      0|        break;
  143|       |
  144|      0|#if (NGX_HAVE_INET6)
  145|       |
  146|      0|    case AF_INET6:
  ------------------
  |  Branch (146:5): [True: 0, False: 11]
  ------------------
  147|      0|        sin6 = (struct sockaddr_in6 *) r->connection->sockaddr;
  148|      0|        p = sin6->sin6_addr.s6_addr;
  149|       |
  150|      0|        if (alcf->rules && IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
  ------------------
  |  Branch (150:13): [True: 0, False: 0]
  ------------------
  151|      0|            addr = p[12] << 24;
  152|      0|            addr += p[13] << 16;
  153|      0|            addr += p[14] << 8;
  154|      0|            addr += p[15];
  155|      0|            return ngx_http_access_inet(r, alcf, htonl(addr));
  156|      0|        }
  157|       |
  158|      0|        if (alcf->rules6) {
  ------------------
  |  Branch (158:13): [True: 0, False: 0]
  ------------------
  159|      0|            return ngx_http_access_inet6(r, alcf, p);
  160|      0|        }
  161|       |
  162|      0|        break;
  163|       |
  164|      0|#endif
  165|       |
  166|      0|#if (NGX_HAVE_UNIX_DOMAIN)
  167|       |
  168|     11|    case AF_UNIX:
  ------------------
  |  Branch (168:5): [True: 11, False: 0]
  ------------------
  169|     11|        if (alcf->rules_un) {
  ------------------
  |  Branch (169:13): [True: 0, False: 11]
  ------------------
  170|      0|            return ngx_http_access_unix(r, alcf);
  171|      0|        }
  172|       |
  173|     11|        break;
  174|       |
  175|     11|#endif
  176|     11|    }
  177|       |
  178|     11|    return NGX_DECLINED;
  ------------------
  |  |   43|     11|#define  NGX_DECLINED   -5
  ------------------
  179|     11|}
ngx_http_access_module.c:ngx_http_access_create_loc_conf:
  408|      4|{
  409|      4|    ngx_http_access_loc_conf_t  *conf;
  410|       |
  411|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_access_loc_conf_t));
  412|      4|    if (conf == NULL) {
  ------------------
  |  Branch (412:9): [True: 0, False: 4]
  ------------------
  413|      0|        return NULL;
  414|      0|    }
  415|       |
  416|      4|    return conf;
  417|      4|}
ngx_http_access_module.c:ngx_http_access_merge_loc_conf:
  422|      2|{
  423|      2|    ngx_http_access_loc_conf_t  *prev = parent;
  424|      2|    ngx_http_access_loc_conf_t  *conf = child;
  425|       |
  426|      2|    if (conf->rules == NULL
  ------------------
  |  Branch (426:9): [True: 2, False: 0]
  ------------------
  427|      2|#if (NGX_HAVE_INET6)
  428|      2|        && conf->rules6 == NULL
  ------------------
  |  Branch (428:12): [True: 2, False: 0]
  ------------------
  429|      2|#endif
  430|      2|#if (NGX_HAVE_UNIX_DOMAIN)
  431|      2|        && conf->rules_un == NULL
  ------------------
  |  Branch (431:12): [True: 2, False: 0]
  ------------------
  432|      2|#endif
  433|      2|    ) {
  434|      2|        conf->rules = prev->rules;
  435|      2|#if (NGX_HAVE_INET6)
  436|      2|        conf->rules6 = prev->rules6;
  437|      2|#endif
  438|      2|#if (NGX_HAVE_UNIX_DOMAIN)
  439|      2|        conf->rules_un = prev->rules_un;
  440|      2|#endif
  441|      2|    }
  442|       |
  443|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  444|      2|}

ngx_http_auth_basic_module.c:ngx_http_auth_basic_init:
  383|      1|{
  384|      1|    ngx_http_handler_pt        *h;
  385|      1|    ngx_http_core_main_conf_t  *cmcf;
  386|       |
  387|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  388|       |
  389|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers);
  390|      1|    if (h == NULL) {
  ------------------
  |  Branch (390:9): [True: 0, False: 1]
  ------------------
  391|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  392|      0|    }
  393|       |
  394|      1|    *h = ngx_http_auth_basic_handler;
  395|       |
  396|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  397|      1|}
ngx_http_auth_basic_module.c:ngx_http_auth_basic_handler:
   91|     11|{
   92|     11|    off_t                            offset;
   93|     11|    ssize_t                          n;
   94|     11|    ngx_fd_t                         fd;
   95|     11|    ngx_int_t                        rc;
   96|     11|    ngx_err_t                        err;
   97|     11|    ngx_str_t                        pwd, realm, user_file;
   98|     11|    ngx_uint_t                       i, level, login, left, passwd;
   99|     11|    ngx_file_t                       file;
  100|     11|    ngx_http_auth_basic_loc_conf_t  *alcf;
  101|     11|    u_char                           buf[NGX_HTTP_AUTH_BUF_SIZE];
  102|     11|    enum {
  103|     11|        sw_login,
  104|     11|        sw_passwd,
  105|     11|        sw_skip
  106|     11|    } state;
  107|       |
  108|     11|    alcf = ngx_http_get_module_loc_conf(r, ngx_http_auth_basic_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  109|       |
  110|     11|    if (alcf->realm == NULL || alcf->user_file == NULL) {
  ------------------
  |  Branch (110:9): [True: 11, False: 0]
  |  Branch (110:32): [True: 0, False: 0]
  ------------------
  111|     11|        return NGX_DECLINED;
  ------------------
  |  |   43|     11|#define  NGX_DECLINED   -5
  ------------------
  112|     11|    }
  113|       |
  114|      0|    if (ngx_http_complex_value(r, alcf->realm, &realm) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (114:9): [True: 0, False: 0]
  ------------------
  115|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  116|      0|    }
  117|       |
  118|      0|    if (realm.len == 3 && ngx_strncmp(realm.data, "off", 3) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (118:9): [True: 0, False: 0]
  |  Branch (118:27): [True: 0, False: 0]
  ------------------
  119|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  120|      0|    }
  121|       |
  122|      0|    rc = ngx_http_auth_basic_user(r);
  123|       |
  124|      0|    if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (124:9): [True: 0, False: 0]
  ------------------
  125|       |
  126|      0|        ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  127|      0|                      "no user/password was provided for basic authentication");
  128|       |
  129|      0|        return ngx_http_auth_basic_set_realm(r, &realm);
  130|      0|    }
  131|       |
  132|      0|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (132:9): [True: 0, False: 0]
  ------------------
  133|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  134|      0|    }
  135|       |
  136|      0|    if (ngx_http_complex_value(r, alcf->user_file, &user_file) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (136:9): [True: 0, False: 0]
  ------------------
  137|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  138|      0|    }
  139|       |
  140|      0|    fd = ngx_open_file(user_file.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
  ------------------
  |  |   66|      0|    open((const char *) name, mode|create, access)
  ------------------
  141|       |
  142|      0|    if (fd == NGX_INVALID_FILE) {
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
  |  Branch (142:9): [True: 0, False: 0]
  ------------------
  143|      0|        err = ngx_errno;
  ------------------
  |  |   69|      0|#define ngx_errno                  errno
  ------------------
  144|       |
  145|      0|        if (err == NGX_ENOENT) {
  ------------------
  |  |   19|      0|#define NGX_ENOENT        ENOENT
  ------------------
  |  Branch (145:13): [True: 0, False: 0]
  ------------------
  146|      0|            level = NGX_LOG_ERR;
  ------------------
  |  |   20|      0|#define NGX_LOG_ERR               4
  ------------------
  147|      0|            rc = NGX_HTTP_FORBIDDEN;
  ------------------
  |  |   94|      0|#define NGX_HTTP_FORBIDDEN                 403
  ------------------
  148|       |
  149|      0|        } else {
  150|      0|            level = NGX_LOG_CRIT;
  ------------------
  |  |   19|      0|#define NGX_LOG_CRIT              3
  ------------------
  151|      0|            rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  152|      0|        }
  153|       |
  154|      0|        ngx_log_error(level, r->connection->log, err,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  155|      0|                      ngx_open_file_n " \"%s\" failed", user_file.data);
  156|       |
  157|      0|        return rc;
  158|      0|    }
  159|       |
  160|      0|    ngx_memzero(&file, sizeof(ngx_file_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  161|       |
  162|      0|    file.fd = fd;
  163|      0|    file.name = user_file;
  164|      0|    file.log = r->connection->log;
  165|       |
  166|      0|    state = sw_login;
  167|      0|    passwd = 0;
  168|      0|    login = 0;
  169|      0|    left = 0;
  170|      0|    offset = 0;
  171|       |
  172|      0|    for ( ;; ) {
  173|      0|        i = left;
  174|       |
  175|      0|        n = ngx_read_file(&file, buf + left, NGX_HTTP_AUTH_BUF_SIZE - left,
  ------------------
  |  |   14|      0|#define NGX_HTTP_AUTH_BUF_SIZE  2048
  ------------------
  176|      0|                          offset);
  177|       |
  178|      0|        if (n == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (178:13): [True: 0, False: 0]
  ------------------
  179|      0|            rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  180|      0|            goto cleanup;
  181|      0|        }
  182|       |
  183|      0|        if (n == 0) {
  ------------------
  |  Branch (183:13): [True: 0, False: 0]
  ------------------
  184|      0|            break;
  185|      0|        }
  186|       |
  187|      0|        for (i = left; i < left + n; i++) {
  ------------------
  |  Branch (187:24): [True: 0, False: 0]
  ------------------
  188|      0|            switch (state) {
  ------------------
  |  Branch (188:21): [True: 0, False: 0]
  ------------------
  189|       |
  190|      0|            case sw_login:
  ------------------
  |  Branch (190:13): [True: 0, False: 0]
  ------------------
  191|      0|                if (login == 0) {
  ------------------
  |  Branch (191:21): [True: 0, False: 0]
  ------------------
  192|       |
  193|      0|                    if (buf[i] == '#' || buf[i] == CR) {
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (193:25): [True: 0, False: 0]
  |  Branch (193:42): [True: 0, False: 0]
  ------------------
  194|      0|                        state = sw_skip;
  195|      0|                        break;
  196|      0|                    }
  197|       |
  198|      0|                    if (buf[i] == LF) {
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (198:25): [True: 0, False: 0]
  ------------------
  199|      0|                        break;
  200|      0|                    }
  201|      0|                }
  202|       |
  203|      0|                if (buf[i] != r->headers_in.user.data[login]) {
  ------------------
  |  Branch (203:21): [True: 0, False: 0]
  ------------------
  204|      0|                    state = sw_skip;
  205|      0|                    break;
  206|      0|                }
  207|       |
  208|      0|                if (login == r->headers_in.user.len) {
  ------------------
  |  Branch (208:21): [True: 0, False: 0]
  ------------------
  209|      0|                    state = sw_passwd;
  210|      0|                    passwd = i + 1;
  211|      0|                }
  212|       |
  213|      0|                login++;
  214|       |
  215|      0|                break;
  216|       |
  217|      0|            case sw_passwd:
  ------------------
  |  Branch (217:13): [True: 0, False: 0]
  ------------------
  218|      0|                if (buf[i] == LF || buf[i] == CR || buf[i] == ':') {
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
                              if (buf[i] == LF || buf[i] == CR || buf[i] == ':') {
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (218:21): [True: 0, False: 0]
  |  Branch (218:37): [True: 0, False: 0]
  |  Branch (218:53): [True: 0, False: 0]
  ------------------
  219|      0|                    buf[i] = '\0';
  220|       |
  221|      0|                    pwd.len = i - passwd;
  222|      0|                    pwd.data = &buf[passwd];
  223|       |
  224|      0|                    rc = ngx_http_auth_basic_crypt_handler(r, &pwd, &realm);
  225|      0|                    goto cleanup;
  226|      0|                }
  227|       |
  228|      0|                break;
  229|       |
  230|      0|            case sw_skip:
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|                if (buf[i] == LF) {
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (231:21): [True: 0, False: 0]
  ------------------
  232|      0|                    state = sw_login;
  233|      0|                    login = 0;
  234|      0|                }
  235|       |
  236|      0|                break;
  237|      0|            }
  238|      0|        }
  239|       |
  240|      0|        if (state == sw_passwd) {
  ------------------
  |  Branch (240:13): [True: 0, False: 0]
  ------------------
  241|      0|            left = left + n - passwd;
  242|      0|            ngx_memmove(buf, &buf[passwd], left);
  ------------------
  |  |  143|      0|#define ngx_memmove(dst, src, n)  (void) memmove(dst, src, n)
  ------------------
  243|      0|            passwd = 0;
  244|       |
  245|      0|        } else {
  246|      0|            left = 0;
  247|      0|        }
  248|       |
  249|      0|        offset += n;
  250|      0|    }
  251|       |
  252|      0|    if (state == sw_passwd) {
  ------------------
  |  Branch (252:9): [True: 0, False: 0]
  ------------------
  253|      0|        pwd.len = i - passwd;
  254|      0|        pwd.data = ngx_pnalloc(r->pool, pwd.len + 1);
  255|      0|        if (pwd.data == NULL) {
  ------------------
  |  Branch (255:13): [True: 0, False: 0]
  ------------------
  256|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  257|      0|        }
  258|       |
  259|      0|        ngx_cpystrn(pwd.data, &buf[passwd], pwd.len + 1);
  260|       |
  261|      0|        rc = ngx_http_auth_basic_crypt_handler(r, &pwd, &realm);
  262|      0|        goto cleanup;
  263|      0|    }
  264|       |
  265|      0|    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  266|      0|                  "user \"%V\" was not found in \"%s\"",
  267|      0|                  &r->headers_in.user, user_file.data);
  268|       |
  269|      0|    rc = ngx_http_auth_basic_set_realm(r, &realm);
  270|       |
  271|      0|cleanup:
  272|       |
  273|      0|    if (ngx_close_file(file.fd) == NGX_FILE_ERROR) {
  ------------------
  |  |  109|      0|#define ngx_close_file           close
  ------------------
                  if (ngx_close_file(file.fd) == NGX_FILE_ERROR) {
  ------------------
  |  |   50|      0|#define NGX_FILE_ERROR           -1
  ------------------
  |  Branch (273:9): [True: 0, False: 0]
  ------------------
  274|      0|        ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  275|      0|                      ngx_close_file_n " \"%s\" failed", user_file.data);
  276|      0|    }
  277|       |
  278|      0|    ngx_explicit_memzero(buf, NGX_HTTP_AUTH_BUF_SIZE);
  ------------------
  |  |   14|      0|#define NGX_HTTP_AUTH_BUF_SIZE  2048
  ------------------
  279|       |
  280|      0|    return rc;
  281|      0|}
ngx_http_auth_basic_module.c:ngx_http_auth_basic_create_loc_conf:
  353|      4|{
  354|      4|    ngx_http_auth_basic_loc_conf_t  *conf;
  355|       |
  356|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_auth_basic_loc_conf_t));
  357|      4|    if (conf == NULL) {
  ------------------
  |  Branch (357:9): [True: 0, False: 4]
  ------------------
  358|      0|        return NULL;
  359|      0|    }
  360|       |
  361|      4|    conf->realm = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  362|      4|    conf->user_file = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  363|       |
  364|      4|    return conf;
  365|      4|}
ngx_http_auth_basic_module.c:ngx_http_auth_basic_merge_loc_conf:
  370|      2|{
  371|      2|    ngx_http_auth_basic_loc_conf_t  *prev = parent;
  372|      2|    ngx_http_auth_basic_loc_conf_t  *conf = child;
  373|       |
  374|      2|    ngx_conf_merge_ptr_value(conf->realm, prev->realm, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
  375|      2|    ngx_conf_merge_ptr_value(conf->user_file, prev->user_file, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
  376|       |
  377|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  378|      2|}

ngx_http_autoindex_module.c:ngx_http_autoindex_init:
 1058|      1|{
 1059|      1|    ngx_http_handler_pt        *h;
 1060|      1|    ngx_http_core_main_conf_t  *cmcf;
 1061|       |
 1062|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 1063|       |
 1064|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
 1065|      1|    if (h == NULL) {
  ------------------
  |  Branch (1065:9): [True: 0, False: 1]
  ------------------
 1066|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1067|      0|    }
 1068|       |
 1069|      1|    *h = ngx_http_autoindex_handler;
 1070|       |
 1071|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1072|      1|}
ngx_http_autoindex_module.c:ngx_http_autoindex_create_loc_conf:
 1023|      4|{
 1024|      4|    ngx_http_autoindex_loc_conf_t  *conf;
 1025|       |
 1026|      4|    conf = ngx_palloc(cf->pool, sizeof(ngx_http_autoindex_loc_conf_t));
 1027|      4|    if (conf == NULL) {
  ------------------
  |  Branch (1027:9): [True: 0, False: 4]
  ------------------
 1028|      0|        return NULL;
 1029|      0|    }
 1030|       |
 1031|      4|    conf->enable = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1032|      4|    conf->format = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1033|      4|    conf->localtime = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1034|      4|    conf->exact_size = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1035|       |
 1036|      4|    return conf;
 1037|      4|}
ngx_http_autoindex_module.c:ngx_http_autoindex_merge_loc_conf:
 1042|      2|{
 1043|      2|    ngx_http_autoindex_loc_conf_t *prev = parent;
 1044|      2|    ngx_http_autoindex_loc_conf_t *conf = child;
 1045|       |
 1046|      2|    ngx_conf_merge_value(conf->enable, prev->enable, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1047|      2|    ngx_conf_merge_uint_value(conf->format, prev->format,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 1048|      2|                              NGX_HTTP_AUTOINDEX_HTML);
 1049|      2|    ngx_conf_merge_value(conf->localtime, prev->localtime, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1050|      2|    ngx_conf_merge_value(conf->exact_size, prev->exact_size, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1051|       |
 1052|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 1053|      2|}

ngx_http_browser_module.c:ngx_http_browser_add_variables:
  399|      1|{
  400|      1|    ngx_http_variable_t  *var, *v;
  401|       |
  402|      4|    for (v = ngx_http_browser_vars; v->name.len; v++) {
  ------------------
  |  Branch (402:37): [True: 3, False: 1]
  ------------------
  403|       |
  404|      3|        var = ngx_http_add_variable(cf, &v->name, v->flags);
  405|      3|        if (var == NULL) {
  ------------------
  |  Branch (405:13): [True: 0, False: 3]
  ------------------
  406|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  407|      0|        }
  408|       |
  409|      3|        var->get_handler = v->get_handler;
  410|      3|        var->data = v->data;
  411|      3|    }
  412|       |
  413|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  414|      1|}
ngx_http_browser_module.c:ngx_http_browser_create_conf:
  419|      4|{
  420|      4|    ngx_http_browser_conf_t  *conf;
  421|       |
  422|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_browser_conf_t));
  423|      4|    if (conf == NULL) {
  ------------------
  |  Branch (423:9): [True: 0, False: 4]
  ------------------
  424|      0|        return NULL;
  425|      0|    }
  426|       |
  427|       |    /*
  428|       |     * set by ngx_pcalloc():
  429|       |     *
  430|       |     *     conf->modern_browsers = NULL;
  431|       |     *     conf->ancient_browsers = NULL;
  432|       |     *     conf->modern_browser_value = NULL;
  433|       |     *     conf->ancient_browser_value = NULL;
  434|       |     *
  435|       |     *     conf->modern_unlisted_browsers = 0;
  436|       |     *     conf->netscape4 = 0;
  437|       |     */
  438|       |
  439|      4|    return conf;
  440|      4|}
ngx_http_browser_module.c:ngx_http_browser_merge_conf:
  445|      2|{
  446|      2|    ngx_http_browser_conf_t *prev = parent;
  447|      2|    ngx_http_browser_conf_t *conf = child;
  448|       |
  449|      2|    ngx_uint_t                  i, n;
  450|      2|    ngx_http_modern_browser_t  *browsers, *opera;
  451|       |
  452|       |    /*
  453|       |     * At the merge the skip field is used to store the browser slot,
  454|       |     * it will be used in sorting and then will overwritten
  455|       |     * with a real skip value.  The zero value means Opera.
  456|       |     */
  457|       |
  458|      2|    if (conf->modern_browsers == NULL && conf->modern_unlisted_browsers == 0) {
  ------------------
  |  Branch (458:9): [True: 2, False: 0]
  |  Branch (458:42): [True: 2, False: 0]
  ------------------
  459|      2|        conf->modern_browsers = prev->modern_browsers;
  460|      2|        conf->modern_unlisted_browsers = prev->modern_unlisted_browsers;
  461|       |
  462|      2|    } else if (conf->modern_browsers != NULL) {
  ------------------
  |  Branch (462:16): [True: 0, False: 0]
  ------------------
  463|      0|        browsers = conf->modern_browsers->elts;
  464|       |
  465|      0|        for (i = 0; i < conf->modern_browsers->nelts; i++) {
  ------------------
  |  Branch (465:21): [True: 0, False: 0]
  ------------------
  466|      0|            if (browsers[i].skip == 0) {
  ------------------
  |  Branch (466:17): [True: 0, False: 0]
  ------------------
  467|      0|                goto found;
  468|      0|            }
  469|      0|        }
  470|       |
  471|       |        /*
  472|       |         * Opera may contain MSIE string, so if Opera was not enumerated
  473|       |         * as modern browsers, then add it and set a unreachable version
  474|       |         */
  475|       |
  476|      0|        opera = ngx_array_push(conf->modern_browsers);
  477|      0|        if (opera == NULL) {
  ------------------
  |  Branch (477:13): [True: 0, False: 0]
  ------------------
  478|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  479|      0|        }
  480|       |
  481|      0|        opera->skip = 0;
  482|      0|        opera->version = 4001000000U;
  483|       |
  484|      0|        browsers = conf->modern_browsers->elts;
  485|       |
  486|      0|found:
  487|       |
  488|      0|        ngx_qsort(browsers, (size_t) conf->modern_browsers->nelts,
  ------------------
  |  |  231|      0|#define ngx_qsort             qsort
  ------------------
  489|      0|                  sizeof(ngx_http_modern_browser_t),
  490|      0|                  ngx_http_modern_browser_sort);
  491|       |
  492|      0|        for (i = 0; i < conf->modern_browsers->nelts; i++) {
  ------------------
  |  Branch (492:21): [True: 0, False: 0]
  ------------------
  493|      0|             n = browsers[i].skip;
  494|       |
  495|      0|             browsers[i].skip = ngx_http_modern_browser_masks[n].skip;
  496|      0|             browsers[i].add = ngx_http_modern_browser_masks[n].add;
  497|      0|             (void) ngx_cpystrn(browsers[i].name,
  498|      0|                                ngx_http_modern_browser_masks[n].name, 12);
  499|      0|        }
  500|      0|    }
  501|       |
  502|      2|    if (conf->ancient_browsers == NULL && conf->netscape4 == 0) {
  ------------------
  |  Branch (502:9): [True: 2, False: 0]
  |  Branch (502:43): [True: 2, False: 0]
  ------------------
  503|      2|        conf->ancient_browsers = prev->ancient_browsers;
  504|      2|        conf->netscape4 = prev->netscape4;
  505|      2|    }
  506|       |
  507|      2|    if (conf->modern_browser_value == NULL) {
  ------------------
  |  Branch (507:9): [True: 2, False: 0]
  ------------------
  508|      2|        conf->modern_browser_value = prev->modern_browser_value;
  509|      2|    }
  510|       |
  511|      2|    if (conf->modern_browser_value == NULL) {
  ------------------
  |  Branch (511:9): [True: 1, False: 1]
  ------------------
  512|      1|        conf->modern_browser_value = &ngx_http_variable_true_value;
  513|      1|    }
  514|       |
  515|      2|    if (conf->ancient_browser_value == NULL) {
  ------------------
  |  Branch (515:9): [True: 2, False: 0]
  ------------------
  516|      2|        conf->ancient_browser_value = prev->ancient_browser_value;
  517|      2|    }
  518|       |
  519|      2|    if (conf->ancient_browser_value == NULL) {
  ------------------
  |  Branch (519:9): [True: 1, False: 1]
  ------------------
  520|      1|        conf->ancient_browser_value = &ngx_http_variable_true_value;
  521|      1|    }
  522|       |
  523|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  524|      2|}

ngx_http_charset_filter_module.c:ngx_http_charset_postconfiguration:
 1609|      1|{
 1610|      1|    u_char                       **src, **dst;
 1611|      1|    ngx_int_t                      c;
 1612|      1|    ngx_uint_t                     i, t;
 1613|      1|    ngx_http_charset_t            *charset;
 1614|      1|    ngx_http_charset_recode_t     *recode;
 1615|      1|    ngx_http_charset_tables_t     *tables;
 1616|      1|    ngx_http_charset_main_conf_t  *mcf;
 1617|       |
 1618|      1|    mcf = ngx_http_conf_get_module_main_conf(cf,
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 1619|      1|                                             ngx_http_charset_filter_module);
 1620|       |
 1621|      1|    recode = mcf->recodes.elts;
 1622|      1|    tables = mcf->tables.elts;
 1623|      1|    charset = mcf->charsets.elts;
 1624|       |
 1625|      1|    for (i = 0; i < mcf->recodes.nelts; i++) {
  ------------------
  |  Branch (1625:17): [True: 0, False: 1]
  ------------------
 1626|       |
 1627|      0|        c = recode[i].src;
 1628|       |
 1629|      0|        for (t = 0; t < mcf->tables.nelts; t++) {
  ------------------
  |  Branch (1629:21): [True: 0, False: 0]
  ------------------
 1630|       |
 1631|      0|            if (c == tables[t].src && recode[i].dst == tables[t].dst) {
  ------------------
  |  Branch (1631:17): [True: 0, False: 0]
  |  Branch (1631:39): [True: 0, False: 0]
  ------------------
 1632|      0|                goto next;
 1633|      0|            }
 1634|       |
 1635|      0|            if (c == tables[t].dst && recode[i].dst == tables[t].src) {
  ------------------
  |  Branch (1635:17): [True: 0, False: 0]
  |  Branch (1635:39): [True: 0, False: 0]
  ------------------
 1636|      0|                goto next;
 1637|      0|            }
 1638|      0|        }
 1639|       |
 1640|      0|        ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1641|      0|                   "no \"charset_map\" between the charsets \"%V\" and \"%V\"",
 1642|      0|                   &charset[c].name, &charset[recode[i].dst].name);
 1643|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1644|       |
 1645|      0|    next:
 1646|      0|        continue;
 1647|      0|    }
 1648|       |
 1649|       |
 1650|      1|    for (t = 0; t < mcf->tables.nelts; t++) {
  ------------------
  |  Branch (1650:17): [True: 0, False: 1]
  ------------------
 1651|       |
 1652|      0|        src = charset[tables[t].src].tables;
 1653|       |
 1654|      0|        if (src == NULL) {
  ------------------
  |  Branch (1654:13): [True: 0, False: 0]
  ------------------
 1655|      0|            src = ngx_pcalloc(cf->pool, sizeof(u_char *) * mcf->charsets.nelts);
 1656|      0|            if (src == NULL) {
  ------------------
  |  Branch (1656:17): [True: 0, False: 0]
  ------------------
 1657|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1658|      0|            }
 1659|       |
 1660|      0|            charset[tables[t].src].tables = src;
 1661|      0|        }
 1662|       |
 1663|      0|        dst = charset[tables[t].dst].tables;
 1664|       |
 1665|      0|        if (dst == NULL) {
  ------------------
  |  Branch (1665:13): [True: 0, False: 0]
  ------------------
 1666|      0|            dst = ngx_pcalloc(cf->pool, sizeof(u_char *) * mcf->charsets.nelts);
 1667|      0|            if (dst == NULL) {
  ------------------
  |  Branch (1667:17): [True: 0, False: 0]
  ------------------
 1668|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1669|      0|            }
 1670|       |
 1671|      0|            charset[tables[t].dst].tables = dst;
 1672|      0|        }
 1673|       |
 1674|      0|        src[tables[t].dst] = tables[t].src2dst;
 1675|      0|        dst[tables[t].src] = tables[t].dst2src;
 1676|      0|    }
 1677|       |
 1678|      1|    ngx_http_next_header_filter = ngx_http_top_header_filter;
 1679|      1|    ngx_http_top_header_filter = ngx_http_charset_header_filter;
 1680|       |
 1681|      1|    ngx_http_next_body_filter = ngx_http_top_body_filter;
 1682|      1|    ngx_http_top_body_filter = ngx_http_charset_body_filter;
 1683|       |
 1684|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1685|      1|}
ngx_http_charset_filter_module.c:ngx_http_charset_header_filter:
  218|      7|{
  219|      7|    ngx_int_t                      charset, source_charset;
  220|      7|    ngx_str_t                      dst, src;
  221|      7|    ngx_http_charset_t            *charsets;
  222|      7|    ngx_http_charset_main_conf_t  *mcf;
  223|       |
  224|      7|    if (r == r->main) {
  ------------------
  |  Branch (224:9): [True: 7, False: 0]
  ------------------
  225|      7|        charset = ngx_http_destination_charset(r, &dst);
  226|       |
  227|      7|    } else {
  228|      0|        charset = ngx_http_main_request_charset(r, &dst);
  229|      0|    }
  230|       |
  231|      7|    if (charset == NGX_ERROR) {
  ------------------
  |  |   39|      7|#define  NGX_ERROR      -1
  ------------------
  |  Branch (231:9): [True: 0, False: 7]
  ------------------
  232|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  233|      0|    }
  234|       |
  235|      7|    if (charset == NGX_DECLINED) {
  ------------------
  |  |   43|      7|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (235:9): [True: 7, False: 0]
  ------------------
  236|      7|        return ngx_http_next_header_filter(r);
  237|      7|    }
  238|       |
  239|       |    /* charset: charset index or NGX_HTTP_NO_CHARSET */
  240|       |
  241|      0|    source_charset = ngx_http_source_charset(r, &src);
  242|       |
  243|      0|    if (source_charset == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (243:9): [True: 0, False: 0]
  ------------------
  244|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  245|      0|    }
  246|       |
  247|       |    /*
  248|       |     * source_charset: charset index, NGX_HTTP_NO_CHARSET,
  249|       |     *                 or NGX_HTTP_CHARSET_OFF
  250|       |     */
  251|       |
  252|      0|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  253|      0|                   "charset: \"%V\" > \"%V\"", &src, &dst);
  254|       |
  255|      0|    if (source_charset == NGX_HTTP_CHARSET_OFF) {
  ------------------
  |  |   13|      0|#define NGX_HTTP_CHARSET_OFF    -2
  ------------------
  |  Branch (255:9): [True: 0, False: 0]
  ------------------
  256|      0|        ngx_http_set_charset(r, &dst);
  257|       |
  258|      0|        return ngx_http_next_header_filter(r);
  259|      0|    }
  260|       |
  261|      0|    if (charset == NGX_HTTP_NO_CHARSET
  ------------------
  |  |   14|      0|#define NGX_HTTP_NO_CHARSET     -3
  ------------------
  |  Branch (261:9): [True: 0, False: 0]
  ------------------
  262|      0|        || source_charset == NGX_HTTP_NO_CHARSET)
  ------------------
  |  |   14|      0|#define NGX_HTTP_NO_CHARSET     -3
  ------------------
  |  Branch (262:12): [True: 0, False: 0]
  ------------------
  263|      0|    {
  264|      0|        if (source_charset != charset
  ------------------
  |  Branch (264:13): [True: 0, False: 0]
  ------------------
  265|      0|            || ngx_strncasecmp(dst.data, src.data, dst.len) != 0)
  ------------------
  |  Branch (265:16): [True: 0, False: 0]
  ------------------
  266|      0|        {
  267|      0|            goto no_charset_map;
  268|      0|        }
  269|       |
  270|      0|        ngx_http_set_charset(r, &dst);
  271|       |
  272|      0|        return ngx_http_next_header_filter(r);
  273|      0|    }
  274|       |
  275|      0|    if (source_charset == charset) {
  ------------------
  |  Branch (275:9): [True: 0, False: 0]
  ------------------
  276|      0|        r->headers_out.content_type.len = r->headers_out.content_type_len;
  277|       |
  278|      0|        ngx_http_set_charset(r, &dst);
  279|       |
  280|      0|        return ngx_http_next_header_filter(r);
  281|      0|    }
  282|       |
  283|       |    /* source_charset != charset */
  284|       |
  285|      0|    if (r->headers_out.content_encoding
  ------------------
  |  Branch (285:9): [True: 0, False: 0]
  ------------------
  286|      0|        && r->headers_out.content_encoding->value.len)
  ------------------
  |  Branch (286:12): [True: 0, False: 0]
  ------------------
  287|      0|    {
  288|      0|        return ngx_http_next_header_filter(r);
  289|      0|    }
  290|       |
  291|      0|    mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module);
  ------------------
  |  |   56|      0|    (r)->main_conf[module.ctx_index]
  ------------------
  292|      0|    charsets = mcf->charsets.elts;
  293|       |
  294|      0|    if (charsets[source_charset].tables == NULL
  ------------------
  |  Branch (294:9): [True: 0, False: 0]
  ------------------
  295|      0|        || charsets[source_charset].tables[charset] == NULL)
  ------------------
  |  Branch (295:12): [True: 0, False: 0]
  ------------------
  296|      0|    {
  297|      0|        goto no_charset_map;
  298|      0|    }
  299|       |
  300|      0|    r->headers_out.content_type.len = r->headers_out.content_type_len;
  301|       |
  302|      0|    ngx_http_set_charset(r, &dst);
  303|       |
  304|      0|    return ngx_http_charset_ctx(r, charsets, charset, source_charset);
  305|       |
  306|      0|no_charset_map:
  307|       |
  308|      0|    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  309|      0|                  "no \"charset_map\" between the charsets \"%V\" and \"%V\"",
  310|      0|                  &src, &dst);
  311|       |
  312|      0|    return ngx_http_next_header_filter(r);
  313|      0|}
ngx_http_charset_filter_module.c:ngx_http_destination_charset:
  318|      7|{
  319|      7|    ngx_int_t                      charset;
  320|      7|    ngx_http_charset_t            *charsets;
  321|      7|    ngx_http_variable_value_t     *vv;
  322|      7|    ngx_http_charset_loc_conf_t   *mlcf;
  323|      7|    ngx_http_charset_main_conf_t  *mcf;
  324|       |
  325|      7|    if (r->headers_out.content_type.len == 0) {
  ------------------
  |  Branch (325:9): [True: 5, False: 2]
  ------------------
  326|      5|        return NGX_DECLINED;
  ------------------
  |  |   43|      5|#define  NGX_DECLINED   -5
  ------------------
  327|      5|    }
  328|       |
  329|      2|    if (r->headers_out.override_charset
  ------------------
  |  Branch (329:9): [True: 0, False: 2]
  ------------------
  330|      2|        && r->headers_out.override_charset->len)
  ------------------
  |  Branch (330:12): [True: 0, False: 0]
  ------------------
  331|      0|    {
  332|      0|        *name = *r->headers_out.override_charset;
  333|       |
  334|      0|        charset = ngx_http_get_charset(r, name);
  335|       |
  336|      0|        if (charset != NGX_HTTP_NO_CHARSET) {
  ------------------
  |  |   14|      0|#define NGX_HTTP_NO_CHARSET     -3
  ------------------
  |  Branch (336:13): [True: 0, False: 0]
  ------------------
  337|      0|            return charset;
  338|      0|        }
  339|       |
  340|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  341|      0|                      "unknown charset \"%V\" to override", name);
  342|       |
  343|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  344|      0|    }
  345|       |
  346|      2|    mlcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module);
  ------------------
  |  |   58|      2|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  347|      2|    charset = mlcf->charset;
  348|       |
  349|      2|    if (charset == NGX_HTTP_CHARSET_OFF) {
  ------------------
  |  |   13|      2|#define NGX_HTTP_CHARSET_OFF    -2
  ------------------
  |  Branch (349:9): [True: 2, False: 0]
  ------------------
  350|      2|        return NGX_DECLINED;
  ------------------
  |  |   43|      2|#define  NGX_DECLINED   -5
  ------------------
  351|      2|    }
  352|       |
  353|      0|    if (r->headers_out.charset.len) {
  ------------------
  |  Branch (353:9): [True: 0, False: 0]
  ------------------
  354|      0|        if (mlcf->override_charset == 0) {
  ------------------
  |  Branch (354:13): [True: 0, False: 0]
  ------------------
  355|      0|            return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  356|      0|        }
  357|       |
  358|      0|    } else {
  359|      0|        if (ngx_http_test_content_type(r, &mlcf->types) == NULL) {
  ------------------
  |  Branch (359:13): [True: 0, False: 0]
  ------------------
  360|      0|            return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  361|      0|        }
  362|      0|    }
  363|       |
  364|      0|    if (charset < NGX_HTTP_CHARSET_VAR) {
  ------------------
  |  |   15|      0|#define NGX_HTTP_CHARSET_VAR    0x10000
  ------------------
  |  Branch (364:9): [True: 0, False: 0]
  ------------------
  365|      0|        mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module);
  ------------------
  |  |   56|      0|    (r)->main_conf[module.ctx_index]
  ------------------
  366|      0|        charsets = mcf->charsets.elts;
  367|      0|        *name = charsets[charset].name;
  368|      0|        return charset;
  369|      0|    }
  370|       |
  371|      0|    vv = ngx_http_get_indexed_variable(r, charset - NGX_HTTP_CHARSET_VAR);
  ------------------
  |  |   15|      0|#define NGX_HTTP_CHARSET_VAR    0x10000
  ------------------
  372|       |
  373|      0|    if (vv == NULL || vv->not_found) {
  ------------------
  |  Branch (373:9): [True: 0, False: 0]
  |  Branch (373:23): [True: 0, False: 0]
  ------------------
  374|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  375|      0|    }
  376|       |
  377|      0|    name->len = vv->len;
  378|      0|    name->data = vv->data;
  379|       |
  380|      0|    return ngx_http_get_charset(r, name);
  381|      0|}
ngx_http_charset_filter_module.c:ngx_http_charset_body_filter:
  548|     13|{
  549|     13|    ngx_int_t                rc;
  550|     13|    ngx_buf_t               *b;
  551|     13|    ngx_chain_t             *cl, *out, **ll;
  552|     13|    ngx_http_charset_ctx_t  *ctx;
  553|       |
  554|     13|    ctx = ngx_http_get_module_ctx(r, ngx_http_charset_filter_module);
  ------------------
  |  |   80|     13|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
  555|       |
  556|     13|    if (ctx == NULL || ctx->table == NULL) {
  ------------------
  |  Branch (556:9): [True: 13, False: 0]
  |  Branch (556:24): [True: 0, False: 0]
  ------------------
  557|     13|        return ngx_http_next_body_filter(r, in);
  558|     13|    }
  559|       |
  560|      0|    if ((ctx->to_utf8 || ctx->from_utf8) || ctx->busy) {
  ------------------
  |  Branch (560:10): [True: 0, False: 0]
  |  Branch (560:26): [True: 0, False: 0]
  |  Branch (560:45): [True: 0, False: 0]
  ------------------
  561|       |
  562|      0|        out = NULL;
  563|      0|        ll = &out;
  564|       |
  565|      0|        for (cl = in; cl; cl = cl->next) {
  ------------------
  |  Branch (565:23): [True: 0, False: 0]
  ------------------
  566|      0|            b = cl->buf;
  567|       |
  568|      0|            if (ngx_buf_size(b) == 0) {
  ------------------
  |  |  137|      0|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|                            ((b)->file_last - (b)->file_pos))
  ------------------
  |  Branch (568:17): [True: 0, False: 0]
  ------------------
  569|       |
  570|      0|                *ll = ngx_alloc_chain_link(r->pool);
  571|      0|                if (*ll == NULL) {
  ------------------
  |  Branch (571:21): [True: 0, False: 0]
  ------------------
  572|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  573|      0|                }
  574|       |
  575|      0|                (*ll)->buf = b;
  576|      0|                (*ll)->next = NULL;
  577|       |
  578|      0|                ll = &(*ll)->next;
  579|       |
  580|      0|                continue;
  581|      0|            }
  582|       |
  583|      0|            if (ctx->to_utf8) {
  ------------------
  |  Branch (583:17): [True: 0, False: 0]
  ------------------
  584|      0|                *ll = ngx_http_charset_recode_to_utf8(r->pool, b, ctx);
  585|       |
  586|      0|            } else {
  587|      0|                *ll = ngx_http_charset_recode_from_utf8(r->pool, b, ctx);
  588|      0|            }
  589|       |
  590|      0|            if (*ll == NULL) {
  ------------------
  |  Branch (590:17): [True: 0, False: 0]
  ------------------
  591|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  592|      0|            }
  593|       |
  594|      0|            while (*ll) {
  ------------------
  |  Branch (594:20): [True: 0, False: 0]
  ------------------
  595|      0|                ll = &(*ll)->next;
  596|      0|            }
  597|      0|        }
  598|       |
  599|      0|        rc = ngx_http_next_body_filter(r, out);
  600|       |
  601|      0|        if (out) {
  ------------------
  |  Branch (601:13): [True: 0, False: 0]
  ------------------
  602|      0|            if (ctx->busy == NULL) {
  ------------------
  |  Branch (602:17): [True: 0, False: 0]
  ------------------
  603|      0|                ctx->busy = out;
  604|       |
  605|      0|            } else {
  606|      0|                for (cl = ctx->busy; cl->next; cl = cl->next) { /* void */ }
  ------------------
  |  Branch (606:38): [True: 0, False: 0]
  ------------------
  607|      0|                cl->next = out;
  608|      0|            }
  609|      0|        }
  610|       |
  611|      0|        while (ctx->busy) {
  ------------------
  |  Branch (611:16): [True: 0, False: 0]
  ------------------
  612|       |
  613|      0|            cl = ctx->busy;
  614|      0|            b = cl->buf;
  615|       |
  616|      0|            if (ngx_buf_size(b) != 0) {
  ------------------
  |  |  137|      0|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|                            ((b)->file_last - (b)->file_pos))
  ------------------
  |  Branch (616:17): [True: 0, False: 0]
  ------------------
  617|      0|                break;
  618|      0|            }
  619|       |
  620|      0|            ctx->busy = cl->next;
  621|       |
  622|      0|            if (b->tag != (ngx_buf_tag_t) &ngx_http_charset_filter_module) {
  ------------------
  |  Branch (622:17): [True: 0, False: 0]
  ------------------
  623|      0|                continue;
  624|      0|            }
  625|       |
  626|      0|            if (b->shadow) {
  ------------------
  |  Branch (626:17): [True: 0, False: 0]
  ------------------
  627|      0|                b->shadow->pos = b->shadow->last;
  628|      0|            }
  629|       |
  630|      0|            if (b->pos) {
  ------------------
  |  Branch (630:17): [True: 0, False: 0]
  ------------------
  631|      0|                cl->next = ctx->free_buffers;
  632|      0|                ctx->free_buffers = cl;
  633|      0|                continue;
  634|      0|            }
  635|       |
  636|      0|            cl->next = ctx->free_bufs;
  637|      0|            ctx->free_bufs = cl;
  638|      0|        }
  639|       |
  640|      0|        return rc;
  641|      0|    }
  642|       |
  643|      0|    for (cl = in; cl; cl = cl->next) {
  ------------------
  |  Branch (643:19): [True: 0, False: 0]
  ------------------
  644|      0|        (void) ngx_http_charset_recode(cl->buf, ctx->table);
  645|      0|    }
  646|       |
  647|      0|    return ngx_http_next_body_filter(r, in);
  648|      0|}
ngx_http_charset_filter_module.c:ngx_http_charset_create_main_conf:
 1491|      1|{
 1492|      1|    ngx_http_charset_main_conf_t  *mcf;
 1493|       |
 1494|      1|    mcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_charset_main_conf_t));
 1495|      1|    if (mcf == NULL) {
  ------------------
  |  Branch (1495:9): [True: 0, False: 1]
  ------------------
 1496|      0|        return NULL;
 1497|      0|    }
 1498|       |
 1499|      1|    if (ngx_array_init(&mcf->charsets, cf->pool, 2, sizeof(ngx_http_charset_t))
  ------------------
  |  Branch (1499:9): [True: 0, False: 1]
  ------------------
 1500|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1501|      0|    {
 1502|      0|        return NULL;
 1503|      0|    }
 1504|       |
 1505|      1|    if (ngx_array_init(&mcf->tables, cf->pool, 1,
  ------------------
  |  Branch (1505:9): [True: 0, False: 1]
  ------------------
 1506|      1|                       sizeof(ngx_http_charset_tables_t))
 1507|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1508|      0|    {
 1509|      0|        return NULL;
 1510|      0|    }
 1511|       |
 1512|      1|    if (ngx_array_init(&mcf->recodes, cf->pool, 2,
  ------------------
  |  Branch (1512:9): [True: 0, False: 1]
  ------------------
 1513|      1|                       sizeof(ngx_http_charset_recode_t))
 1514|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1515|      0|    {
 1516|      0|        return NULL;
 1517|      0|    }
 1518|       |
 1519|      1|    return mcf;
 1520|      1|}
ngx_http_charset_filter_module.c:ngx_http_charset_create_loc_conf:
 1525|      4|{
 1526|      4|    ngx_http_charset_loc_conf_t  *lcf;
 1527|       |
 1528|      4|    lcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_charset_loc_conf_t));
 1529|      4|    if (lcf == NULL) {
  ------------------
  |  Branch (1529:9): [True: 0, False: 4]
  ------------------
 1530|      0|        return NULL;
 1531|      0|    }
 1532|       |
 1533|       |    /*
 1534|       |     * set by ngx_pcalloc():
 1535|       |     *
 1536|       |     *     lcf->types = { NULL };
 1537|       |     *     lcf->types_keys = NULL;
 1538|       |     */
 1539|       |
 1540|      4|    lcf->charset = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1541|      4|    lcf->source_charset = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1542|      4|    lcf->override_charset = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1543|       |
 1544|      4|    return lcf;
 1545|      4|}
ngx_http_charset_filter_module.c:ngx_http_charset_merge_loc_conf:
 1550|      2|{
 1551|      2|    ngx_http_charset_loc_conf_t *prev = parent;
 1552|      2|    ngx_http_charset_loc_conf_t *conf = child;
 1553|       |
 1554|      2|    ngx_uint_t                     i;
 1555|      2|    ngx_http_charset_recode_t     *recode;
 1556|      2|    ngx_http_charset_main_conf_t  *mcf;
 1557|       |
 1558|      2|    if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
  ------------------
  |  Branch (1558:9): [True: 0, False: 2]
  ------------------
 1559|      2|                             &prev->types_keys, &prev->types,
 1560|      2|                             ngx_http_charset_default_types)
 1561|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 1562|      0|    {
 1563|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1564|      0|    }
 1565|       |
 1566|      2|    ngx_conf_merge_value(conf->override_charset, prev->override_charset, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1567|      2|    ngx_conf_merge_value(conf->charset, prev->charset, NGX_HTTP_CHARSET_OFF);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1568|      2|    ngx_conf_merge_value(conf->source_charset, prev->source_charset,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1569|      2|                         NGX_HTTP_CHARSET_OFF);
 1570|       |
 1571|      2|    if (conf->charset == NGX_HTTP_CHARSET_OFF
  ------------------
  |  |   13|      4|#define NGX_HTTP_CHARSET_OFF    -2
  ------------------
  |  Branch (1571:9): [True: 2, False: 0]
  ------------------
 1572|      2|        || conf->source_charset == NGX_HTTP_CHARSET_OFF
  ------------------
  |  |   13|      2|#define NGX_HTTP_CHARSET_OFF    -2
  ------------------
  |  Branch (1572:12): [True: 0, False: 0]
  ------------------
 1573|      2|        || conf->charset == conf->source_charset)
  ------------------
  |  Branch (1573:12): [True: 0, False: 0]
  ------------------
 1574|      2|    {
 1575|      2|        return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 1576|      2|    }
 1577|       |
 1578|      0|    if (conf->source_charset >= NGX_HTTP_CHARSET_VAR
  ------------------
  |  |   15|      0|#define NGX_HTTP_CHARSET_VAR    0x10000
  ------------------
  |  Branch (1578:9): [True: 0, False: 0]
  ------------------
 1579|      0|        || conf->charset >= NGX_HTTP_CHARSET_VAR)
  ------------------
  |  |   15|      0|#define NGX_HTTP_CHARSET_VAR    0x10000
  ------------------
  |  Branch (1579:12): [True: 0, False: 0]
  ------------------
 1580|      0|    {
 1581|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 1582|      0|    }
 1583|       |
 1584|      0|    mcf = ngx_http_conf_get_module_main_conf(cf,
  ------------------
  |  |   62|      0|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 1585|      0|                                             ngx_http_charset_filter_module);
 1586|      0|    recode = mcf->recodes.elts;
 1587|      0|    for (i = 0; i < mcf->recodes.nelts; i++) {
  ------------------
  |  Branch (1587:17): [True: 0, False: 0]
  ------------------
 1588|      0|        if (conf->source_charset == recode[i].src
  ------------------
  |  Branch (1588:13): [True: 0, False: 0]
  ------------------
 1589|      0|            && conf->charset == recode[i].dst)
  ------------------
  |  Branch (1589:16): [True: 0, False: 0]
  ------------------
 1590|      0|        {
 1591|      0|            return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 1592|      0|        }
 1593|      0|    }
 1594|       |
 1595|      0|    recode = ngx_array_push(&mcf->recodes);
 1596|      0|    if (recode == NULL) {
  ------------------
  |  Branch (1596:9): [True: 0, False: 0]
  ------------------
 1597|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1598|      0|    }
 1599|       |
 1600|      0|    recode->src = conf->source_charset;
 1601|      0|    recode->dst = conf->charset;
 1602|       |
 1603|      0|    return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 1604|      0|}

ngx_http_chunked_filter_module.c:ngx_http_chunked_filter_init:
  333|      1|{
  334|      1|    ngx_http_next_header_filter = ngx_http_top_header_filter;
  335|      1|    ngx_http_top_header_filter = ngx_http_chunked_header_filter;
  336|       |
  337|      1|    ngx_http_next_body_filter = ngx_http_top_body_filter;
  338|      1|    ngx_http_top_body_filter = ngx_http_chunked_body_filter;
  339|       |
  340|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  341|      1|}
ngx_http_chunked_filter_module.c:ngx_http_chunked_header_filter:
   61|      7|{
   62|      7|    ngx_http_core_loc_conf_t       *clcf;
   63|      7|    ngx_http_chunked_filter_ctx_t  *ctx;
   64|       |
   65|      7|    if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED
  ------------------
  |  |   88|     14|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
  |  Branch (65:9): [True: 0, False: 7]
  ------------------
   66|      7|        || r->headers_out.status == NGX_HTTP_NO_CONTENT
  ------------------
  |  |   81|     14|#define NGX_HTTP_NO_CONTENT                204
  ------------------
  |  Branch (66:12): [True: 0, False: 7]
  ------------------
   67|      7|        || r->headers_out.status < NGX_HTTP_OK
  ------------------
  |  |   78|     14|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (67:12): [True: 2, False: 5]
  ------------------
   68|      7|        || r != r->main
  ------------------
  |  Branch (68:12): [True: 0, False: 5]
  ------------------
   69|      7|        || r->method == NGX_HTTP_HEAD)
  ------------------
  |  |   31|      5|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
  |  Branch (69:12): [True: 0, False: 5]
  ------------------
   70|      2|    {
   71|      2|        return ngx_http_next_header_filter(r);
   72|      2|    }
   73|       |
   74|      5|    if (r->headers_out.content_length_n == -1
  ------------------
  |  Branch (74:9): [True: 3, False: 2]
  ------------------
   75|      5|        || r->expect_trailers)
  ------------------
  |  Branch (75:12): [True: 0, False: 2]
  ------------------
   76|      3|    {
   77|      3|        clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      3|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
   78|       |
   79|      3|        if (r->http_version >= NGX_HTTP_VERSION_11
  ------------------
  |  |   25|      6|#define NGX_HTTP_VERSION_11                1001
  ------------------
  |  Branch (79:13): [True: 0, False: 3]
  ------------------
   80|      3|            && clcf->chunked_transfer_encoding)
  ------------------
  |  Branch (80:16): [True: 0, False: 0]
  ------------------
   81|      0|        {
   82|      0|            if (r->expect_trailers) {
  ------------------
  |  Branch (82:17): [True: 0, False: 0]
  ------------------
   83|      0|                ngx_http_clear_content_length(r);
  ------------------
  |  |  555|      0|    r->headers_out.content_length_n = -1;                                     \
  |  |  556|      0|    if (r->headers_out.content_length) {                                      \
  |  |  ------------------
  |  |  |  Branch (556:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  557|      0|        r->headers_out.content_length->hash = 0;                              \
  |  |  558|      0|        r->headers_out.content_length = NULL;                                 \
  |  |  559|      0|    }
  ------------------
   84|      0|            }
   85|       |
   86|      0|            r->chunked = 1;
   87|       |
   88|      0|            ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_chunked_filter_ctx_t));
   89|      0|            if (ctx == NULL) {
  ------------------
  |  Branch (89:17): [True: 0, False: 0]
  ------------------
   90|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   91|      0|            }
   92|       |
   93|      0|            ngx_http_set_ctx(r, ctx, ngx_http_chunked_filter_module);
  ------------------
  |  |   81|      0|#define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;
  ------------------
   94|       |
   95|      3|        } else if (r->headers_out.content_length_n == -1) {
  ------------------
  |  Branch (95:20): [True: 3, False: 0]
  ------------------
   96|      3|            r->keepalive = 0;
   97|      3|        }
   98|      3|    }
   99|       |
  100|      5|    return ngx_http_next_header_filter(r);
  101|      5|}
ngx_http_chunked_filter_module.c:ngx_http_chunked_body_filter:
  106|     13|{
  107|     13|    u_char                         *chunk;
  108|     13|    off_t                           size;
  109|     13|    ngx_int_t                       rc;
  110|     13|    ngx_buf_t                      *b;
  111|     13|    ngx_chain_t                    *out, *cl, *tl, **ll;
  112|     13|    ngx_http_chunked_filter_ctx_t  *ctx;
  113|       |
  114|     13|    if (in == NULL || !r->chunked || r->header_only) {
  ------------------
  |  Branch (114:9): [True: 9, False: 4]
  |  Branch (114:23): [True: 4, False: 0]
  |  Branch (114:38): [True: 0, False: 0]
  ------------------
  115|     13|        return ngx_http_next_body_filter(r, in);
  116|     13|    }
  117|       |
  118|      0|    ctx = ngx_http_get_module_ctx(r, ngx_http_chunked_filter_module);
  ------------------
  |  |   80|      0|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
  119|       |
  120|      0|    out = NULL;
  121|      0|    ll = &out;
  122|       |
  123|      0|    size = 0;
  124|      0|    cl = in;
  125|       |
  126|      0|    for ( ;; ) {
  127|      0|        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  128|      0|                       "http chunk: %O", ngx_buf_size(cl->buf));
  129|       |
  130|      0|        size += ngx_buf_size(cl->buf);
  ------------------
  |  |  137|      0|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|                            ((b)->file_last - (b)->file_pos))
  ------------------
  131|       |
  132|      0|        if (cl->buf->flush
  ------------------
  |  Branch (132:13): [True: 0, False: 0]
  ------------------
  133|      0|            || cl->buf->sync
  ------------------
  |  Branch (133:16): [True: 0, False: 0]
  ------------------
  134|      0|            || ngx_buf_in_memory(cl->buf)
  ------------------
  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  ------------------
  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  135|      0|            || cl->buf->in_file)
  ------------------
  |  Branch (135:16): [True: 0, False: 0]
  ------------------
  136|      0|        {
  137|      0|            tl = ngx_alloc_chain_link(r->pool);
  138|      0|            if (tl == NULL) {
  ------------------
  |  Branch (138:17): [True: 0, False: 0]
  ------------------
  139|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  140|      0|            }
  141|       |
  142|      0|            tl->buf = cl->buf;
  143|      0|            *ll = tl;
  144|      0|            ll = &tl->next;
  145|      0|        }
  146|       |
  147|      0|        if (cl->next == NULL) {
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|            break;
  149|      0|        }
  150|       |
  151|      0|        cl = cl->next;
  152|      0|    }
  153|       |
  154|      0|    if (size) {
  ------------------
  |  Branch (154:9): [True: 0, False: 0]
  ------------------
  155|      0|        tl = ngx_chain_get_free_buf(r->pool, &ctx->free);
  156|      0|        if (tl == NULL) {
  ------------------
  |  Branch (156:13): [True: 0, False: 0]
  ------------------
  157|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  158|      0|        }
  159|       |
  160|      0|        b = tl->buf;
  161|      0|        chunk = b->start;
  162|       |
  163|      0|        if (chunk == NULL) {
  ------------------
  |  Branch (163:13): [True: 0, False: 0]
  ------------------
  164|       |            /* the "0000000000000000" is 64-bit hexadecimal string */
  165|       |
  166|      0|            chunk = ngx_palloc(r->pool, sizeof("0000000000000000" CRLF) - 1);
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  167|      0|            if (chunk == NULL) {
  ------------------
  |  Branch (167:17): [True: 0, False: 0]
  ------------------
  168|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  169|      0|            }
  170|       |
  171|      0|            b->start = chunk;
  172|      0|            b->end = chunk + sizeof("0000000000000000" CRLF) - 1;
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  173|      0|        }
  174|       |
  175|      0|        b->tag = (ngx_buf_tag_t) &ngx_http_chunked_filter_module;
  176|      0|        b->memory = 0;
  177|      0|        b->temporary = 1;
  178|      0|        b->pos = chunk;
  179|      0|        b->last = ngx_sprintf(chunk, "%xO" CRLF, size);
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  180|       |
  181|      0|        tl->next = out;
  182|      0|        out = tl;
  183|      0|    }
  184|       |
  185|      0|    if (cl->buf->last_buf) {
  ------------------
  |  Branch (185:9): [True: 0, False: 0]
  ------------------
  186|      0|        tl = ngx_http_chunked_create_trailers(r, ctx);
  187|      0|        if (tl == NULL) {
  ------------------
  |  Branch (187:13): [True: 0, False: 0]
  ------------------
  188|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  189|      0|        }
  190|       |
  191|      0|        cl->buf->last_buf = 0;
  192|       |
  193|      0|        *ll = tl;
  194|       |
  195|      0|        if (size == 0) {
  ------------------
  |  Branch (195:13): [True: 0, False: 0]
  ------------------
  196|      0|            tl->buf->pos += 2;
  197|      0|        }
  198|       |
  199|      0|    } else if (size > 0) {
  ------------------
  |  Branch (199:16): [True: 0, False: 0]
  ------------------
  200|      0|        tl = ngx_chain_get_free_buf(r->pool, &ctx->free);
  201|      0|        if (tl == NULL) {
  ------------------
  |  Branch (201:13): [True: 0, False: 0]
  ------------------
  202|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  203|      0|        }
  204|       |
  205|      0|        b = tl->buf;
  206|       |
  207|      0|        b->tag = (ngx_buf_tag_t) &ngx_http_chunked_filter_module;
  208|      0|        b->temporary = 0;
  209|      0|        b->memory = 1;
  210|      0|        b->pos = (u_char *) CRLF;
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  211|      0|        b->last = b->pos + 2;
  212|       |
  213|      0|        *ll = tl;
  214|       |
  215|      0|    } else {
  216|      0|        *ll = NULL;
  217|      0|    }
  218|       |
  219|      0|    rc = ngx_http_next_body_filter(r, out);
  220|       |
  221|      0|    ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &out,
  222|      0|                            (ngx_buf_tag_t) &ngx_http_chunked_filter_module);
  223|       |
  224|      0|    return rc;
  225|      0|}

ngx_http_fastcgi_module.c:ngx_http_fastcgi_add_variables:
 2813|      1|{
 2814|      1|    ngx_http_variable_t  *var, *v;
 2815|       |
 2816|      3|    for (v = ngx_http_fastcgi_vars; v->name.len; v++) {
  ------------------
  |  Branch (2816:37): [True: 2, False: 1]
  ------------------
 2817|      2|        var = ngx_http_add_variable(cf, &v->name, v->flags);
 2818|      2|        if (var == NULL) {
  ------------------
  |  Branch (2818:13): [True: 0, False: 2]
  ------------------
 2819|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2820|      0|        }
 2821|       |
 2822|      2|        var->get_handler = v->get_handler;
 2823|      2|        var->data = v->data;
 2824|      2|    }
 2825|       |
 2826|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2827|      1|}
ngx_http_fastcgi_module.c:ngx_http_fastcgi_create_main_conf:
 2832|      1|{
 2833|      1|    ngx_http_fastcgi_main_conf_t  *conf;
 2834|       |
 2835|      1|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_fastcgi_main_conf_t));
 2836|      1|    if (conf == NULL) {
  ------------------
  |  Branch (2836:9): [True: 0, False: 1]
  ------------------
 2837|      0|        return NULL;
 2838|      0|    }
 2839|       |
 2840|      1|#if (NGX_HTTP_CACHE)
 2841|      1|    if (ngx_array_init(&conf->caches, cf->pool, 4,
  ------------------
  |  Branch (2841:9): [True: 0, False: 1]
  ------------------
 2842|      1|                       sizeof(ngx_http_file_cache_t *))
 2843|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2844|      0|    {
 2845|      0|        return NULL;
 2846|      0|    }
 2847|      1|#endif
 2848|       |
 2849|      1|    return conf;
 2850|      1|}
ngx_http_fastcgi_module.c:ngx_http_fastcgi_create_loc_conf:
 2855|      4|{
 2856|      4|    ngx_http_fastcgi_loc_conf_t  *conf;
 2857|       |
 2858|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_fastcgi_loc_conf_t));
 2859|      4|    if (conf == NULL) {
  ------------------
  |  Branch (2859:9): [True: 0, False: 4]
  ------------------
 2860|      0|        return NULL;
 2861|      0|    }
 2862|       |
 2863|       |    /*
 2864|       |     * set by ngx_pcalloc():
 2865|       |     *
 2866|       |     *     conf->upstream.bufs.num = 0;
 2867|       |     *     conf->upstream.ignore_headers = 0;
 2868|       |     *     conf->upstream.next_upstream = 0;
 2869|       |     *     conf->upstream.cache_zone = NULL;
 2870|       |     *     conf->upstream.cache_use_stale = 0;
 2871|       |     *     conf->upstream.cache_methods = 0;
 2872|       |     *     conf->upstream.temp_path = NULL;
 2873|       |     *     conf->upstream.hide_headers_hash = { NULL, 0 };
 2874|       |     *     conf->upstream.store_lengths = NULL;
 2875|       |     *     conf->upstream.store_values = NULL;
 2876|       |     *
 2877|       |     *     conf->index.len = { 0, NULL };
 2878|       |     */
 2879|       |
 2880|      4|    conf->upstream.store = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2881|      4|    conf->upstream.store_access = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 2882|      4|    conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 2883|      4|    conf->upstream.buffering = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2884|      4|    conf->upstream.request_buffering = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2885|      4|    conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2886|      4|    conf->upstream.force_ranges = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2887|       |
 2888|      4|    conf->upstream.local = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 2889|      4|    conf->upstream.socket_keepalive = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2890|       |
 2891|      4|    conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 2892|      4|    conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 2893|      4|    conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 2894|      4|    conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 2895|       |
 2896|      4|    conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 2897|      4|    conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 2898|      4|    conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 2899|       |
 2900|      4|    conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 2901|      4|    conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 2902|      4|    conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 2903|       |
 2904|      4|    conf->upstream.pass_request_headers = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2905|      4|    conf->upstream.pass_request_body = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2906|       |
 2907|      4|#if (NGX_HTTP_CACHE)
 2908|      4|    conf->upstream.cache = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2909|      4|    conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 2910|      4|    conf->upstream.cache_max_range_offset = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2911|      4|    conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 2912|      4|    conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 2913|      4|    conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 2914|      4|    conf->upstream.cache_lock = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2915|      4|    conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 2916|      4|    conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 2917|      4|    conf->upstream.cache_revalidate = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2918|      4|    conf->upstream.cache_background_update = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2919|      4|#endif
 2920|       |
 2921|      4|    conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 2922|      4|    conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 2923|       |
 2924|      4|    conf->upstream.intercept_errors = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2925|       |
 2926|       |    /* "fastcgi_cyclic_temp_file" is disabled */
 2927|      4|    conf->upstream.cyclic_temp_file = 0;
 2928|       |
 2929|      4|    conf->upstream.change_buffering = 1;
 2930|       |
 2931|      4|    conf->catch_stderr = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 2932|       |
 2933|      4|    conf->keep_conn = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2934|       |
 2935|      4|    ngx_str_set(&conf->upstream.module, "fastcgi");
  ------------------
  |  |   43|      4|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 2936|       |
 2937|      4|    return conf;
 2938|      4|}
ngx_http_fastcgi_module.c:ngx_http_fastcgi_merge_loc_conf:
 2943|      2|{
 2944|      2|    ngx_http_fastcgi_loc_conf_t *prev = parent;
 2945|      2|    ngx_http_fastcgi_loc_conf_t *conf = child;
 2946|       |
 2947|      2|    size_t                        size;
 2948|      2|    ngx_int_t                     rc;
 2949|      2|    ngx_hash_init_t               hash;
 2950|      2|    ngx_http_core_loc_conf_t     *clcf;
 2951|       |
 2952|      2|#if (NGX_HTTP_CACHE)
 2953|       |
 2954|      2|    if (conf->upstream.store > 0) {
  ------------------
  |  Branch (2954:9): [True: 0, False: 2]
  ------------------
 2955|      0|        conf->upstream.cache = 0;
 2956|      0|    }
 2957|       |
 2958|      2|    if (conf->upstream.cache > 0) {
  ------------------
  |  Branch (2958:9): [True: 0, False: 2]
  ------------------
 2959|      0|        conf->upstream.store = 0;
 2960|      0|    }
 2961|       |
 2962|      2|#endif
 2963|       |
 2964|      2|    if (conf->upstream.store == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      2|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (2964:9): [True: 2, False: 0]
  ------------------
 2965|      2|        ngx_conf_merge_value(conf->upstream.store,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2966|      2|                              prev->upstream.store, 0);
 2967|       |
 2968|      2|        conf->upstream.store_lengths = prev->upstream.store_lengths;
 2969|      2|        conf->upstream.store_values = prev->upstream.store_values;
 2970|      2|    }
 2971|       |
 2972|      2|    ngx_conf_merge_uint_value(conf->upstream.store_access,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 2973|      2|                              prev->upstream.store_access, 0600);
 2974|       |
 2975|      2|    ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 2976|      2|                              prev->upstream.next_upstream_tries, 0);
 2977|       |
 2978|      2|    ngx_conf_merge_value(conf->upstream.buffering,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2979|      2|                              prev->upstream.buffering, 1);
 2980|       |
 2981|      2|    ngx_conf_merge_value(conf->upstream.request_buffering,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2982|      2|                              prev->upstream.request_buffering, 1);
 2983|       |
 2984|      2|    ngx_conf_merge_value(conf->upstream.ignore_client_abort,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2985|      2|                              prev->upstream.ignore_client_abort, 0);
 2986|       |
 2987|      2|    ngx_conf_merge_value(conf->upstream.force_ranges,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2988|      2|                              prev->upstream.force_ranges, 0);
 2989|       |
 2990|      2|    ngx_conf_merge_ptr_value(conf->upstream.local,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 2991|      2|                              prev->upstream.local, NULL);
 2992|       |
 2993|      2|    ngx_conf_merge_value(conf->upstream.socket_keepalive,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2994|      2|                              prev->upstream.socket_keepalive, 0);
 2995|       |
 2996|      2|    ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 2997|      2|                              prev->upstream.connect_timeout, 60000);
 2998|       |
 2999|      2|    ngx_conf_merge_msec_value(conf->upstream.send_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3000|      2|                              prev->upstream.send_timeout, 60000);
 3001|       |
 3002|      2|    ngx_conf_merge_msec_value(conf->upstream.read_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3003|      2|                              prev->upstream.read_timeout, 60000);
 3004|       |
 3005|      2|    ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3006|      2|                              prev->upstream.next_upstream_timeout, 0);
 3007|       |
 3008|      2|    ngx_conf_merge_size_value(conf->upstream.send_lowat,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3009|      2|                              prev->upstream.send_lowat, 0);
 3010|       |
 3011|      2|    ngx_conf_merge_size_value(conf->upstream.buffer_size,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3012|      2|                              prev->upstream.buffer_size,
 3013|      2|                              (size_t) ngx_pagesize);
 3014|       |
 3015|      2|    ngx_conf_merge_size_value(conf->upstream.limit_rate,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3016|      2|                              prev->upstream.limit_rate, 0);
 3017|       |
 3018|       |
 3019|      2|    ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
  ------------------
  |  |  252|      2|    if (conf.num == 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  253|      2|        if (prev.num) {                                                      \
  |  |  ------------------
  |  |  |  Branch (253:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  254|      1|            conf.num = prev.num;                                             \
  |  |  255|      1|            conf.size = prev.size;                                           \
  |  |  256|      1|        } else {                                                             \
  |  |  257|      1|            conf.num = default_num;                                          \
  |  |  258|      1|            conf.size = default_size;                                        \
  |  |  259|      1|        }                                                                    \
  |  |  260|      2|    }
  ------------------
 3020|      2|                              8, ngx_pagesize);
 3021|       |
 3022|      2|    if (conf->upstream.bufs.num < 2) {
  ------------------
  |  Branch (3022:9): [True: 0, False: 2]
  ------------------
 3023|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3024|      0|                           "there must be at least 2 \"fastcgi_buffers\"");
 3025|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3026|      0|    }
 3027|       |
 3028|       |
 3029|      2|    size = conf->upstream.buffer_size;
 3030|      2|    if (size < conf->upstream.bufs.size) {
  ------------------
  |  Branch (3030:9): [True: 0, False: 2]
  ------------------
 3031|      0|        size = conf->upstream.bufs.size;
 3032|      0|    }
 3033|       |
 3034|       |
 3035|      2|    ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3036|      2|                              prev->upstream.busy_buffers_size_conf,
 3037|      2|                              NGX_CONF_UNSET_SIZE);
 3038|       |
 3039|      2|    if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (3039:9): [True: 2, False: 0]
  ------------------
 3040|      2|        conf->upstream.busy_buffers_size = 2 * size;
 3041|      2|    } else {
 3042|      0|        conf->upstream.busy_buffers_size =
 3043|      0|                                         conf->upstream.busy_buffers_size_conf;
 3044|      0|    }
 3045|       |
 3046|      2|    if (conf->upstream.busy_buffers_size < size) {
  ------------------
  |  Branch (3046:9): [True: 0, False: 2]
  ------------------
 3047|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3048|      0|             "\"fastcgi_busy_buffers_size\" must be equal to or greater than "
 3049|      0|             "the maximum of the value of \"fastcgi_buffer_size\" and "
 3050|      0|             "one of the \"fastcgi_buffers\"");
 3051|       |
 3052|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3053|      0|    }
 3054|       |
 3055|      2|    if (conf->upstream.busy_buffers_size
  ------------------
  |  Branch (3055:9): [True: 0, False: 2]
  ------------------
 3056|      2|        > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
 3057|      0|    {
 3058|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3059|      0|             "\"fastcgi_busy_buffers_size\" must be less than "
 3060|      0|             "the size of all \"fastcgi_buffers\" minus one buffer");
 3061|       |
 3062|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3063|      0|    }
 3064|       |
 3065|       |
 3066|      2|    ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3067|      2|                              prev->upstream.temp_file_write_size_conf,
 3068|      2|                              NGX_CONF_UNSET_SIZE);
 3069|       |
 3070|      2|    if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (3070:9): [True: 2, False: 0]
  ------------------
 3071|      2|        conf->upstream.temp_file_write_size = 2 * size;
 3072|      2|    } else {
 3073|      0|        conf->upstream.temp_file_write_size =
 3074|      0|                                      conf->upstream.temp_file_write_size_conf;
 3075|      0|    }
 3076|       |
 3077|      2|    if (conf->upstream.temp_file_write_size < size) {
  ------------------
  |  Branch (3077:9): [True: 0, False: 2]
  ------------------
 3078|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3079|      0|             "\"fastcgi_temp_file_write_size\" must be equal to or greater "
 3080|      0|             "than the maximum of the value of \"fastcgi_buffer_size\" and "
 3081|      0|             "one of the \"fastcgi_buffers\"");
 3082|       |
 3083|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3084|      0|    }
 3085|       |
 3086|       |
 3087|      2|    ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3088|      2|                              prev->upstream.max_temp_file_size_conf,
 3089|      2|                              NGX_CONF_UNSET_SIZE);
 3090|       |
 3091|      2|    if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (3091:9): [True: 2, False: 0]
  ------------------
 3092|      2|        conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
 3093|      2|    } else {
 3094|      0|        conf->upstream.max_temp_file_size =
 3095|      0|                                        conf->upstream.max_temp_file_size_conf;
 3096|      0|    }
 3097|       |
 3098|      2|    if (conf->upstream.max_temp_file_size != 0
  ------------------
  |  Branch (3098:9): [True: 2, False: 0]
  ------------------
 3099|      2|        && conf->upstream.max_temp_file_size < size)
  ------------------
  |  Branch (3099:12): [True: 0, False: 2]
  ------------------
 3100|      0|    {
 3101|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3102|      0|             "\"fastcgi_max_temp_file_size\" must be equal to zero to disable "
 3103|      0|             "temporary files usage or must be equal to or greater than "
 3104|      0|             "the maximum of the value of \"fastcgi_buffer_size\" and "
 3105|      0|             "one of the \"fastcgi_buffers\"");
 3106|       |
 3107|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3108|      0|    }
 3109|       |
 3110|       |
 3111|      2|    ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 3112|      2|                              prev->upstream.ignore_headers,
 3113|      2|                              NGX_CONF_BITMASK_SET);
 3114|       |
 3115|       |
 3116|      2|    ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 3117|      2|                              prev->upstream.next_upstream,
 3118|      2|                              (NGX_CONF_BITMASK_SET
 3119|      2|                               |NGX_HTTP_UPSTREAM_FT_ERROR
 3120|      2|                               |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
 3121|       |
 3122|      2|    if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (3122:9): [True: 0, False: 2]
  ------------------
 3123|      0|        conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      0|#define NGX_CONF_BITMASK_SET  1
  ------------------
 3124|      0|                                       |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      0|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
 3125|      0|    }
 3126|       |
 3127|      2|    if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
  ------------------
  |  Branch (3127:9): [True: 0, False: 2]
  ------------------
 3128|      2|                              prev->upstream.temp_path,
 3129|      2|                              &ngx_http_fastcgi_temp_path)
 3130|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 3131|      0|    {
 3132|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3133|      0|    }
 3134|       |
 3135|      2|#if (NGX_HTTP_CACHE)
 3136|       |
 3137|      2|    if (conf->upstream.cache == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      2|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (3137:9): [True: 2, False: 0]
  ------------------
 3138|      2|        ngx_conf_merge_value(conf->upstream.cache,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3139|      2|                              prev->upstream.cache, 0);
 3140|       |
 3141|      2|        conf->upstream.cache_zone = prev->upstream.cache_zone;
 3142|      2|        conf->upstream.cache_value = prev->upstream.cache_value;
 3143|      2|    }
 3144|       |
 3145|      2|    if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) {
  ------------------
  |  Branch (3145:9): [True: 0, False: 2]
  |  Branch (3145:38): [True: 0, False: 0]
  ------------------
 3146|      0|        ngx_shm_zone_t  *shm_zone;
 3147|       |
 3148|      0|        shm_zone = conf->upstream.cache_zone;
 3149|       |
 3150|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3151|      0|                           "\"fastcgi_cache\" zone \"%V\" is unknown",
 3152|      0|                           &shm_zone->shm.name);
 3153|       |
 3154|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3155|      0|    }
 3156|       |
 3157|      2|    ngx_conf_merge_uint_value(conf->upstream.cache_min_uses,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3158|      2|                              prev->upstream.cache_min_uses, 1);
 3159|       |
 3160|      2|    ngx_conf_merge_off_value(conf->upstream.cache_max_range_offset,
  ------------------
  |  |  236|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (236:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  237|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (237:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  238|      2|    }
  ------------------
 3161|      2|                              prev->upstream.cache_max_range_offset,
 3162|      2|                              NGX_MAX_OFF_T_VALUE);
 3163|       |
 3164|      2|    ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 3165|      2|                              prev->upstream.cache_use_stale,
 3166|      2|                              (NGX_CONF_BITMASK_SET
 3167|      2|                               |NGX_HTTP_UPSTREAM_FT_OFF));
 3168|       |
 3169|      2|    if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (3169:9): [True: 2, False: 0]
  ------------------
 3170|      2|        conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      2|#define NGX_CONF_BITMASK_SET  1
  ------------------
 3171|      2|                                         |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
 3172|      2|    }
 3173|       |
 3174|      2|    if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_ERROR) {
  ------------------
  |  |   20|      2|#define NGX_HTTP_UPSTREAM_FT_ERROR           0x00000002
  ------------------
  |  Branch (3174:9): [True: 0, False: 2]
  ------------------
 3175|      0|        conf->upstream.cache_use_stale |= NGX_HTTP_UPSTREAM_FT_NOLIVE;
  ------------------
  |  |   34|      0|#define NGX_HTTP_UPSTREAM_FT_NOLIVE          0x40000000
  ------------------
 3176|      0|    }
 3177|       |
 3178|      2|    if (conf->upstream.cache_methods == 0) {
  ------------------
  |  Branch (3178:9): [True: 2, False: 0]
  ------------------
 3179|      2|        conf->upstream.cache_methods = prev->upstream.cache_methods;
 3180|      2|    }
 3181|       |
 3182|      2|    conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
  ------------------
  |  |   30|      2|#define NGX_HTTP_GET                       0x00000002
  ------------------
                  conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
  ------------------
  |  |   31|      2|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
 3183|       |
 3184|      2|    ngx_conf_merge_ptr_value(conf->upstream.cache_bypass,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3185|      2|                             prev->upstream.cache_bypass, NULL);
 3186|       |
 3187|      2|    ngx_conf_merge_ptr_value(conf->upstream.no_cache,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3188|      2|                             prev->upstream.no_cache, NULL);
 3189|       |
 3190|      2|    ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3191|      2|                             prev->upstream.cache_valid, NULL);
 3192|       |
 3193|      2|    if (conf->cache_key.value.data == NULL) {
  ------------------
  |  Branch (3193:9): [True: 2, False: 0]
  ------------------
 3194|      2|        conf->cache_key = prev->cache_key;
 3195|      2|    }
 3196|       |
 3197|      2|    if (conf->upstream.cache && conf->cache_key.value.data == NULL) {
  ------------------
  |  Branch (3197:9): [True: 0, False: 2]
  |  Branch (3197:33): [True: 0, False: 0]
  ------------------
 3198|      0|        ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
  ------------------
  |  |   21|      0|#define NGX_LOG_WARN              5
  ------------------
 3199|      0|                           "no \"fastcgi_cache_key\" for \"fastcgi_cache\"");
 3200|      0|    }
 3201|       |
 3202|      2|    ngx_conf_merge_value(conf->upstream.cache_lock,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3203|      2|                              prev->upstream.cache_lock, 0);
 3204|       |
 3205|      2|    ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3206|      2|                              prev->upstream.cache_lock_timeout, 5000);
 3207|       |
 3208|      2|    ngx_conf_merge_msec_value(conf->upstream.cache_lock_age,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3209|      2|                              prev->upstream.cache_lock_age, 5000);
 3210|       |
 3211|      2|    ngx_conf_merge_value(conf->upstream.cache_revalidate,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3212|      2|                              prev->upstream.cache_revalidate, 0);
 3213|       |
 3214|      2|    ngx_conf_merge_value(conf->upstream.cache_background_update,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3215|      2|                              prev->upstream.cache_background_update, 0);
 3216|       |
 3217|      2|#endif
 3218|       |
 3219|      2|    ngx_conf_merge_value(conf->upstream.pass_request_headers,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3220|      2|                              prev->upstream.pass_request_headers, 1);
 3221|      2|    ngx_conf_merge_value(conf->upstream.pass_request_body,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3222|      2|                              prev->upstream.pass_request_body, 1);
 3223|       |
 3224|      2|    ngx_conf_merge_value(conf->upstream.intercept_errors,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3225|      2|                              prev->upstream.intercept_errors, 0);
 3226|       |
 3227|      2|    ngx_conf_merge_ptr_value(conf->catch_stderr, prev->catch_stderr, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3228|       |
 3229|      2|    ngx_conf_merge_value(conf->keep_conn, prev->keep_conn, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3230|       |
 3231|       |
 3232|      2|    ngx_conf_merge_str_value(conf->index, prev->index, "");
  ------------------
  |  |  241|      2|    if (conf.data == NULL) {                                                 \
  |  |  ------------------
  |  |  |  Branch (241:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  242|      2|        if (prev.data) {                                                     \
  |  |  ------------------
  |  |  |  Branch (242:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  243|      1|            conf.len = prev.len;                                             \
  |  |  244|      1|            conf.data = prev.data;                                           \
  |  |  245|      1|        } else {                                                             \
  |  |  246|      1|            conf.len = sizeof(default) - 1;                                  \
  |  |  247|      1|            conf.data = (u_char *) default;                                  \
  |  |  248|      1|        }                                                                    \
  |  |  249|      2|    }
  ------------------
 3233|       |
 3234|      2|    hash.max_size = 512;
 3235|      2|    hash.bucket_size = ngx_align(64, ngx_cacheline_size);
  ------------------
  |  |  100|      2|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
 3236|      2|    hash.name = "fastcgi_hide_headers_hash";
 3237|       |
 3238|      2|    if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
  ------------------
  |  Branch (3238:9): [True: 0, False: 2]
  ------------------
 3239|      2|             &prev->upstream, ngx_http_fastcgi_hide_headers, &hash)
 3240|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 3241|      0|    {
 3242|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3243|      0|    }
 3244|       |
 3245|      2|    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
  ------------------
  |  |   66|      2|    ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index]
  ------------------
 3246|       |
 3247|      2|    if (clcf->noname
  ------------------
  |  Branch (3247:9): [True: 0, False: 2]
  ------------------
 3248|      2|        && conf->upstream.upstream == NULL && conf->fastcgi_lengths == NULL)
  ------------------
  |  Branch (3248:12): [True: 0, False: 0]
  |  Branch (3248:47): [True: 0, False: 0]
  ------------------
 3249|      0|    {
 3250|      0|        conf->upstream.upstream = prev->upstream.upstream;
 3251|      0|        conf->fastcgi_lengths = prev->fastcgi_lengths;
 3252|      0|        conf->fastcgi_values = prev->fastcgi_values;
 3253|      0|    }
 3254|       |
 3255|      2|    if (clcf->lmt_excpt && clcf->handler == NULL
  ------------------
  |  Branch (3255:9): [True: 0, False: 2]
  |  Branch (3255:28): [True: 0, False: 0]
  ------------------
 3256|      2|        && (conf->upstream.upstream || conf->fastcgi_lengths))
  ------------------
  |  Branch (3256:13): [True: 0, False: 0]
  |  Branch (3256:40): [True: 0, False: 0]
  ------------------
 3257|      0|    {
 3258|      0|        clcf->handler = ngx_http_fastcgi_handler;
 3259|      0|    }
 3260|       |
 3261|      2|#if (NGX_PCRE)
 3262|      2|    if (conf->split_regex == NULL) {
  ------------------
  |  Branch (3262:9): [True: 2, False: 0]
  ------------------
 3263|      2|        conf->split_regex = prev->split_regex;
 3264|      2|        conf->split_name = prev->split_name;
 3265|      2|    }
 3266|      2|#endif
 3267|       |
 3268|      2|    if (conf->params_source == NULL) {
  ------------------
  |  Branch (3268:9): [True: 2, False: 0]
  ------------------
 3269|      2|        conf->params = prev->params;
 3270|      2|#if (NGX_HTTP_CACHE)
 3271|      2|        conf->params_cache = prev->params_cache;
 3272|      2|#endif
 3273|      2|        conf->params_source = prev->params_source;
 3274|      2|    }
 3275|       |
 3276|      2|    rc = ngx_http_fastcgi_init_params(cf, conf, &conf->params, NULL);
 3277|      2|    if (rc != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (3277:9): [True: 0, False: 2]
  ------------------
 3278|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3279|      0|    }
 3280|       |
 3281|      2|#if (NGX_HTTP_CACHE)
 3282|       |
 3283|      2|    if (conf->upstream.cache) {
  ------------------
  |  Branch (3283:9): [True: 0, False: 2]
  ------------------
 3284|      0|        rc = ngx_http_fastcgi_init_params(cf, conf, &conf->params_cache,
 3285|      0|                                          ngx_http_fastcgi_cache_headers);
 3286|      0|        if (rc != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3286:13): [True: 0, False: 0]
  ------------------
 3287|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3288|      0|        }
 3289|      0|    }
 3290|       |
 3291|      2|#endif
 3292|       |
 3293|       |    /*
 3294|       |     * special handling to preserve conf->params in the "http" section
 3295|       |     * to inherit it to all servers
 3296|       |     */
 3297|       |
 3298|      2|    if (prev->params.hash.buckets == NULL
  ------------------
  |  Branch (3298:9): [True: 1, False: 1]
  ------------------
 3299|      2|        && conf->params_source == prev->params_source)
  ------------------
  |  Branch (3299:12): [True: 1, False: 0]
  ------------------
 3300|      1|    {
 3301|      1|        prev->params = conf->params;
 3302|      1|#if (NGX_HTTP_CACHE)
 3303|      1|        prev->params_cache = conf->params_cache;
 3304|      1|#endif
 3305|      1|    }
 3306|       |
 3307|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 3308|      2|}
ngx_http_fastcgi_module.c:ngx_http_fastcgi_init_params:
 3314|      2|{
 3315|      2|    u_char                       *p;
 3316|      2|    size_t                        size;
 3317|      2|    uintptr_t                    *code;
 3318|      2|    ngx_uint_t                    i, nsrc;
 3319|      2|    ngx_array_t                   headers_names, params_merged;
 3320|      2|    ngx_keyval_t                 *h;
 3321|      2|    ngx_hash_key_t               *hk;
 3322|      2|    ngx_hash_init_t               hash;
 3323|      2|    ngx_http_upstream_param_t    *src, *s;
 3324|      2|    ngx_http_script_compile_t     sc;
 3325|      2|    ngx_http_script_copy_code_t  *copy;
 3326|       |
 3327|      2|    if (params->hash.buckets) {
  ------------------
  |  Branch (3327:9): [True: 1, False: 1]
  ------------------
 3328|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 3329|      1|    }
 3330|       |
 3331|      1|    if (conf->params_source == NULL && default_params == NULL) {
  ------------------
  |  Branch (3331:9): [True: 1, False: 0]
  |  Branch (3331:40): [True: 1, False: 0]
  ------------------
 3332|      1|        params->hash.buckets = (void *) 1;
 3333|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 3334|      1|    }
 3335|       |
 3336|      0|    params->lengths = ngx_array_create(cf->pool, 64, 1);
 3337|      0|    if (params->lengths == NULL) {
  ------------------
  |  Branch (3337:9): [True: 0, False: 0]
  ------------------
 3338|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3339|      0|    }
 3340|       |
 3341|      0|    params->values = ngx_array_create(cf->pool, 512, 1);
 3342|      0|    if (params->values == NULL) {
  ------------------
  |  Branch (3342:9): [True: 0, False: 0]
  ------------------
 3343|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3344|      0|    }
 3345|       |
 3346|      0|    if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
  ------------------
  |  Branch (3346:9): [True: 0, False: 0]
  ------------------
 3347|      0|        != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 3348|      0|    {
 3349|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3350|      0|    }
 3351|       |
 3352|      0|    if (conf->params_source) {
  ------------------
  |  Branch (3352:9): [True: 0, False: 0]
  ------------------
 3353|      0|        src = conf->params_source->elts;
 3354|      0|        nsrc = conf->params_source->nelts;
 3355|       |
 3356|      0|    } else {
 3357|      0|        src = NULL;
 3358|      0|        nsrc = 0;
 3359|      0|    }
 3360|       |
 3361|      0|    if (default_params) {
  ------------------
  |  Branch (3361:9): [True: 0, False: 0]
  ------------------
 3362|      0|        if (ngx_array_init(&params_merged, cf->temp_pool, 4,
  ------------------
  |  Branch (3362:13): [True: 0, False: 0]
  ------------------
 3363|      0|                           sizeof(ngx_http_upstream_param_t))
 3364|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 3365|      0|        {
 3366|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3367|      0|        }
 3368|       |
 3369|      0|        for (i = 0; i < nsrc; i++) {
  ------------------
  |  Branch (3369:21): [True: 0, False: 0]
  ------------------
 3370|       |
 3371|      0|            s = ngx_array_push(&params_merged);
 3372|      0|            if (s == NULL) {
  ------------------
  |  Branch (3372:17): [True: 0, False: 0]
  ------------------
 3373|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3374|      0|            }
 3375|       |
 3376|      0|            *s = src[i];
 3377|      0|        }
 3378|       |
 3379|      0|        h = default_params;
 3380|       |
 3381|      0|        while (h->key.len) {
  ------------------
  |  Branch (3381:16): [True: 0, False: 0]
  ------------------
 3382|       |
 3383|      0|            src = params_merged.elts;
 3384|      0|            nsrc = params_merged.nelts;
 3385|       |
 3386|      0|            for (i = 0; i < nsrc; i++) {
  ------------------
  |  Branch (3386:25): [True: 0, False: 0]
  ------------------
 3387|      0|                if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
  ------------------
  |  Branch (3387:21): [True: 0, False: 0]
  ------------------
 3388|      0|                    goto next;
 3389|      0|                }
 3390|      0|            }
 3391|       |
 3392|      0|            s = ngx_array_push(&params_merged);
 3393|      0|            if (s == NULL) {
  ------------------
  |  Branch (3393:17): [True: 0, False: 0]
  ------------------
 3394|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3395|      0|            }
 3396|       |
 3397|      0|            s->key = h->key;
 3398|      0|            s->value = h->value;
 3399|      0|            s->skip_empty = 1;
 3400|       |
 3401|      0|        next:
 3402|       |
 3403|      0|            h++;
 3404|      0|        }
 3405|       |
 3406|      0|        src = params_merged.elts;
 3407|      0|        nsrc = params_merged.nelts;
 3408|      0|    }
 3409|       |
 3410|      0|    for (i = 0; i < nsrc; i++) {
  ------------------
  |  Branch (3410:17): [True: 0, False: 0]
  ------------------
 3411|       |
 3412|      0|        if (src[i].key.len > sizeof("HTTP_") - 1
  ------------------
  |  Branch (3412:13): [True: 0, False: 0]
  ------------------
 3413|      0|            && ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0)
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (3413:16): [True: 0, False: 0]
  ------------------
 3414|      0|        {
 3415|      0|            hk = ngx_array_push(&headers_names);
 3416|      0|            if (hk == NULL) {
  ------------------
  |  Branch (3416:17): [True: 0, False: 0]
  ------------------
 3417|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3418|      0|            }
 3419|       |
 3420|      0|            hk->key.len = src[i].key.len - 5;
 3421|      0|            hk->key.data = src[i].key.data + 5;
 3422|      0|            hk->key_hash = ngx_hash_key_lc(hk->key.data, hk->key.len);
 3423|      0|            hk->value = (void *) 1;
 3424|       |
 3425|      0|            if (src[i].value.len == 0) {
  ------------------
  |  Branch (3425:17): [True: 0, False: 0]
  ------------------
 3426|      0|                continue;
 3427|      0|            }
 3428|      0|        }
 3429|       |
 3430|      0|        copy = ngx_array_push_n(params->lengths,
 3431|      0|                                sizeof(ngx_http_script_copy_code_t));
 3432|      0|        if (copy == NULL) {
  ------------------
  |  Branch (3432:13): [True: 0, False: 0]
  ------------------
 3433|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3434|      0|        }
 3435|       |
 3436|      0|        copy->code = (ngx_http_script_code_pt) (void *)
 3437|      0|                                                 ngx_http_script_copy_len_code;
 3438|      0|        copy->len = src[i].key.len;
 3439|       |
 3440|      0|        copy = ngx_array_push_n(params->lengths,
 3441|      0|                                sizeof(ngx_http_script_copy_code_t));
 3442|      0|        if (copy == NULL) {
  ------------------
  |  Branch (3442:13): [True: 0, False: 0]
  ------------------
 3443|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3444|      0|        }
 3445|       |
 3446|      0|        copy->code = (ngx_http_script_code_pt) (void *)
 3447|      0|                                                 ngx_http_script_copy_len_code;
 3448|      0|        copy->len = src[i].skip_empty;
 3449|       |
 3450|       |
 3451|      0|        size = (sizeof(ngx_http_script_copy_code_t)
 3452|      0|                + src[i].key.len + sizeof(uintptr_t) - 1)
 3453|      0|               & ~(sizeof(uintptr_t) - 1);
 3454|       |
 3455|      0|        copy = ngx_array_push_n(params->values, size);
 3456|      0|        if (copy == NULL) {
  ------------------
  |  Branch (3456:13): [True: 0, False: 0]
  ------------------
 3457|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3458|      0|        }
 3459|       |
 3460|      0|        copy->code = ngx_http_script_copy_code;
 3461|      0|        copy->len = src[i].key.len;
 3462|       |
 3463|      0|        p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
 3464|      0|        ngx_memcpy(p, src[i].key.data, src[i].key.len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 3465|       |
 3466|       |
 3467|      0|        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 3468|       |
 3469|      0|        sc.cf = cf;
 3470|      0|        sc.source = &src[i].value;
 3471|      0|        sc.flushes = &params->flushes;
 3472|      0|        sc.lengths = &params->lengths;
 3473|      0|        sc.values = &params->values;
 3474|       |
 3475|      0|        if (ngx_http_script_compile(&sc) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3475:13): [True: 0, False: 0]
  ------------------
 3476|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3477|      0|        }
 3478|       |
 3479|      0|        code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
 3480|      0|        if (code == NULL) {
  ------------------
  |  Branch (3480:13): [True: 0, False: 0]
  ------------------
 3481|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3482|      0|        }
 3483|       |
 3484|      0|        *code = (uintptr_t) NULL;
 3485|       |
 3486|       |
 3487|      0|        code = ngx_array_push_n(params->values, sizeof(uintptr_t));
 3488|      0|        if (code == NULL) {
  ------------------
  |  Branch (3488:13): [True: 0, False: 0]
  ------------------
 3489|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3490|      0|        }
 3491|       |
 3492|      0|        *code = (uintptr_t) NULL;
 3493|      0|    }
 3494|       |
 3495|      0|    code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
 3496|      0|    if (code == NULL) {
  ------------------
  |  Branch (3496:9): [True: 0, False: 0]
  ------------------
 3497|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3498|      0|    }
 3499|       |
 3500|      0|    *code = (uintptr_t) NULL;
 3501|       |
 3502|      0|    params->number = headers_names.nelts;
 3503|       |
 3504|      0|    hash.hash = &params->hash;
 3505|      0|    hash.key = ngx_hash_key_lc;
 3506|      0|    hash.max_size = 512;
 3507|      0|    hash.bucket_size = 64;
 3508|      0|    hash.name = "fastcgi_params_hash";
 3509|      0|    hash.pool = cf->pool;
 3510|      0|    hash.temp_pool = NULL;
 3511|       |
 3512|      0|    return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
 3513|      0|}

ngx_http_grpc_module.c:ngx_http_grpc_add_variables:
 4317|      1|{
 4318|      1|    ngx_http_variable_t  *var, *v;
 4319|       |
 4320|      2|    for (v = ngx_http_grpc_vars; v->name.len; v++) {
  ------------------
  |  Branch (4320:34): [True: 1, False: 1]
  ------------------
 4321|      1|        var = ngx_http_add_variable(cf, &v->name, v->flags);
 4322|      1|        if (var == NULL) {
  ------------------
  |  Branch (4322:13): [True: 0, False: 1]
  ------------------
 4323|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4324|      0|        }
 4325|       |
 4326|      1|        var->get_handler = v->get_handler;
 4327|      1|        var->data = v->data;
 4328|      1|    }
 4329|       |
 4330|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 4331|      1|}
ngx_http_grpc_module.c:ngx_http_grpc_create_loc_conf:
 4336|      4|{
 4337|      4|    ngx_http_grpc_loc_conf_t  *conf;
 4338|       |
 4339|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_grpc_loc_conf_t));
 4340|      4|    if (conf == NULL) {
  ------------------
  |  Branch (4340:9): [True: 0, False: 4]
  ------------------
 4341|      0|        return NULL;
 4342|      0|    }
 4343|       |
 4344|       |    /*
 4345|       |     * set by ngx_pcalloc():
 4346|       |     *
 4347|       |     *     conf->upstream.ignore_headers = 0;
 4348|       |     *     conf->upstream.next_upstream = 0;
 4349|       |     *     conf->upstream.hide_headers_hash = { NULL, 0 };
 4350|       |     *
 4351|       |     *     conf->headers.lengths = NULL;
 4352|       |     *     conf->headers.values = NULL;
 4353|       |     *     conf->headers.hash = { NULL, 0 };
 4354|       |     *     conf->host = { 0, NULL };
 4355|       |     *     conf->host_set = 0;
 4356|       |     *     conf->ssl = 0;
 4357|       |     *     conf->ssl_protocols = 0;
 4358|       |     *     conf->ssl_ciphers = { 0, NULL };
 4359|       |     *     conf->ssl_trusted_certificate = { 0, NULL };
 4360|       |     *     conf->ssl_crl = { 0, NULL };
 4361|       |     */
 4362|       |
 4363|      4|    conf->upstream.local = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 4364|      4|    conf->upstream.socket_keepalive = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 4365|      4|    conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 4366|      4|    conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 4367|      4|    conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 4368|      4|    conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 4369|      4|    conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 4370|       |
 4371|      4|    conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 4372|       |
 4373|      4|    conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 4374|      4|    conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 4375|       |
 4376|      4|    conf->upstream.intercept_errors = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 4377|       |
 4378|       |#if (NGX_HTTP_SSL)
 4379|       |    conf->upstream.ssl_session_reuse = NGX_CONF_UNSET;
 4380|       |    conf->upstream.ssl_name = NGX_CONF_UNSET_PTR;
 4381|       |    conf->upstream.ssl_server_name = NGX_CONF_UNSET;
 4382|       |    conf->upstream.ssl_verify = NGX_CONF_UNSET;
 4383|       |    conf->ssl_verify_depth = NGX_CONF_UNSET_UINT;
 4384|       |    conf->upstream.ssl_certificate = NGX_CONF_UNSET_PTR;
 4385|       |    conf->upstream.ssl_certificate_key = NGX_CONF_UNSET_PTR;
 4386|       |    conf->upstream.ssl_passwords = NGX_CONF_UNSET_PTR;
 4387|       |    conf->ssl_conf_commands = NGX_CONF_UNSET_PTR;
 4388|       |#endif
 4389|       |
 4390|       |    /* the hardcoded values */
 4391|      4|    conf->upstream.cyclic_temp_file = 0;
 4392|      4|    conf->upstream.buffering = 0;
 4393|      4|    conf->upstream.ignore_client_abort = 0;
 4394|      4|    conf->upstream.send_lowat = 0;
 4395|      4|    conf->upstream.bufs.num = 0;
 4396|      4|    conf->upstream.busy_buffers_size = 0;
 4397|      4|    conf->upstream.max_temp_file_size = 0;
 4398|      4|    conf->upstream.temp_file_write_size = 0;
 4399|      4|    conf->upstream.pass_request_headers = 1;
 4400|      4|    conf->upstream.pass_request_body = 1;
 4401|      4|    conf->upstream.force_ranges = 0;
 4402|      4|    conf->upstream.pass_trailers = 1;
 4403|      4|    conf->upstream.preserve_output = 1;
 4404|       |
 4405|      4|    conf->headers_source = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 4406|       |
 4407|      4|    ngx_str_set(&conf->upstream.module, "grpc");
  ------------------
  |  |   43|      4|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 4408|       |
 4409|      4|    return conf;
 4410|      4|}
ngx_http_grpc_module.c:ngx_http_grpc_merge_loc_conf:
 4415|      2|{
 4416|      2|    ngx_http_grpc_loc_conf_t *prev = parent;
 4417|      2|    ngx_http_grpc_loc_conf_t *conf = child;
 4418|       |
 4419|      2|    ngx_int_t                  rc;
 4420|      2|    ngx_hash_init_t            hash;
 4421|      2|    ngx_http_core_loc_conf_t  *clcf;
 4422|       |
 4423|      2|    ngx_conf_merge_ptr_value(conf->upstream.local,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 4424|      2|                              prev->upstream.local, NULL);
 4425|       |
 4426|      2|    ngx_conf_merge_value(conf->upstream.socket_keepalive,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 4427|      2|                              prev->upstream.socket_keepalive, 0);
 4428|       |
 4429|      2|    ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 4430|      2|                              prev->upstream.next_upstream_tries, 0);
 4431|       |
 4432|      2|    ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 4433|      2|                              prev->upstream.connect_timeout, 60000);
 4434|       |
 4435|      2|    ngx_conf_merge_msec_value(conf->upstream.send_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 4436|      2|                              prev->upstream.send_timeout, 60000);
 4437|       |
 4438|      2|    ngx_conf_merge_msec_value(conf->upstream.read_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 4439|      2|                              prev->upstream.read_timeout, 60000);
 4440|       |
 4441|      2|    ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 4442|      2|                              prev->upstream.next_upstream_timeout, 0);
 4443|       |
 4444|      2|    ngx_conf_merge_size_value(conf->upstream.buffer_size,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 4445|      2|                              prev->upstream.buffer_size,
 4446|      2|                              (size_t) ngx_pagesize);
 4447|       |
 4448|      2|    ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 4449|      2|                              prev->upstream.ignore_headers,
 4450|      2|                              NGX_CONF_BITMASK_SET);
 4451|       |
 4452|      2|    ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 4453|      2|                              prev->upstream.next_upstream,
 4454|      2|                              (NGX_CONF_BITMASK_SET
 4455|      2|                               |NGX_HTTP_UPSTREAM_FT_ERROR
 4456|      2|                               |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
 4457|       |
 4458|      2|    if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (4458:9): [True: 0, False: 2]
  ------------------
 4459|      0|        conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      0|#define NGX_CONF_BITMASK_SET  1
  ------------------
 4460|      0|                                       |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      0|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
 4461|      0|    }
 4462|       |
 4463|      2|    ngx_conf_merge_value(conf->upstream.intercept_errors,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 4464|      2|                              prev->upstream.intercept_errors, 0);
 4465|       |
 4466|       |#if (NGX_HTTP_SSL)
 4467|       |
 4468|       |    if (ngx_http_grpc_merge_ssl(cf, conf, prev) != NGX_OK) {
 4469|       |        return NGX_CONF_ERROR;
 4470|       |    }
 4471|       |
 4472|       |    ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
 4473|       |                              prev->upstream.ssl_session_reuse, 1);
 4474|       |
 4475|       |    ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
 4476|       |                                 (NGX_CONF_BITMASK_SET
 4477|       |                                  |NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
 4478|       |                                  |NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
 4479|       |
 4480|       |    ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
 4481|       |                             "DEFAULT");
 4482|       |
 4483|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_name,
 4484|       |                              prev->upstream.ssl_name, NULL);
 4485|       |    ngx_conf_merge_value(conf->upstream.ssl_server_name,
 4486|       |                              prev->upstream.ssl_server_name, 0);
 4487|       |    ngx_conf_merge_value(conf->upstream.ssl_verify,
 4488|       |                              prev->upstream.ssl_verify, 0);
 4489|       |    ngx_conf_merge_uint_value(conf->ssl_verify_depth,
 4490|       |                              prev->ssl_verify_depth, 1);
 4491|       |    ngx_conf_merge_str_value(conf->ssl_trusted_certificate,
 4492|       |                              prev->ssl_trusted_certificate, "");
 4493|       |    ngx_conf_merge_str_value(conf->ssl_crl, prev->ssl_crl, "");
 4494|       |
 4495|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_certificate,
 4496|       |                              prev->upstream.ssl_certificate, NULL);
 4497|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_certificate_key,
 4498|       |                              prev->upstream.ssl_certificate_key, NULL);
 4499|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_passwords,
 4500|       |                              prev->upstream.ssl_passwords, NULL);
 4501|       |
 4502|       |    ngx_conf_merge_ptr_value(conf->ssl_conf_commands,
 4503|       |                              prev->ssl_conf_commands, NULL);
 4504|       |
 4505|       |    if (conf->ssl && ngx_http_grpc_set_ssl(cf, conf) != NGX_OK) {
 4506|       |        return NGX_CONF_ERROR;
 4507|       |    }
 4508|       |
 4509|       |#endif
 4510|       |
 4511|      2|    hash.max_size = 512;
 4512|      2|    hash.bucket_size = ngx_align(64, ngx_cacheline_size);
  ------------------
  |  |  100|      2|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
 4513|      2|    hash.name = "grpc_headers_hash";
 4514|       |
 4515|      2|    if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
  ------------------
  |  Branch (4515:9): [True: 0, False: 2]
  ------------------
 4516|      2|            &prev->upstream, ngx_http_grpc_hide_headers, &hash)
 4517|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 4518|      0|    {
 4519|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4520|      0|    }
 4521|       |
 4522|      2|    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
  ------------------
  |  |   66|      2|    ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index]
  ------------------
 4523|       |
 4524|      2|    if (clcf->noname
  ------------------
  |  Branch (4524:9): [True: 0, False: 2]
  ------------------
 4525|      2|        && conf->upstream.upstream == NULL && conf->grpc_lengths == NULL)
  ------------------
  |  Branch (4525:12): [True: 0, False: 0]
  |  Branch (4525:47): [True: 0, False: 0]
  ------------------
 4526|      0|    {
 4527|      0|        conf->upstream.upstream = prev->upstream.upstream;
 4528|      0|        conf->host = prev->host;
 4529|       |
 4530|      0|        conf->grpc_lengths = prev->grpc_lengths;
 4531|      0|        conf->grpc_values = prev->grpc_values;
 4532|       |
 4533|       |#if (NGX_HTTP_SSL)
 4534|       |        conf->ssl = prev->ssl;
 4535|       |#endif
 4536|      0|    }
 4537|       |
 4538|      2|    if (clcf->lmt_excpt && clcf->handler == NULL
  ------------------
  |  Branch (4538:9): [True: 0, False: 2]
  |  Branch (4538:28): [True: 0, False: 0]
  ------------------
 4539|      2|        && (conf->upstream.upstream || conf->grpc_lengths))
  ------------------
  |  Branch (4539:13): [True: 0, False: 0]
  |  Branch (4539:40): [True: 0, False: 0]
  ------------------
 4540|      0|    {
 4541|      0|        clcf->handler = ngx_http_grpc_handler;
 4542|      0|    }
 4543|       |
 4544|      2|    ngx_conf_merge_ptr_value(conf->headers_source, prev->headers_source, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 4545|       |
 4546|      2|    if (conf->headers_source == prev->headers_source) {
  ------------------
  |  Branch (4546:9): [True: 1, False: 1]
  ------------------
 4547|      1|        conf->headers = prev->headers;
 4548|      1|        conf->host_set = prev->host_set;
 4549|      1|    }
 4550|       |
 4551|      2|    rc = ngx_http_grpc_init_headers(cf, conf, &conf->headers,
 4552|      2|                                    ngx_http_grpc_headers);
 4553|      2|    if (rc != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (4553:9): [True: 0, False: 2]
  ------------------
 4554|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4555|      0|    }
 4556|       |
 4557|       |    /*
 4558|       |     * special handling to preserve conf->headers in the "http" section
 4559|       |     * to inherit it to all servers
 4560|       |     */
 4561|       |
 4562|      2|    if (prev->headers.hash.buckets == NULL
  ------------------
  |  Branch (4562:9): [True: 1, False: 1]
  ------------------
 4563|      2|        && conf->headers_source == prev->headers_source)
  ------------------
  |  Branch (4563:12): [True: 0, False: 1]
  ------------------
 4564|      0|    {
 4565|      0|        prev->headers = conf->headers;
 4566|      0|        prev->host_set = conf->host_set;
 4567|      0|    }
 4568|       |
 4569|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 4570|      2|}
ngx_http_grpc_module.c:ngx_http_grpc_init_headers:
 4576|      2|{
 4577|      2|    u_char                       *p;
 4578|      2|    size_t                        size;
 4579|      2|    uintptr_t                    *code;
 4580|      2|    ngx_uint_t                    i;
 4581|      2|    ngx_array_t                   headers_names, headers_merged;
 4582|      2|    ngx_keyval_t                 *src, *s, *h;
 4583|      2|    ngx_hash_key_t               *hk;
 4584|      2|    ngx_hash_init_t               hash;
 4585|      2|    ngx_http_script_compile_t     sc;
 4586|      2|    ngx_http_script_copy_code_t  *copy;
 4587|       |
 4588|      2|    if (headers->hash.buckets) {
  ------------------
  |  Branch (4588:9): [True: 1, False: 1]
  ------------------
 4589|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 4590|      1|    }
 4591|       |
 4592|      1|    if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
  ------------------
  |  Branch (4592:9): [True: 0, False: 1]
  ------------------
 4593|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 4594|      0|    {
 4595|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4596|      0|    }
 4597|       |
 4598|      1|    if (ngx_array_init(&headers_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t))
  ------------------
  |  Branch (4598:9): [True: 0, False: 1]
  ------------------
 4599|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 4600|      0|    {
 4601|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4602|      0|    }
 4603|       |
 4604|      1|    headers->lengths = ngx_array_create(cf->pool, 64, 1);
 4605|      1|    if (headers->lengths == NULL) {
  ------------------
  |  Branch (4605:9): [True: 0, False: 1]
  ------------------
 4606|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4607|      0|    }
 4608|       |
 4609|      1|    headers->values = ngx_array_create(cf->pool, 512, 1);
 4610|      1|    if (headers->values == NULL) {
  ------------------
  |  Branch (4610:9): [True: 0, False: 1]
  ------------------
 4611|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4612|      0|    }
 4613|       |
 4614|      1|    if (conf->headers_source) {
  ------------------
  |  Branch (4614:9): [True: 0, False: 1]
  ------------------
 4615|       |
 4616|      0|        src = conf->headers_source->elts;
 4617|      0|        for (i = 0; i < conf->headers_source->nelts; i++) {
  ------------------
  |  Branch (4617:21): [True: 0, False: 0]
  ------------------
 4618|       |
 4619|      0|            if (src[i].key.len == 4
  ------------------
  |  Branch (4619:17): [True: 0, False: 0]
  ------------------
 4620|      0|                && ngx_strncasecmp(src[i].key.data, (u_char *) "Host", 4) == 0)
  ------------------
  |  Branch (4620:20): [True: 0, False: 0]
  ------------------
 4621|      0|            {
 4622|      0|                conf->host_set = 1;
 4623|      0|            }
 4624|       |
 4625|      0|            s = ngx_array_push(&headers_merged);
 4626|      0|            if (s == NULL) {
  ------------------
  |  Branch (4626:17): [True: 0, False: 0]
  ------------------
 4627|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4628|      0|            }
 4629|       |
 4630|      0|            *s = src[i];
 4631|      0|        }
 4632|      0|    }
 4633|       |
 4634|      1|    h = default_headers;
 4635|       |
 4636|      9|    while (h->key.len) {
  ------------------
  |  Branch (4636:12): [True: 8, False: 1]
  ------------------
 4637|       |
 4638|      8|        src = headers_merged.elts;
 4639|     36|        for (i = 0; i < headers_merged.nelts; i++) {
  ------------------
  |  Branch (4639:21): [True: 28, False: 8]
  ------------------
 4640|     28|            if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
  ------------------
  |  Branch (4640:17): [True: 0, False: 28]
  ------------------
 4641|      0|                goto next;
 4642|      0|            }
 4643|     28|        }
 4644|       |
 4645|      8|        s = ngx_array_push(&headers_merged);
 4646|      8|        if (s == NULL) {
  ------------------
  |  Branch (4646:13): [True: 0, False: 8]
  ------------------
 4647|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4648|      0|        }
 4649|       |
 4650|      8|        *s = *h;
 4651|       |
 4652|      8|    next:
 4653|       |
 4654|      8|        h++;
 4655|      8|    }
 4656|       |
 4657|       |
 4658|      1|    src = headers_merged.elts;
 4659|      9|    for (i = 0; i < headers_merged.nelts; i++) {
  ------------------
  |  Branch (4659:17): [True: 8, False: 1]
  ------------------
 4660|       |
 4661|      8|        hk = ngx_array_push(&headers_names);
 4662|      8|        if (hk == NULL) {
  ------------------
  |  Branch (4662:13): [True: 0, False: 8]
  ------------------
 4663|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4664|      0|        }
 4665|       |
 4666|      8|        hk->key = src[i].key;
 4667|      8|        hk->key_hash = ngx_hash_key_lc(src[i].key.data, src[i].key.len);
 4668|      8|        hk->value = (void *) 1;
 4669|       |
 4670|      8|        if (src[i].value.len == 0) {
  ------------------
  |  Branch (4670:13): [True: 6, False: 2]
  ------------------
 4671|      6|            continue;
 4672|      6|        }
 4673|       |
 4674|      2|        copy = ngx_array_push_n(headers->lengths,
 4675|      2|                                sizeof(ngx_http_script_copy_code_t));
 4676|      2|        if (copy == NULL) {
  ------------------
  |  Branch (4676:13): [True: 0, False: 2]
  ------------------
 4677|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4678|      0|        }
 4679|       |
 4680|      2|        copy->code = (ngx_http_script_code_pt) (void *)
 4681|      2|                                                 ngx_http_script_copy_len_code;
 4682|      2|        copy->len = src[i].key.len;
 4683|       |
 4684|      2|        size = (sizeof(ngx_http_script_copy_code_t)
 4685|      2|                + src[i].key.len + sizeof(uintptr_t) - 1)
 4686|      2|               & ~(sizeof(uintptr_t) - 1);
 4687|       |
 4688|      2|        copy = ngx_array_push_n(headers->values, size);
 4689|      2|        if (copy == NULL) {
  ------------------
  |  Branch (4689:13): [True: 0, False: 2]
  ------------------
 4690|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4691|      0|        }
 4692|       |
 4693|      2|        copy->code = ngx_http_script_copy_code;
 4694|      2|        copy->len = src[i].key.len;
 4695|       |
 4696|      2|        p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
 4697|      2|        ngx_memcpy(p, src[i].key.data, src[i].key.len);
  ------------------
  |  |  106|      2|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 4698|       |
 4699|      2|        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
  ------------------
  |  |   88|      2|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 4700|       |
 4701|      2|        sc.cf = cf;
 4702|      2|        sc.source = &src[i].value;
 4703|      2|        sc.flushes = &headers->flushes;
 4704|      2|        sc.lengths = &headers->lengths;
 4705|      2|        sc.values = &headers->values;
 4706|       |
 4707|      2|        if (ngx_http_script_compile(&sc) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (4707:13): [True: 0, False: 2]
  ------------------
 4708|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4709|      0|        }
 4710|       |
 4711|      2|        code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t));
 4712|      2|        if (code == NULL) {
  ------------------
  |  Branch (4712:13): [True: 0, False: 2]
  ------------------
 4713|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4714|      0|        }
 4715|       |
 4716|      2|        *code = (uintptr_t) NULL;
 4717|       |
 4718|      2|        code = ngx_array_push_n(headers->values, sizeof(uintptr_t));
 4719|      2|        if (code == NULL) {
  ------------------
  |  Branch (4719:13): [True: 0, False: 2]
  ------------------
 4720|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4721|      0|        }
 4722|       |
 4723|      2|        *code = (uintptr_t) NULL;
 4724|      2|    }
 4725|       |
 4726|      1|    code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t));
 4727|      1|    if (code == NULL) {
  ------------------
  |  Branch (4727:9): [True: 0, False: 1]
  ------------------
 4728|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4729|      0|    }
 4730|       |
 4731|      1|    *code = (uintptr_t) NULL;
 4732|       |
 4733|       |
 4734|      1|    hash.hash = &headers->hash;
 4735|      1|    hash.key = ngx_hash_key_lc;
 4736|      1|    hash.max_size = 512;
 4737|      1|    hash.bucket_size = 64;
 4738|      1|    hash.name = "grpc_headers_hash";
 4739|      1|    hash.pool = cf->pool;
 4740|      1|    hash.temp_pool = NULL;
 4741|       |
 4742|      1|    return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
 4743|      1|}

ngx_http_gzip_filter_module.c:ngx_http_gzip_add_variables:
 1000|      1|{
 1001|      1|    ngx_http_variable_t  *var;
 1002|       |
 1003|      1|    var = ngx_http_add_variable(cf, &ngx_http_gzip_ratio, NGX_HTTP_VAR_NOHASH);
  ------------------
  |  |   32|      1|#define NGX_HTTP_VAR_NOHASH       8
  ------------------
 1004|      1|    if (var == NULL) {
  ------------------
  |  Branch (1004:9): [True: 0, False: 1]
  ------------------
 1005|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1006|      0|    }
 1007|       |
 1008|      1|    var->get_handler = ngx_http_gzip_ratio_variable;
 1009|       |
 1010|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1011|      1|}
ngx_http_gzip_filter_module.c:ngx_http_gzip_filter_init:
 1123|      1|{
 1124|      1|    ngx_http_next_header_filter = ngx_http_top_header_filter;
 1125|      1|    ngx_http_top_header_filter = ngx_http_gzip_header_filter;
 1126|       |
 1127|      1|    ngx_http_next_body_filter = ngx_http_top_body_filter;
 1128|      1|    ngx_http_top_body_filter = ngx_http_gzip_body_filter;
 1129|       |
 1130|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1131|      1|}
ngx_http_gzip_filter_module.c:ngx_http_gzip_header_filter:
  222|      7|{
  223|      7|    ngx_table_elt_t       *h;
  224|      7|    ngx_http_gzip_ctx_t   *ctx;
  225|      7|    ngx_http_gzip_conf_t  *conf;
  226|       |
  227|      7|    conf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_filter_module);
  ------------------
  |  |   58|      7|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  228|       |
  229|      7|    if (!conf->enable
  ------------------
  |  Branch (229:9): [True: 7, False: 0]
  ------------------
  230|      7|        || (r->headers_out.status != NGX_HTTP_OK
  ------------------
  |  |   78|      0|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            && r->headers_out.status != NGX_HTTP_FORBIDDEN
  ------------------
  |  |   94|      0|#define NGX_HTTP_FORBIDDEN                 403
  ------------------
  |  Branch (231:16): [True: 0, False: 0]
  ------------------
  232|      0|            && r->headers_out.status != NGX_HTTP_NOT_FOUND)
  ------------------
  |  |   95|      0|#define NGX_HTTP_NOT_FOUND                 404
  ------------------
  |  Branch (232:16): [True: 0, False: 0]
  ------------------
  233|      7|        || (r->headers_out.content_encoding
  ------------------
  |  Branch (233:13): [True: 0, False: 0]
  ------------------
  234|      0|            && r->headers_out.content_encoding->value.len)
  ------------------
  |  Branch (234:16): [True: 0, False: 0]
  ------------------
  235|      7|        || (r->headers_out.content_length_n != -1
  ------------------
  |  Branch (235:13): [True: 0, False: 0]
  ------------------
  236|      0|            && r->headers_out.content_length_n < conf->min_length)
  ------------------
  |  Branch (236:16): [True: 0, False: 0]
  ------------------
  237|      7|        || ngx_http_test_content_type(r, &conf->types) == NULL
  ------------------
  |  Branch (237:12): [True: 0, False: 0]
  ------------------
  238|      7|        || r->header_only)
  ------------------
  |  Branch (238:12): [True: 0, False: 0]
  ------------------
  239|      7|    {
  240|      7|        return ngx_http_next_header_filter(r);
  241|      7|    }
  242|       |
  243|      0|    r->gzip_vary = 1;
  244|       |
  245|       |#if (NGX_HTTP_DEGRADATION)
  246|       |    {
  247|       |    ngx_http_core_loc_conf_t  *clcf;
  248|       |
  249|       |    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  250|       |
  251|       |    if (clcf->gzip_disable_degradation && ngx_http_degraded(r)) {
  252|       |        return ngx_http_next_header_filter(r);
  253|       |    }
  254|       |    }
  255|       |#endif
  256|       |
  257|      0|    if (!r->gzip_tested) {
  ------------------
  |  Branch (257:9): [True: 0, False: 0]
  ------------------
  258|      0|        if (ngx_http_gzip_ok(r) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (258:13): [True: 0, False: 0]
  ------------------
  259|      0|            return ngx_http_next_header_filter(r);
  260|      0|        }
  261|       |
  262|      0|    } else if (!r->gzip_ok) {
  ------------------
  |  Branch (262:16): [True: 0, False: 0]
  ------------------
  263|      0|        return ngx_http_next_header_filter(r);
  264|      0|    }
  265|       |
  266|      0|    ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_gzip_ctx_t));
  267|      0|    if (ctx == NULL) {
  ------------------
  |  Branch (267:9): [True: 0, False: 0]
  ------------------
  268|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  269|      0|    }
  270|       |
  271|      0|    ngx_http_set_ctx(r, ctx, ngx_http_gzip_filter_module);
  ------------------
  |  |   81|      0|#define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;
  ------------------
  272|       |
  273|      0|    ctx->request = r;
  274|      0|    ctx->buffering = (conf->postpone_gzipping != 0);
  275|       |
  276|      0|    ngx_http_gzip_filter_memory(r, ctx);
  277|       |
  278|      0|    h = ngx_list_push(&r->headers_out.headers);
  279|      0|    if (h == NULL) {
  ------------------
  |  Branch (279:9): [True: 0, False: 0]
  ------------------
  280|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  281|      0|    }
  282|       |
  283|      0|    h->hash = 1;
  284|      0|    h->next = NULL;
  285|      0|    ngx_str_set(&h->key, "Content-Encoding");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
  286|      0|    ngx_str_set(&h->value, "gzip");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
  287|      0|    r->headers_out.content_encoding = h;
  288|       |
  289|      0|    r->main_filter_need_in_memory = 1;
  290|       |
  291|      0|    ngx_http_clear_content_length(r);
  ------------------
  |  |  555|      0|    r->headers_out.content_length_n = -1;                                     \
  |  |  556|      0|    if (r->headers_out.content_length) {                                      \
  |  |  ------------------
  |  |  |  Branch (556:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  557|      0|        r->headers_out.content_length->hash = 0;                              \
  |  |  558|      0|        r->headers_out.content_length = NULL;                                 \
  |  |  559|      0|    }
  ------------------
  292|      0|    ngx_http_clear_accept_ranges(r);
  ------------------
  |  |  563|      0|    r->allow_ranges = 0;                                                      \
  |  |  564|      0|    if (r->headers_out.accept_ranges) {                                       \
  |  |  ------------------
  |  |  |  Branch (564:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  565|      0|        r->headers_out.accept_ranges->hash = 0;                               \
  |  |  566|      0|        r->headers_out.accept_ranges = NULL;                                  \
  |  |  567|      0|    }
  ------------------
  293|      0|    ngx_http_weak_etag(r);
  294|       |
  295|      0|    return ngx_http_next_header_filter(r);
  296|      0|}
ngx_http_gzip_filter_module.c:ngx_http_gzip_body_filter:
  301|     13|{
  302|     13|    int                   rc;
  303|     13|    ngx_uint_t            flush;
  304|     13|    ngx_chain_t          *cl;
  305|     13|    ngx_http_gzip_ctx_t  *ctx;
  306|       |
  307|     13|    ctx = ngx_http_get_module_ctx(r, ngx_http_gzip_filter_module);
  ------------------
  |  |   80|     13|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
  308|       |
  309|     13|    if (ctx == NULL || ctx->done || r->header_only) {
  ------------------
  |  Branch (309:9): [True: 13, False: 0]
  |  Branch (309:24): [True: 0, False: 0]
  |  Branch (309:37): [True: 0, False: 0]
  ------------------
  310|     13|        return ngx_http_next_body_filter(r, in);
  311|     13|    }
  312|       |
  313|      0|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  314|      0|                   "http gzip filter");
  315|       |
  316|      0|    if (ctx->buffering) {
  ------------------
  |  Branch (316:9): [True: 0, False: 0]
  ------------------
  317|       |
  318|       |        /*
  319|       |         * With default memory settings zlib starts to output gzipped data
  320|       |         * only after it has got about 90K, so it makes sense to allocate
  321|       |         * zlib memory (200-400K) only after we have enough data to compress.
  322|       |         * Although we copy buffers, nevertheless for not big responses
  323|       |         * this allows to allocate zlib memory, to compress and to output
  324|       |         * the response in one step using hot CPU cache.
  325|       |         */
  326|       |
  327|      0|        if (in) {
  ------------------
  |  Branch (327:13): [True: 0, False: 0]
  ------------------
  328|      0|            switch (ngx_http_gzip_filter_buffer(ctx, in)) {
  329|       |
  330|      0|            case NGX_OK:
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (330:13): [True: 0, False: 0]
  ------------------
  331|      0|                return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  332|       |
  333|      0|            case NGX_DONE:
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  |  Branch (333:13): [True: 0, False: 0]
  ------------------
  334|      0|                in = NULL;
  335|      0|                break;
  336|       |
  337|      0|            default:  /* NGX_ERROR */
  ------------------
  |  Branch (337:13): [True: 0, False: 0]
  ------------------
  338|      0|                goto failed;
  339|      0|            }
  340|       |
  341|      0|        } else {
  342|      0|            ctx->buffering = 0;
  343|      0|        }
  344|      0|    }
  345|       |
  346|      0|    if (ctx->preallocated == NULL) {
  ------------------
  |  Branch (346:9): [True: 0, False: 0]
  ------------------
  347|      0|        if (ngx_http_gzip_filter_deflate_start(r, ctx) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (347:13): [True: 0, False: 0]
  ------------------
  348|      0|            goto failed;
  349|      0|        }
  350|      0|    }
  351|       |
  352|      0|    if (in) {
  ------------------
  |  Branch (352:9): [True: 0, False: 0]
  ------------------
  353|      0|        if (ngx_chain_add_copy(r->pool, &ctx->in, in) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (353:13): [True: 0, False: 0]
  ------------------
  354|      0|            goto failed;
  355|      0|        }
  356|       |
  357|      0|        r->connection->buffered |= NGX_HTTP_GZIP_BUFFERED;
  ------------------
  |  |  149|      0|#define NGX_HTTP_GZIP_BUFFERED             0x20
  ------------------
  358|      0|    }
  359|       |
  360|      0|    if (ctx->nomem) {
  ------------------
  |  Branch (360:9): [True: 0, False: 0]
  ------------------
  361|       |
  362|       |        /* flush busy buffers */
  363|       |
  364|      0|        if (ngx_http_next_body_filter(r, NULL) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (364:13): [True: 0, False: 0]
  ------------------
  365|      0|            goto failed;
  366|      0|        }
  367|       |
  368|      0|        cl = NULL;
  369|       |
  370|      0|        ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &cl,
  371|      0|                                (ngx_buf_tag_t) &ngx_http_gzip_filter_module);
  372|      0|        ctx->nomem = 0;
  373|      0|        flush = 0;
  374|       |
  375|      0|    } else {
  376|      0|        flush = ctx->busy ? 1 : 0;
  ------------------
  |  Branch (376:17): [True: 0, False: 0]
  ------------------
  377|      0|    }
  378|       |
  379|      0|    for ( ;; ) {
  380|       |
  381|       |        /* cycle while we can write to a client */
  382|       |
  383|      0|        for ( ;; ) {
  384|       |
  385|       |            /* cycle while there is data to feed zlib and ... */
  386|       |
  387|      0|            rc = ngx_http_gzip_filter_add_data(r, ctx);
  388|       |
  389|      0|            if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (389:17): [True: 0, False: 0]
  ------------------
  390|      0|                break;
  391|      0|            }
  392|       |
  393|      0|            if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (393:17): [True: 0, False: 0]
  ------------------
  394|      0|                continue;
  395|      0|            }
  396|       |
  397|       |
  398|       |            /* ... there are buffers to write zlib output */
  399|       |
  400|      0|            rc = ngx_http_gzip_filter_get_buf(r, ctx);
  401|       |
  402|      0|            if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (402:17): [True: 0, False: 0]
  ------------------
  403|      0|                break;
  404|      0|            }
  405|       |
  406|      0|            if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (406:17): [True: 0, False: 0]
  ------------------
  407|      0|                goto failed;
  408|      0|            }
  409|       |
  410|       |
  411|      0|            rc = ngx_http_gzip_filter_deflate(r, ctx);
  412|       |
  413|      0|            if (rc == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (413:17): [True: 0, False: 0]
  ------------------
  414|      0|                break;
  415|      0|            }
  416|       |
  417|      0|            if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (417:17): [True: 0, False: 0]
  ------------------
  418|      0|                goto failed;
  419|      0|            }
  420|       |
  421|       |            /* rc == NGX_AGAIN */
  422|      0|        }
  423|       |
  424|      0|        if (ctx->out == NULL && !flush) {
  ------------------
  |  Branch (424:13): [True: 0, False: 0]
  |  Branch (424:33): [True: 0, False: 0]
  ------------------
  425|      0|            ngx_http_gzip_filter_free_copy_buf(r, ctx);
  426|       |
  427|      0|            return ctx->busy ? NGX_AGAIN : NGX_OK;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
                          return ctx->busy ? NGX_AGAIN : NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (427:20): [True: 0, False: 0]
  ------------------
  428|      0|        }
  429|       |
  430|      0|        rc = ngx_http_next_body_filter(r, ctx->out);
  431|       |
  432|      0|        if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (432:13): [True: 0, False: 0]
  ------------------
  433|      0|            goto failed;
  434|      0|        }
  435|       |
  436|      0|        ngx_http_gzip_filter_free_copy_buf(r, ctx);
  437|       |
  438|      0|        ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &ctx->out,
  439|      0|                                (ngx_buf_tag_t) &ngx_http_gzip_filter_module);
  440|      0|        ctx->last_out = &ctx->out;
  441|       |
  442|      0|        ctx->nomem = 0;
  443|      0|        flush = 0;
  444|       |
  445|      0|        if (ctx->done) {
  ------------------
  |  Branch (445:13): [True: 0, False: 0]
  ------------------
  446|      0|            return rc;
  447|      0|        }
  448|      0|    }
  449|       |
  450|       |    /* unreachable */
  451|       |
  452|      0|failed:
  453|       |
  454|      0|    ctx->done = 1;
  455|       |
  456|      0|    if (ctx->preallocated) {
  ------------------
  |  Branch (456:9): [True: 0, False: 0]
  ------------------
  457|      0|        deflateEnd(&ctx->zstream);
  458|       |
  459|      0|        ngx_pfree(r->pool, ctx->preallocated);
  460|      0|    }
  461|       |
  462|      0|    ngx_http_gzip_filter_free_copy_buf(r, ctx);
  463|       |
  464|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  465|      0|}
ngx_http_gzip_filter_module.c:ngx_http_gzip_create_conf:
 1060|      4|{
 1061|      4|    ngx_http_gzip_conf_t  *conf;
 1062|       |
 1063|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_gzip_conf_t));
 1064|      4|    if (conf == NULL) {
  ------------------
  |  Branch (1064:9): [True: 0, False: 4]
  ------------------
 1065|      0|        return NULL;
 1066|      0|    }
 1067|       |
 1068|       |    /*
 1069|       |     * set by ngx_pcalloc():
 1070|       |     *
 1071|       |     *     conf->bufs.num = 0;
 1072|       |     *     conf->types = { NULL };
 1073|       |     *     conf->types_keys = NULL;
 1074|       |     */
 1075|       |
 1076|      4|    conf->enable = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1077|      4|    conf->no_buffer = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1078|       |
 1079|      4|    conf->postpone_gzipping = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1080|      4|    conf->level = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1081|      4|    conf->wbits = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1082|      4|    conf->memlevel = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1083|      4|    conf->min_length = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1084|       |
 1085|      4|    return conf;
 1086|      4|}
ngx_http_gzip_filter_module.c:ngx_http_gzip_merge_conf:
 1091|      2|{
 1092|      2|    ngx_http_gzip_conf_t *prev = parent;
 1093|      2|    ngx_http_gzip_conf_t *conf = child;
 1094|       |
 1095|      2|    ngx_conf_merge_value(conf->enable, prev->enable, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1096|      2|    ngx_conf_merge_value(conf->no_buffer, prev->no_buffer, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1097|       |
 1098|      2|    ngx_conf_merge_bufs_value(conf->bufs, prev->bufs,
  ------------------
  |  |  252|      2|    if (conf.num == 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  253|      2|        if (prev.num) {                                                      \
  |  |  ------------------
  |  |  |  Branch (253:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  254|      1|            conf.num = prev.num;                                             \
  |  |  255|      1|            conf.size = prev.size;                                           \
  |  |  256|      1|        } else {                                                             \
  |  |  257|      1|            conf.num = default_num;                                          \
  |  |  258|      1|            conf.size = default_size;                                        \
  |  |  259|      1|        }                                                                    \
  |  |  260|      2|    }
  ------------------
 1099|      2|                              (128 * 1024) / ngx_pagesize, ngx_pagesize);
 1100|       |
 1101|      2|    ngx_conf_merge_size_value(conf->postpone_gzipping, prev->postpone_gzipping,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1102|      2|                              0);
 1103|      2|    ngx_conf_merge_value(conf->level, prev->level, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1104|      2|    ngx_conf_merge_size_value(conf->wbits, prev->wbits, MAX_WBITS);
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1105|      2|    ngx_conf_merge_size_value(conf->memlevel, prev->memlevel,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1106|      2|                              MAX_MEM_LEVEL - 1);
 1107|      2|    ngx_conf_merge_value(conf->min_length, prev->min_length, 20);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1108|       |
 1109|      2|    if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
  ------------------
  |  Branch (1109:9): [True: 0, False: 2]
  ------------------
 1110|      2|                             &prev->types_keys, &prev->types,
 1111|      2|                             ngx_http_html_default_types)
 1112|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 1113|      0|    {
 1114|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1115|      0|    }
 1116|       |
 1117|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 1118|      2|}

ngx_http_headers_filter_module.c:ngx_http_headers_filter_init:
  695|      1|{
  696|      1|    ngx_http_next_header_filter = ngx_http_top_header_filter;
  697|      1|    ngx_http_top_header_filter = ngx_http_headers_filter;
  698|       |
  699|      1|    ngx_http_next_body_filter = ngx_http_top_body_filter;
  700|      1|    ngx_http_top_body_filter = ngx_http_trailers_filter;
  701|       |
  702|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  703|      1|}
ngx_http_headers_filter_module.c:ngx_http_headers_filter:
  167|      7|{
  168|      7|    ngx_str_t                 value;
  169|      7|    ngx_uint_t                i, safe_status;
  170|      7|    ngx_http_header_val_t    *h;
  171|      7|    ngx_http_headers_conf_t  *conf;
  172|       |
  173|      7|    if (r != r->main) {
  ------------------
  |  Branch (173:9): [True: 0, False: 7]
  ------------------
  174|      0|        return ngx_http_next_header_filter(r);
  175|      0|    }
  176|       |
  177|      7|    conf = ngx_http_get_module_loc_conf(r, ngx_http_headers_filter_module);
  ------------------
  |  |   58|      7|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  178|       |
  179|      7|    if (conf->expires == NGX_HTTP_EXPIRES_OFF
  ------------------
  |  Branch (179:9): [True: 7, False: 0]
  ------------------
  180|      7|        && conf->headers == NULL
  ------------------
  |  Branch (180:12): [True: 7, False: 0]
  ------------------
  181|      7|        && conf->trailers == NULL)
  ------------------
  |  Branch (181:12): [True: 7, False: 0]
  ------------------
  182|      7|    {
  183|      7|        return ngx_http_next_header_filter(r);
  184|      7|    }
  185|       |
  186|      0|    switch (r->headers_out.status) {
  187|       |
  188|      0|    case NGX_HTTP_OK:
  ------------------
  |  |   78|      0|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (188:5): [True: 0, False: 0]
  ------------------
  189|      0|    case NGX_HTTP_CREATED:
  ------------------
  |  |   79|      0|#define NGX_HTTP_CREATED                   201
  ------------------
  |  Branch (189:5): [True: 0, False: 0]
  ------------------
  190|      0|    case NGX_HTTP_NO_CONTENT:
  ------------------
  |  |   81|      0|#define NGX_HTTP_NO_CONTENT                204
  ------------------
  |  Branch (190:5): [True: 0, False: 0]
  ------------------
  191|      0|    case NGX_HTTP_PARTIAL_CONTENT:
  ------------------
  |  |   82|      0|#define NGX_HTTP_PARTIAL_CONTENT           206
  ------------------
  |  Branch (191:5): [True: 0, False: 0]
  ------------------
  192|      0|    case NGX_HTTP_MOVED_PERMANENTLY:
  ------------------
  |  |   85|      0|#define NGX_HTTP_MOVED_PERMANENTLY         301
  ------------------
  |  Branch (192:5): [True: 0, False: 0]
  ------------------
  193|      0|    case NGX_HTTP_MOVED_TEMPORARILY:
  ------------------
  |  |   86|      0|#define NGX_HTTP_MOVED_TEMPORARILY         302
  ------------------
  |  Branch (193:5): [True: 0, False: 0]
  ------------------
  194|      0|    case NGX_HTTP_SEE_OTHER:
  ------------------
  |  |   87|      0|#define NGX_HTTP_SEE_OTHER                 303
  ------------------
  |  Branch (194:5): [True: 0, False: 0]
  ------------------
  195|      0|    case NGX_HTTP_NOT_MODIFIED:
  ------------------
  |  |   88|      0|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
  |  Branch (195:5): [True: 0, False: 0]
  ------------------
  196|      0|    case NGX_HTTP_TEMPORARY_REDIRECT:
  ------------------
  |  |   89|      0|#define NGX_HTTP_TEMPORARY_REDIRECT        307
  ------------------
  |  Branch (196:5): [True: 0, False: 0]
  ------------------
  197|      0|    case NGX_HTTP_PERMANENT_REDIRECT:
  ------------------
  |  |   90|      0|#define NGX_HTTP_PERMANENT_REDIRECT        308
  ------------------
  |  Branch (197:5): [True: 0, False: 0]
  ------------------
  198|      0|        safe_status = 1;
  199|      0|        break;
  200|       |
  201|      0|    default:
  ------------------
  |  Branch (201:5): [True: 0, False: 0]
  ------------------
  202|      0|        safe_status = 0;
  203|      0|        break;
  204|      0|    }
  205|       |
  206|      0|    if (conf->expires != NGX_HTTP_EXPIRES_OFF && safe_status) {
  ------------------
  |  Branch (206:9): [True: 0, False: 0]
  |  Branch (206:50): [True: 0, False: 0]
  ------------------
  207|      0|        if (ngx_http_set_expires(r, conf) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (207:13): [True: 0, False: 0]
  ------------------
  208|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  209|      0|        }
  210|      0|    }
  211|       |
  212|      0|    if (conf->headers) {
  ------------------
  |  Branch (212:9): [True: 0, False: 0]
  ------------------
  213|      0|        h = conf->headers->elts;
  214|      0|        for (i = 0; i < conf->headers->nelts; i++) {
  ------------------
  |  Branch (214:21): [True: 0, False: 0]
  ------------------
  215|       |
  216|      0|            if (!safe_status && !h[i].always) {
  ------------------
  |  Branch (216:17): [True: 0, False: 0]
  |  Branch (216:33): [True: 0, False: 0]
  ------------------
  217|      0|                continue;
  218|      0|            }
  219|       |
  220|      0|            if (ngx_http_complex_value(r, &h[i].value, &value) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (220:17): [True: 0, False: 0]
  ------------------
  221|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  222|      0|            }
  223|       |
  224|      0|            if (h[i].handler(r, &h[i], &value) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (224:17): [True: 0, False: 0]
  ------------------
  225|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  226|      0|            }
  227|      0|        }
  228|      0|    }
  229|       |
  230|      0|    if (conf->trailers) {
  ------------------
  |  Branch (230:9): [True: 0, False: 0]
  ------------------
  231|      0|        h = conf->trailers->elts;
  232|      0|        for (i = 0; i < conf->trailers->nelts; i++) {
  ------------------
  |  Branch (232:21): [True: 0, False: 0]
  ------------------
  233|       |
  234|      0|            if (!safe_status && !h[i].always) {
  ------------------
  |  Branch (234:17): [True: 0, False: 0]
  |  Branch (234:33): [True: 0, False: 0]
  ------------------
  235|      0|                continue;
  236|      0|            }
  237|       |
  238|      0|            r->expect_trailers = 1;
  239|      0|            break;
  240|      0|        }
  241|      0|    }
  242|       |
  243|      0|    return ngx_http_next_header_filter(r);
  244|      0|}
ngx_http_headers_filter_module.c:ngx_http_trailers_filter:
  249|     13|{
  250|     13|    ngx_str_t                 value;
  251|     13|    ngx_uint_t                i, safe_status;
  252|     13|    ngx_chain_t              *cl;
  253|     13|    ngx_table_elt_t          *t;
  254|     13|    ngx_http_header_val_t    *h;
  255|     13|    ngx_http_headers_conf_t  *conf;
  256|       |
  257|     13|    conf = ngx_http_get_module_loc_conf(r, ngx_http_headers_filter_module);
  ------------------
  |  |   58|     13|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  258|       |
  259|     13|    if (in == NULL
  ------------------
  |  Branch (259:9): [True: 9, False: 4]
  ------------------
  260|     13|        || conf->trailers == NULL
  ------------------
  |  Branch (260:12): [True: 4, False: 0]
  ------------------
  261|     13|        || !r->expect_trailers
  ------------------
  |  Branch (261:12): [True: 0, False: 0]
  ------------------
  262|     13|        || r->header_only)
  ------------------
  |  Branch (262:12): [True: 0, False: 0]
  ------------------
  263|     13|    {
  264|     13|        return ngx_http_next_body_filter(r, in);
  265|     13|    }
  266|       |
  267|      0|    for (cl = in; cl; cl = cl->next) {
  ------------------
  |  Branch (267:19): [True: 0, False: 0]
  ------------------
  268|      0|        if (cl->buf->last_buf) {
  ------------------
  |  Branch (268:13): [True: 0, False: 0]
  ------------------
  269|      0|            break;
  270|      0|        }
  271|      0|    }
  272|       |
  273|      0|    if (cl == NULL) {
  ------------------
  |  Branch (273:9): [True: 0, False: 0]
  ------------------
  274|      0|        return ngx_http_next_body_filter(r, in);
  275|      0|    }
  276|       |
  277|      0|    switch (r->headers_out.status) {
  278|       |
  279|      0|    case NGX_HTTP_OK:
  ------------------
  |  |   78|      0|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (279:5): [True: 0, False: 0]
  ------------------
  280|      0|    case NGX_HTTP_CREATED:
  ------------------
  |  |   79|      0|#define NGX_HTTP_CREATED                   201
  ------------------
  |  Branch (280:5): [True: 0, False: 0]
  ------------------
  281|      0|    case NGX_HTTP_NO_CONTENT:
  ------------------
  |  |   81|      0|#define NGX_HTTP_NO_CONTENT                204
  ------------------
  |  Branch (281:5): [True: 0, False: 0]
  ------------------
  282|      0|    case NGX_HTTP_PARTIAL_CONTENT:
  ------------------
  |  |   82|      0|#define NGX_HTTP_PARTIAL_CONTENT           206
  ------------------
  |  Branch (282:5): [True: 0, False: 0]
  ------------------
  283|      0|    case NGX_HTTP_MOVED_PERMANENTLY:
  ------------------
  |  |   85|      0|#define NGX_HTTP_MOVED_PERMANENTLY         301
  ------------------
  |  Branch (283:5): [True: 0, False: 0]
  ------------------
  284|      0|    case NGX_HTTP_MOVED_TEMPORARILY:
  ------------------
  |  |   86|      0|#define NGX_HTTP_MOVED_TEMPORARILY         302
  ------------------
  |  Branch (284:5): [True: 0, False: 0]
  ------------------
  285|      0|    case NGX_HTTP_SEE_OTHER:
  ------------------
  |  |   87|      0|#define NGX_HTTP_SEE_OTHER                 303
  ------------------
  |  Branch (285:5): [True: 0, False: 0]
  ------------------
  286|      0|    case NGX_HTTP_NOT_MODIFIED:
  ------------------
  |  |   88|      0|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
  |  Branch (286:5): [True: 0, False: 0]
  ------------------
  287|      0|    case NGX_HTTP_TEMPORARY_REDIRECT:
  ------------------
  |  |   89|      0|#define NGX_HTTP_TEMPORARY_REDIRECT        307
  ------------------
  |  Branch (287:5): [True: 0, False: 0]
  ------------------
  288|      0|    case NGX_HTTP_PERMANENT_REDIRECT:
  ------------------
  |  |   90|      0|#define NGX_HTTP_PERMANENT_REDIRECT        308
  ------------------
  |  Branch (288:5): [True: 0, False: 0]
  ------------------
  289|      0|        safe_status = 1;
  290|      0|        break;
  291|       |
  292|      0|    default:
  ------------------
  |  Branch (292:5): [True: 0, False: 0]
  ------------------
  293|      0|        safe_status = 0;
  294|      0|        break;
  295|      0|    }
  296|       |
  297|      0|    h = conf->trailers->elts;
  298|      0|    for (i = 0; i < conf->trailers->nelts; i++) {
  ------------------
  |  Branch (298:17): [True: 0, False: 0]
  ------------------
  299|       |
  300|      0|        if (!safe_status && !h[i].always) {
  ------------------
  |  Branch (300:13): [True: 0, False: 0]
  |  Branch (300:29): [True: 0, False: 0]
  ------------------
  301|      0|            continue;
  302|      0|        }
  303|       |
  304|      0|        if (ngx_http_complex_value(r, &h[i].value, &value) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (304:13): [True: 0, False: 0]
  ------------------
  305|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  306|      0|        }
  307|       |
  308|      0|        if (value.len) {
  ------------------
  |  Branch (308:13): [True: 0, False: 0]
  ------------------
  309|      0|            t = ngx_list_push(&r->headers_out.trailers);
  310|      0|            if (t == NULL) {
  ------------------
  |  Branch (310:17): [True: 0, False: 0]
  ------------------
  311|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  312|      0|            }
  313|       |
  314|      0|            t->key = h[i].key;
  315|      0|            t->value = value;
  316|      0|            t->hash = 1;
  317|      0|        }
  318|      0|    }
  319|       |
  320|      0|    return ngx_http_next_body_filter(r, in);
  321|      0|}
ngx_http_headers_filter_module.c:ngx_http_headers_create_conf:
  642|      4|{
  643|      4|    ngx_http_headers_conf_t  *conf;
  644|       |
  645|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_headers_conf_t));
  646|      4|    if (conf == NULL) {
  ------------------
  |  Branch (646:9): [True: 0, False: 4]
  ------------------
  647|      0|        return NULL;
  648|      0|    }
  649|       |
  650|       |    /*
  651|       |     * set by ngx_pcalloc():
  652|       |     *
  653|       |     *     conf->headers = NULL;
  654|       |     *     conf->trailers = NULL;
  655|       |     *     conf->expires_time = 0;
  656|       |     *     conf->expires_value = NULL;
  657|       |     */
  658|       |
  659|      4|    conf->expires = NGX_HTTP_EXPIRES_UNSET;
  660|       |
  661|      4|    return conf;
  662|      4|}
ngx_http_headers_filter_module.c:ngx_http_headers_merge_conf:
  667|      2|{
  668|      2|    ngx_http_headers_conf_t *prev = parent;
  669|      2|    ngx_http_headers_conf_t *conf = child;
  670|       |
  671|      2|    if (conf->expires == NGX_HTTP_EXPIRES_UNSET) {
  ------------------
  |  Branch (671:9): [True: 2, False: 0]
  ------------------
  672|      2|        conf->expires = prev->expires;
  673|      2|        conf->expires_time = prev->expires_time;
  674|      2|        conf->expires_value = prev->expires_value;
  675|       |
  676|      2|        if (conf->expires == NGX_HTTP_EXPIRES_UNSET) {
  ------------------
  |  Branch (676:13): [True: 1, False: 1]
  ------------------
  677|      1|            conf->expires = NGX_HTTP_EXPIRES_OFF;
  678|      1|        }
  679|      2|    }
  680|       |
  681|      2|    if (conf->headers == NULL) {
  ------------------
  |  Branch (681:9): [True: 2, False: 0]
  ------------------
  682|      2|        conf->headers = prev->headers;
  683|      2|    }
  684|       |
  685|      2|    if (conf->trailers == NULL) {
  ------------------
  |  Branch (685:9): [True: 2, False: 0]
  ------------------
  686|      2|        conf->trailers = prev->trailers;
  687|      2|    }
  688|       |
  689|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  690|      2|}

ngx_http_index_module.c:ngx_http_index_init:
  444|      1|{
  445|      1|    ngx_http_handler_pt        *h;
  446|      1|    ngx_http_core_main_conf_t  *cmcf;
  447|       |
  448|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  449|       |
  450|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
  451|      1|    if (h == NULL) {
  ------------------
  |  Branch (451:9): [True: 0, False: 1]
  ------------------
  452|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  453|      0|    }
  454|       |
  455|      1|    *h = ngx_http_index_handler;
  456|       |
  457|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  458|      1|}
ngx_http_index_module.c:ngx_http_index_create_loc_conf:
  389|      4|{
  390|      4|    ngx_http_index_loc_conf_t  *conf;
  391|       |
  392|      4|    conf = ngx_palloc(cf->pool, sizeof(ngx_http_index_loc_conf_t));
  393|      4|    if (conf == NULL) {
  ------------------
  |  Branch (393:9): [True: 0, False: 4]
  ------------------
  394|      0|        return NULL;
  395|      0|    }
  396|       |
  397|      4|    conf->indices = NULL;
  398|      4|    conf->max_index_len = 0;
  399|       |
  400|      4|    return conf;
  401|      4|}
ngx_http_index_module.c:ngx_http_index_merge_loc_conf:
  406|      2|{
  407|      2|    ngx_http_index_loc_conf_t  *prev = parent;
  408|      2|    ngx_http_index_loc_conf_t  *conf = child;
  409|       |
  410|      2|    ngx_http_index_t  *index;
  411|       |
  412|      2|    if (conf->indices == NULL) {
  ------------------
  |  Branch (412:9): [True: 2, False: 0]
  ------------------
  413|      2|        conf->indices = prev->indices;
  414|      2|        conf->max_index_len = prev->max_index_len;
  415|      2|    }
  416|       |
  417|      2|    if (conf->indices == NULL) {
  ------------------
  |  Branch (417:9): [True: 1, False: 1]
  ------------------
  418|      1|        conf->indices = ngx_array_create(cf->pool, 1, sizeof(ngx_http_index_t));
  419|      1|        if (conf->indices == NULL) {
  ------------------
  |  Branch (419:13): [True: 0, False: 1]
  ------------------
  420|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  421|      0|        }
  422|       |
  423|      1|        index = ngx_array_push(conf->indices);
  424|      1|        if (index == NULL) {
  ------------------
  |  Branch (424:13): [True: 0, False: 1]
  ------------------
  425|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  426|      0|        }
  427|       |
  428|      1|        index->name.len = sizeof(NGX_HTTP_DEFAULT_INDEX);
  ------------------
  |  |   26|      1|#define NGX_HTTP_DEFAULT_INDEX   "index.html"
  ------------------
  429|      1|        index->name.data = (u_char *) NGX_HTTP_DEFAULT_INDEX;
  ------------------
  |  |   26|      1|#define NGX_HTTP_DEFAULT_INDEX   "index.html"
  ------------------
  430|      1|        index->lengths = NULL;
  431|      1|        index->values = NULL;
  432|       |
  433|      1|        conf->max_index_len = sizeof(NGX_HTTP_DEFAULT_INDEX);
  ------------------
  |  |   26|      1|#define NGX_HTTP_DEFAULT_INDEX   "index.html"
  ------------------
  434|       |
  435|      1|        return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  436|      1|    }
  437|       |
  438|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  439|      2|}

ngx_http_limit_conn_module.c:ngx_http_limit_conn_add_variables:
  725|      1|{
  726|      1|    ngx_http_variable_t  *var, *v;
  727|       |
  728|      2|    for (v = ngx_http_limit_conn_vars; v->name.len; v++) {
  ------------------
  |  Branch (728:40): [True: 1, False: 1]
  ------------------
  729|      1|        var = ngx_http_add_variable(cf, &v->name, v->flags);
  730|      1|        if (var == NULL) {
  ------------------
  |  Branch (730:13): [True: 0, False: 1]
  ------------------
  731|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  732|      0|        }
  733|       |
  734|      1|        var->get_handler = v->get_handler;
  735|      1|        var->data = v->data;
  736|      1|    }
  737|       |
  738|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  739|      1|}
ngx_http_limit_conn_module.c:ngx_http_limit_conn_init:
  744|      1|{
  745|      1|    ngx_http_handler_pt        *h;
  746|      1|    ngx_http_core_main_conf_t  *cmcf;
  747|       |
  748|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  749|       |
  750|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_PREACCESS_PHASE].handlers);
  751|      1|    if (h == NULL) {
  ------------------
  |  Branch (751:9): [True: 0, False: 1]
  ------------------
  752|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  753|      0|    }
  754|       |
  755|      1|    *h = ngx_http_limit_conn_handler;
  756|       |
  757|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  758|      1|}
ngx_http_limit_conn_module.c:ngx_http_limit_conn_handler:
  181|     11|{
  182|     11|    size_t                          n;
  183|     11|    uint32_t                        hash;
  184|     11|    ngx_str_t                       key;
  185|     11|    ngx_uint_t                      i;
  186|     11|    ngx_rbtree_node_t              *node;
  187|     11|    ngx_pool_cleanup_t             *cln;
  188|     11|    ngx_http_limit_conn_ctx_t      *ctx;
  189|     11|    ngx_http_limit_conn_node_t     *lc;
  190|     11|    ngx_http_limit_conn_conf_t     *lccf;
  191|     11|    ngx_http_limit_conn_limit_t    *limits;
  192|     11|    ngx_http_limit_conn_cleanup_t  *lccln;
  193|       |
  194|     11|    if (r->main->limit_conn_status) {
  ------------------
  |  Branch (194:9): [True: 0, False: 11]
  ------------------
  195|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  196|      0|    }
  197|       |
  198|     11|    lccf = ngx_http_get_module_loc_conf(r, ngx_http_limit_conn_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  199|     11|    limits = lccf->limits.elts;
  200|       |
  201|     11|    for (i = 0; i < lccf->limits.nelts; i++) {
  ------------------
  |  Branch (201:17): [True: 0, False: 11]
  ------------------
  202|      0|        ctx = limits[i].shm_zone->data;
  203|       |
  204|      0|        if (ngx_http_complex_value(r, &ctx->key, &key) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (204:13): [True: 0, False: 0]
  ------------------
  205|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  206|      0|        }
  207|       |
  208|      0|        if (key.len == 0) {
  ------------------
  |  Branch (208:13): [True: 0, False: 0]
  ------------------
  209|      0|            continue;
  210|      0|        }
  211|       |
  212|      0|        if (key.len > 255) {
  ------------------
  |  Branch (212:13): [True: 0, False: 0]
  ------------------
  213|      0|            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  214|      0|                          "the value of the \"%V\" key "
  215|      0|                          "is more than 255 bytes: \"%V\"",
  216|      0|                          &ctx->key.value, &key);
  217|      0|            continue;
  218|      0|        }
  219|       |
  220|      0|        r->main->limit_conn_status = NGX_HTTP_LIMIT_CONN_PASSED;
  ------------------
  |  |   13|      0|#define NGX_HTTP_LIMIT_CONN_PASSED            1
  ------------------
  221|       |
  222|      0|        hash = ngx_crc32_short(key.data, key.len);
  223|       |
  224|      0|        ngx_shmtx_lock(&ctx->shpool->mutex);
  225|       |
  226|      0|        node = ngx_http_limit_conn_lookup(&ctx->sh->rbtree, &key, hash);
  227|       |
  228|      0|        if (node == NULL) {
  ------------------
  |  Branch (228:13): [True: 0, False: 0]
  ------------------
  229|       |
  230|      0|            n = offsetof(ngx_rbtree_node_t, color)
  231|      0|                + offsetof(ngx_http_limit_conn_node_t, data)
  232|      0|                + key.len;
  233|       |
  234|      0|            node = ngx_slab_alloc_locked(ctx->shpool, n);
  235|       |
  236|      0|            if (node == NULL) {
  ------------------
  |  Branch (236:17): [True: 0, False: 0]
  ------------------
  237|      0|                ngx_shmtx_unlock(&ctx->shpool->mutex);
  238|      0|                ngx_http_limit_conn_cleanup_all(r->pool);
  239|       |
  240|      0|                if (lccf->dry_run) {
  ------------------
  |  Branch (240:21): [True: 0, False: 0]
  ------------------
  241|      0|                    r->main->limit_conn_status =
  242|      0|                                          NGX_HTTP_LIMIT_CONN_REJECTED_DRY_RUN;
  ------------------
  |  |   15|      0|#define NGX_HTTP_LIMIT_CONN_REJECTED_DRY_RUN  3
  ------------------
  243|      0|                    return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  244|      0|                }
  245|       |
  246|      0|                r->main->limit_conn_status = NGX_HTTP_LIMIT_CONN_REJECTED;
  ------------------
  |  |   14|      0|#define NGX_HTTP_LIMIT_CONN_REJECTED          2
  ------------------
  247|       |
  248|      0|                return lccf->status_code;
  249|      0|            }
  250|       |
  251|      0|            lc = (ngx_http_limit_conn_node_t *) &node->color;
  252|       |
  253|      0|            node->key = hash;
  254|      0|            lc->len = (u_char) key.len;
  255|      0|            lc->conn = 1;
  256|      0|            ngx_memcpy(lc->data, key.data, key.len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  257|       |
  258|      0|            ngx_rbtree_insert(&ctx->sh->rbtree, node);
  259|       |
  260|      0|        } else {
  261|       |
  262|      0|            lc = (ngx_http_limit_conn_node_t *) &node->color;
  263|       |
  264|      0|            if ((ngx_uint_t) lc->conn >= limits[i].conn) {
  ------------------
  |  Branch (264:17): [True: 0, False: 0]
  ------------------
  265|       |
  266|      0|                ngx_shmtx_unlock(&ctx->shpool->mutex);
  267|       |
  268|      0|                ngx_log_error(lccf->log_level, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  |  Branch (86:67): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  269|      0|                              "limiting connections%s by zone \"%V\"",
  270|      0|                              lccf->dry_run ? ", dry run," : "",
  271|      0|                              &limits[i].shm_zone->shm.name);
  272|       |
  273|      0|                ngx_http_limit_conn_cleanup_all(r->pool);
  274|       |
  275|      0|                if (lccf->dry_run) {
  ------------------
  |  Branch (275:21): [True: 0, False: 0]
  ------------------
  276|      0|                    r->main->limit_conn_status =
  277|      0|                                          NGX_HTTP_LIMIT_CONN_REJECTED_DRY_RUN;
  ------------------
  |  |   15|      0|#define NGX_HTTP_LIMIT_CONN_REJECTED_DRY_RUN  3
  ------------------
  278|      0|                    return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  279|      0|                }
  280|       |
  281|      0|                r->main->limit_conn_status = NGX_HTTP_LIMIT_CONN_REJECTED;
  ------------------
  |  |   14|      0|#define NGX_HTTP_LIMIT_CONN_REJECTED          2
  ------------------
  282|       |
  283|      0|                return lccf->status_code;
  284|      0|            }
  285|       |
  286|      0|            lc->conn++;
  287|      0|        }
  288|       |
  289|      0|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  290|      0|                       "limit conn: %08Xi %d", node->key, lc->conn);
  291|       |
  292|      0|        ngx_shmtx_unlock(&ctx->shpool->mutex);
  293|       |
  294|      0|        cln = ngx_pool_cleanup_add(r->pool,
  295|      0|                                   sizeof(ngx_http_limit_conn_cleanup_t));
  296|      0|        if (cln == NULL) {
  ------------------
  |  Branch (296:13): [True: 0, False: 0]
  ------------------
  297|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  298|      0|        }
  299|       |
  300|      0|        cln->handler = ngx_http_limit_conn_cleanup;
  301|      0|        lccln = cln->data;
  302|       |
  303|      0|        lccln->shm_zone = limits[i].shm_zone;
  304|      0|        lccln->node = node;
  305|      0|    }
  306|       |
  307|     11|    return NGX_DECLINED;
  ------------------
  |  |   43|     11|#define  NGX_DECLINED   -5
  ------------------
  308|     11|}
ngx_http_limit_conn_module.c:ngx_http_limit_conn_create_conf:
  519|      4|{
  520|      4|    ngx_http_limit_conn_conf_t  *conf;
  521|       |
  522|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_conn_conf_t));
  523|      4|    if (conf == NULL) {
  ------------------
  |  Branch (523:9): [True: 0, False: 4]
  ------------------
  524|      0|        return NULL;
  525|      0|    }
  526|       |
  527|       |    /*
  528|       |     * set by ngx_pcalloc():
  529|       |     *
  530|       |     *     conf->limits.elts = NULL;
  531|       |     */
  532|       |
  533|      4|    conf->log_level = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  534|      4|    conf->status_code = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  535|      4|    conf->dry_run = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  536|       |
  537|      4|    return conf;
  538|      4|}
ngx_http_limit_conn_module.c:ngx_http_limit_conn_merge_conf:
  543|      2|{
  544|      2|    ngx_http_limit_conn_conf_t *prev = parent;
  545|      2|    ngx_http_limit_conn_conf_t *conf = child;
  546|       |
  547|      2|    if (conf->limits.elts == NULL) {
  ------------------
  |  Branch (547:9): [True: 2, False: 0]
  ------------------
  548|      2|        conf->limits = prev->limits;
  549|      2|    }
  550|       |
  551|      2|    ngx_conf_merge_uint_value(conf->log_level, prev->log_level, NGX_LOG_ERR);
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  552|      2|    ngx_conf_merge_uint_value(conf->status_code, prev->status_code,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  553|      2|                              NGX_HTTP_SERVICE_UNAVAILABLE);
  554|       |
  555|      2|    ngx_conf_merge_value(conf->dry_run, prev->dry_run, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  556|       |
  557|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  558|      2|}

ngx_http_limit_req_module.c:ngx_http_limit_req_add_variables:
 1069|      1|{
 1070|      1|    ngx_http_variable_t  *var, *v;
 1071|       |
 1072|      2|    for (v = ngx_http_limit_req_vars; v->name.len; v++) {
  ------------------
  |  Branch (1072:39): [True: 1, False: 1]
  ------------------
 1073|      1|        var = ngx_http_add_variable(cf, &v->name, v->flags);
 1074|      1|        if (var == NULL) {
  ------------------
  |  Branch (1074:13): [True: 0, False: 1]
  ------------------
 1075|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1076|      0|        }
 1077|       |
 1078|      1|        var->get_handler = v->get_handler;
 1079|      1|        var->data = v->data;
 1080|      1|    }
 1081|       |
 1082|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1083|      1|}
ngx_http_limit_req_module.c:ngx_http_limit_req_init:
 1088|      1|{
 1089|      1|    ngx_http_handler_pt        *h;
 1090|      1|    ngx_http_core_main_conf_t  *cmcf;
 1091|       |
 1092|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 1093|       |
 1094|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_PREACCESS_PHASE].handlers);
 1095|      1|    if (h == NULL) {
  ------------------
  |  Branch (1095:9): [True: 0, False: 1]
  ------------------
 1096|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1097|      0|    }
 1098|       |
 1099|      1|    *h = ngx_http_limit_req_handler;
 1100|       |
 1101|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1102|      1|}
ngx_http_limit_req_module.c:ngx_http_limit_req_handler:
  196|     11|{
  197|     11|    uint32_t                     hash;
  198|     11|    ngx_str_t                    key;
  199|     11|    ngx_int_t                    rc;
  200|     11|    ngx_uint_t                   n, excess;
  201|     11|    ngx_msec_t                   delay;
  202|     11|    ngx_http_limit_req_ctx_t    *ctx;
  203|     11|    ngx_http_limit_req_conf_t   *lrcf;
  204|     11|    ngx_http_limit_req_limit_t  *limit, *limits;
  205|       |
  206|     11|    if (r->main->limit_req_status) {
  ------------------
  |  Branch (206:9): [True: 0, False: 11]
  ------------------
  207|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  208|      0|    }
  209|       |
  210|     11|    lrcf = ngx_http_get_module_loc_conf(r, ngx_http_limit_req_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  211|     11|    limits = lrcf->limits.elts;
  212|       |
  213|     11|    excess = 0;
  214|       |
  215|     11|    rc = NGX_DECLINED;
  ------------------
  |  |   43|     11|#define  NGX_DECLINED   -5
  ------------------
  216|       |
  217|     11|#if (NGX_SUPPRESS_WARN)
  218|     11|    limit = NULL;
  219|     11|#endif
  220|       |
  221|     11|    for (n = 0; n < lrcf->limits.nelts; n++) {
  ------------------
  |  Branch (221:17): [True: 0, False: 11]
  ------------------
  222|       |
  223|      0|        limit = &limits[n];
  224|       |
  225|      0|        ctx = limit->shm_zone->data;
  226|       |
  227|      0|        if (ngx_http_complex_value(r, &ctx->key, &key) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (227:13): [True: 0, False: 0]
  ------------------
  228|      0|            ngx_http_limit_req_unlock(limits, n);
  229|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  230|      0|        }
  231|       |
  232|      0|        if (key.len == 0) {
  ------------------
  |  Branch (232:13): [True: 0, False: 0]
  ------------------
  233|      0|            continue;
  234|      0|        }
  235|       |
  236|      0|        if (key.len > 65535) {
  ------------------
  |  Branch (236:13): [True: 0, False: 0]
  ------------------
  237|      0|            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  238|      0|                          "the value of the \"%V\" key "
  239|      0|                          "is more than 65535 bytes: \"%V\"",
  240|      0|                          &ctx->key.value, &key);
  241|      0|            continue;
  242|      0|        }
  243|       |
  244|      0|        hash = ngx_crc32_short(key.data, key.len);
  245|       |
  246|      0|        ngx_shmtx_lock(&ctx->shpool->mutex);
  247|       |
  248|      0|        rc = ngx_http_limit_req_lookup(limit, hash, &key, &excess,
  249|      0|                                       (n == lrcf->limits.nelts - 1));
  250|       |
  251|      0|        ngx_shmtx_unlock(&ctx->shpool->mutex);
  252|       |
  253|      0|        ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  254|      0|                       "limit_req[%ui]: %i %ui.%03ui",
  255|      0|                       n, rc, excess / 1000, excess % 1000);
  256|       |
  257|      0|        if (rc != NGX_AGAIN) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (257:13): [True: 0, False: 0]
  ------------------
  258|      0|            break;
  259|      0|        }
  260|      0|    }
  261|       |
  262|     11|    if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|     11|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (262:9): [True: 11, False: 0]
  ------------------
  263|     11|        return NGX_DECLINED;
  ------------------
  |  |   43|     11|#define  NGX_DECLINED   -5
  ------------------
  264|     11|    }
  265|       |
  266|      0|    if (rc == NGX_BUSY || rc == NGX_ERROR) {
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
                  if (rc == NGX_BUSY || rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (266:9): [True: 0, False: 0]
  |  Branch (266:27): [True: 0, False: 0]
  ------------------
  267|       |
  268|      0|        if (rc == NGX_BUSY) {
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  |  Branch (268:13): [True: 0, False: 0]
  ------------------
  269|      0|            ngx_log_error(lrcf->limit_log_level, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  |  Branch (86:67): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  270|      0|                        "limiting requests%s, excess: %ui.%03ui by zone \"%V\"",
  271|      0|                        lrcf->dry_run ? ", dry run" : "",
  272|      0|                        excess / 1000, excess % 1000,
  273|      0|                        &limit->shm_zone->shm.name);
  274|      0|        }
  275|       |
  276|      0|        ngx_http_limit_req_unlock(limits, n);
  277|       |
  278|      0|        if (lrcf->dry_run) {
  ------------------
  |  Branch (278:13): [True: 0, False: 0]
  ------------------
  279|      0|            r->main->limit_req_status = NGX_HTTP_LIMIT_REQ_REJECTED_DRY_RUN;
  ------------------
  |  |   17|      0|#define NGX_HTTP_LIMIT_REQ_REJECTED_DRY_RUN  5
  ------------------
  280|      0|            return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  281|      0|        }
  282|       |
  283|      0|        r->main->limit_req_status = NGX_HTTP_LIMIT_REQ_REJECTED;
  ------------------
  |  |   15|      0|#define NGX_HTTP_LIMIT_REQ_REJECTED          3
  ------------------
  284|       |
  285|      0|        return lrcf->status_code;
  286|      0|    }
  287|       |
  288|       |    /* rc == NGX_AGAIN || rc == NGX_OK */
  289|       |
  290|      0|    if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (290:9): [True: 0, False: 0]
  ------------------
  291|      0|        excess = 0;
  292|      0|    }
  293|       |
  294|      0|    delay = ngx_http_limit_req_account(limits, n, &excess, &limit);
  295|       |
  296|      0|    if (!delay) {
  ------------------
  |  Branch (296:9): [True: 0, False: 0]
  ------------------
  297|      0|        r->main->limit_req_status = NGX_HTTP_LIMIT_REQ_PASSED;
  ------------------
  |  |   13|      0|#define NGX_HTTP_LIMIT_REQ_PASSED            1
  ------------------
  298|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  299|      0|    }
  300|       |
  301|      0|    ngx_log_error(lrcf->delay_log_level, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  |  Branch (86:67): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  302|      0|                  "delaying request%s, excess: %ui.%03ui, by zone \"%V\"",
  303|      0|                  lrcf->dry_run ? ", dry run" : "",
  304|      0|                  excess / 1000, excess % 1000, &limit->shm_zone->shm.name);
  305|       |
  306|      0|    if (lrcf->dry_run) {
  ------------------
  |  Branch (306:9): [True: 0, False: 0]
  ------------------
  307|      0|        r->main->limit_req_status = NGX_HTTP_LIMIT_REQ_DELAYED_DRY_RUN;
  ------------------
  |  |   16|      0|#define NGX_HTTP_LIMIT_REQ_DELAYED_DRY_RUN   4
  ------------------
  308|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  309|      0|    }
  310|       |
  311|      0|    r->main->limit_req_status = NGX_HTTP_LIMIT_REQ_DELAYED;
  ------------------
  |  |   14|      0|#define NGX_HTTP_LIMIT_REQ_DELAYED           2
  ------------------
  312|       |
  313|      0|    if (r->connection->read->ready) {
  ------------------
  |  Branch (313:9): [True: 0, False: 0]
  ------------------
  314|      0|        ngx_post_event(r->connection->read, &ngx_posted_events);
  ------------------
  |  |   19|      0|    if (!(ev)->posted) {                                                      \
  |  |  ------------------
  |  |  |  Branch (19:9): [True: 0, False: 0]
  |  |  ------------------
  |  |   20|      0|        (ev)->posted = 1;                                                     \
  |  |   21|      0|        ngx_queue_insert_tail(q, &(ev)->queue);                               \
  |  |  ------------------
  |  |  |  |   44|      0|    (x)->prev = (h)->prev;                                                    \
  |  |  |  |   45|      0|    (x)->prev->next = x;                                                      \
  |  |  |  |   46|      0|    (x)->next = h;                                                            \
  |  |  |  |   47|      0|    (h)->prev = x
  |  |  ------------------
  |  |   22|      0|                                                                              \
  |  |   23|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, "post event %p", ev);\
  |  |   24|      0|                                                                              \
  |  |   25|      0|    } else  {                                                                 \
  |  |   26|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                      \
  |  |   27|      0|                       "update posted event %p", ev);                         \
  |  |   28|      0|    }
  ------------------
  315|       |
  316|      0|    } else {
  317|      0|        if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (317:13): [True: 0, False: 0]
  ------------------
  318|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  319|      0|        }
  320|      0|    }
  321|       |
  322|      0|    r->read_event_handler = ngx_http_test_reading;
  323|      0|    r->write_event_handler = ngx_http_limit_req_delay;
  324|       |
  325|      0|    r->connection->write->delayed = 1;
  326|      0|    ngx_add_timer(r->connection->write, delay);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
  327|       |
  328|      0|    return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  329|      0|}
ngx_http_limit_req_module.c:ngx_http_limit_req_create_conf:
  785|      4|{
  786|      4|    ngx_http_limit_req_conf_t  *conf;
  787|       |
  788|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_req_conf_t));
  789|      4|    if (conf == NULL) {
  ------------------
  |  Branch (789:9): [True: 0, False: 4]
  ------------------
  790|      0|        return NULL;
  791|      0|    }
  792|       |
  793|       |    /*
  794|       |     * set by ngx_pcalloc():
  795|       |     *
  796|       |     *     conf->limits.elts = NULL;
  797|       |     */
  798|       |
  799|      4|    conf->limit_log_level = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  800|      4|    conf->status_code = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  801|      4|    conf->dry_run = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  802|       |
  803|      4|    return conf;
  804|      4|}
ngx_http_limit_req_module.c:ngx_http_limit_req_merge_conf:
  809|      2|{
  810|      2|    ngx_http_limit_req_conf_t *prev = parent;
  811|      2|    ngx_http_limit_req_conf_t *conf = child;
  812|       |
  813|      2|    if (conf->limits.elts == NULL) {
  ------------------
  |  Branch (813:9): [True: 2, False: 0]
  ------------------
  814|      2|        conf->limits = prev->limits;
  815|      2|    }
  816|       |
  817|      2|    ngx_conf_merge_uint_value(conf->limit_log_level, prev->limit_log_level,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  818|      2|                              NGX_LOG_ERR);
  819|       |
  820|      2|    conf->delay_log_level = (conf->limit_log_level == NGX_LOG_INFO) ?
  ------------------
  |  |   23|      2|#define NGX_LOG_INFO              7
  ------------------
  |  Branch (820:29): [True: 0, False: 2]
  ------------------
  821|      2|                                NGX_LOG_INFO : conf->limit_log_level + 1;
  ------------------
  |  |   23|      0|#define NGX_LOG_INFO              7
  ------------------
  822|       |
  823|      2|    ngx_conf_merge_uint_value(conf->status_code, prev->status_code,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  824|      2|                              NGX_HTTP_SERVICE_UNAVAILABLE);
  825|       |
  826|      2|    ngx_conf_merge_value(conf->dry_run, prev->dry_run, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  827|       |
  828|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  829|      2|}

ngx_http_log_module.c:ngx_http_log_init:
 1869|      1|{
 1870|      1|    ngx_str_t                  *value;
 1871|      1|    ngx_array_t                 a;
 1872|      1|    ngx_http_handler_pt        *h;
 1873|      1|    ngx_http_log_fmt_t         *fmt;
 1874|      1|    ngx_http_log_main_conf_t   *lmcf;
 1875|      1|    ngx_http_core_main_conf_t  *cmcf;
 1876|       |
 1877|      1|    lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 1878|       |
 1879|      1|    if (lmcf->combined_used) {
  ------------------
  |  Branch (1879:9): [True: 0, False: 1]
  ------------------
 1880|      0|        if (ngx_array_init(&a, cf->pool, 1, sizeof(ngx_str_t)) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1880:13): [True: 0, False: 0]
  ------------------
 1881|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1882|      0|        }
 1883|       |
 1884|      0|        value = ngx_array_push(&a);
 1885|      0|        if (value == NULL) {
  ------------------
  |  Branch (1885:13): [True: 0, False: 0]
  ------------------
 1886|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1887|      0|        }
 1888|       |
 1889|      0|        *value = ngx_http_combined_fmt;
 1890|      0|        fmt = lmcf->formats.elts;
 1891|       |
 1892|      0|        if (ngx_http_log_compile_format(cf, NULL, fmt->ops, &a, 0)
  ------------------
  |  Branch (1892:13): [True: 0, False: 0]
  ------------------
 1893|      0|            != NGX_CONF_OK)
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 1894|      0|        {
 1895|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1896|      0|        }
 1897|      0|    }
 1898|       |
 1899|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 1900|       |
 1901|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_LOG_PHASE].handlers);
 1902|      1|    if (h == NULL) {
  ------------------
  |  Branch (1902:9): [True: 0, False: 1]
  ------------------
 1903|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1904|      0|    }
 1905|       |
 1906|      1|    *h = ngx_http_log_handler;
 1907|       |
 1908|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1909|      1|}
ngx_http_log_module.c:ngx_http_log_handler:
  255|     16|{
  256|     16|    u_char                   *line, *p;
  257|     16|    size_t                    len, size;
  258|     16|    ssize_t                   n;
  259|     16|    ngx_str_t                 val;
  260|     16|    ngx_uint_t                i, l;
  261|     16|    ngx_http_log_t           *log;
  262|     16|    ngx_http_log_op_t        *op;
  263|     16|    ngx_http_log_buf_t       *buffer;
  264|     16|    ngx_http_log_loc_conf_t  *lcf;
  265|       |
  266|     16|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  267|     16|                   "http log handler");
  268|       |
  269|     16|    lcf = ngx_http_get_module_loc_conf(r, ngx_http_log_module);
  ------------------
  |  |   58|     16|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  270|       |
  271|     16|    if (lcf->off) {
  ------------------
  |  Branch (271:9): [True: 16, False: 0]
  ------------------
  272|     16|        return NGX_OK;
  ------------------
  |  |   38|     16|#define  NGX_OK          0
  ------------------
  273|     16|    }
  274|       |
  275|      0|    log = lcf->logs->elts;
  276|      0|    for (l = 0; l < lcf->logs->nelts; l++) {
  ------------------
  |  Branch (276:17): [True: 0, False: 0]
  ------------------
  277|       |
  278|      0|        if (log[l].filter) {
  ------------------
  |  Branch (278:13): [True: 0, False: 0]
  ------------------
  279|      0|            if (ngx_http_complex_value(r, log[l].filter, &val) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (279:17): [True: 0, False: 0]
  ------------------
  280|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  281|      0|            }
  282|       |
  283|      0|            if (val.len == 0 || (val.len == 1 && val.data[0] == '0')) {
  ------------------
  |  Branch (283:17): [True: 0, False: 0]
  |  Branch (283:34): [True: 0, False: 0]
  |  Branch (283:50): [True: 0, False: 0]
  ------------------
  284|      0|                continue;
  285|      0|            }
  286|      0|        }
  287|       |
  288|      0|        if (ngx_time() == log[l].disk_full_time) {
  ------------------
  |  |   36|      0|#define ngx_time()           ngx_cached_time->sec
  ------------------
  |  Branch (288:13): [True: 0, False: 0]
  ------------------
  289|       |
  290|       |            /*
  291|       |             * on FreeBSD writing to a full filesystem with enabled softupdates
  292|       |             * may block process for much longer time than writing to non-full
  293|       |             * filesystem, so we skip writing to a log for one second
  294|       |             */
  295|       |
  296|      0|            continue;
  297|      0|        }
  298|       |
  299|      0|        ngx_http_script_flush_no_cacheable_variables(r, log[l].format->flushes);
  300|       |
  301|      0|        len = 0;
  302|      0|        op = log[l].format->ops->elts;
  303|      0|        for (i = 0; i < log[l].format->ops->nelts; i++) {
  ------------------
  |  Branch (303:21): [True: 0, False: 0]
  ------------------
  304|      0|            if (op[i].len == 0) {
  ------------------
  |  Branch (304:17): [True: 0, False: 0]
  ------------------
  305|      0|                len += op[i].getlen(r, op[i].data);
  306|       |
  307|      0|            } else {
  308|      0|                len += op[i].len;
  309|      0|            }
  310|      0|        }
  311|       |
  312|      0|        if (log[l].syslog_peer) {
  ------------------
  |  Branch (312:13): [True: 0, False: 0]
  ------------------
  313|       |
  314|       |            /* length of syslog's PRI and HEADER message parts */
  315|      0|            len += sizeof("<255>Jan 01 00:00:00 ") - 1
  316|      0|                   + ngx_cycle->hostname.len + 1
  317|      0|                   + log[l].syslog_peer->tag.len + 2;
  318|       |
  319|      0|            goto alloc_line;
  320|      0|        }
  321|       |
  322|      0|        len += NGX_LINEFEED_SIZE;
  ------------------
  |  |  157|      0|#define NGX_LINEFEED_SIZE        1
  ------------------
  323|       |
  324|      0|        buffer = log[l].file ? log[l].file->data : NULL;
  ------------------
  |  Branch (324:18): [True: 0, False: 0]
  ------------------
  325|       |
  326|      0|        if (buffer) {
  ------------------
  |  Branch (326:13): [True: 0, False: 0]
  ------------------
  327|       |
  328|      0|            if (len > (size_t) (buffer->last - buffer->pos)) {
  ------------------
  |  Branch (328:17): [True: 0, False: 0]
  ------------------
  329|       |
  330|      0|                ngx_http_log_write(r, &log[l], buffer->start,
  331|      0|                                   buffer->pos - buffer->start);
  332|       |
  333|      0|                buffer->pos = buffer->start;
  334|      0|            }
  335|       |
  336|      0|            if (len <= (size_t) (buffer->last - buffer->pos)) {
  ------------------
  |  Branch (336:17): [True: 0, False: 0]
  ------------------
  337|       |
  338|      0|                p = buffer->pos;
  339|       |
  340|      0|                if (buffer->event && p == buffer->start) {
  ------------------
  |  Branch (340:21): [True: 0, False: 0]
  |  Branch (340:38): [True: 0, False: 0]
  ------------------
  341|      0|                    ngx_add_timer(buffer->event, buffer->flush);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
  342|      0|                }
  343|       |
  344|      0|                for (i = 0; i < log[l].format->ops->nelts; i++) {
  ------------------
  |  Branch (344:29): [True: 0, False: 0]
  ------------------
  345|      0|                    p = op[i].run(r, p, &op[i]);
  346|      0|                }
  347|       |
  348|      0|                ngx_linefeed(p);
  ------------------
  |  |  156|      0|#define ngx_linefeed(p)          *p++ = LF;
  |  |  ------------------
  |  |  |  |  103|      0|#define LF     (u_char) '\n'
  |  |  ------------------
  ------------------
  349|       |
  350|      0|                buffer->pos = p;
  351|       |
  352|      0|                continue;
  353|      0|            }
  354|       |
  355|      0|            if (buffer->event && buffer->event->timer_set) {
  ------------------
  |  Branch (355:17): [True: 0, False: 0]
  |  Branch (355:34): [True: 0, False: 0]
  ------------------
  356|      0|                ngx_del_timer(buffer->event);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
  357|      0|            }
  358|      0|        }
  359|       |
  360|      0|    alloc_line:
  361|       |
  362|      0|        line = ngx_pnalloc(r->pool, len);
  363|      0|        if (line == NULL) {
  ------------------
  |  Branch (363:13): [True: 0, False: 0]
  ------------------
  364|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  365|      0|        }
  366|       |
  367|      0|        p = line;
  368|       |
  369|      0|        if (log[l].syslog_peer) {
  ------------------
  |  Branch (369:13): [True: 0, False: 0]
  ------------------
  370|      0|            p = ngx_syslog_add_header(log[l].syslog_peer, line);
  371|      0|        }
  372|       |
  373|      0|        for (i = 0; i < log[l].format->ops->nelts; i++) {
  ------------------
  |  Branch (373:21): [True: 0, False: 0]
  ------------------
  374|      0|            p = op[i].run(r, p, &op[i]);
  375|      0|        }
  376|       |
  377|      0|        if (log[l].syslog_peer) {
  ------------------
  |  Branch (377:13): [True: 0, False: 0]
  ------------------
  378|       |
  379|      0|            size = p - line;
  380|       |
  381|      0|            n = ngx_syslog_send(log[l].syslog_peer, line, size);
  382|       |
  383|      0|            if (n < 0) {
  ------------------
  |  Branch (383:17): [True: 0, False: 0]
  ------------------
  384|      0|                ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  385|      0|                              "send() to syslog failed");
  386|       |
  387|      0|            } else if ((size_t) n != size) {
  ------------------
  |  Branch (387:24): [True: 0, False: 0]
  ------------------
  388|      0|                ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  389|      0|                              "send() to syslog has written only %z of %uz",
  390|      0|                              n, size);
  391|      0|            }
  392|       |
  393|      0|            continue;
  394|      0|        }
  395|       |
  396|      0|        ngx_linefeed(p);
  ------------------
  |  |  156|      0|#define ngx_linefeed(p)          *p++ = LF;
  |  |  ------------------
  |  |  |  |  103|      0|#define LF     (u_char) '\n'
  |  |  ------------------
  ------------------
  397|       |
  398|      0|        ngx_http_log_write(r, &log[l], line, p - line);
  399|      0|    }
  400|       |
  401|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  402|      0|}
ngx_http_log_module.c:ngx_http_log_create_main_conf:
 1127|      1|{
 1128|      1|    ngx_http_log_main_conf_t  *conf;
 1129|       |
 1130|      1|    ngx_http_log_fmt_t  *fmt;
 1131|       |
 1132|      1|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_main_conf_t));
 1133|      1|    if (conf == NULL) {
  ------------------
  |  Branch (1133:9): [True: 0, False: 1]
  ------------------
 1134|      0|        return NULL;
 1135|      0|    }
 1136|       |
 1137|      1|    if (ngx_array_init(&conf->formats, cf->pool, 4, sizeof(ngx_http_log_fmt_t))
  ------------------
  |  Branch (1137:9): [True: 0, False: 1]
  ------------------
 1138|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1139|      0|    {
 1140|      0|        return NULL;
 1141|      0|    }
 1142|       |
 1143|      1|    fmt = ngx_array_push(&conf->formats);
 1144|      1|    if (fmt == NULL) {
  ------------------
  |  Branch (1144:9): [True: 0, False: 1]
  ------------------
 1145|      0|        return NULL;
 1146|      0|    }
 1147|       |
 1148|      1|    ngx_str_set(&fmt->name, "combined");
  ------------------
  |  |   43|      1|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 1149|       |
 1150|      1|    fmt->flushes = NULL;
 1151|       |
 1152|      1|    fmt->ops = ngx_array_create(cf->pool, 16, sizeof(ngx_http_log_op_t));
 1153|      1|    if (fmt->ops == NULL) {
  ------------------
  |  Branch (1153:9): [True: 0, False: 1]
  ------------------
 1154|      0|        return NULL;
 1155|      0|    }
 1156|       |
 1157|      1|    return conf;
 1158|      1|}
ngx_http_log_module.c:ngx_http_log_create_loc_conf:
 1163|      4|{
 1164|      4|    ngx_http_log_loc_conf_t  *conf;
 1165|       |
 1166|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_loc_conf_t));
 1167|      4|    if (conf == NULL) {
  ------------------
  |  Branch (1167:9): [True: 0, False: 4]
  ------------------
 1168|      0|        return NULL;
 1169|      0|    }
 1170|       |
 1171|      4|    conf->open_file_cache = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1172|       |
 1173|      4|    return conf;
 1174|      4|}
ngx_http_log_module.c:ngx_http_log_merge_loc_conf:
 1179|      2|{
 1180|      2|    ngx_http_log_loc_conf_t *prev = parent;
 1181|      2|    ngx_http_log_loc_conf_t *conf = child;
 1182|       |
 1183|      2|    ngx_http_log_t            *log;
 1184|      2|    ngx_http_log_fmt_t        *fmt;
 1185|      2|    ngx_http_log_main_conf_t  *lmcf;
 1186|       |
 1187|      2|    if (conf->open_file_cache == NGX_CONF_UNSET_PTR) {
  ------------------
  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  |  Branch (1187:9): [True: 2, False: 0]
  ------------------
 1188|       |
 1189|      2|        conf->open_file_cache = prev->open_file_cache;
 1190|      2|        conf->open_file_cache_valid = prev->open_file_cache_valid;
 1191|      2|        conf->open_file_cache_min_uses = prev->open_file_cache_min_uses;
 1192|       |
 1193|      2|        if (conf->open_file_cache == NGX_CONF_UNSET_PTR) {
  ------------------
  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  |  Branch (1193:13): [True: 1, False: 1]
  ------------------
 1194|      1|            conf->open_file_cache = NULL;
 1195|      1|        }
 1196|      2|    }
 1197|       |
 1198|      2|    if (conf->logs || conf->off) {
  ------------------
  |  Branch (1198:9): [True: 0, False: 2]
  |  Branch (1198:23): [True: 0, False: 2]
  ------------------
 1199|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 1200|      0|    }
 1201|       |
 1202|      2|    conf->logs = prev->logs;
 1203|      2|    conf->off = prev->off;
 1204|       |
 1205|      2|    if (conf->logs || conf->off) {
  ------------------
  |  Branch (1205:9): [True: 0, False: 2]
  |  Branch (1205:23): [True: 2, False: 0]
  ------------------
 1206|      2|        return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 1207|      2|    }
 1208|       |
 1209|      0|    conf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));
 1210|      0|    if (conf->logs == NULL) {
  ------------------
  |  Branch (1210:9): [True: 0, False: 0]
  ------------------
 1211|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1212|      0|    }
 1213|       |
 1214|      0|    log = ngx_array_push(conf->logs);
 1215|      0|    if (log == NULL) {
  ------------------
  |  Branch (1215:9): [True: 0, False: 0]
  ------------------
 1216|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1217|      0|    }
 1218|       |
 1219|      0|    ngx_memzero(log, sizeof(ngx_http_log_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1220|       |
 1221|      0|    log->file = ngx_conf_open_file(cf->cycle, &ngx_http_access_log);
 1222|      0|    if (log->file == NULL) {
  ------------------
  |  Branch (1222:9): [True: 0, False: 0]
  ------------------
 1223|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1224|      0|    }
 1225|       |
 1226|      0|    lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
  ------------------
  |  |   62|      0|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 1227|      0|    fmt = lmcf->formats.elts;
 1228|       |
 1229|       |    /* the default "combined" format */
 1230|      0|    log->format = &fmt[0];
 1231|      0|    lmcf->combined_used = 1;
 1232|       |
 1233|      0|    return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 1234|      0|}
ngx_http_log_module.c:ngx_http_log_set_log:
 1239|      1|{
 1240|      1|    ngx_http_log_loc_conf_t *llcf = conf;
 1241|       |
 1242|      1|    ssize_t                            size;
 1243|      1|    ngx_int_t                          gzip;
 1244|      1|    ngx_uint_t                         i, n;
 1245|      1|    ngx_msec_t                         flush;
 1246|      1|    ngx_str_t                         *value, name, s;
 1247|      1|    ngx_http_log_t                    *log;
 1248|      1|    ngx_syslog_peer_t                 *peer;
 1249|      1|    ngx_http_log_buf_t                *buffer;
 1250|      1|    ngx_http_log_fmt_t                *fmt;
 1251|      1|    ngx_http_log_main_conf_t          *lmcf;
 1252|      1|    ngx_http_script_compile_t          sc;
 1253|      1|    ngx_http_compile_complex_value_t   ccv;
 1254|       |
 1255|      1|    value = cf->args->elts;
 1256|       |
 1257|      1|    if (ngx_strcmp(value[1].data, "off") == 0) {
  ------------------
  |  |   57|      1|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (1257:9): [True: 1, False: 0]
  ------------------
 1258|      1|        llcf->off = 1;
 1259|      1|        if (cf->args->nelts == 2) {
  ------------------
  |  Branch (1259:13): [True: 1, False: 0]
  ------------------
 1260|      1|            return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 1261|      1|        }
 1262|       |
 1263|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1264|      0|                           "invalid parameter \"%V\"", &value[2]);
 1265|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1266|      1|    }
 1267|       |
 1268|      0|    if (llcf->logs == NULL) {
  ------------------
  |  Branch (1268:9): [True: 0, False: 0]
  ------------------
 1269|      0|        llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));
 1270|      0|        if (llcf->logs == NULL) {
  ------------------
  |  Branch (1270:13): [True: 0, False: 0]
  ------------------
 1271|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1272|      0|        }
 1273|      0|    }
 1274|       |
 1275|      0|    lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
  ------------------
  |  |   62|      0|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 1276|       |
 1277|      0|    log = ngx_array_push(llcf->logs);
 1278|      0|    if (log == NULL) {
  ------------------
  |  Branch (1278:9): [True: 0, False: 0]
  ------------------
 1279|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1280|      0|    }
 1281|       |
 1282|      0|    ngx_memzero(log, sizeof(ngx_http_log_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1283|       |
 1284|       |
 1285|      0|    if (ngx_strncmp(value[1].data, "syslog:", 7) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (1285:9): [True: 0, False: 0]
  ------------------
 1286|       |
 1287|      0|        peer = ngx_pcalloc(cf->pool, sizeof(ngx_syslog_peer_t));
 1288|      0|        if (peer == NULL) {
  ------------------
  |  Branch (1288:13): [True: 0, False: 0]
  ------------------
 1289|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1290|      0|        }
 1291|       |
 1292|      0|        if (ngx_syslog_process_conf(cf, peer) != NGX_CONF_OK) {
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (1292:13): [True: 0, False: 0]
  ------------------
 1293|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1294|      0|        }
 1295|       |
 1296|      0|        log->syslog_peer = peer;
 1297|       |
 1298|      0|        goto process_formats;
 1299|      0|    }
 1300|       |
 1301|      0|    n = ngx_http_script_variables_count(&value[1]);
 1302|       |
 1303|      0|    if (n == 0) {
  ------------------
  |  Branch (1303:9): [True: 0, False: 0]
  ------------------
 1304|      0|        log->file = ngx_conf_open_file(cf->cycle, &value[1]);
 1305|      0|        if (log->file == NULL) {
  ------------------
  |  Branch (1305:13): [True: 0, False: 0]
  ------------------
 1306|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1307|      0|        }
 1308|       |
 1309|      0|    } else {
 1310|      0|        if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1310:13): [True: 0, False: 0]
  ------------------
 1311|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1312|      0|        }
 1313|       |
 1314|      0|        log->script = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_script_t));
 1315|      0|        if (log->script == NULL) {
  ------------------
  |  Branch (1315:13): [True: 0, False: 0]
  ------------------
 1316|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1317|      0|        }
 1318|       |
 1319|      0|        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1320|       |
 1321|      0|        sc.cf = cf;
 1322|      0|        sc.source = &value[1];
 1323|      0|        sc.lengths = &log->script->lengths;
 1324|      0|        sc.values = &log->script->values;
 1325|      0|        sc.variables = n;
 1326|      0|        sc.complete_lengths = 1;
 1327|      0|        sc.complete_values = 1;
 1328|       |
 1329|      0|        if (ngx_http_script_compile(&sc) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1329:13): [True: 0, False: 0]
  ------------------
 1330|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1331|      0|        }
 1332|      0|    }
 1333|       |
 1334|      0|process_formats:
 1335|       |
 1336|      0|    if (cf->args->nelts >= 3) {
  ------------------
  |  Branch (1336:9): [True: 0, False: 0]
  ------------------
 1337|      0|        name = value[2];
 1338|       |
 1339|      0|        if (ngx_strcmp(name.data, "combined") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (1339:13): [True: 0, False: 0]
  ------------------
 1340|      0|            lmcf->combined_used = 1;
 1341|      0|        }
 1342|       |
 1343|      0|    } else {
 1344|      0|        ngx_str_set(&name, "combined");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 1345|      0|        lmcf->combined_used = 1;
 1346|      0|    }
 1347|       |
 1348|      0|    fmt = lmcf->formats.elts;
 1349|      0|    for (i = 0; i < lmcf->formats.nelts; i++) {
  ------------------
  |  Branch (1349:17): [True: 0, False: 0]
  ------------------
 1350|      0|        if (fmt[i].name.len == name.len
  ------------------
  |  Branch (1350:13): [True: 0, False: 0]
  ------------------
 1351|      0|            && ngx_strcasecmp(fmt[i].name.data, name.data) == 0)
  ------------------
  |  Branch (1351:16): [True: 0, False: 0]
  ------------------
 1352|      0|        {
 1353|      0|            log->format = &fmt[i];
 1354|      0|            break;
 1355|      0|        }
 1356|      0|    }
 1357|       |
 1358|      0|    if (log->format == NULL) {
  ------------------
  |  Branch (1358:9): [True: 0, False: 0]
  ------------------
 1359|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1360|      0|                           "unknown log format \"%V\"", &name);
 1361|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1362|      0|    }
 1363|       |
 1364|      0|    size = 0;
 1365|      0|    flush = 0;
 1366|      0|    gzip = 0;
 1367|       |
 1368|      0|    for (i = 3; i < cf->args->nelts; i++) {
  ------------------
  |  Branch (1368:17): [True: 0, False: 0]
  ------------------
 1369|       |
 1370|      0|        if (ngx_strncmp(value[i].data, "buffer=", 7) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (1370:13): [True: 0, False: 0]
  ------------------
 1371|      0|            s.len = value[i].len - 7;
 1372|      0|            s.data = value[i].data + 7;
 1373|       |
 1374|      0|            size = ngx_parse_size(&s);
 1375|       |
 1376|      0|            if (size == NGX_ERROR || size == 0) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1376:17): [True: 0, False: 0]
  |  Branch (1376:38): [True: 0, False: 0]
  ------------------
 1377|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1378|      0|                                   "invalid buffer size \"%V\"", &s);
 1379|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1380|      0|            }
 1381|       |
 1382|      0|            continue;
 1383|      0|        }
 1384|       |
 1385|      0|        if (ngx_strncmp(value[i].data, "flush=", 6) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (1385:13): [True: 0, False: 0]
  ------------------
 1386|      0|            s.len = value[i].len - 6;
 1387|      0|            s.data = value[i].data + 6;
 1388|       |
 1389|      0|            flush = ngx_parse_time(&s, 0);
 1390|       |
 1391|      0|            if (flush == (ngx_msec_t) NGX_ERROR || flush == 0) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1391:17): [True: 0, False: 0]
  |  Branch (1391:52): [True: 0, False: 0]
  ------------------
 1392|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1393|      0|                                   "invalid flush time \"%V\"", &s);
 1394|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1395|      0|            }
 1396|       |
 1397|      0|            continue;
 1398|      0|        }
 1399|       |
 1400|      0|        if (ngx_strncmp(value[i].data, "gzip", 4) == 0
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (1400:13): [True: 0, False: 0]
  ------------------
 1401|      0|            && (value[i].len == 4 || value[i].data[4] == '='))
  ------------------
  |  Branch (1401:17): [True: 0, False: 0]
  |  Branch (1401:38): [True: 0, False: 0]
  ------------------
 1402|      0|        {
 1403|      0|#if (NGX_ZLIB)
 1404|      0|            if (size == 0) {
  ------------------
  |  Branch (1404:17): [True: 0, False: 0]
  ------------------
 1405|      0|                size = 64 * 1024;
 1406|      0|            }
 1407|       |
 1408|      0|            if (value[i].len == 4) {
  ------------------
  |  Branch (1408:17): [True: 0, False: 0]
  ------------------
 1409|      0|                gzip = Z_BEST_SPEED;
 1410|      0|                continue;
 1411|      0|            }
 1412|       |
 1413|      0|            s.len = value[i].len - 5;
 1414|      0|            s.data = value[i].data + 5;
 1415|       |
 1416|      0|            gzip = ngx_atoi(s.data, s.len);
 1417|       |
 1418|      0|            if (gzip < 1 || gzip > 9) {
  ------------------
  |  Branch (1418:17): [True: 0, False: 0]
  |  Branch (1418:29): [True: 0, False: 0]
  ------------------
 1419|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1420|      0|                                   "invalid compression level \"%V\"", &s);
 1421|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1422|      0|            }
 1423|       |
 1424|      0|            continue;
 1425|       |
 1426|       |#else
 1427|       |            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
 1428|       |                               "nginx was built without zlib support");
 1429|       |            return NGX_CONF_ERROR;
 1430|       |#endif
 1431|      0|        }
 1432|       |
 1433|      0|        if (ngx_strncmp(value[i].data, "if=", 3) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (1433:13): [True: 0, False: 0]
  ------------------
 1434|      0|            s.len = value[i].len - 3;
 1435|      0|            s.data = value[i].data + 3;
 1436|       |
 1437|      0|            ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1438|       |
 1439|      0|            ccv.cf = cf;
 1440|      0|            ccv.value = &s;
 1441|      0|            ccv.complex_value = ngx_palloc(cf->pool,
 1442|      0|                                           sizeof(ngx_http_complex_value_t));
 1443|      0|            if (ccv.complex_value == NULL) {
  ------------------
  |  Branch (1443:17): [True: 0, False: 0]
  ------------------
 1444|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1445|      0|            }
 1446|       |
 1447|      0|            if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1447:17): [True: 0, False: 0]
  ------------------
 1448|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1449|      0|            }
 1450|       |
 1451|      0|            log->filter = ccv.complex_value;
 1452|       |
 1453|      0|            continue;
 1454|      0|        }
 1455|       |
 1456|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1457|      0|                           "invalid parameter \"%V\"", &value[i]);
 1458|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1459|      0|    }
 1460|       |
 1461|      0|    if (flush && size == 0) {
  ------------------
  |  Branch (1461:9): [True: 0, False: 0]
  |  Branch (1461:18): [True: 0, False: 0]
  ------------------
 1462|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1463|      0|                           "no buffer is defined for access_log \"%V\"",
 1464|      0|                           &value[1]);
 1465|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1466|      0|    }
 1467|       |
 1468|      0|    if (size) {
  ------------------
  |  Branch (1468:9): [True: 0, False: 0]
  ------------------
 1469|       |
 1470|      0|        if (log->script) {
  ------------------
  |  Branch (1470:13): [True: 0, False: 0]
  ------------------
 1471|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1472|      0|                               "buffered logs cannot have variables in name");
 1473|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1474|      0|        }
 1475|       |
 1476|      0|        if (log->syslog_peer) {
  ------------------
  |  Branch (1476:13): [True: 0, False: 0]
  ------------------
 1477|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1478|      0|                               "logs to syslog cannot be buffered");
 1479|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1480|      0|        }
 1481|       |
 1482|      0|        if (log->file->data) {
  ------------------
  |  Branch (1482:13): [True: 0, False: 0]
  ------------------
 1483|      0|            buffer = log->file->data;
 1484|       |
 1485|      0|            if (buffer->last - buffer->start != size
  ------------------
  |  Branch (1485:17): [True: 0, False: 0]
  ------------------
 1486|      0|                || buffer->flush != flush
  ------------------
  |  Branch (1486:20): [True: 0, False: 0]
  ------------------
 1487|      0|                || buffer->gzip != gzip)
  ------------------
  |  Branch (1487:20): [True: 0, False: 0]
  ------------------
 1488|      0|            {
 1489|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1490|      0|                                   "access_log \"%V\" already defined "
 1491|      0|                                   "with conflicting parameters",
 1492|      0|                                   &value[1]);
 1493|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1494|      0|            }
 1495|       |
 1496|      0|            return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 1497|      0|        }
 1498|       |
 1499|      0|        buffer = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_buf_t));
 1500|      0|        if (buffer == NULL) {
  ------------------
  |  Branch (1500:13): [True: 0, False: 0]
  ------------------
 1501|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1502|      0|        }
 1503|       |
 1504|      0|        buffer->start = ngx_pnalloc(cf->pool, size);
 1505|      0|        if (buffer->start == NULL) {
  ------------------
  |  Branch (1505:13): [True: 0, False: 0]
  ------------------
 1506|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1507|      0|        }
 1508|       |
 1509|      0|        buffer->pos = buffer->start;
 1510|      0|        buffer->last = buffer->start + size;
 1511|       |
 1512|      0|        if (flush) {
  ------------------
  |  Branch (1512:13): [True: 0, False: 0]
  ------------------
 1513|      0|            buffer->event = ngx_pcalloc(cf->pool, sizeof(ngx_event_t));
 1514|      0|            if (buffer->event == NULL) {
  ------------------
  |  Branch (1514:17): [True: 0, False: 0]
  ------------------
 1515|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1516|      0|            }
 1517|       |
 1518|      0|            buffer->event->data = log->file;
 1519|      0|            buffer->event->handler = ngx_http_log_flush_handler;
 1520|      0|            buffer->event->log = &cf->cycle->new_log;
 1521|      0|            buffer->event->cancelable = 1;
 1522|       |
 1523|      0|            buffer->flush = flush;
 1524|      0|        }
 1525|       |
 1526|      0|        buffer->gzip = gzip;
 1527|       |
 1528|      0|        log->file->flush = ngx_http_log_flush;
 1529|      0|        log->file->data = buffer;
 1530|      0|    }
 1531|       |
 1532|      0|    return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 1533|      0|}

ngx_http_map_module.c:ngx_http_map_create_conf:
  160|      1|{
  161|      1|    ngx_http_map_conf_t  *mcf;
  162|       |
  163|      1|    mcf = ngx_palloc(cf->pool, sizeof(ngx_http_map_conf_t));
  164|      1|    if (mcf == NULL) {
  ------------------
  |  Branch (164:9): [True: 0, False: 1]
  ------------------
  165|      0|        return NULL;
  166|      0|    }
  167|       |
  168|      1|    mcf->hash_max_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  169|      1|    mcf->hash_bucket_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  170|       |
  171|      1|    return mcf;
  172|      1|}
ngx_http_map_module.c:ngx_http_map_block:
  177|      2|{
  178|      2|    ngx_http_map_conf_t  *mcf = conf;
  179|       |
  180|      2|    char                              *rv;
  181|      2|    ngx_str_t                         *value, name;
  182|      2|    ngx_conf_t                         save;
  183|      2|    ngx_pool_t                        *pool;
  184|      2|    ngx_hash_init_t                    hash;
  185|      2|    ngx_http_map_ctx_t                *map;
  186|      2|    ngx_http_variable_t               *var;
  187|      2|    ngx_http_map_conf_ctx_t            ctx;
  188|      2|    ngx_http_compile_complex_value_t   ccv;
  189|       |
  190|      2|    if (mcf->hash_max_size == NGX_CONF_UNSET_UINT) {
  ------------------
  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  |  Branch (190:9): [True: 1, False: 1]
  ------------------
  191|      1|        mcf->hash_max_size = 2048;
  192|      1|    }
  193|       |
  194|      2|    if (mcf->hash_bucket_size == NGX_CONF_UNSET_UINT) {
  ------------------
  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  |  Branch (194:9): [True: 1, False: 1]
  ------------------
  195|      1|        mcf->hash_bucket_size = ngx_cacheline_size;
  196|       |
  197|      1|    } else {
  198|      1|        mcf->hash_bucket_size = ngx_align(mcf->hash_bucket_size,
  ------------------
  |  |  100|      1|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
  199|      1|                                          ngx_cacheline_size);
  200|      1|    }
  201|       |
  202|      2|    map = ngx_pcalloc(cf->pool, sizeof(ngx_http_map_ctx_t));
  203|      2|    if (map == NULL) {
  ------------------
  |  Branch (203:9): [True: 0, False: 2]
  ------------------
  204|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  205|      0|    }
  206|       |
  207|      2|    value = cf->args->elts;
  208|       |
  209|      2|    ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
  ------------------
  |  |   88|      2|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  210|       |
  211|      2|    ccv.cf = cf;
  212|      2|    ccv.value = &value[1];
  213|      2|    ccv.complex_value = &map->value;
  214|       |
  215|      2|    if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (215:9): [True: 0, False: 2]
  ------------------
  216|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  217|      0|    }
  218|       |
  219|      2|    name = value[2];
  220|       |
  221|      2|    if (name.data[0] != '$') {
  ------------------
  |  Branch (221:9): [True: 0, False: 2]
  ------------------
  222|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  223|      0|                           "invalid variable name \"%V\"", &name);
  224|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  225|      0|    }
  226|       |
  227|      2|    name.len--;
  228|      2|    name.data++;
  229|       |
  230|      2|    var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE);
  ------------------
  |  |   29|      2|#define NGX_HTTP_VAR_CHANGEABLE   1
  ------------------
  231|      2|    if (var == NULL) {
  ------------------
  |  Branch (231:9): [True: 0, False: 2]
  ------------------
  232|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  233|      0|    }
  234|       |
  235|      2|    var->get_handler = ngx_http_map_variable;
  236|      2|    var->data = (uintptr_t) map;
  237|       |
  238|      2|    pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, cf->log);
  ------------------
  |  |   22|      2|#define NGX_DEFAULT_POOL_SIZE    (16 * 1024)
  ------------------
  239|      2|    if (pool == NULL) {
  ------------------
  |  Branch (239:9): [True: 0, False: 2]
  ------------------
  240|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  241|      0|    }
  242|       |
  243|      2|    ctx.keys.pool = cf->pool;
  244|      2|    ctx.keys.temp_pool = pool;
  245|       |
  246|      2|    if (ngx_hash_keys_array_init(&ctx.keys, NGX_HASH_LARGE) != NGX_OK) {
  ------------------
  |  |   66|      2|#define NGX_HASH_LARGE            2
  ------------------
                  if (ngx_hash_keys_array_init(&ctx.keys, NGX_HASH_LARGE) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (246:9): [True: 0, False: 2]
  ------------------
  247|      0|        ngx_destroy_pool(pool);
  248|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  249|      0|    }
  250|       |
  251|      2|    ctx.values_hash = ngx_pcalloc(pool, sizeof(ngx_array_t) * ctx.keys.hsize);
  252|      2|    if (ctx.values_hash == NULL) {
  ------------------
  |  Branch (252:9): [True: 0, False: 2]
  ------------------
  253|      0|        ngx_destroy_pool(pool);
  254|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  255|      0|    }
  256|       |
  257|      2|#if (NGX_PCRE)
  258|      2|    if (ngx_array_init(&ctx.regexes, cf->pool, 2, sizeof(ngx_http_map_regex_t))
  ------------------
  |  Branch (258:9): [True: 0, False: 2]
  ------------------
  259|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  260|      0|    {
  261|      0|        ngx_destroy_pool(pool);
  262|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  263|      0|    }
  264|      2|#endif
  265|       |
  266|      2|    ctx.default_value = NULL;
  267|      2|    ctx.cf = &save;
  268|      2|    ctx.hostnames = 0;
  269|      2|    ctx.no_cacheable = 0;
  270|       |
  271|      2|    save = *cf;
  272|      2|    cf->pool = pool;
  273|      2|    cf->ctx = &ctx;
  274|      2|    cf->handler = ngx_http_map;
  275|      2|    cf->handler_conf = conf;
  276|       |
  277|      2|    rv = ngx_conf_parse(cf, NULL);
  278|       |
  279|      2|    *cf = save;
  280|       |
  281|      2|    if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (281:9): [True: 0, False: 2]
  ------------------
  282|      0|        ngx_destroy_pool(pool);
  283|      0|        return rv;
  284|      0|    }
  285|       |
  286|      2|    if (ctx.no_cacheable) {
  ------------------
  |  Branch (286:9): [True: 0, False: 2]
  ------------------
  287|      0|        var->flags |= NGX_HTTP_VAR_NOCACHEABLE;
  ------------------
  |  |   30|      0|#define NGX_HTTP_VAR_NOCACHEABLE  2
  ------------------
  288|      0|    }
  289|       |
  290|      2|    map->default_value = ctx.default_value ? ctx.default_value:
  ------------------
  |  Branch (290:26): [True: 2, False: 0]
  ------------------
  291|      2|                                             &ngx_http_variable_null_value;
  292|       |
  293|      2|    map->hostnames = ctx.hostnames;
  294|       |
  295|      2|    hash.key = ngx_hash_key_lc;
  296|      2|    hash.max_size = mcf->hash_max_size;
  297|      2|    hash.bucket_size = mcf->hash_bucket_size;
  298|      2|    hash.name = "map_hash";
  299|      2|    hash.pool = cf->pool;
  300|       |
  301|      2|    if (ctx.keys.keys.nelts) {
  ------------------
  |  Branch (301:9): [True: 1, False: 1]
  ------------------
  302|      1|        hash.hash = &map->map.hash.hash;
  303|      1|        hash.temp_pool = NULL;
  304|       |
  305|      1|        if (ngx_hash_init(&hash, ctx.keys.keys.elts, ctx.keys.keys.nelts)
  ------------------
  |  Branch (305:13): [True: 0, False: 1]
  ------------------
  306|      1|            != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  307|      0|        {
  308|      0|            ngx_destroy_pool(pool);
  309|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  310|      0|        }
  311|      1|    }
  312|       |
  313|      2|    if (ctx.keys.dns_wc_head.nelts) {
  ------------------
  |  Branch (313:9): [True: 0, False: 2]
  ------------------
  314|       |
  315|      0|        ngx_qsort(ctx.keys.dns_wc_head.elts,
  ------------------
  |  |  231|      0|#define ngx_qsort             qsort
  ------------------
  316|      0|                  (size_t) ctx.keys.dns_wc_head.nelts,
  317|      0|                  sizeof(ngx_hash_key_t), ngx_http_map_cmp_dns_wildcards);
  318|       |
  319|      0|        hash.hash = NULL;
  320|      0|        hash.temp_pool = pool;
  321|       |
  322|      0|        if (ngx_hash_wildcard_init(&hash, ctx.keys.dns_wc_head.elts,
  ------------------
  |  Branch (322:13): [True: 0, False: 0]
  ------------------
  323|      0|                                   ctx.keys.dns_wc_head.nelts)
  324|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  325|      0|        {
  326|      0|            ngx_destroy_pool(pool);
  327|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  328|      0|        }
  329|       |
  330|      0|        map->map.hash.wc_head = (ngx_hash_wildcard_t *) hash.hash;
  331|      0|    }
  332|       |
  333|      2|    if (ctx.keys.dns_wc_tail.nelts) {
  ------------------
  |  Branch (333:9): [True: 0, False: 2]
  ------------------
  334|       |
  335|      0|        ngx_qsort(ctx.keys.dns_wc_tail.elts,
  ------------------
  |  |  231|      0|#define ngx_qsort             qsort
  ------------------
  336|      0|                  (size_t) ctx.keys.dns_wc_tail.nelts,
  337|      0|                  sizeof(ngx_hash_key_t), ngx_http_map_cmp_dns_wildcards);
  338|       |
  339|      0|        hash.hash = NULL;
  340|      0|        hash.temp_pool = pool;
  341|       |
  342|      0|        if (ngx_hash_wildcard_init(&hash, ctx.keys.dns_wc_tail.elts,
  ------------------
  |  Branch (342:13): [True: 0, False: 0]
  ------------------
  343|      0|                                   ctx.keys.dns_wc_tail.nelts)
  344|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  345|      0|        {
  346|      0|            ngx_destroy_pool(pool);
  347|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  348|      0|        }
  349|       |
  350|      0|        map->map.hash.wc_tail = (ngx_hash_wildcard_t *) hash.hash;
  351|      0|    }
  352|       |
  353|      2|#if (NGX_PCRE)
  354|       |
  355|      2|    if (ctx.regexes.nelts) {
  ------------------
  |  Branch (355:9): [True: 0, False: 2]
  ------------------
  356|      0|        map->map.regex = ctx.regexes.elts;
  357|      0|        map->map.nregex = ctx.regexes.nelts;
  358|      0|    }
  359|       |
  360|      2|#endif
  361|       |
  362|      2|    ngx_destroy_pool(pool);
  363|       |
  364|      2|    return rv;
  365|      2|}
ngx_http_map_module.c:ngx_http_map_variable:
  110|     11|{
  111|     11|    ngx_http_map_ctx_t  *map = (ngx_http_map_ctx_t *) data;
  112|       |
  113|     11|    ngx_str_t                   val, str;
  114|     11|    ngx_http_complex_value_t   *cv;
  115|     11|    ngx_http_variable_value_t  *value;
  116|       |
  117|     11|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  118|     11|                   "http map started");
  119|       |
  120|     11|    if (ngx_http_complex_value(r, &map->value, &val) != NGX_OK) {
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  |  Branch (120:9): [True: 0, False: 11]
  ------------------
  121|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  122|      0|    }
  123|       |
  124|     11|    if (map->hostnames && val.len > 0 && val.data[val.len - 1] == '.') {
  ------------------
  |  Branch (124:9): [True: 0, False: 11]
  |  Branch (124:27): [True: 0, False: 0]
  |  Branch (124:42): [True: 0, False: 0]
  ------------------
  125|      0|        val.len--;
  126|      0|    }
  127|       |
  128|     11|    value = ngx_http_map_find(r, &map->map, &val);
  129|       |
  130|     11|    if (value == NULL) {
  ------------------
  |  Branch (130:9): [True: 11, False: 0]
  ------------------
  131|     11|        value = map->default_value;
  132|     11|    }
  133|       |
  134|     11|    if (!value->valid) {
  ------------------
  |  Branch (134:9): [True: 0, False: 11]
  ------------------
  135|      0|        cv = (ngx_http_complex_value_t *) value->data;
  136|       |
  137|      0|        if (ngx_http_complex_value(r, cv, &str) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (137:13): [True: 0, False: 0]
  ------------------
  138|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  139|      0|        }
  140|       |
  141|      0|        v->valid = 1;
  142|      0|        v->no_cacheable = 0;
  143|      0|        v->not_found = 0;
  144|      0|        v->len = str.len;
  145|      0|        v->data = str.data;
  146|       |
  147|     11|    } else {
  148|     11|        *v = *value;
  149|     11|    }
  150|       |
  151|     11|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  152|     11|                   "http map: \"%V\" \"%v\"", &val, v);
  153|       |
  154|     11|    return NGX_OK;
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  155|     11|}
ngx_http_map_module.c:ngx_http_map:
  382|      3|{
  383|      3|    u_char                            *data;
  384|      3|    size_t                             len;
  385|      3|    ngx_int_t                          rv;
  386|      3|    ngx_str_t                         *value, v;
  387|      3|    ngx_uint_t                         i, key;
  388|      3|    ngx_http_map_conf_ctx_t           *ctx;
  389|      3|    ngx_http_complex_value_t           cv, *cvp;
  390|      3|    ngx_http_variable_value_t         *var, **vp;
  391|      3|    ngx_http_compile_complex_value_t   ccv;
  392|       |
  393|      3|    ctx = cf->ctx;
  394|       |
  395|      3|    value = cf->args->elts;
  396|       |
  397|      3|    if (cf->args->nelts == 1
  ------------------
  |  Branch (397:9): [True: 0, False: 3]
  ------------------
  398|      3|        && ngx_strcmp(value[0].data, "hostnames") == 0)
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (398:12): [True: 0, False: 0]
  ------------------
  399|      0|    {
  400|      0|        ctx->hostnames = 1;
  401|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  402|      0|    }
  403|       |
  404|      3|    if (cf->args->nelts == 1
  ------------------
  |  Branch (404:9): [True: 0, False: 3]
  ------------------
  405|      3|        && ngx_strcmp(value[0].data, "volatile") == 0)
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (405:12): [True: 0, False: 0]
  ------------------
  406|      0|    {
  407|      0|        ctx->no_cacheable = 1;
  408|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  409|      0|    }
  410|       |
  411|      3|    if (cf->args->nelts != 2) {
  ------------------
  |  Branch (411:9): [True: 0, False: 3]
  ------------------
  412|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  413|      0|                           "invalid number of the map parameters");
  414|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  415|      0|    }
  416|       |
  417|      3|    if (ngx_strcmp(value[0].data, "include") == 0) {
  ------------------
  |  |   57|      3|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (417:9): [True: 0, False: 3]
  ------------------
  418|      0|        return ngx_conf_include(cf, dummy, conf);
  419|      0|    }
  420|       |
  421|      3|    key = 0;
  422|       |
  423|     29|    for (i = 0; i < value[1].len; i++) {
  ------------------
  |  Branch (423:17): [True: 26, False: 3]
  ------------------
  424|     26|        key = ngx_hash(key, value[1].data[i]);
  ------------------
  |  |  114|     26|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
  425|     26|    }
  426|       |
  427|      3|    key %= ctx->keys.hsize;
  428|       |
  429|      3|    vp = ctx->values_hash[key].elts;
  430|       |
  431|      3|    if (vp) {
  ------------------
  |  Branch (431:9): [True: 0, False: 3]
  ------------------
  432|      0|        for (i = 0; i < ctx->values_hash[key].nelts; i++) {
  ------------------
  |  Branch (432:21): [True: 0, False: 0]
  ------------------
  433|       |
  434|      0|            if (vp[i]->valid) {
  ------------------
  |  Branch (434:17): [True: 0, False: 0]
  ------------------
  435|      0|                data = vp[i]->data;
  436|      0|                len = vp[i]->len;
  437|       |
  438|      0|            } else {
  439|      0|                cvp = (ngx_http_complex_value_t *) vp[i]->data;
  440|      0|                data = cvp->value.data;
  441|      0|                len = cvp->value.len;
  442|      0|            }
  443|       |
  444|      0|            if (value[1].len != len) {
  ------------------
  |  Branch (444:17): [True: 0, False: 0]
  ------------------
  445|      0|                continue;
  446|      0|            }
  447|       |
  448|      0|            if (ngx_strncmp(value[1].data, data, len) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (448:17): [True: 0, False: 0]
  ------------------
  449|      0|                var = vp[i];
  450|      0|                goto found;
  451|      0|            }
  452|      0|        }
  453|       |
  454|      3|    } else {
  455|      3|        if (ngx_array_init(&ctx->values_hash[key], cf->pool, 4,
  ------------------
  |  Branch (455:13): [True: 0, False: 3]
  ------------------
  456|      3|                           sizeof(ngx_http_variable_value_t *))
  457|      3|            != NGX_OK)
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
  458|      0|        {
  459|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  460|      0|        }
  461|      3|    }
  462|       |
  463|      3|    var = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_variable_value_t));
  464|      3|    if (var == NULL) {
  ------------------
  |  Branch (464:9): [True: 0, False: 3]
  ------------------
  465|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  466|      0|    }
  467|       |
  468|      3|    v.len = value[1].len;
  469|      3|    v.data = ngx_pstrdup(ctx->keys.pool, &value[1]);
  470|      3|    if (v.data == NULL) {
  ------------------
  |  Branch (470:9): [True: 0, False: 3]
  ------------------
  471|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  472|      0|    }
  473|       |
  474|      3|    ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
  ------------------
  |  |   88|      3|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  475|       |
  476|      3|    ccv.cf = ctx->cf;
  477|      3|    ccv.value = &v;
  478|      3|    ccv.complex_value = &cv;
  479|       |
  480|      3|    if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
  |  Branch (480:9): [True: 0, False: 3]
  ------------------
  481|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  482|      0|    }
  483|       |
  484|      3|    if (cv.lengths != NULL) {
  ------------------
  |  Branch (484:9): [True: 0, False: 3]
  ------------------
  485|      0|        cvp = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_complex_value_t));
  486|      0|        if (cvp == NULL) {
  ------------------
  |  Branch (486:13): [True: 0, False: 0]
  ------------------
  487|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  488|      0|        }
  489|       |
  490|      0|        *cvp = cv;
  491|       |
  492|      0|        var->len = 0;
  493|      0|        var->data = (u_char *) cvp;
  494|      0|        var->valid = 0;
  495|       |
  496|      3|    } else {
  497|      3|        var->len = v.len;
  498|      3|        var->data = v.data;
  499|      3|        var->valid = 1;
  500|      3|    }
  501|       |
  502|      3|    var->no_cacheable = 0;
  503|      3|    var->not_found = 0;
  504|       |
  505|      3|    vp = ngx_array_push(&ctx->values_hash[key]);
  506|      3|    if (vp == NULL) {
  ------------------
  |  Branch (506:9): [True: 0, False: 3]
  ------------------
  507|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  508|      0|    }
  509|       |
  510|      3|    *vp = var;
  511|       |
  512|      3|found:
  513|       |
  514|      3|    if (ngx_strcmp(value[0].data, "default") == 0) {
  ------------------
  |  |   57|      3|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (514:9): [True: 2, False: 1]
  ------------------
  515|       |
  516|      2|        if (ctx->default_value) {
  ------------------
  |  Branch (516:13): [True: 0, False: 2]
  ------------------
  517|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  518|      0|                               "duplicate default map parameter");
  519|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  520|      0|        }
  521|       |
  522|      2|        ctx->default_value = var;
  523|       |
  524|      2|        return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  525|      2|    }
  526|       |
  527|      1|#if (NGX_PCRE)
  528|       |
  529|      1|    if (value[0].len && value[0].data[0] == '~') {
  ------------------
  |  Branch (529:9): [True: 0, False: 1]
  |  Branch (529:25): [True: 0, False: 0]
  ------------------
  530|      0|        ngx_regex_compile_t    rc;
  531|      0|        ngx_http_map_regex_t  *regex;
  532|      0|        u_char                 errstr[NGX_MAX_CONF_ERRSTR];
  533|       |
  534|      0|        regex = ngx_array_push(&ctx->regexes);
  535|      0|        if (regex == NULL) {
  ------------------
  |  Branch (535:13): [True: 0, False: 0]
  ------------------
  536|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  537|      0|        }
  538|       |
  539|      0|        value[0].len--;
  540|      0|        value[0].data++;
  541|       |
  542|      0|        ngx_memzero(&rc, sizeof(ngx_regex_compile_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  543|       |
  544|      0|        if (value[0].data[0] == '*') {
  ------------------
  |  Branch (544:13): [True: 0, False: 0]
  ------------------
  545|      0|            value[0].len--;
  546|      0|            value[0].data++;
  547|      0|            rc.options = NGX_REGEX_CASELESS;
  ------------------
  |  |   39|      0|#define NGX_REGEX_CASELESS     0x00000001
  ------------------
  548|      0|        }
  549|       |
  550|      0|        rc.pattern = value[0];
  551|      0|        rc.err.len = NGX_MAX_CONF_ERRSTR;
  ------------------
  |  |   74|      0|#define NGX_MAX_CONF_ERRSTR  1024
  ------------------
  552|      0|        rc.err.data = errstr;
  553|       |
  554|      0|        regex->regex = ngx_http_regex_compile(ctx->cf, &rc);
  555|      0|        if (regex->regex == NULL) {
  ------------------
  |  Branch (555:13): [True: 0, False: 0]
  ------------------
  556|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  557|      0|        }
  558|       |
  559|      0|        regex->value = var;
  560|       |
  561|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  562|      0|    }
  563|       |
  564|      1|#endif
  565|       |
  566|      1|    if (value[0].len && value[0].data[0] == '\\') {
  ------------------
  |  Branch (566:9): [True: 0, False: 1]
  |  Branch (566:25): [True: 0, False: 0]
  ------------------
  567|      0|        value[0].len--;
  568|      0|        value[0].data++;
  569|      0|    }
  570|       |
  571|      1|    rv = ngx_hash_add_key(&ctx->keys, &value[0], var,
  572|      1|                          (ctx->hostnames) ? NGX_HASH_WILDCARD_KEY : 0);
  ------------------
  |  |   71|      0|#define NGX_HASH_WILDCARD_KEY     1
  ------------------
  |  Branch (572:27): [True: 0, False: 1]
  ------------------
  573|       |
  574|      1|    if (rv == NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (574:9): [True: 1, False: 0]
  ------------------
  575|      1|        return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  576|      1|    }
  577|       |
  578|      0|    if (rv == NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (578:9): [True: 0, False: 0]
  ------------------
  579|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  580|      0|                           "invalid hostname or wildcard \"%V\"", &value[0]);
  581|      0|    }
  582|       |
  583|      0|    if (rv == NGX_BUSY) {
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  |  Branch (583:9): [True: 0, False: 0]
  ------------------
  584|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  585|      0|                           "conflicting parameter \"%V\"", &value[0]);
  586|      0|    }
  587|       |
  588|      0|    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  589|      1|}

ngx_http_memcached_module.c:ngx_http_memcached_create_loc_conf:
  592|      4|{
  593|      4|    ngx_http_memcached_loc_conf_t  *conf;
  594|       |
  595|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_memcached_loc_conf_t));
  596|      4|    if (conf == NULL) {
  ------------------
  |  Branch (596:9): [True: 0, False: 4]
  ------------------
  597|      0|        return NULL;
  598|      0|    }
  599|       |
  600|       |    /*
  601|       |     * set by ngx_pcalloc():
  602|       |     *
  603|       |     *     conf->upstream.bufs.num = 0;
  604|       |     *     conf->upstream.next_upstream = 0;
  605|       |     *     conf->upstream.temp_path = NULL;
  606|       |     */
  607|       |
  608|      4|    conf->upstream.local = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  609|      4|    conf->upstream.socket_keepalive = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  610|      4|    conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  611|      4|    conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
  612|      4|    conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
  613|      4|    conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
  614|      4|    conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
  615|       |
  616|      4|    conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  617|       |
  618|       |    /* the hardcoded values */
  619|      4|    conf->upstream.cyclic_temp_file = 0;
  620|      4|    conf->upstream.buffering = 0;
  621|      4|    conf->upstream.ignore_client_abort = 0;
  622|      4|    conf->upstream.send_lowat = 0;
  623|      4|    conf->upstream.bufs.num = 0;
  624|      4|    conf->upstream.busy_buffers_size = 0;
  625|      4|    conf->upstream.max_temp_file_size = 0;
  626|      4|    conf->upstream.temp_file_write_size = 0;
  627|      4|    conf->upstream.intercept_errors = 1;
  628|      4|    conf->upstream.intercept_404 = 1;
  629|      4|    conf->upstream.pass_request_headers = 0;
  630|      4|    conf->upstream.pass_request_body = 0;
  631|      4|    conf->upstream.force_ranges = 1;
  632|       |
  633|      4|    conf->index = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  634|      4|    conf->gzip_flag = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  635|       |
  636|      4|    return conf;
  637|      4|}
ngx_http_memcached_module.c:ngx_http_memcached_merge_loc_conf:
  642|      2|{
  643|      2|    ngx_http_memcached_loc_conf_t *prev = parent;
  644|      2|    ngx_http_memcached_loc_conf_t *conf = child;
  645|       |
  646|      2|    ngx_conf_merge_ptr_value(conf->upstream.local,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
  647|      2|                              prev->upstream.local, NULL);
  648|       |
  649|      2|    ngx_conf_merge_value(conf->upstream.socket_keepalive,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  650|      2|                              prev->upstream.socket_keepalive, 0);
  651|       |
  652|      2|    ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  653|      2|                              prev->upstream.next_upstream_tries, 0);
  654|       |
  655|      2|    ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
  656|      2|                              prev->upstream.connect_timeout, 60000);
  657|       |
  658|      2|    ngx_conf_merge_msec_value(conf->upstream.send_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
  659|      2|                              prev->upstream.send_timeout, 60000);
  660|       |
  661|      2|    ngx_conf_merge_msec_value(conf->upstream.read_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
  662|      2|                              prev->upstream.read_timeout, 60000);
  663|       |
  664|      2|    ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
  665|      2|                              prev->upstream.next_upstream_timeout, 0);
  666|       |
  667|      2|    ngx_conf_merge_size_value(conf->upstream.buffer_size,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
  668|      2|                              prev->upstream.buffer_size,
  669|      2|                              (size_t) ngx_pagesize);
  670|       |
  671|      2|    ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
  672|      2|                              prev->upstream.next_upstream,
  673|      2|                              (NGX_CONF_BITMASK_SET
  674|      2|                               |NGX_HTTP_UPSTREAM_FT_ERROR
  675|      2|                               |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
  676|       |
  677|      2|    if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (677:9): [True: 0, False: 2]
  ------------------
  678|      0|        conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      0|#define NGX_CONF_BITMASK_SET  1
  ------------------
  679|      0|                                       |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      0|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  680|      0|    }
  681|       |
  682|      2|    if (conf->upstream.upstream == NULL) {
  ------------------
  |  Branch (682:9): [True: 2, False: 0]
  ------------------
  683|      2|        conf->upstream.upstream = prev->upstream.upstream;
  684|      2|    }
  685|       |
  686|      2|    if (conf->index == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      2|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (686:9): [True: 2, False: 0]
  ------------------
  687|      2|        conf->index = prev->index;
  688|      2|    }
  689|       |
  690|      2|    ngx_conf_merge_uint_value(conf->gzip_flag, prev->gzip_flag, 0);
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  691|       |
  692|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  693|      2|}

ngx_http_mirror_module.c:ngx_http_mirror_init:
  250|      1|{
  251|      1|    ngx_http_handler_pt        *h;
  252|      1|    ngx_http_core_main_conf_t  *cmcf;
  253|       |
  254|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  255|       |
  256|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_PRECONTENT_PHASE].handlers);
  257|      1|    if (h == NULL) {
  ------------------
  |  Branch (257:9): [True: 0, False: 1]
  ------------------
  258|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  259|      0|    }
  260|       |
  261|      1|    *h = ngx_http_mirror_handler;
  262|       |
  263|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  264|      1|}
ngx_http_mirror_module.c:ngx_http_mirror_handler:
   87|     11|{
   88|     11|    ngx_int_t                    rc;
   89|     11|    ngx_http_mirror_ctx_t       *ctx;
   90|     11|    ngx_http_mirror_loc_conf_t  *mlcf;
   91|       |
   92|     11|    if (r != r->main) {
  ------------------
  |  Branch (92:9): [True: 0, False: 11]
  ------------------
   93|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
   94|      0|    }
   95|       |
   96|     11|    mlcf = ngx_http_get_module_loc_conf(r, ngx_http_mirror_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
   97|       |
   98|     11|    if (mlcf->mirror == NULL) {
  ------------------
  |  Branch (98:9): [True: 11, False: 0]
  ------------------
   99|     11|        return NGX_DECLINED;
  ------------------
  |  |   43|     11|#define  NGX_DECLINED   -5
  ------------------
  100|     11|    }
  101|       |
  102|      0|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "mirror handler");
  103|       |
  104|      0|    if (mlcf->request_body) {
  ------------------
  |  Branch (104:9): [True: 0, False: 0]
  ------------------
  105|      0|        ctx = ngx_http_get_module_ctx(r, ngx_http_mirror_module);
  ------------------
  |  |   80|      0|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
  106|       |
  107|      0|        if (ctx) {
  ------------------
  |  Branch (107:13): [True: 0, False: 0]
  ------------------
  108|      0|            return ctx->status;
  109|      0|        }
  110|       |
  111|      0|        ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_mirror_ctx_t));
  112|      0|        if (ctx == NULL) {
  ------------------
  |  Branch (112:13): [True: 0, False: 0]
  ------------------
  113|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  114|      0|        }
  115|       |
  116|      0|        ctx->status = NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  117|       |
  118|      0|        ngx_http_set_ctx(r, ctx, ngx_http_mirror_module);
  ------------------
  |  |   81|      0|#define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;
  ------------------
  119|       |
  120|      0|        rc = ngx_http_read_client_request_body(r, ngx_http_mirror_body_handler);
  121|      0|        if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
  ------------------
  |  |   84|      0|#define NGX_HTTP_SPECIAL_RESPONSE          300
  ------------------
  |  Branch (121:13): [True: 0, False: 0]
  ------------------
  122|      0|            return rc;
  123|      0|        }
  124|       |
  125|      0|        ngx_http_finalize_request(r, NGX_DONE);
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  126|      0|        return NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  127|      0|    }
  128|       |
  129|      0|    return ngx_http_mirror_handler_internal(r);
  130|      0|}
ngx_http_mirror_module.c:ngx_http_mirror_create_loc_conf:
  180|      4|{
  181|      4|    ngx_http_mirror_loc_conf_t  *mlcf;
  182|       |
  183|      4|    mlcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_mirror_loc_conf_t));
  184|      4|    if (mlcf == NULL) {
  ------------------
  |  Branch (184:9): [True: 0, False: 4]
  ------------------
  185|      0|        return NULL;
  186|      0|    }
  187|       |
  188|      4|    mlcf->mirror = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  189|      4|    mlcf->request_body = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  190|       |
  191|      4|    return mlcf;
  192|      4|}
ngx_http_mirror_module.c:ngx_http_mirror_merge_loc_conf:
  197|      2|{
  198|      2|    ngx_http_mirror_loc_conf_t *prev = parent;
  199|      2|    ngx_http_mirror_loc_conf_t *conf = child;
  200|       |
  201|      2|    ngx_conf_merge_ptr_value(conf->mirror, prev->mirror, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
  202|      2|    ngx_conf_merge_value(conf->request_body, prev->request_body, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  203|       |
  204|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  205|      2|}

ngx_http_not_modified_filter_module.c:ngx_http_not_modified_filter_init:
  261|      1|{
  262|      1|    ngx_http_next_header_filter = ngx_http_top_header_filter;
  263|      1|    ngx_http_top_header_filter = ngx_http_not_modified_header_filter;
  264|       |
  265|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  266|      1|}
ngx_http_not_modified_filter_module.c:ngx_http_not_modified_header_filter:
   56|      7|{
   57|      7|    if (r->headers_out.status != NGX_HTTP_OK
  ------------------
  |  |   78|     14|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (57:9): [True: 7, False: 0]
  ------------------
   58|      7|        || r != r->main
  ------------------
  |  Branch (58:12): [True: 0, False: 0]
  ------------------
   59|      7|        || r->disable_not_modified)
  ------------------
  |  Branch (59:12): [True: 0, False: 0]
  ------------------
   60|      7|    {
   61|      7|        return ngx_http_next_header_filter(r);
   62|      7|    }
   63|       |
   64|      0|    if (r->headers_in.if_unmodified_since
  ------------------
  |  Branch (64:9): [True: 0, False: 0]
  ------------------
   65|      0|        && !ngx_http_test_if_unmodified(r))
  ------------------
  |  Branch (65:12): [True: 0, False: 0]
  ------------------
   66|      0|    {
   67|      0|        return ngx_http_filter_finalize_request(r, NULL,
   68|      0|                                                NGX_HTTP_PRECONDITION_FAILED);
  ------------------
  |  |  100|      0|#define NGX_HTTP_PRECONDITION_FAILED       412
  ------------------
   69|      0|    }
   70|       |
   71|      0|    if (r->headers_in.if_match
  ------------------
  |  Branch (71:9): [True: 0, False: 0]
  ------------------
   72|      0|        && !ngx_http_test_if_match(r, r->headers_in.if_match, 0))
  ------------------
  |  Branch (72:12): [True: 0, False: 0]
  ------------------
   73|      0|    {
   74|      0|        return ngx_http_filter_finalize_request(r, NULL,
   75|      0|                                                NGX_HTTP_PRECONDITION_FAILED);
  ------------------
  |  |  100|      0|#define NGX_HTTP_PRECONDITION_FAILED       412
  ------------------
   76|      0|    }
   77|       |
   78|      0|    if (r->headers_in.if_modified_since || r->headers_in.if_none_match) {
  ------------------
  |  Branch (78:9): [True: 0, False: 0]
  |  Branch (78:44): [True: 0, False: 0]
  ------------------
   79|       |
   80|      0|        if (r->headers_in.if_modified_since
  ------------------
  |  Branch (80:13): [True: 0, False: 0]
  ------------------
   81|      0|            && ngx_http_test_if_modified(r))
  ------------------
  |  Branch (81:16): [True: 0, False: 0]
  ------------------
   82|      0|        {
   83|      0|            return ngx_http_next_header_filter(r);
   84|      0|        }
   85|       |
   86|      0|        if (r->headers_in.if_none_match
  ------------------
  |  Branch (86:13): [True: 0, False: 0]
  ------------------
   87|      0|            && !ngx_http_test_if_match(r, r->headers_in.if_none_match, 1))
  ------------------
  |  Branch (87:16): [True: 0, False: 0]
  ------------------
   88|      0|        {
   89|      0|            return ngx_http_next_header_filter(r);
   90|      0|        }
   91|       |
   92|       |        /* not modified */
   93|       |
   94|      0|        r->headers_out.status = NGX_HTTP_NOT_MODIFIED;
  ------------------
  |  |   88|      0|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
   95|      0|        r->headers_out.status_line.len = 0;
   96|      0|        r->headers_out.content_type.len = 0;
   97|      0|        ngx_http_clear_content_length(r);
  ------------------
  |  |  555|      0|    r->headers_out.content_length_n = -1;                                     \
  |  |  556|      0|    if (r->headers_out.content_length) {                                      \
  |  |  ------------------
  |  |  |  Branch (556:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  557|      0|        r->headers_out.content_length->hash = 0;                              \
  |  |  558|      0|        r->headers_out.content_length = NULL;                                 \
  |  |  559|      0|    }
  ------------------
   98|      0|        ngx_http_clear_accept_ranges(r);
  ------------------
  |  |  563|      0|    r->allow_ranges = 0;                                                      \
  |  |  564|      0|    if (r->headers_out.accept_ranges) {                                       \
  |  |  ------------------
  |  |  |  Branch (564:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  565|      0|        r->headers_out.accept_ranges->hash = 0;                               \
  |  |  566|      0|        r->headers_out.accept_ranges = NULL;                                  \
  |  |  567|      0|    }
  ------------------
   99|       |
  100|      0|        if (r->headers_out.content_encoding) {
  ------------------
  |  Branch (100:13): [True: 0, False: 0]
  ------------------
  101|      0|            r->headers_out.content_encoding->hash = 0;
  102|      0|            r->headers_out.content_encoding = NULL;
  103|      0|        }
  104|       |
  105|      0|        return ngx_http_next_header_filter(r);
  106|      0|    }
  107|       |
  108|      0|    return ngx_http_next_header_filter(r);
  109|      0|}

ngx_http_proxy_module.c:ngx_http_proxy_add_variables:
 3273|      1|{
 3274|      1|    ngx_http_variable_t  *var, *v;
 3275|       |
 3276|      6|    for (v = ngx_http_proxy_vars; v->name.len; v++) {
  ------------------
  |  Branch (3276:35): [True: 5, False: 1]
  ------------------
 3277|      5|        var = ngx_http_add_variable(cf, &v->name, v->flags);
 3278|      5|        if (var == NULL) {
  ------------------
  |  Branch (3278:13): [True: 0, False: 5]
  ------------------
 3279|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3280|      0|        }
 3281|       |
 3282|      5|        var->get_handler = v->get_handler;
 3283|      5|        var->data = v->data;
 3284|      5|    }
 3285|       |
 3286|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 3287|      1|}
ngx_http_proxy_module.c:ngx_http_proxy_internal_body_length_variable:
 2616|      5|{
 2617|      5|    ngx_http_proxy_ctx_t  *ctx;
 2618|       |
 2619|      5|    ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
  ------------------
  |  |   80|      5|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
 2620|       |
 2621|      5|    if (ctx == NULL || ctx->internal_body_length < 0) {
  ------------------
  |  Branch (2621:9): [True: 0, False: 5]
  |  Branch (2621:24): [True: 5, False: 0]
  ------------------
 2622|      5|        v->not_found = 1;
 2623|      5|        return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 2624|      5|    }
 2625|       |
 2626|      0|    v->valid = 1;
 2627|      0|    v->no_cacheable = 0;
 2628|      0|    v->not_found = 0;
 2629|       |
 2630|      0|    v->data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN);
  ------------------
  |  |  202|      0|#define NGX_OFF_T_LEN  (sizeof("-9223372036854775808") - 1)
  ------------------
 2631|       |
 2632|      0|    if (v->data == NULL) {
  ------------------
  |  Branch (2632:9): [True: 0, False: 0]
  ------------------
 2633|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2634|      0|    }
 2635|       |
 2636|      0|    v->len = ngx_sprintf(v->data, "%O", ctx->internal_body_length) - v->data;
 2637|       |
 2638|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2639|      0|}
ngx_http_proxy_module.c:ngx_http_proxy_internal_chunked_variable:
 2645|      5|{
 2646|      5|    ngx_http_proxy_ctx_t  *ctx;
 2647|       |
 2648|      5|    ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
  ------------------
  |  |   80|      5|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
 2649|       |
 2650|      5|    if (ctx == NULL || !ctx->internal_chunked) {
  ------------------
  |  Branch (2650:9): [True: 0, False: 5]
  |  Branch (2650:24): [True: 5, False: 0]
  ------------------
 2651|      5|        v->not_found = 1;
 2652|      5|        return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 2653|      5|    }
 2654|       |
 2655|      0|    v->valid = 1;
 2656|      0|    v->no_cacheable = 0;
 2657|      0|    v->not_found = 0;
 2658|       |
 2659|      0|    v->data = (u_char *) "chunked";
 2660|      0|    v->len = sizeof("chunked") - 1;
 2661|       |
 2662|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2663|      5|}
ngx_http_proxy_module.c:ngx_http_proxy_create_main_conf:
 3292|      1|{
 3293|      1|    ngx_http_proxy_main_conf_t  *conf;
 3294|       |
 3295|      1|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_main_conf_t));
 3296|      1|    if (conf == NULL) {
  ------------------
  |  Branch (3296:9): [True: 0, False: 1]
  ------------------
 3297|      0|        return NULL;
 3298|      0|    }
 3299|       |
 3300|      1|#if (NGX_HTTP_CACHE)
 3301|      1|    if (ngx_array_init(&conf->caches, cf->pool, 4,
  ------------------
  |  Branch (3301:9): [True: 0, False: 1]
  ------------------
 3302|      1|                       sizeof(ngx_http_file_cache_t *))
 3303|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 3304|      0|    {
 3305|      0|        return NULL;
 3306|      0|    }
 3307|      1|#endif
 3308|       |
 3309|      1|    return conf;
 3310|      1|}
ngx_http_proxy_module.c:ngx_http_proxy_create_loc_conf:
 3315|      4|{
 3316|      4|    ngx_http_proxy_loc_conf_t  *conf;
 3317|       |
 3318|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_loc_conf_t));
 3319|      4|    if (conf == NULL) {
  ------------------
  |  Branch (3319:9): [True: 0, False: 4]
  ------------------
 3320|      0|        return NULL;
 3321|      0|    }
 3322|       |
 3323|       |    /*
 3324|       |     * set by ngx_pcalloc():
 3325|       |     *
 3326|       |     *     conf->upstream.bufs.num = 0;
 3327|       |     *     conf->upstream.ignore_headers = 0;
 3328|       |     *     conf->upstream.next_upstream = 0;
 3329|       |     *     conf->upstream.cache_zone = NULL;
 3330|       |     *     conf->upstream.cache_use_stale = 0;
 3331|       |     *     conf->upstream.cache_methods = 0;
 3332|       |     *     conf->upstream.temp_path = NULL;
 3333|       |     *     conf->upstream.hide_headers_hash = { NULL, 0 };
 3334|       |     *     conf->upstream.store_lengths = NULL;
 3335|       |     *     conf->upstream.store_values = NULL;
 3336|       |     *
 3337|       |     *     conf->location = NULL;
 3338|       |     *     conf->url = { 0, NULL };
 3339|       |     *     conf->headers.lengths = NULL;
 3340|       |     *     conf->headers.values = NULL;
 3341|       |     *     conf->headers.hash = { NULL, 0 };
 3342|       |     *     conf->headers_cache.lengths = NULL;
 3343|       |     *     conf->headers_cache.values = NULL;
 3344|       |     *     conf->headers_cache.hash = { NULL, 0 };
 3345|       |     *     conf->body_lengths = NULL;
 3346|       |     *     conf->body_values = NULL;
 3347|       |     *     conf->body_source = { 0, NULL };
 3348|       |     *     conf->redirects = NULL;
 3349|       |     *     conf->ssl = 0;
 3350|       |     *     conf->ssl_protocols = 0;
 3351|       |     *     conf->ssl_ciphers = { 0, NULL };
 3352|       |     *     conf->ssl_trusted_certificate = { 0, NULL };
 3353|       |     *     conf->ssl_crl = { 0, NULL };
 3354|       |     */
 3355|       |
 3356|      4|    conf->upstream.store = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3357|      4|    conf->upstream.store_access = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3358|      4|    conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3359|      4|    conf->upstream.buffering = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3360|      4|    conf->upstream.request_buffering = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3361|      4|    conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3362|      4|    conf->upstream.force_ranges = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3363|       |
 3364|      4|    conf->upstream.local = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3365|      4|    conf->upstream.socket_keepalive = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3366|       |
 3367|      4|    conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3368|      4|    conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3369|      4|    conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3370|      4|    conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3371|       |
 3372|      4|    conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3373|      4|    conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3374|      4|    conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3375|       |
 3376|      4|    conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3377|      4|    conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3378|      4|    conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3379|       |
 3380|      4|    conf->upstream.pass_request_headers = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3381|      4|    conf->upstream.pass_request_body = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3382|       |
 3383|      4|#if (NGX_HTTP_CACHE)
 3384|      4|    conf->upstream.cache = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3385|      4|    conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3386|      4|    conf->upstream.cache_max_range_offset = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3387|      4|    conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3388|      4|    conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3389|      4|    conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3390|      4|    conf->upstream.cache_lock = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3391|      4|    conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3392|      4|    conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3393|      4|    conf->upstream.cache_revalidate = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3394|      4|    conf->upstream.cache_convert_head = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3395|      4|    conf->upstream.cache_background_update = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3396|      4|#endif
 3397|       |
 3398|      4|    conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3399|      4|    conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3400|       |
 3401|      4|    conf->upstream.intercept_errors = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3402|       |
 3403|       |#if (NGX_HTTP_SSL)
 3404|       |    conf->upstream.ssl_session_reuse = NGX_CONF_UNSET;
 3405|       |    conf->upstream.ssl_name = NGX_CONF_UNSET_PTR;
 3406|       |    conf->upstream.ssl_server_name = NGX_CONF_UNSET;
 3407|       |    conf->upstream.ssl_verify = NGX_CONF_UNSET;
 3408|       |    conf->upstream.ssl_certificate = NGX_CONF_UNSET_PTR;
 3409|       |    conf->upstream.ssl_certificate_key = NGX_CONF_UNSET_PTR;
 3410|       |    conf->upstream.ssl_passwords = NGX_CONF_UNSET_PTR;
 3411|       |    conf->ssl_verify_depth = NGX_CONF_UNSET_UINT;
 3412|       |    conf->ssl_conf_commands = NGX_CONF_UNSET_PTR;
 3413|       |#endif
 3414|       |
 3415|       |    /* "proxy_cyclic_temp_file" is disabled */
 3416|      4|    conf->upstream.cyclic_temp_file = 0;
 3417|       |
 3418|      4|    conf->upstream.change_buffering = 1;
 3419|       |
 3420|      4|    conf->headers_source = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3421|       |
 3422|      4|    conf->method = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3423|       |
 3424|      4|    conf->redirect = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3425|       |
 3426|      4|    conf->cookie_domains = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3427|      4|    conf->cookie_paths = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3428|      4|    conf->cookie_flags = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3429|       |
 3430|      4|    conf->http_version = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3431|       |
 3432|      4|    conf->headers_hash_max_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3433|      4|    conf->headers_hash_bucket_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3434|       |
 3435|      4|    ngx_str_set(&conf->upstream.module, "proxy");
  ------------------
  |  |   43|      4|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 3436|       |
 3437|      4|    return conf;
 3438|      4|}
ngx_http_proxy_module.c:ngx_http_proxy_merge_loc_conf:
 3443|      2|{
 3444|      2|    ngx_http_proxy_loc_conf_t *prev = parent;
 3445|      2|    ngx_http_proxy_loc_conf_t *conf = child;
 3446|       |
 3447|      2|    u_char                     *p;
 3448|      2|    size_t                      size;
 3449|      2|    ngx_int_t                   rc;
 3450|      2|    ngx_hash_init_t             hash;
 3451|      2|    ngx_http_core_loc_conf_t   *clcf;
 3452|      2|    ngx_http_proxy_rewrite_t   *pr;
 3453|      2|    ngx_http_script_compile_t   sc;
 3454|       |
 3455|      2|#if (NGX_HTTP_CACHE)
 3456|       |
 3457|      2|    if (conf->upstream.store > 0) {
  ------------------
  |  Branch (3457:9): [True: 0, False: 2]
  ------------------
 3458|      0|        conf->upstream.cache = 0;
 3459|      0|    }
 3460|       |
 3461|      2|    if (conf->upstream.cache > 0) {
  ------------------
  |  Branch (3461:9): [True: 0, False: 2]
  ------------------
 3462|      0|        conf->upstream.store = 0;
 3463|      0|    }
 3464|       |
 3465|      2|#endif
 3466|       |
 3467|      2|    if (conf->upstream.store == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      2|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (3467:9): [True: 2, False: 0]
  ------------------
 3468|      2|        ngx_conf_merge_value(conf->upstream.store,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3469|      2|                              prev->upstream.store, 0);
 3470|       |
 3471|      2|        conf->upstream.store_lengths = prev->upstream.store_lengths;
 3472|      2|        conf->upstream.store_values = prev->upstream.store_values;
 3473|      2|    }
 3474|       |
 3475|      2|    ngx_conf_merge_uint_value(conf->upstream.store_access,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3476|      2|                              prev->upstream.store_access, 0600);
 3477|       |
 3478|      2|    ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3479|      2|                              prev->upstream.next_upstream_tries, 0);
 3480|       |
 3481|      2|    ngx_conf_merge_value(conf->upstream.buffering,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 1, False: 1]
  |  |  ------------------
  |  |  207|      1|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      1|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 0, False: 1]
  |  |  ------------------
  |  |  208|      1|    }
  ------------------
 3482|      2|                              prev->upstream.buffering, 1);
 3483|       |
 3484|      2|    ngx_conf_merge_value(conf->upstream.request_buffering,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3485|      2|                              prev->upstream.request_buffering, 1);
 3486|       |
 3487|      2|    ngx_conf_merge_value(conf->upstream.ignore_client_abort,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3488|      2|                              prev->upstream.ignore_client_abort, 0);
 3489|       |
 3490|      2|    ngx_conf_merge_value(conf->upstream.force_ranges,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3491|      2|                              prev->upstream.force_ranges, 0);
 3492|       |
 3493|      2|    ngx_conf_merge_ptr_value(conf->upstream.local,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3494|      2|                              prev->upstream.local, NULL);
 3495|       |
 3496|      2|    ngx_conf_merge_value(conf->upstream.socket_keepalive,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3497|      2|                              prev->upstream.socket_keepalive, 0);
 3498|       |
 3499|      2|    ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3500|      2|                              prev->upstream.connect_timeout, 60000);
 3501|       |
 3502|      2|    ngx_conf_merge_msec_value(conf->upstream.send_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3503|      2|                              prev->upstream.send_timeout, 60000);
 3504|       |
 3505|      2|    ngx_conf_merge_msec_value(conf->upstream.read_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 1, False: 1]
  |  |  ------------------
  |  |  222|      1|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      1|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 0, False: 1]
  |  |  ------------------
  |  |  223|      1|    }
  ------------------
 3506|      2|                              prev->upstream.read_timeout, 60000);
 3507|       |
 3508|      2|    ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3509|      2|                              prev->upstream.next_upstream_timeout, 0);
 3510|       |
 3511|      2|    ngx_conf_merge_size_value(conf->upstream.send_lowat,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3512|      2|                              prev->upstream.send_lowat, 0);
 3513|       |
 3514|      2|    ngx_conf_merge_size_value(conf->upstream.buffer_size,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 0, False: 2]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3515|      2|                              prev->upstream.buffer_size,
 3516|      2|                              (size_t) ngx_pagesize);
 3517|       |
 3518|      2|    ngx_conf_merge_size_value(conf->upstream.limit_rate,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3519|      2|                              prev->upstream.limit_rate, 0);
 3520|       |
 3521|      2|    ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
  ------------------
  |  |  252|      2|    if (conf.num == 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  253|      2|        if (prev.num) {                                                      \
  |  |  ------------------
  |  |  |  Branch (253:13): [True: 2, False: 0]
  |  |  ------------------
  |  |  254|      2|            conf.num = prev.num;                                             \
  |  |  255|      2|            conf.size = prev.size;                                           \
  |  |  256|      2|        } else {                                                             \
  |  |  257|      0|            conf.num = default_num;                                          \
  |  |  258|      0|            conf.size = default_size;                                        \
  |  |  259|      0|        }                                                                    \
  |  |  260|      2|    }
  ------------------
 3522|      2|                              8, ngx_pagesize);
 3523|       |
 3524|      2|    if (conf->upstream.bufs.num < 2) {
  ------------------
  |  Branch (3524:9): [True: 0, False: 2]
  ------------------
 3525|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3526|      0|                           "there must be at least 2 \"proxy_buffers\"");
 3527|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3528|      0|    }
 3529|       |
 3530|       |
 3531|      2|    size = conf->upstream.buffer_size;
 3532|      2|    if (size < conf->upstream.bufs.size) {
  ------------------
  |  Branch (3532:9): [True: 0, False: 2]
  ------------------
 3533|      0|        size = conf->upstream.bufs.size;
 3534|      0|    }
 3535|       |
 3536|       |
 3537|      2|    ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 0, False: 2]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3538|      2|                              prev->upstream.busy_buffers_size_conf,
 3539|      2|                              NGX_CONF_UNSET_SIZE);
 3540|       |
 3541|      2|    if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (3541:9): [True: 0, False: 2]
  ------------------
 3542|      0|        conf->upstream.busy_buffers_size = 2 * size;
 3543|      2|    } else {
 3544|      2|        conf->upstream.busy_buffers_size =
 3545|      2|                                         conf->upstream.busy_buffers_size_conf;
 3546|      2|    }
 3547|       |
 3548|      2|    if (conf->upstream.busy_buffers_size < size) {
  ------------------
  |  Branch (3548:9): [True: 0, False: 2]
  ------------------
 3549|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3550|      0|             "\"proxy_busy_buffers_size\" must be equal to or greater than "
 3551|      0|             "the maximum of the value of \"proxy_buffer_size\" and "
 3552|      0|             "one of the \"proxy_buffers\"");
 3553|       |
 3554|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3555|      0|    }
 3556|       |
 3557|      2|    if (conf->upstream.busy_buffers_size
  ------------------
  |  Branch (3557:9): [True: 0, False: 2]
  ------------------
 3558|      2|        > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
 3559|      0|    {
 3560|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3561|      0|             "\"proxy_busy_buffers_size\" must be less than "
 3562|      0|             "the size of all \"proxy_buffers\" minus one buffer");
 3563|       |
 3564|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3565|      0|    }
 3566|       |
 3567|       |
 3568|      2|    ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3569|      2|                              prev->upstream.temp_file_write_size_conf,
 3570|      2|                              NGX_CONF_UNSET_SIZE);
 3571|       |
 3572|      2|    if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (3572:9): [True: 2, False: 0]
  ------------------
 3573|      2|        conf->upstream.temp_file_write_size = 2 * size;
 3574|      2|    } else {
 3575|      0|        conf->upstream.temp_file_write_size =
 3576|      0|                                      conf->upstream.temp_file_write_size_conf;
 3577|      0|    }
 3578|       |
 3579|      2|    if (conf->upstream.temp_file_write_size < size) {
  ------------------
  |  Branch (3579:9): [True: 0, False: 2]
  ------------------
 3580|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3581|      0|             "\"proxy_temp_file_write_size\" must be equal to or greater "
 3582|      0|             "than the maximum of the value of \"proxy_buffer_size\" and "
 3583|      0|             "one of the \"proxy_buffers\"");
 3584|       |
 3585|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3586|      0|    }
 3587|       |
 3588|      2|    ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 0, False: 2]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3589|      2|                              prev->upstream.max_temp_file_size_conf,
 3590|      2|                              NGX_CONF_UNSET_SIZE);
 3591|       |
 3592|      2|    if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (3592:9): [True: 0, False: 2]
  ------------------
 3593|      0|        conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
 3594|      2|    } else {
 3595|      2|        conf->upstream.max_temp_file_size =
 3596|      2|                                        conf->upstream.max_temp_file_size_conf;
 3597|      2|    }
 3598|       |
 3599|      2|    if (conf->upstream.max_temp_file_size != 0
  ------------------
  |  Branch (3599:9): [True: 0, False: 2]
  ------------------
 3600|      2|        && conf->upstream.max_temp_file_size < size)
  ------------------
  |  Branch (3600:12): [True: 0, False: 0]
  ------------------
 3601|      0|    {
 3602|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3603|      0|             "\"proxy_max_temp_file_size\" must be equal to zero to disable "
 3604|      0|             "temporary files usage or must be equal to or greater than "
 3605|      0|             "the maximum of the value of \"proxy_buffer_size\" and "
 3606|      0|             "one of the \"proxy_buffers\"");
 3607|       |
 3608|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3609|      0|    }
 3610|       |
 3611|       |
 3612|      2|    ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 3613|      2|                              prev->upstream.ignore_headers,
 3614|      2|                              NGX_CONF_BITMASK_SET);
 3615|       |
 3616|       |
 3617|      2|    ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 1, False: 1]
  |  |  ------------------
  |  |  264|      1|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 0, False: 1]
  |  |  ------------------
  |  |  265|      1|    }
  ------------------
 3618|      2|                              prev->upstream.next_upstream,
 3619|      2|                              (NGX_CONF_BITMASK_SET
 3620|      2|                               |NGX_HTTP_UPSTREAM_FT_ERROR
 3621|      2|                               |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
 3622|       |
 3623|      2|    if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (3623:9): [True: 2, False: 0]
  ------------------
 3624|      2|        conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      2|#define NGX_CONF_BITMASK_SET  1
  ------------------
 3625|      2|                                       |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
 3626|      2|    }
 3627|       |
 3628|      2|    if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
  ------------------
  |  Branch (3628:9): [True: 0, False: 2]
  ------------------
 3629|      2|                              prev->upstream.temp_path,
 3630|      2|                              &ngx_http_proxy_temp_path)
 3631|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 3632|      0|    {
 3633|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3634|      0|    }
 3635|       |
 3636|       |
 3637|      2|#if (NGX_HTTP_CACHE)
 3638|       |
 3639|      2|    if (conf->upstream.cache == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      2|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (3639:9): [True: 1, False: 1]
  ------------------
 3640|      1|        ngx_conf_merge_value(conf->upstream.cache,
  ------------------
  |  |  206|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  207|      1|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      1|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  208|      1|    }
  ------------------
 3641|      1|                              prev->upstream.cache, 0);
 3642|       |
 3643|      1|        conf->upstream.cache_zone = prev->upstream.cache_zone;
 3644|      1|        conf->upstream.cache_value = prev->upstream.cache_value;
 3645|      1|    }
 3646|       |
 3647|      2|    if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) {
  ------------------
  |  Branch (3647:9): [True: 0, False: 2]
  |  Branch (3647:38): [True: 0, False: 0]
  ------------------
 3648|      0|        ngx_shm_zone_t  *shm_zone;
 3649|       |
 3650|      0|        shm_zone = conf->upstream.cache_zone;
 3651|       |
 3652|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3653|      0|                           "\"proxy_cache\" zone \"%V\" is unknown",
 3654|      0|                           &shm_zone->shm.name);
 3655|       |
 3656|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3657|      0|    }
 3658|       |
 3659|      2|    ngx_conf_merge_uint_value(conf->upstream.cache_min_uses,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3660|      2|                              prev->upstream.cache_min_uses, 1);
 3661|       |
 3662|      2|    ngx_conf_merge_off_value(conf->upstream.cache_max_range_offset,
  ------------------
  |  |  236|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (236:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  237|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (237:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  238|      2|    }
  ------------------
 3663|      2|                              prev->upstream.cache_max_range_offset,
 3664|      2|                              NGX_MAX_OFF_T_VALUE);
 3665|       |
 3666|      2|    ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 3667|      2|                              prev->upstream.cache_use_stale,
 3668|      2|                              (NGX_CONF_BITMASK_SET
 3669|      2|                               |NGX_HTTP_UPSTREAM_FT_OFF));
 3670|       |
 3671|      2|    if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (3671:9): [True: 2, False: 0]
  ------------------
 3672|      2|        conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      2|#define NGX_CONF_BITMASK_SET  1
  ------------------
 3673|      2|                                         |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
 3674|      2|    }
 3675|       |
 3676|      2|    if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_ERROR) {
  ------------------
  |  |   20|      2|#define NGX_HTTP_UPSTREAM_FT_ERROR           0x00000002
  ------------------
  |  Branch (3676:9): [True: 0, False: 2]
  ------------------
 3677|      0|        conf->upstream.cache_use_stale |= NGX_HTTP_UPSTREAM_FT_NOLIVE;
  ------------------
  |  |   34|      0|#define NGX_HTTP_UPSTREAM_FT_NOLIVE          0x40000000
  ------------------
 3678|      0|    }
 3679|       |
 3680|      2|    if (conf->upstream.cache_methods == 0) {
  ------------------
  |  Branch (3680:9): [True: 2, False: 0]
  ------------------
 3681|      2|        conf->upstream.cache_methods = prev->upstream.cache_methods;
 3682|      2|    }
 3683|       |
 3684|      2|    conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
  ------------------
  |  |   30|      2|#define NGX_HTTP_GET                       0x00000002
  ------------------
                  conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
  ------------------
  |  |   31|      2|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
 3685|       |
 3686|      2|    ngx_conf_merge_ptr_value(conf->upstream.cache_bypass,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3687|      2|                             prev->upstream.cache_bypass, NULL);
 3688|       |
 3689|      2|    ngx_conf_merge_ptr_value(conf->upstream.no_cache,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3690|      2|                             prev->upstream.no_cache, NULL);
 3691|       |
 3692|      2|    ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3693|      2|                             prev->upstream.cache_valid, NULL);
 3694|       |
 3695|      2|    if (conf->cache_key.value.data == NULL) {
  ------------------
  |  Branch (3695:9): [True: 2, False: 0]
  ------------------
 3696|      2|        conf->cache_key = prev->cache_key;
 3697|      2|    }
 3698|       |
 3699|      2|    ngx_conf_merge_value(conf->upstream.cache_lock,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3700|      2|                              prev->upstream.cache_lock, 0);
 3701|       |
 3702|      2|    ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3703|      2|                              prev->upstream.cache_lock_timeout, 5000);
 3704|       |
 3705|      2|    ngx_conf_merge_msec_value(conf->upstream.cache_lock_age,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3706|      2|                              prev->upstream.cache_lock_age, 5000);
 3707|       |
 3708|      2|    ngx_conf_merge_value(conf->upstream.cache_revalidate,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3709|      2|                              prev->upstream.cache_revalidate, 0);
 3710|       |
 3711|      2|    ngx_conf_merge_value(conf->upstream.cache_convert_head,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3712|      2|                              prev->upstream.cache_convert_head, 1);
 3713|       |
 3714|      2|    ngx_conf_merge_value(conf->upstream.cache_background_update,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3715|      2|                              prev->upstream.cache_background_update, 0);
 3716|       |
 3717|      2|#endif
 3718|       |
 3719|      2|    ngx_conf_merge_value(conf->upstream.pass_request_headers,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3720|      2|                              prev->upstream.pass_request_headers, 1);
 3721|      2|    ngx_conf_merge_value(conf->upstream.pass_request_body,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3722|      2|                              prev->upstream.pass_request_body, 1);
 3723|       |
 3724|      2|    ngx_conf_merge_value(conf->upstream.intercept_errors,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3725|      2|                              prev->upstream.intercept_errors, 0);
 3726|       |
 3727|       |#if (NGX_HTTP_SSL)
 3728|       |
 3729|       |    if (ngx_http_proxy_merge_ssl(cf, conf, prev) != NGX_OK) {
 3730|       |        return NGX_CONF_ERROR;
 3731|       |    }
 3732|       |
 3733|       |    ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
 3734|       |                              prev->upstream.ssl_session_reuse, 1);
 3735|       |
 3736|       |    ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
 3737|       |                                 (NGX_CONF_BITMASK_SET
 3738|       |                                  |NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
 3739|       |                                  |NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
 3740|       |
 3741|       |    ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
 3742|       |                             "DEFAULT");
 3743|       |
 3744|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_name,
 3745|       |                              prev->upstream.ssl_name, NULL);
 3746|       |    ngx_conf_merge_value(conf->upstream.ssl_server_name,
 3747|       |                              prev->upstream.ssl_server_name, 0);
 3748|       |    ngx_conf_merge_value(conf->upstream.ssl_verify,
 3749|       |                              prev->upstream.ssl_verify, 0);
 3750|       |    ngx_conf_merge_uint_value(conf->ssl_verify_depth,
 3751|       |                              prev->ssl_verify_depth, 1);
 3752|       |    ngx_conf_merge_str_value(conf->ssl_trusted_certificate,
 3753|       |                              prev->ssl_trusted_certificate, "");
 3754|       |    ngx_conf_merge_str_value(conf->ssl_crl, prev->ssl_crl, "");
 3755|       |
 3756|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_certificate,
 3757|       |                              prev->upstream.ssl_certificate, NULL);
 3758|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_certificate_key,
 3759|       |                              prev->upstream.ssl_certificate_key, NULL);
 3760|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_passwords,
 3761|       |                              prev->upstream.ssl_passwords, NULL);
 3762|       |
 3763|       |    ngx_conf_merge_ptr_value(conf->ssl_conf_commands,
 3764|       |                              prev->ssl_conf_commands, NULL);
 3765|       |
 3766|       |    if (conf->ssl && ngx_http_proxy_set_ssl(cf, conf) != NGX_OK) {
 3767|       |        return NGX_CONF_ERROR;
 3768|       |    }
 3769|       |
 3770|       |#endif
 3771|       |
 3772|      2|    ngx_conf_merge_ptr_value(conf->method, prev->method, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3773|       |
 3774|      2|    ngx_conf_merge_value(conf->redirect, prev->redirect, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3775|       |
 3776|      2|    if (conf->redirect) {
  ------------------
  |  Branch (3776:9): [True: 2, False: 0]
  ------------------
 3777|       |
 3778|      2|        if (conf->redirects == NULL) {
  ------------------
  |  Branch (3778:13): [True: 2, False: 0]
  ------------------
 3779|      2|            conf->redirects = prev->redirects;
 3780|      2|        }
 3781|       |
 3782|      2|        if (conf->redirects == NULL && conf->url.data) {
  ------------------
  |  Branch (3782:13): [True: 2, False: 0]
  |  Branch (3782:40): [True: 0, False: 2]
  ------------------
 3783|       |
 3784|      0|            conf->redirects = ngx_array_create(cf->pool, 1,
 3785|      0|                                             sizeof(ngx_http_proxy_rewrite_t));
 3786|      0|            if (conf->redirects == NULL) {
  ------------------
  |  Branch (3786:17): [True: 0, False: 0]
  ------------------
 3787|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3788|      0|            }
 3789|       |
 3790|      0|            pr = ngx_array_push(conf->redirects);
 3791|      0|            if (pr == NULL) {
  ------------------
  |  Branch (3791:17): [True: 0, False: 0]
  ------------------
 3792|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3793|      0|            }
 3794|       |
 3795|      0|            ngx_memzero(&pr->pattern.complex,
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 3796|      0|                        sizeof(ngx_http_complex_value_t));
 3797|       |
 3798|      0|            ngx_memzero(&pr->replacement, sizeof(ngx_http_complex_value_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 3799|       |
 3800|      0|            pr->handler = ngx_http_proxy_rewrite_complex_handler;
 3801|       |
 3802|      0|            if (conf->vars.uri.len) {
  ------------------
  |  Branch (3802:17): [True: 0, False: 0]
  ------------------
 3803|      0|                pr->pattern.complex.value = conf->url;
 3804|      0|                pr->replacement.value = conf->location;
 3805|       |
 3806|      0|            } else {
 3807|      0|                pr->pattern.complex.value.len = conf->url.len
 3808|      0|                                                + sizeof("/") - 1;
 3809|       |
 3810|      0|                p = ngx_pnalloc(cf->pool, pr->pattern.complex.value.len);
 3811|      0|                if (p == NULL) {
  ------------------
  |  Branch (3811:21): [True: 0, False: 0]
  ------------------
 3812|      0|                    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3813|      0|                }
 3814|       |
 3815|      0|                pr->pattern.complex.value.data = p;
 3816|       |
 3817|      0|                p = ngx_cpymem(p, conf->url.data, conf->url.len);
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
 3818|      0|                *p = '/';
 3819|       |
 3820|      0|                ngx_str_set(&pr->replacement.value, "/");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 3821|      0|            }
 3822|      0|        }
 3823|      2|    }
 3824|       |
 3825|      2|    ngx_conf_merge_ptr_value(conf->cookie_domains, prev->cookie_domains, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3826|       |
 3827|      2|    ngx_conf_merge_ptr_value(conf->cookie_paths, prev->cookie_paths, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3828|       |
 3829|      2|    ngx_conf_merge_ptr_value(conf->cookie_flags, prev->cookie_flags, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3830|       |
 3831|      2|    ngx_conf_merge_uint_value(conf->http_version, prev->http_version,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 1, False: 1]
  |  |  ------------------
  |  |  217|      1|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 0, False: 1]
  |  |  ------------------
  |  |  218|      1|    }
  ------------------
 3832|      2|                              NGX_HTTP_VERSION_10);
 3833|       |
 3834|      2|    ngx_conf_merge_uint_value(conf->headers_hash_max_size,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3835|      2|                              prev->headers_hash_max_size, 512);
 3836|       |
 3837|      2|    ngx_conf_merge_uint_value(conf->headers_hash_bucket_size,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3838|      2|                              prev->headers_hash_bucket_size, 64);
 3839|       |
 3840|      2|    conf->headers_hash_bucket_size = ngx_align(conf->headers_hash_bucket_size,
  ------------------
  |  |  100|      2|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
 3841|      2|                                               ngx_cacheline_size);
 3842|       |
 3843|      2|    hash.max_size = conf->headers_hash_max_size;
 3844|      2|    hash.bucket_size = conf->headers_hash_bucket_size;
 3845|      2|    hash.name = "proxy_headers_hash";
 3846|       |
 3847|      2|    if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
  ------------------
  |  Branch (3847:9): [True: 0, False: 2]
  ------------------
 3848|      2|            &prev->upstream, ngx_http_proxy_hide_headers, &hash)
 3849|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 3850|      0|    {
 3851|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3852|      0|    }
 3853|       |
 3854|      2|    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
  ------------------
  |  |   66|      2|    ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index]
  ------------------
 3855|       |
 3856|      2|    if (clcf->noname
  ------------------
  |  Branch (3856:9): [True: 0, False: 2]
  ------------------
 3857|      2|        && conf->upstream.upstream == NULL && conf->proxy_lengths == NULL)
  ------------------
  |  Branch (3857:12): [True: 0, False: 0]
  |  Branch (3857:47): [True: 0, False: 0]
  ------------------
 3858|      0|    {
 3859|      0|        conf->upstream.upstream = prev->upstream.upstream;
 3860|      0|        conf->location = prev->location;
 3861|      0|        conf->vars = prev->vars;
 3862|       |
 3863|      0|        conf->proxy_lengths = prev->proxy_lengths;
 3864|      0|        conf->proxy_values = prev->proxy_values;
 3865|       |
 3866|       |#if (NGX_HTTP_SSL)
 3867|       |        conf->ssl = prev->ssl;
 3868|       |#endif
 3869|      0|    }
 3870|       |
 3871|      2|    if (clcf->lmt_excpt && clcf->handler == NULL
  ------------------
  |  Branch (3871:9): [True: 0, False: 2]
  |  Branch (3871:28): [True: 0, False: 0]
  ------------------
 3872|      2|        && (conf->upstream.upstream || conf->proxy_lengths))
  ------------------
  |  Branch (3872:13): [True: 0, False: 0]
  |  Branch (3872:40): [True: 0, False: 0]
  ------------------
 3873|      0|    {
 3874|      0|        clcf->handler = ngx_http_proxy_handler;
 3875|      0|    }
 3876|       |
 3877|      2|    if (conf->body_source.data == NULL) {
  ------------------
  |  Branch (3877:9): [True: 2, False: 0]
  ------------------
 3878|      2|        conf->body_flushes = prev->body_flushes;
 3879|      2|        conf->body_source = prev->body_source;
 3880|      2|        conf->body_lengths = prev->body_lengths;
 3881|      2|        conf->body_values = prev->body_values;
 3882|      2|    }
 3883|       |
 3884|      2|    if (conf->body_source.data && conf->body_lengths == NULL) {
  ------------------
  |  Branch (3884:9): [True: 0, False: 2]
  |  Branch (3884:35): [True: 0, False: 0]
  ------------------
 3885|       |
 3886|      0|        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 3887|       |
 3888|      0|        sc.cf = cf;
 3889|      0|        sc.source = &conf->body_source;
 3890|      0|        sc.flushes = &conf->body_flushes;
 3891|      0|        sc.lengths = &conf->body_lengths;
 3892|      0|        sc.values = &conf->body_values;
 3893|      0|        sc.complete_lengths = 1;
 3894|      0|        sc.complete_values = 1;
 3895|       |
 3896|      0|        if (ngx_http_script_compile(&sc) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3896:13): [True: 0, False: 0]
  ------------------
 3897|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3898|      0|        }
 3899|      0|    }
 3900|       |
 3901|      2|    ngx_conf_merge_ptr_value(conf->headers_source, prev->headers_source, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 0, False: 2]
  |  |  ------------------
  |  |  212|      0|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      0|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  213|      0|    }
  ------------------
 3902|       |
 3903|      2|    if (conf->headers_source == prev->headers_source) {
  ------------------
  |  Branch (3903:9): [True: 0, False: 2]
  ------------------
 3904|      0|        conf->headers = prev->headers;
 3905|      0|#if (NGX_HTTP_CACHE)
 3906|      0|        conf->headers_cache = prev->headers_cache;
 3907|      0|#endif
 3908|      0|    }
 3909|       |
 3910|      2|    rc = ngx_http_proxy_init_headers(cf, conf, &conf->headers,
 3911|      2|                                     ngx_http_proxy_headers);
 3912|      2|    if (rc != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (3912:9): [True: 0, False: 2]
  ------------------
 3913|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3914|      0|    }
 3915|       |
 3916|      2|#if (NGX_HTTP_CACHE)
 3917|       |
 3918|      2|    if (conf->upstream.cache) {
  ------------------
  |  Branch (3918:9): [True: 0, False: 2]
  ------------------
 3919|      0|        rc = ngx_http_proxy_init_headers(cf, conf, &conf->headers_cache,
 3920|      0|                                         ngx_http_proxy_cache_headers);
 3921|      0|        if (rc != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3921:13): [True: 0, False: 0]
  ------------------
 3922|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3923|      0|        }
 3924|      0|    }
 3925|       |
 3926|      2|#endif
 3927|       |
 3928|       |    /*
 3929|       |     * special handling to preserve conf->headers in the "http" section
 3930|       |     * to inherit it to all servers
 3931|       |     */
 3932|       |
 3933|      2|    if (prev->headers.hash.buckets == NULL
  ------------------
  |  Branch (3933:9): [True: 1, False: 1]
  ------------------
 3934|      2|        && conf->headers_source == prev->headers_source)
  ------------------
  |  Branch (3934:12): [True: 0, False: 1]
  ------------------
 3935|      0|    {
 3936|      0|        prev->headers = conf->headers;
 3937|      0|#if (NGX_HTTP_CACHE)
 3938|      0|        prev->headers_cache = conf->headers_cache;
 3939|      0|#endif
 3940|      0|    }
 3941|       |
 3942|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 3943|      2|}
ngx_http_proxy_module.c:ngx_http_proxy_handler:
  936|     11|{
  937|     11|    ngx_int_t                    rc;
  938|     11|    ngx_http_upstream_t         *u;
  939|     11|    ngx_http_proxy_ctx_t        *ctx;
  940|     11|    ngx_http_proxy_loc_conf_t   *plcf;
  941|     11|#if (NGX_HTTP_CACHE)
  942|     11|    ngx_http_proxy_main_conf_t  *pmcf;
  943|     11|#endif
  944|       |
  945|     11|    if (ngx_http_upstream_create(r) != NGX_OK) {
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  |  Branch (945:9): [True: 0, False: 11]
  ------------------
  946|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  947|      0|    }
  948|       |
  949|     11|    ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_proxy_ctx_t));
  950|     11|    if (ctx == NULL) {
  ------------------
  |  Branch (950:9): [True: 0, False: 11]
  ------------------
  951|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  952|      0|    }
  953|       |
  954|     11|    ngx_http_set_ctx(r, ctx, ngx_http_proxy_module);
  ------------------
  |  |   81|     11|#define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;
  ------------------
  955|       |
  956|     11|    plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  957|       |
  958|     11|    u = r->upstream;
  959|       |
  960|     11|    if (plcf->proxy_lengths == NULL) {
  ------------------
  |  Branch (960:9): [True: 0, False: 11]
  ------------------
  961|      0|        ctx->vars = plcf->vars;
  962|      0|        u->schema = plcf->vars.schema;
  963|       |#if (NGX_HTTP_SSL)
  964|       |        u->ssl = plcf->ssl;
  965|       |#endif
  966|       |
  967|     11|    } else {
  968|     11|        if (ngx_http_proxy_eval(r, ctx, plcf) != NGX_OK) {
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  |  Branch (968:13): [True: 0, False: 11]
  ------------------
  969|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  970|      0|        }
  971|     11|    }
  972|       |
  973|     11|    u->output.tag = (ngx_buf_tag_t) &ngx_http_proxy_module;
  974|       |
  975|     11|    u->conf = &plcf->upstream;
  976|       |
  977|     11|#if (NGX_HTTP_CACHE)
  978|     11|    pmcf = ngx_http_get_module_main_conf(r, ngx_http_proxy_module);
  ------------------
  |  |   56|     11|    (r)->main_conf[module.ctx_index]
  ------------------
  979|       |
  980|     11|    u->caches = &pmcf->caches;
  981|     11|    u->create_key = ngx_http_proxy_create_key;
  982|     11|#endif
  983|       |
  984|     11|    u->create_request = ngx_http_proxy_create_request;
  985|     11|    u->reinit_request = ngx_http_proxy_reinit_request;
  986|     11|    u->process_header = ngx_http_proxy_process_status_line;
  987|     11|    u->abort_request = ngx_http_proxy_abort_request;
  988|     11|    u->finalize_request = ngx_http_proxy_finalize_request;
  989|     11|    r->state = 0;
  990|       |
  991|     11|    if (plcf->redirects) {
  ------------------
  |  Branch (991:9): [True: 0, False: 11]
  ------------------
  992|      0|        u->rewrite_redirect = ngx_http_proxy_rewrite_redirect;
  993|      0|    }
  994|       |
  995|     11|    if (plcf->cookie_domains || plcf->cookie_paths || plcf->cookie_flags) {
  ------------------
  |  Branch (995:9): [True: 0, False: 11]
  |  Branch (995:33): [True: 0, False: 11]
  |  Branch (995:55): [True: 0, False: 11]
  ------------------
  996|      0|        u->rewrite_cookie = ngx_http_proxy_rewrite_cookie;
  997|      0|    }
  998|       |
  999|     11|    u->buffering = plcf->upstream.buffering;
 1000|       |
 1001|     11|    u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t));
 1002|     11|    if (u->pipe == NULL) {
  ------------------
  |  Branch (1002:9): [True: 0, False: 11]
  ------------------
 1003|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1004|      0|    }
 1005|       |
 1006|     11|    u->pipe->input_filter = ngx_http_proxy_copy_filter;
 1007|     11|    u->pipe->input_ctx = r;
 1008|       |
 1009|     11|    u->input_filter_init = ngx_http_proxy_input_filter_init;
 1010|     11|    u->input_filter = ngx_http_proxy_non_buffered_copy_filter;
 1011|     11|    u->input_filter_ctx = r;
 1012|       |
 1013|     11|    u->accel = 1;
 1014|       |
 1015|     11|    if (!plcf->upstream.request_buffering
  ------------------
  |  Branch (1015:9): [True: 0, False: 11]
  ------------------
 1016|     11|        && plcf->body_values == NULL && plcf->upstream.pass_request_body
  ------------------
  |  Branch (1016:12): [True: 0, False: 0]
  |  Branch (1016:41): [True: 0, False: 0]
  ------------------
 1017|     11|        && (!r->headers_in.chunked
  ------------------
  |  Branch (1017:13): [True: 0, False: 0]
  ------------------
 1018|      0|            || plcf->http_version == NGX_HTTP_VERSION_11))
  ------------------
  |  |   25|      0|#define NGX_HTTP_VERSION_11                1001
  ------------------
  |  Branch (1018:16): [True: 0, False: 0]
  ------------------
 1019|      0|    {
 1020|      0|        r->request_body_no_buffering = 1;
 1021|      0|    }
 1022|       |
 1023|     11|    rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init);
 1024|       |
 1025|     11|    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
  ------------------
  |  |   84|     11|#define NGX_HTTP_SPECIAL_RESPONSE          300
  ------------------
  |  Branch (1025:9): [True: 6, False: 5]
  ------------------
 1026|      6|        return rc;
 1027|      6|    }
 1028|       |
 1029|      5|    return NGX_DONE;
  ------------------
  |  |   42|      5|#define  NGX_DONE       -4
  ------------------
 1030|     11|}
ngx_http_proxy_module.c:ngx_http_proxy_eval:
 1036|     11|{
 1037|     11|    u_char               *p;
 1038|     11|    size_t                add;
 1039|     11|    u_short               port;
 1040|     11|    ngx_str_t             proxy;
 1041|     11|    ngx_url_t             url;
 1042|     11|    ngx_http_upstream_t  *u;
 1043|       |
 1044|     11|    if (ngx_http_script_run(r, &proxy, plcf->proxy_lengths->elts, 0,
  ------------------
  |  Branch (1044:9): [True: 0, False: 11]
  ------------------
 1045|     11|                            plcf->proxy_values->elts)
 1046|     11|        == NULL)
 1047|      0|    {
 1048|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1049|      0|    }
 1050|       |
 1051|     11|    if (proxy.len > 7
  ------------------
  |  Branch (1051:9): [True: 11, False: 0]
  ------------------
 1052|     11|        && ngx_strncasecmp(proxy.data, (u_char *) "http://", 7) == 0)
  ------------------
  |  Branch (1052:12): [True: 11, False: 0]
  ------------------
 1053|     11|    {
 1054|     11|        add = 7;
 1055|     11|        port = 80;
 1056|       |
 1057|       |#if (NGX_HTTP_SSL)
 1058|       |
 1059|       |    } else if (proxy.len > 8
 1060|       |               && ngx_strncasecmp(proxy.data, (u_char *) "https://", 8) == 0)
 1061|       |    {
 1062|       |        add = 8;
 1063|       |        port = 443;
 1064|       |        r->upstream->ssl = 1;
 1065|       |
 1066|       |#endif
 1067|       |
 1068|     11|    } else {
 1069|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1070|      0|                      "invalid URL prefix in \"%V\"", &proxy);
 1071|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1072|      0|    }
 1073|       |
 1074|     11|    u = r->upstream;
 1075|       |
 1076|     11|    u->schema.len = add;
 1077|     11|    u->schema.data = proxy.data;
 1078|       |
 1079|     11|    ngx_memzero(&url, sizeof(ngx_url_t));
  ------------------
  |  |   88|     11|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1080|       |
 1081|     11|    url.url.len = proxy.len - add;
 1082|     11|    url.url.data = proxy.data + add;
 1083|     11|    url.default_port = port;
 1084|     11|    url.uri_part = 1;
 1085|     11|    url.no_resolve = 1;
 1086|       |
 1087|     11|    if (ngx_parse_url(r->pool, &url) != NGX_OK) {
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  |  Branch (1087:9): [True: 0, False: 11]
  ------------------
 1088|      0|        if (url.err) {
  ------------------
  |  Branch (1088:13): [True: 0, False: 0]
  ------------------
 1089|      0|            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1090|      0|                          "%s in upstream \"%V\"", url.err, &url.url);
 1091|      0|        }
 1092|       |
 1093|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1094|      0|    }
 1095|       |
 1096|     11|    if (url.uri.len) {
  ------------------
  |  Branch (1096:9): [True: 0, False: 11]
  ------------------
 1097|      0|        if (url.uri.data[0] == '?') {
  ------------------
  |  Branch (1097:13): [True: 0, False: 0]
  ------------------
 1098|      0|            p = ngx_pnalloc(r->pool, url.uri.len + 1);
 1099|      0|            if (p == NULL) {
  ------------------
  |  Branch (1099:17): [True: 0, False: 0]
  ------------------
 1100|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1101|      0|            }
 1102|       |
 1103|      0|            *p++ = '/';
 1104|      0|            ngx_memcpy(p, url.uri.data, url.uri.len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1105|       |
 1106|      0|            url.uri.len++;
 1107|      0|            url.uri.data = p - 1;
 1108|      0|        }
 1109|      0|    }
 1110|       |
 1111|     11|    ctx->vars.key_start = u->schema;
 1112|       |
 1113|     11|    ngx_http_proxy_set_vars(&url, &ctx->vars);
 1114|       |
 1115|     11|    u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t));
 1116|     11|    if (u->resolved == NULL) {
  ------------------
  |  Branch (1116:9): [True: 0, False: 11]
  ------------------
 1117|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1118|      0|    }
 1119|       |
 1120|     11|    if (url.addrs) {
  ------------------
  |  Branch (1120:9): [True: 0, False: 11]
  ------------------
 1121|      0|        u->resolved->sockaddr = url.addrs[0].sockaddr;
 1122|      0|        u->resolved->socklen = url.addrs[0].socklen;
 1123|      0|        u->resolved->name = url.addrs[0].name;
 1124|      0|        u->resolved->naddrs = 1;
 1125|      0|    }
 1126|       |
 1127|     11|    u->resolved->host = url.host;
 1128|     11|    u->resolved->port = (in_port_t) (url.no_port ? port : url.port);
  ------------------
  |  Branch (1128:38): [True: 11, False: 0]
  ------------------
 1129|     11|    u->resolved->no_port = url.no_port;
 1130|       |
 1131|     11|    return NGX_OK;
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
 1132|     11|}
ngx_http_proxy_module.c:ngx_http_proxy_set_vars:
 5084|     11|{
 5085|     11|    if (u->family != AF_UNIX) {
  ------------------
  |  Branch (5085:9): [True: 11, False: 0]
  ------------------
 5086|       |
 5087|     11|        if (u->no_port || u->port == u->default_port) {
  ------------------
  |  Branch (5087:13): [True: 11, False: 0]
  |  Branch (5087:27): [True: 0, False: 0]
  ------------------
 5088|       |
 5089|     11|            v->host_header = u->host;
 5090|       |
 5091|     11|            if (u->default_port == 80) {
  ------------------
  |  Branch (5091:17): [True: 11, False: 0]
  ------------------
 5092|     11|                ngx_str_set(&v->port, "80");
  ------------------
  |  |   43|     11|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 5093|       |
 5094|     11|            } else {
 5095|      0|                ngx_str_set(&v->port, "443");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 5096|      0|            }
 5097|       |
 5098|     11|        } else {
 5099|      0|            v->host_header.len = u->host.len + 1 + u->port_text.len;
 5100|      0|            v->host_header.data = u->host.data;
 5101|      0|            v->port = u->port_text;
 5102|      0|        }
 5103|       |
 5104|     11|        v->key_start.len += v->host_header.len;
 5105|       |
 5106|     11|    } else {
 5107|      0|        ngx_str_set(&v->host_header, "localhost");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 5108|      0|        ngx_str_null(&v->port);
  ------------------
  |  |   44|      0|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
 5109|      0|        v->key_start.len += sizeof("unix:") - 1 + u->host.len + 1;
 5110|      0|    }
 5111|       |
 5112|     11|    v->uri = u->uri;
 5113|     11|}
ngx_http_proxy_module.c:ngx_http_proxy_create_request:
 1237|      5|{
 1238|      5|    size_t                        len, uri_len, loc_len, body_len,
 1239|      5|                                  key_len, val_len;
 1240|      5|    uintptr_t                     escape;
 1241|      5|    ngx_buf_t                    *b;
 1242|      5|    ngx_str_t                     method;
 1243|      5|    ngx_uint_t                    i, unparsed_uri;
 1244|      5|    ngx_chain_t                  *cl, *body;
 1245|      5|    ngx_list_part_t              *part;
 1246|      5|    ngx_table_elt_t              *header;
 1247|      5|    ngx_http_upstream_t          *u;
 1248|      5|    ngx_http_proxy_ctx_t         *ctx;
 1249|      5|    ngx_http_script_code_pt       code;
 1250|      5|    ngx_http_proxy_headers_t     *headers;
 1251|      5|    ngx_http_script_engine_t      e, le;
 1252|      5|    ngx_http_proxy_loc_conf_t    *plcf;
 1253|      5|    ngx_http_script_len_code_pt   lcode;
 1254|       |
 1255|      5|    u = r->upstream;
 1256|       |
 1257|      5|    plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
  ------------------
  |  |   58|      5|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 1258|       |
 1259|      5|#if (NGX_HTTP_CACHE)
 1260|      5|    headers = u->cacheable ? &plcf->headers_cache : &plcf->headers;
  ------------------
  |  Branch (1260:15): [True: 0, False: 5]
  ------------------
 1261|       |#else
 1262|       |    headers = &plcf->headers;
 1263|       |#endif
 1264|       |
 1265|      5|    if (u->method.len) {
  ------------------
  |  Branch (1265:9): [True: 0, False: 5]
  ------------------
 1266|       |        /* HEAD was changed to GET to cache response */
 1267|      0|        method = u->method;
 1268|       |
 1269|      5|    } else if (plcf->method) {
  ------------------
  |  Branch (1269:16): [True: 0, False: 5]
  ------------------
 1270|      0|        if (ngx_http_complex_value(r, plcf->method, &method) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1270:13): [True: 0, False: 0]
  ------------------
 1271|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1272|      0|        }
 1273|       |
 1274|      5|    } else {
 1275|      5|        method = r->method_name;
 1276|      5|    }
 1277|       |
 1278|      5|    ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
  ------------------
  |  |   80|      5|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
 1279|       |
 1280|      5|    if (method.len == 4
  ------------------
  |  Branch (1280:9): [True: 0, False: 5]
  ------------------
 1281|      5|        && ngx_strncasecmp(method.data, (u_char *) "HEAD", 4) == 0)
  ------------------
  |  Branch (1281:12): [True: 0, False: 0]
  ------------------
 1282|      0|    {
 1283|      0|        ctx->head = 1;
 1284|      0|    }
 1285|       |
 1286|      5|    len = method.len + 1 + sizeof(ngx_http_proxy_version) - 1
 1287|      5|          + sizeof(CRLF) - 1;
  ------------------
  |  |  105|      5|#define CRLF   "\r\n"
  ------------------
 1288|       |
 1289|      5|    escape = 0;
 1290|      5|    loc_len = 0;
 1291|      5|    unparsed_uri = 0;
 1292|       |
 1293|      5|    if (plcf->proxy_lengths && ctx->vars.uri.len) {
  ------------------
  |  Branch (1293:9): [True: 5, False: 0]
  |  Branch (1293:32): [True: 0, False: 5]
  ------------------
 1294|      0|        uri_len = ctx->vars.uri.len;
 1295|       |
 1296|      5|    } else if (ctx->vars.uri.len == 0 && r->valid_unparsed_uri) {
  ------------------
  |  Branch (1296:16): [True: 5, False: 0]
  |  Branch (1296:42): [True: 5, False: 0]
  ------------------
 1297|      5|        unparsed_uri = 1;
 1298|      5|        uri_len = r->unparsed_uri.len;
 1299|       |
 1300|      5|    } else {
 1301|      0|        loc_len = (r->valid_location && ctx->vars.uri.len) ?
  ------------------
  |  Branch (1301:20): [True: 0, False: 0]
  |  Branch (1301:41): [True: 0, False: 0]
  ------------------
 1302|      0|                      plcf->location.len : 0;
 1303|       |
 1304|      0|        if (r->quoted_uri || r->internal) {
  ------------------
  |  Branch (1304:13): [True: 0, False: 0]
  |  Branch (1304:30): [True: 0, False: 0]
  ------------------
 1305|      0|            escape = 2 * ngx_escape_uri(NULL, r->uri.data + loc_len,
 1306|      0|                                        r->uri.len - loc_len, NGX_ESCAPE_URI);
  ------------------
  |  |  199|      0|#define NGX_ESCAPE_URI            0
  ------------------
 1307|      0|        }
 1308|       |
 1309|      0|        uri_len = ctx->vars.uri.len + r->uri.len - loc_len + escape
 1310|      0|                  + sizeof("?") - 1 + r->args.len;
 1311|      0|    }
 1312|       |
 1313|      5|    if (uri_len == 0) {
  ------------------
  |  Branch (1313:9): [True: 0, False: 5]
  ------------------
 1314|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1315|      0|                      "zero length URI to proxy");
 1316|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1317|      0|    }
 1318|       |
 1319|      5|    len += uri_len;
 1320|       |
 1321|      5|    ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
  ------------------
  |  |   88|      5|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1322|       |
 1323|      5|    ngx_http_script_flush_no_cacheable_variables(r, plcf->body_flushes);
 1324|      5|    ngx_http_script_flush_no_cacheable_variables(r, headers->flushes);
 1325|       |
 1326|      5|    if (plcf->body_lengths) {
  ------------------
  |  Branch (1326:9): [True: 0, False: 5]
  ------------------
 1327|      0|        le.ip = plcf->body_lengths->elts;
 1328|      0|        le.request = r;
 1329|      0|        le.flushed = 1;
 1330|      0|        body_len = 0;
 1331|       |
 1332|      0|        while (*(uintptr_t *) le.ip) {
  ------------------
  |  Branch (1332:16): [True: 0, False: 0]
  ------------------
 1333|      0|            lcode = *(ngx_http_script_len_code_pt *) le.ip;
 1334|      0|            body_len += lcode(&le);
 1335|      0|        }
 1336|       |
 1337|      0|        ctx->internal_body_length = body_len;
 1338|      0|        len += body_len;
 1339|       |
 1340|      5|    } else if (r->headers_in.chunked && r->reading_body) {
  ------------------
  |  Branch (1340:16): [True: 0, False: 5]
  |  Branch (1340:41): [True: 0, False: 0]
  ------------------
 1341|      0|        ctx->internal_body_length = -1;
 1342|      0|        ctx->internal_chunked = 1;
 1343|       |
 1344|      5|    } else {
 1345|      5|        ctx->internal_body_length = r->headers_in.content_length_n;
 1346|      5|    }
 1347|       |
 1348|      5|    le.ip = headers->lengths->elts;
 1349|      5|    le.request = r;
 1350|      5|    le.flushed = 1;
 1351|       |
 1352|     30|    while (*(uintptr_t *) le.ip) {
  ------------------
  |  Branch (1352:12): [True: 25, False: 5]
  ------------------
 1353|       |
 1354|     25|        lcode = *(ngx_http_script_len_code_pt *) le.ip;
 1355|     25|        key_len = lcode(&le);
 1356|       |
 1357|     50|        for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
  ------------------
  |  Branch (1357:27): [True: 25, False: 25]
  ------------------
 1358|     25|            lcode = *(ngx_http_script_len_code_pt *) le.ip;
 1359|     25|        }
 1360|     25|        le.ip += sizeof(uintptr_t);
 1361|       |
 1362|     25|        if (val_len == 0) {
  ------------------
  |  Branch (1362:13): [True: 25, False: 0]
  ------------------
 1363|     25|            continue;
 1364|     25|        }
 1365|       |
 1366|      0|        len += key_len + sizeof(": ") - 1 + val_len + sizeof(CRLF) - 1;
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
 1367|      0|    }
 1368|       |
 1369|       |
 1370|      5|    if (plcf->upstream.pass_request_headers) {
  ------------------
  |  Branch (1370:9): [True: 5, False: 0]
  ------------------
 1371|      5|        part = &r->headers_in.headers.part;
 1372|      5|        header = part->elts;
 1373|       |
 1374|      5|        for (i = 0; /* void */; i++) {
 1375|       |
 1376|      5|            if (i >= part->nelts) {
  ------------------
  |  Branch (1376:17): [True: 5, False: 0]
  ------------------
 1377|      5|                if (part->next == NULL) {
  ------------------
  |  Branch (1377:21): [True: 5, False: 0]
  ------------------
 1378|      5|                    break;
 1379|      5|                }
 1380|       |
 1381|      0|                part = part->next;
 1382|      0|                header = part->elts;
 1383|      0|                i = 0;
 1384|      0|            }
 1385|       |
 1386|      0|            if (ngx_hash_find(&headers->hash, header[i].hash,
  ------------------
  |  Branch (1386:17): [True: 0, False: 0]
  ------------------
 1387|      0|                              header[i].lowcase_key, header[i].key.len))
 1388|      0|            {
 1389|      0|                continue;
 1390|      0|            }
 1391|       |
 1392|      0|            len += header[i].key.len + sizeof(": ") - 1
 1393|      0|                + header[i].value.len + sizeof(CRLF) - 1;
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
 1394|      0|        }
 1395|      5|    }
 1396|       |
 1397|       |
 1398|      5|    b = ngx_create_temp_buf(r->pool, len);
 1399|      5|    if (b == NULL) {
  ------------------
  |  Branch (1399:9): [True: 0, False: 5]
  ------------------
 1400|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1401|      0|    }
 1402|       |
 1403|      5|    cl = ngx_alloc_chain_link(r->pool);
 1404|      5|    if (cl == NULL) {
  ------------------
  |  Branch (1404:9): [True: 0, False: 5]
  ------------------
 1405|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1406|      0|    }
 1407|       |
 1408|      5|    cl->buf = b;
 1409|       |
 1410|       |
 1411|       |    /* the request line */
 1412|       |
 1413|      5|    b->last = ngx_copy(b->last, method.data, method.len);
  ------------------
  |  |  138|      5|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      5|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
 1414|      5|    *b->last++ = ' ';
 1415|       |
 1416|      5|    u->uri.data = b->last;
 1417|       |
 1418|      5|    if (plcf->proxy_lengths && ctx->vars.uri.len) {
  ------------------
  |  Branch (1418:9): [True: 5, False: 0]
  |  Branch (1418:32): [True: 0, False: 5]
  ------------------
 1419|      0|        b->last = ngx_copy(b->last, ctx->vars.uri.data, ctx->vars.uri.len);
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
 1420|       |
 1421|      5|    } else if (unparsed_uri) {
  ------------------
  |  Branch (1421:16): [True: 5, False: 0]
  ------------------
 1422|      5|        b->last = ngx_copy(b->last, r->unparsed_uri.data, r->unparsed_uri.len);
  ------------------
  |  |  138|      5|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      5|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
 1423|       |
 1424|      5|    } else {
 1425|      0|        if (r->valid_location) {
  ------------------
  |  Branch (1425:13): [True: 0, False: 0]
  ------------------
 1426|      0|            b->last = ngx_copy(b->last, ctx->vars.uri.data, ctx->vars.uri.len);
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
 1427|      0|        }
 1428|       |
 1429|      0|        if (escape) {
  ------------------
  |  Branch (1429:13): [True: 0, False: 0]
  ------------------
 1430|      0|            ngx_escape_uri(b->last, r->uri.data + loc_len,
 1431|      0|                           r->uri.len - loc_len, NGX_ESCAPE_URI);
  ------------------
  |  |  199|      0|#define NGX_ESCAPE_URI            0
  ------------------
 1432|      0|            b->last += r->uri.len - loc_len + escape;
 1433|       |
 1434|      0|        } else {
 1435|      0|            b->last = ngx_copy(b->last, r->uri.data + loc_len,
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
 1436|      0|                               r->uri.len - loc_len);
 1437|      0|        }
 1438|       |
 1439|      0|        if (r->args.len > 0) {
  ------------------
  |  Branch (1439:13): [True: 0, False: 0]
  ------------------
 1440|      0|            *b->last++ = '?';
 1441|      0|            b->last = ngx_copy(b->last, r->args.data, r->args.len);
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
 1442|      0|        }
 1443|      0|    }
 1444|       |
 1445|      5|    u->uri.len = b->last - u->uri.data;
 1446|       |
 1447|      5|    if (plcf->http_version == NGX_HTTP_VERSION_11) {
  ------------------
  |  |   25|      5|#define NGX_HTTP_VERSION_11                1001
  ------------------
  |  Branch (1447:9): [True: 5, False: 0]
  ------------------
 1448|      5|        b->last = ngx_cpymem(b->last, ngx_http_proxy_version_11,
  ------------------
  |  |  107|      5|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
 1449|      5|                             sizeof(ngx_http_proxy_version_11) - 1);
 1450|       |
 1451|      5|    } else {
 1452|      0|        b->last = ngx_cpymem(b->last, ngx_http_proxy_version,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
 1453|      0|                             sizeof(ngx_http_proxy_version) - 1);
 1454|      0|    }
 1455|       |
 1456|      5|    ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
  ------------------
  |  |   88|      5|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1457|       |
 1458|      5|    e.ip = headers->values->elts;
 1459|      5|    e.pos = b->last;
 1460|      5|    e.request = r;
 1461|      5|    e.flushed = 1;
 1462|       |
 1463|      5|    le.ip = headers->lengths->elts;
 1464|       |
 1465|     30|    while (*(uintptr_t *) le.ip) {
  ------------------
  |  Branch (1465:12): [True: 25, False: 5]
  ------------------
 1466|       |
 1467|     25|        lcode = *(ngx_http_script_len_code_pt *) le.ip;
 1468|     25|        (void) lcode(&le);
 1469|       |
 1470|     50|        for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
  ------------------
  |  Branch (1470:27): [True: 25, False: 25]
  ------------------
 1471|     25|            lcode = *(ngx_http_script_len_code_pt *) le.ip;
 1472|     25|        }
 1473|     25|        le.ip += sizeof(uintptr_t);
 1474|       |
 1475|     25|        if (val_len == 0) {
  ------------------
  |  Branch (1475:13): [True: 25, False: 0]
  ------------------
 1476|     25|            e.skip = 1;
 1477|       |
 1478|     75|            while (*(uintptr_t *) e.ip) {
  ------------------
  |  Branch (1478:20): [True: 50, False: 25]
  ------------------
 1479|     50|                code = *(ngx_http_script_code_pt *) e.ip;
 1480|     50|                code((ngx_http_script_engine_t *) &e);
 1481|     50|            }
 1482|     25|            e.ip += sizeof(uintptr_t);
 1483|       |
 1484|     25|            e.skip = 0;
 1485|       |
 1486|     25|            continue;
 1487|     25|        }
 1488|       |
 1489|      0|        code = *(ngx_http_script_code_pt *) e.ip;
 1490|      0|        code((ngx_http_script_engine_t *) &e);
 1491|       |
 1492|      0|        *e.pos++ = ':'; *e.pos++ = ' ';
 1493|       |
 1494|      0|        while (*(uintptr_t *) e.ip) {
  ------------------
  |  Branch (1494:16): [True: 0, False: 0]
  ------------------
 1495|      0|            code = *(ngx_http_script_code_pt *) e.ip;
 1496|      0|            code((ngx_http_script_engine_t *) &e);
 1497|      0|        }
 1498|      0|        e.ip += sizeof(uintptr_t);
 1499|       |
 1500|      0|        *e.pos++ = CR; *e.pos++ = LF;
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
                      *e.pos++ = CR; *e.pos++ = LF;
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
 1501|      0|    }
 1502|       |
 1503|      5|    b->last = e.pos;
 1504|       |
 1505|       |
 1506|      5|    if (plcf->upstream.pass_request_headers) {
  ------------------
  |  Branch (1506:9): [True: 5, False: 0]
  ------------------
 1507|      5|        part = &r->headers_in.headers.part;
 1508|      5|        header = part->elts;
 1509|       |
 1510|      5|        for (i = 0; /* void */; i++) {
 1511|       |
 1512|      5|            if (i >= part->nelts) {
  ------------------
  |  Branch (1512:17): [True: 5, False: 0]
  ------------------
 1513|      5|                if (part->next == NULL) {
  ------------------
  |  Branch (1513:21): [True: 5, False: 0]
  ------------------
 1514|      5|                    break;
 1515|      5|                }
 1516|       |
 1517|      0|                part = part->next;
 1518|      0|                header = part->elts;
 1519|      0|                i = 0;
 1520|      0|            }
 1521|       |
 1522|      0|            if (ngx_hash_find(&headers->hash, header[i].hash,
  ------------------
  |  Branch (1522:17): [True: 0, False: 0]
  ------------------
 1523|      0|                              header[i].lowcase_key, header[i].key.len))
 1524|      0|            {
 1525|      0|                continue;
 1526|      0|            }
 1527|       |
 1528|      0|            b->last = ngx_copy(b->last, header[i].key.data, header[i].key.len);
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
 1529|       |
 1530|      0|            *b->last++ = ':'; *b->last++ = ' ';
 1531|       |
 1532|      0|            b->last = ngx_copy(b->last, header[i].value.data,
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
 1533|      0|                               header[i].value.len);
 1534|       |
 1535|      0|            *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
                          *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
 1536|       |
 1537|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1538|      0|                           "http proxy header: \"%V: %V\"",
 1539|      0|                           &header[i].key, &header[i].value);
 1540|      0|        }
 1541|      5|    }
 1542|       |
 1543|       |
 1544|       |    /* add "\r\n" at the header end */
 1545|      5|    *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  104|      5|#define CR     (u_char) '\r'
  ------------------
                  *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  103|      5|#define LF     (u_char) '\n'
  ------------------
 1546|       |
 1547|      5|    if (plcf->body_values) {
  ------------------
  |  Branch (1547:9): [True: 0, False: 5]
  ------------------
 1548|      0|        e.ip = plcf->body_values->elts;
 1549|      0|        e.pos = b->last;
 1550|      0|        e.skip = 0;
 1551|       |
 1552|      0|        while (*(uintptr_t *) e.ip) {
  ------------------
  |  Branch (1552:16): [True: 0, False: 0]
  ------------------
 1553|      0|            code = *(ngx_http_script_code_pt *) e.ip;
 1554|      0|            code((ngx_http_script_engine_t *) &e);
 1555|      0|        }
 1556|       |
 1557|      0|        b->last = e.pos;
 1558|      0|    }
 1559|       |
 1560|      5|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1561|      5|                   "http proxy header:%N\"%*s\"",
 1562|      5|                   (size_t) (b->last - b->pos), b->pos);
 1563|       |
 1564|      5|    if (r->request_body_no_buffering) {
  ------------------
  |  Branch (1564:9): [True: 0, False: 5]
  ------------------
 1565|       |
 1566|      0|        u->request_bufs = cl;
 1567|       |
 1568|      0|        if (ctx->internal_chunked) {
  ------------------
  |  Branch (1568:13): [True: 0, False: 0]
  ------------------
 1569|      0|            u->output.output_filter = ngx_http_proxy_body_output_filter;
 1570|      0|            u->output.filter_ctx = r;
 1571|      0|        }
 1572|       |
 1573|      5|    } else if (plcf->body_values == NULL && plcf->upstream.pass_request_body) {
  ------------------
  |  Branch (1573:16): [True: 5, False: 0]
  |  Branch (1573:45): [True: 5, False: 0]
  ------------------
 1574|       |
 1575|      5|        body = u->request_bufs;
 1576|      5|        u->request_bufs = cl;
 1577|       |
 1578|      5|        while (body) {
  ------------------
  |  Branch (1578:16): [True: 0, False: 5]
  ------------------
 1579|      0|            b = ngx_alloc_buf(r->pool);
  ------------------
  |  |  144|      0|#define ngx_alloc_buf(pool)  ngx_palloc(pool, sizeof(ngx_buf_t))
  ------------------
 1580|      0|            if (b == NULL) {
  ------------------
  |  Branch (1580:17): [True: 0, False: 0]
  ------------------
 1581|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1582|      0|            }
 1583|       |
 1584|      0|            ngx_memcpy(b, body->buf, sizeof(ngx_buf_t));
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1585|       |
 1586|      0|            cl->next = ngx_alloc_chain_link(r->pool);
 1587|      0|            if (cl->next == NULL) {
  ------------------
  |  Branch (1587:17): [True: 0, False: 0]
  ------------------
 1588|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1589|      0|            }
 1590|       |
 1591|      0|            cl = cl->next;
 1592|      0|            cl->buf = b;
 1593|       |
 1594|      0|            body = body->next;
 1595|      0|        }
 1596|       |
 1597|      5|    } else {
 1598|      0|        u->request_bufs = cl;
 1599|      0|    }
 1600|       |
 1601|      5|    b->flush = 1;
 1602|      5|    cl->next = NULL;
 1603|       |
 1604|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 1605|      5|}
ngx_http_proxy_module.c:ngx_http_proxy_process_status_line:
 1803|      5|{
 1804|      5|    size_t                 len;
 1805|      5|    ngx_int_t              rc;
 1806|      5|    ngx_http_upstream_t   *u;
 1807|      5|    ngx_http_proxy_ctx_t  *ctx;
 1808|       |
 1809|      5|    ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
  ------------------
  |  |   80|      5|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
 1810|       |
 1811|      5|    if (ctx == NULL) {
  ------------------
  |  Branch (1811:9): [True: 0, False: 5]
  ------------------
 1812|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1813|      0|    }
 1814|       |
 1815|      5|    u = r->upstream;
 1816|       |
 1817|      5|    rc = ngx_http_parse_status_line(r, &u->buffer, &ctx->status);
 1818|       |
 1819|      5|    if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      5|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (1819:9): [True: 0, False: 5]
  ------------------
 1820|      0|        return rc;
 1821|      0|    }
 1822|       |
 1823|      5|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      5|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1823:9): [True: 1, False: 4]
  ------------------
 1824|       |
 1825|      1|#if (NGX_HTTP_CACHE)
 1826|       |
 1827|      1|        if (r->cache) {
  ------------------
  |  Branch (1827:13): [True: 0, False: 1]
  ------------------
 1828|      0|            r->http_version = NGX_HTTP_VERSION_9;
  ------------------
  |  |   23|      0|#define NGX_HTTP_VERSION_9                 9
  ------------------
 1829|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1830|      0|        }
 1831|       |
 1832|      1|#endif
 1833|       |
 1834|      1|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      1|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1835|      1|                      "upstream sent no valid HTTP/1.0 header");
 1836|       |
 1837|       |#if 0
 1838|       |        if (u->accel) {
 1839|       |            return NGX_HTTP_UPSTREAM_INVALID_HEADER;
 1840|       |        }
 1841|       |#endif
 1842|       |
 1843|      1|        r->http_version = NGX_HTTP_VERSION_9;
  ------------------
  |  |   23|      1|#define NGX_HTTP_VERSION_9                 9
  ------------------
 1844|      1|        u->state->status = NGX_HTTP_OK;
  ------------------
  |  |   78|      1|#define NGX_HTTP_OK                        200
  ------------------
 1845|      1|        u->headers_in.connection_close = 1;
 1846|       |
 1847|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1848|      1|    }
 1849|       |
 1850|      4|    if (u->state && u->state->status == 0) {
  ------------------
  |  Branch (1850:9): [True: 4, False: 0]
  |  Branch (1850:21): [True: 4, False: 0]
  ------------------
 1851|      4|        u->state->status = ctx->status.code;
 1852|      4|    }
 1853|       |
 1854|      4|    u->headers_in.status_n = ctx->status.code;
 1855|       |
 1856|      4|    len = ctx->status.end - ctx->status.start;
 1857|      4|    u->headers_in.status_line.len = len;
 1858|       |
 1859|      4|    u->headers_in.status_line.data = ngx_pnalloc(r->pool, len);
 1860|      4|    if (u->headers_in.status_line.data == NULL) {
  ------------------
  |  Branch (1860:9): [True: 0, False: 4]
  ------------------
 1861|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1862|      0|    }
 1863|       |
 1864|      4|    ngx_memcpy(u->headers_in.status_line.data, ctx->status.start, len);
  ------------------
  |  |  106|      4|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1865|       |
 1866|      4|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1867|      4|                   "http proxy status %ui \"%V\"",
 1868|      4|                   u->headers_in.status_n, &u->headers_in.status_line);
 1869|       |
 1870|      4|    if (ctx->status.http_version < NGX_HTTP_VERSION_11) {
  ------------------
  |  |   25|      4|#define NGX_HTTP_VERSION_11                1001
  ------------------
  |  Branch (1870:9): [True: 2, False: 2]
  ------------------
 1871|      2|        u->headers_in.connection_close = 1;
 1872|      2|    }
 1873|       |
 1874|      4|    u->process_header = ngx_http_proxy_process_header;
 1875|       |
 1876|      4|    return ngx_http_proxy_process_header(r);
 1877|      4|}
ngx_http_proxy_module.c:ngx_http_proxy_process_header:
 1882|      4|{
 1883|      4|    ngx_int_t                       rc;
 1884|      4|    ngx_table_elt_t                *h;
 1885|      4|    ngx_http_upstream_t            *u;
 1886|      4|    ngx_http_proxy_ctx_t           *ctx;
 1887|      4|    ngx_http_upstream_header_t     *hh;
 1888|      4|    ngx_http_upstream_main_conf_t  *umcf;
 1889|       |
 1890|      4|    umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
  ------------------
  |  |   56|      4|    (r)->main_conf[module.ctx_index]
  ------------------
 1891|       |
 1892|     17|    for ( ;; ) {
 1893|       |
 1894|     17|        rc = ngx_http_parse_header_line(r, &r->upstream->buffer, 1);
 1895|       |
 1896|     17|        if (rc == NGX_OK) {
  ------------------
  |  |   38|     17|#define  NGX_OK          0
  ------------------
  |  Branch (1896:13): [True: 13, False: 4]
  ------------------
 1897|       |
 1898|       |            /* a header line has been parsed successfully */
 1899|       |
 1900|     13|            h = ngx_list_push(&r->upstream->headers_in.headers);
 1901|     13|            if (h == NULL) {
  ------------------
  |  Branch (1901:17): [True: 0, False: 13]
  ------------------
 1902|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1903|      0|            }
 1904|       |
 1905|     13|            h->hash = r->header_hash;
 1906|       |
 1907|     13|            h->key.len = r->header_name_end - r->header_name_start;
 1908|     13|            h->value.len = r->header_end - r->header_start;
 1909|       |
 1910|     13|            h->key.data = ngx_pnalloc(r->pool,
 1911|     13|                               h->key.len + 1 + h->value.len + 1 + h->key.len);
 1912|     13|            if (h->key.data == NULL) {
  ------------------
  |  Branch (1912:17): [True: 0, False: 13]
  ------------------
 1913|      0|                h->hash = 0;
 1914|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1915|      0|            }
 1916|       |
 1917|     13|            h->value.data = h->key.data + h->key.len + 1;
 1918|     13|            h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
 1919|       |
 1920|     13|            ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
  ------------------
  |  |  106|     13|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1921|     13|            h->key.data[h->key.len] = '\0';
 1922|     13|            ngx_memcpy(h->value.data, r->header_start, h->value.len);
  ------------------
  |  |  106|     13|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1923|     13|            h->value.data[h->value.len] = '\0';
 1924|       |
 1925|     13|            if (h->key.len == r->lowcase_index) {
  ------------------
  |  Branch (1925:17): [True: 9, False: 4]
  ------------------
 1926|      9|                ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
  ------------------
  |  |  106|      9|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1927|       |
 1928|      9|            } else {
 1929|      4|                ngx_strlow(h->lowcase_key, h->key.data, h->key.len);
 1930|      4|            }
 1931|       |
 1932|     13|            hh = ngx_hash_find(&umcf->headers_in_hash, h->hash,
 1933|     13|                               h->lowcase_key, h->key.len);
 1934|       |
 1935|     13|            if (hh) {
  ------------------
  |  Branch (1935:17): [True: 6, False: 7]
  ------------------
 1936|      6|                rc = hh->handler(r, h, hh->offset);
 1937|       |
 1938|      6|                if (rc != NGX_OK) {
  ------------------
  |  |   38|      6|#define  NGX_OK          0
  ------------------
  |  Branch (1938:21): [True: 0, False: 6]
  ------------------
 1939|      0|                    return rc;
 1940|      0|                }
 1941|      6|            }
 1942|       |
 1943|     13|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1944|     13|                           "http proxy header: \"%V: %V\"",
 1945|     13|                           &h->key, &h->value);
 1946|       |
 1947|     13|            continue;
 1948|     13|        }
 1949|       |
 1950|      4|        if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
  ------------------
  |  |   54|      4|#define NGX_HTTP_PARSE_HEADER_DONE         1
  ------------------
  |  Branch (1950:13): [True: 4, False: 0]
  ------------------
 1951|       |
 1952|       |            /* a whole header has been parsed successfully */
 1953|       |
 1954|      4|            ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1955|      4|                           "http proxy header done");
 1956|       |
 1957|       |            /*
 1958|       |             * if no "Server" and "Date" in header line,
 1959|       |             * then add the special empty headers
 1960|       |             */
 1961|       |
 1962|      4|            if (r->upstream->headers_in.server == NULL) {
  ------------------
  |  Branch (1962:17): [True: 4, False: 0]
  ------------------
 1963|      4|                h = ngx_list_push(&r->upstream->headers_in.headers);
 1964|      4|                if (h == NULL) {
  ------------------
  |  Branch (1964:21): [True: 0, False: 4]
  ------------------
 1965|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1966|      0|                }
 1967|       |
 1968|      4|                h->hash = ngx_hash(ngx_hash(ngx_hash(ngx_hash(
  ------------------
  |  |  114|      4|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
 1969|      4|                                    ngx_hash('s', 'e'), 'r'), 'v'), 'e'), 'r');
 1970|       |
 1971|      4|                ngx_str_set(&h->key, "Server");
  ------------------
  |  |   43|      4|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 1972|      4|                ngx_str_null(&h->value);
  ------------------
  |  |   44|      4|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
 1973|      4|                h->lowcase_key = (u_char *) "server";
 1974|      4|                h->next = NULL;
 1975|      4|            }
 1976|       |
 1977|      4|            if (r->upstream->headers_in.date == NULL) {
  ------------------
  |  Branch (1977:17): [True: 4, False: 0]
  ------------------
 1978|      4|                h = ngx_list_push(&r->upstream->headers_in.headers);
 1979|      4|                if (h == NULL) {
  ------------------
  |  Branch (1979:21): [True: 0, False: 4]
  ------------------
 1980|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1981|      0|                }
 1982|       |
 1983|      4|                h->hash = ngx_hash(ngx_hash(ngx_hash('d', 'a'), 't'), 'e');
  ------------------
  |  |  114|      4|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
 1984|       |
 1985|      4|                ngx_str_set(&h->key, "Date");
  ------------------
  |  |   43|      4|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 1986|      4|                ngx_str_null(&h->value);
  ------------------
  |  |   44|      4|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
 1987|      4|                h->lowcase_key = (u_char *) "date";
 1988|      4|                h->next = NULL;
 1989|      4|            }
 1990|       |
 1991|       |            /* clear content length if response is chunked */
 1992|       |
 1993|      4|            u = r->upstream;
 1994|       |
 1995|      4|            if (u->headers_in.chunked) {
  ------------------
  |  Branch (1995:17): [True: 4, False: 0]
  ------------------
 1996|      4|                u->headers_in.content_length_n = -1;
 1997|      4|            }
 1998|       |
 1999|       |            /*
 2000|       |             * set u->keepalive if response has no body; this allows to keep
 2001|       |             * connections alive in case of r->header_only or X-Accel-Redirect
 2002|       |             */
 2003|       |
 2004|      4|            ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
  ------------------
  |  |   80|      4|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
 2005|       |
 2006|      4|            if (u->headers_in.status_n == NGX_HTTP_NO_CONTENT
  ------------------
  |  |   81|      8|#define NGX_HTTP_NO_CONTENT                204
  ------------------
  |  Branch (2006:17): [True: 0, False: 4]
  ------------------
 2007|      4|                || u->headers_in.status_n == NGX_HTTP_NOT_MODIFIED
  ------------------
  |  |   88|      8|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
  |  Branch (2007:20): [True: 0, False: 4]
  ------------------
 2008|      4|                || ctx->head
  ------------------
  |  Branch (2008:20): [True: 0, False: 4]
  ------------------
 2009|      4|                || (!u->headers_in.chunked
  ------------------
  |  Branch (2009:21): [True: 0, False: 4]
  ------------------
 2010|      4|                    && u->headers_in.content_length_n == 0))
  ------------------
  |  Branch (2010:24): [True: 0, False: 0]
  ------------------
 2011|      0|            {
 2012|      0|                u->keepalive = !u->headers_in.connection_close;
 2013|      0|            }
 2014|       |
 2015|      4|            if (u->headers_in.status_n == NGX_HTTP_SWITCHING_PROTOCOLS) {
  ------------------
  |  |   75|      4|#define NGX_HTTP_SWITCHING_PROTOCOLS       101
  ------------------
  |  Branch (2015:17): [True: 0, False: 4]
  ------------------
 2016|      0|                u->keepalive = 0;
 2017|       |
 2018|      0|                if (r->headers_in.upgrade) {
  ------------------
  |  Branch (2018:21): [True: 0, False: 0]
  ------------------
 2019|      0|                    u->upgrade = 1;
 2020|      0|                }
 2021|      0|            }
 2022|       |
 2023|      4|            return NGX_OK;
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
 2024|      4|        }
 2025|       |
 2026|      0|        if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (2026:13): [True: 0, False: 0]
  ------------------
 2027|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 2028|      0|        }
 2029|       |
 2030|       |        /* rc == NGX_HTTP_PARSE_INVALID_HEADER */
 2031|       |
 2032|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2033|      0|                      "upstream sent invalid header: \"%*s\\x%02xd...\"",
 2034|      0|                      r->header_end - r->header_name_start,
 2035|      0|                      r->header_name_start, *r->header_end);
 2036|       |
 2037|      0|        return NGX_HTTP_UPSTREAM_INVALID_HEADER;
  ------------------
  |  |   45|      0|#define NGX_HTTP_UPSTREAM_INVALID_HEADER     40
  ------------------
 2038|      0|    }
 2039|      4|}
ngx_http_proxy_module.c:ngx_http_proxy_input_filter_init:
 2044|      5|{
 2045|      5|    ngx_http_request_t    *r = data;
 2046|      5|    ngx_http_upstream_t   *u;
 2047|      5|    ngx_http_proxy_ctx_t  *ctx;
 2048|       |
 2049|      5|    u = r->upstream;
 2050|      5|    ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
  ------------------
  |  |   80|      5|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
 2051|       |
 2052|      5|    if (ctx == NULL) {
  ------------------
  |  Branch (2052:9): [True: 0, False: 5]
  ------------------
 2053|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2054|      0|    }
 2055|       |
 2056|      5|    ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2057|      5|                   "http proxy filter init s:%ui h:%d c:%d l:%O",
 2058|      5|                   u->headers_in.status_n, ctx->head, u->headers_in.chunked,
 2059|      5|                   u->headers_in.content_length_n);
 2060|       |
 2061|       |    /* as per RFC2616, 4.4 Message Length */
 2062|       |
 2063|      5|    if (u->headers_in.status_n == NGX_HTTP_NO_CONTENT
  ------------------
  |  |   81|     10|#define NGX_HTTP_NO_CONTENT                204
  ------------------
  |  Branch (2063:9): [True: 0, False: 5]
  ------------------
 2064|      5|        || u->headers_in.status_n == NGX_HTTP_NOT_MODIFIED
  ------------------
  |  |   88|     10|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
  |  Branch (2064:12): [True: 0, False: 5]
  ------------------
 2065|      5|        || ctx->head)
  ------------------
  |  Branch (2065:12): [True: 0, False: 5]
  ------------------
 2066|      0|    {
 2067|       |        /* 1xx, 204, and 304 and replies to HEAD requests */
 2068|       |        /* no 1xx since we don't send Expect and Upgrade */
 2069|       |
 2070|      0|        u->pipe->length = 0;
 2071|      0|        u->length = 0;
 2072|      0|        u->keepalive = !u->headers_in.connection_close;
 2073|       |
 2074|      5|    } else if (u->headers_in.chunked) {
  ------------------
  |  Branch (2074:16): [True: 4, False: 1]
  ------------------
 2075|       |        /* chunked */
 2076|       |
 2077|      4|        u->pipe->input_filter = ngx_http_proxy_chunked_filter;
 2078|      4|        u->pipe->length = 3; /* "0" LF LF */
 2079|       |
 2080|      4|        u->input_filter = ngx_http_proxy_non_buffered_chunked_filter;
 2081|      4|        u->length = 1;
 2082|       |
 2083|      4|    } else if (u->headers_in.content_length_n == 0) {
  ------------------
  |  Branch (2083:16): [True: 0, False: 1]
  ------------------
 2084|       |        /* empty body: special case as filter won't be called */
 2085|       |
 2086|      0|        u->pipe->length = 0;
 2087|      0|        u->length = 0;
 2088|      0|        u->keepalive = !u->headers_in.connection_close;
 2089|       |
 2090|      1|    } else {
 2091|       |        /* content length or connection close */
 2092|       |
 2093|      1|        u->pipe->length = u->headers_in.content_length_n;
 2094|      1|        u->length = u->headers_in.content_length_n;
 2095|      1|    }
 2096|       |
 2097|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 2098|      5|}
ngx_http_proxy_module.c:ngx_http_proxy_non_buffered_chunked_filter:
 2401|     16|{
 2402|     16|    ngx_http_request_t   *r = data;
 2403|       |
 2404|     16|    ngx_int_t              rc;
 2405|     16|    ngx_buf_t             *b, *buf;
 2406|     16|    ngx_chain_t           *cl, **ll;
 2407|     16|    ngx_http_upstream_t   *u;
 2408|     16|    ngx_http_proxy_ctx_t  *ctx;
 2409|       |
 2410|     16|    ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
  ------------------
  |  |   80|     16|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
 2411|       |
 2412|     16|    if (ctx == NULL) {
  ------------------
  |  Branch (2412:9): [True: 0, False: 16]
  ------------------
 2413|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2414|      0|    }
 2415|       |
 2416|     16|    u = r->upstream;
 2417|     16|    buf = &u->buffer;
 2418|       |
 2419|     16|    buf->pos = buf->last;
 2420|     16|    buf->last += bytes;
 2421|       |
 2422|     16|    for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) {
  ------------------
  |  Branch (2422:47): [True: 0, False: 16]
  ------------------
 2423|      0|        ll = &cl->next;
 2424|      0|    }
 2425|       |
 2426|     16|    for ( ;; ) {
 2427|       |
 2428|     16|        rc = ngx_http_parse_chunked(r, buf, &ctx->chunked);
 2429|       |
 2430|     16|        if (rc == NGX_OK) {
  ------------------
  |  |   38|     16|#define  NGX_OK          0
  ------------------
  |  Branch (2430:13): [True: 0, False: 16]
  ------------------
 2431|       |
 2432|       |            /* a chunk has been parsed successfully */
 2433|       |
 2434|      0|            cl = ngx_chain_get_free_buf(r->pool, &u->free_bufs);
 2435|      0|            if (cl == NULL) {
  ------------------
  |  Branch (2435:17): [True: 0, False: 0]
  ------------------
 2436|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2437|      0|            }
 2438|       |
 2439|      0|            *ll = cl;
 2440|      0|            ll = &cl->next;
 2441|       |
 2442|      0|            b = cl->buf;
 2443|       |
 2444|      0|            b->flush = 1;
 2445|      0|            b->memory = 1;
 2446|       |
 2447|      0|            b->pos = buf->pos;
 2448|      0|            b->tag = u->output.tag;
 2449|       |
 2450|      0|            if (buf->last - buf->pos >= ctx->chunked.size) {
  ------------------
  |  Branch (2450:17): [True: 0, False: 0]
  ------------------
 2451|      0|                buf->pos += (size_t) ctx->chunked.size;
 2452|      0|                b->last = buf->pos;
 2453|      0|                ctx->chunked.size = 0;
 2454|       |
 2455|      0|            } else {
 2456|      0|                ctx->chunked.size -= buf->last - buf->pos;
 2457|      0|                buf->pos = buf->last;
 2458|      0|                b->last = buf->last;
 2459|      0|            }
 2460|       |
 2461|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2462|      0|                           "http proxy out buf %p %z",
 2463|      0|                           b->pos, b->last - b->pos);
 2464|       |
 2465|      0|            continue;
 2466|      0|        }
 2467|       |
 2468|     16|        if (rc == NGX_DONE) {
  ------------------
  |  |   42|     16|#define  NGX_DONE       -4
  ------------------
  |  Branch (2468:13): [True: 0, False: 16]
  ------------------
 2469|       |
 2470|       |            /* a whole response has been parsed successfully */
 2471|       |
 2472|      0|            u->keepalive = !u->headers_in.connection_close;
 2473|      0|            u->length = 0;
 2474|       |
 2475|      0|            if (buf->pos != buf->last) {
  ------------------
  |  Branch (2475:17): [True: 0, False: 0]
  ------------------
 2476|      0|                ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2477|      0|                              "upstream sent data after final chunk");
 2478|      0|                u->keepalive = 0;
 2479|      0|            }
 2480|       |
 2481|      0|            break;
 2482|      0|        }
 2483|       |
 2484|     16|        if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|     16|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (2484:13): [True: 16, False: 0]
  ------------------
 2485|     16|            break;
 2486|     16|        }
 2487|       |
 2488|       |        /* invalid response */
 2489|       |
 2490|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2491|      0|                      "upstream sent invalid chunked response");
 2492|       |
 2493|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2494|     16|    }
 2495|       |
 2496|     16|    return NGX_OK;
  ------------------
  |  |   38|     16|#define  NGX_OK          0
  ------------------
 2497|     16|}
ngx_http_proxy_module.c:ngx_http_proxy_non_buffered_copy_filter:
 2335|      1|{
 2336|      1|    ngx_http_request_t   *r = data;
 2337|       |
 2338|      1|    ngx_buf_t            *b;
 2339|      1|    ngx_chain_t          *cl, **ll;
 2340|      1|    ngx_http_upstream_t  *u;
 2341|       |
 2342|      1|    u = r->upstream;
 2343|       |
 2344|      1|    if (u->length == 0) {
  ------------------
  |  Branch (2344:9): [True: 0, False: 1]
  ------------------
 2345|      0|        ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2346|      0|                      "upstream sent more data than specified in "
 2347|      0|                      "\"Content-Length\" header");
 2348|      0|        u->keepalive = 0;
 2349|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2350|      0|    }
 2351|       |
 2352|      1|    for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) {
  ------------------
  |  Branch (2352:47): [True: 0, False: 1]
  ------------------
 2353|      0|        ll = &cl->next;
 2354|      0|    }
 2355|       |
 2356|      1|    cl = ngx_chain_get_free_buf(r->pool, &u->free_bufs);
 2357|      1|    if (cl == NULL) {
  ------------------
  |  Branch (2357:9): [True: 0, False: 1]
  ------------------
 2358|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2359|      0|    }
 2360|       |
 2361|      1|    *ll = cl;
 2362|       |
 2363|      1|    cl->buf->flush = 1;
 2364|      1|    cl->buf->memory = 1;
 2365|       |
 2366|      1|    b = &u->buffer;
 2367|       |
 2368|      1|    cl->buf->pos = b->last;
 2369|      1|    b->last += bytes;
 2370|      1|    cl->buf->last = b->last;
 2371|      1|    cl->buf->tag = u->output.tag;
 2372|       |
 2373|      1|    if (u->length == -1) {
  ------------------
  |  Branch (2373:9): [True: 1, False: 0]
  ------------------
 2374|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2375|      1|    }
 2376|       |
 2377|      0|    if (bytes > u->length) {
  ------------------
  |  Branch (2377:9): [True: 0, False: 0]
  ------------------
 2378|       |
 2379|      0|        ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2380|      0|                      "upstream sent more data than specified in "
 2381|      0|                      "\"Content-Length\" header");
 2382|       |
 2383|      0|        cl->buf->last = cl->buf->pos + u->length;
 2384|      0|        u->length = 0;
 2385|       |
 2386|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2387|      0|    }
 2388|       |
 2389|      0|    u->length -= bytes;
 2390|       |
 2391|      0|    if (u->length == 0) {
  ------------------
  |  Branch (2391:9): [True: 0, False: 0]
  ------------------
 2392|      0|        u->keepalive = !u->headers_in.connection_close;
 2393|      0|    }
 2394|       |
 2395|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2396|      0|}
ngx_http_proxy_module.c:ngx_http_proxy_init_headers:
 3949|      2|{
 3950|      2|    u_char                       *p;
 3951|      2|    size_t                        size;
 3952|      2|    uintptr_t                    *code;
 3953|      2|    ngx_uint_t                    i;
 3954|      2|    ngx_array_t                   headers_names, headers_merged;
 3955|      2|    ngx_keyval_t                 *src, *s, *h;
 3956|      2|    ngx_hash_key_t               *hk;
 3957|      2|    ngx_hash_init_t               hash;
 3958|      2|    ngx_http_script_compile_t     sc;
 3959|      2|    ngx_http_script_copy_code_t  *copy;
 3960|       |
 3961|      2|    if (headers->hash.buckets) {
  ------------------
  |  Branch (3961:9): [True: 0, False: 2]
  ------------------
 3962|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 3963|      0|    }
 3964|       |
 3965|      2|    if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
  ------------------
  |  Branch (3965:9): [True: 0, False: 2]
  ------------------
 3966|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 3967|      0|    {
 3968|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3969|      0|    }
 3970|       |
 3971|      2|    if (ngx_array_init(&headers_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t))
  ------------------
  |  Branch (3971:9): [True: 0, False: 2]
  ------------------
 3972|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 3973|      0|    {
 3974|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3975|      0|    }
 3976|       |
 3977|      2|    headers->lengths = ngx_array_create(cf->pool, 64, 1);
 3978|      2|    if (headers->lengths == NULL) {
  ------------------
  |  Branch (3978:9): [True: 0, False: 2]
  ------------------
 3979|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3980|      0|    }
 3981|       |
 3982|      2|    headers->values = ngx_array_create(cf->pool, 512, 1);
 3983|      2|    if (headers->values == NULL) {
  ------------------
  |  Branch (3983:9): [True: 0, False: 2]
  ------------------
 3984|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3985|      0|    }
 3986|       |
 3987|      2|    if (conf->headers_source) {
  ------------------
  |  Branch (3987:9): [True: 2, False: 0]
  ------------------
 3988|       |
 3989|      2|        src = conf->headers_source->elts;
 3990|      9|        for (i = 0; i < conf->headers_source->nelts; i++) {
  ------------------
  |  Branch (3990:21): [True: 7, False: 2]
  ------------------
 3991|       |
 3992|      7|            s = ngx_array_push(&headers_merged);
 3993|      7|            if (s == NULL) {
  ------------------
  |  Branch (3993:17): [True: 0, False: 7]
  ------------------
 3994|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3995|      0|            }
 3996|       |
 3997|      7|            *s = src[i];
 3998|      7|        }
 3999|      2|    }
 4000|       |
 4001|      2|    h = default_headers;
 4002|       |
 4003|     18|    while (h->key.len) {
  ------------------
  |  Branch (4003:12): [True: 16, False: 2]
  ------------------
 4004|       |
 4005|     16|        src = headers_merged.elts;
 4006|    100|        for (i = 0; i < headers_merged.nelts; i++) {
  ------------------
  |  Branch (4006:21): [True: 87, False: 13]
  ------------------
 4007|     87|            if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
  ------------------
  |  Branch (4007:17): [True: 3, False: 84]
  ------------------
 4008|      3|                goto next;
 4009|      3|            }
 4010|     87|        }
 4011|       |
 4012|     13|        s = ngx_array_push(&headers_merged);
 4013|     13|        if (s == NULL) {
  ------------------
  |  Branch (4013:13): [True: 0, False: 13]
  ------------------
 4014|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4015|      0|        }
 4016|       |
 4017|     13|        *s = *h;
 4018|       |
 4019|     16|    next:
 4020|       |
 4021|     16|        h++;
 4022|     16|    }
 4023|       |
 4024|       |
 4025|      2|    src = headers_merged.elts;
 4026|     22|    for (i = 0; i < headers_merged.nelts; i++) {
  ------------------
  |  Branch (4026:17): [True: 20, False: 2]
  ------------------
 4027|       |
 4028|     20|        hk = ngx_array_push(&headers_names);
 4029|     20|        if (hk == NULL) {
  ------------------
  |  Branch (4029:13): [True: 0, False: 20]
  ------------------
 4030|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4031|      0|        }
 4032|       |
 4033|     20|        hk->key = src[i].key;
 4034|     20|        hk->key_hash = ngx_hash_key_lc(src[i].key.data, src[i].key.len);
 4035|     20|        hk->value = (void *) 1;
 4036|       |
 4037|     20|        if (src[i].value.len == 0) {
  ------------------
  |  Branch (4037:13): [True: 9, False: 11]
  ------------------
 4038|      9|            continue;
 4039|      9|        }
 4040|       |
 4041|     11|        copy = ngx_array_push_n(headers->lengths,
 4042|     11|                                sizeof(ngx_http_script_copy_code_t));
 4043|     11|        if (copy == NULL) {
  ------------------
  |  Branch (4043:13): [True: 0, False: 11]
  ------------------
 4044|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4045|      0|        }
 4046|       |
 4047|     11|        copy->code = (ngx_http_script_code_pt) (void *)
 4048|     11|                                                 ngx_http_script_copy_len_code;
 4049|     11|        copy->len = src[i].key.len;
 4050|       |
 4051|     11|        size = (sizeof(ngx_http_script_copy_code_t)
 4052|     11|                + src[i].key.len + sizeof(uintptr_t) - 1)
 4053|     11|               & ~(sizeof(uintptr_t) - 1);
 4054|       |
 4055|     11|        copy = ngx_array_push_n(headers->values, size);
 4056|     11|        if (copy == NULL) {
  ------------------
  |  Branch (4056:13): [True: 0, False: 11]
  ------------------
 4057|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4058|      0|        }
 4059|       |
 4060|     11|        copy->code = ngx_http_script_copy_code;
 4061|     11|        copy->len = src[i].key.len;
 4062|       |
 4063|     11|        p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
 4064|     11|        ngx_memcpy(p, src[i].key.data, src[i].key.len);
  ------------------
  |  |  106|     11|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 4065|       |
 4066|     11|        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
  ------------------
  |  |   88|     11|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 4067|       |
 4068|     11|        sc.cf = cf;
 4069|     11|        sc.source = &src[i].value;
 4070|     11|        sc.flushes = &headers->flushes;
 4071|     11|        sc.lengths = &headers->lengths;
 4072|     11|        sc.values = &headers->values;
 4073|       |
 4074|     11|        if (ngx_http_script_compile(&sc) != NGX_OK) {
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  |  Branch (4074:13): [True: 0, False: 11]
  ------------------
 4075|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4076|      0|        }
 4077|       |
 4078|     11|        code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t));
 4079|     11|        if (code == NULL) {
  ------------------
  |  Branch (4079:13): [True: 0, False: 11]
  ------------------
 4080|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4081|      0|        }
 4082|       |
 4083|     11|        *code = (uintptr_t) NULL;
 4084|       |
 4085|     11|        code = ngx_array_push_n(headers->values, sizeof(uintptr_t));
 4086|     11|        if (code == NULL) {
  ------------------
  |  Branch (4086:13): [True: 0, False: 11]
  ------------------
 4087|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4088|      0|        }
 4089|       |
 4090|     11|        *code = (uintptr_t) NULL;
 4091|     11|    }
 4092|       |
 4093|      2|    code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t));
 4094|      2|    if (code == NULL) {
  ------------------
  |  Branch (4094:9): [True: 0, False: 2]
  ------------------
 4095|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 4096|      0|    }
 4097|       |
 4098|      2|    *code = (uintptr_t) NULL;
 4099|       |
 4100|       |
 4101|      2|    hash.hash = &headers->hash;
 4102|      2|    hash.key = ngx_hash_key_lc;
 4103|      2|    hash.max_size = conf->headers_hash_max_size;
 4104|      2|    hash.bucket_size = conf->headers_hash_bucket_size;
 4105|      2|    hash.name = "proxy_headers_hash";
 4106|      2|    hash.pool = cf->pool;
 4107|      2|    hash.temp_pool = NULL;
 4108|       |
 4109|      2|    return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
 4110|      2|}
ngx_http_proxy_module.c:ngx_http_proxy_pass:
 4115|      1|{
 4116|      1|    ngx_http_proxy_loc_conf_t *plcf = conf;
 4117|       |
 4118|      1|    size_t                      add;
 4119|      1|    u_short                     port;
 4120|      1|    ngx_str_t                  *value, *url;
 4121|      1|    ngx_url_t                   u;
 4122|      1|    ngx_uint_t                  n;
 4123|      1|    ngx_http_core_loc_conf_t   *clcf;
 4124|      1|    ngx_http_script_compile_t   sc;
 4125|       |
 4126|      1|    if (plcf->upstream.upstream || plcf->proxy_lengths) {
  ------------------
  |  Branch (4126:9): [True: 0, False: 1]
  |  Branch (4126:36): [True: 0, False: 1]
  ------------------
 4127|      0|        return "is duplicate";
 4128|      0|    }
 4129|       |
 4130|      1|    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
  ------------------
  |  |   66|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index]
  ------------------
 4131|       |
 4132|      1|    clcf->handler = ngx_http_proxy_handler;
 4133|       |
 4134|      1|    if (clcf->name.len && clcf->name.data[clcf->name.len - 1] == '/') {
  ------------------
  |  Branch (4134:9): [True: 1, False: 0]
  |  Branch (4134:27): [True: 1, False: 0]
  ------------------
 4135|      1|        clcf->auto_redirect = 1;
 4136|      1|    }
 4137|       |
 4138|      1|    value = cf->args->elts;
 4139|       |
 4140|      1|    url = &value[1];
 4141|       |
 4142|      1|    n = ngx_http_script_variables_count(url);
 4143|       |
 4144|      1|    if (n) {
  ------------------
  |  Branch (4144:9): [True: 1, False: 0]
  ------------------
 4145|       |
 4146|      1|        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 4147|       |
 4148|      1|        sc.cf = cf;
 4149|      1|        sc.source = url;
 4150|      1|        sc.lengths = &plcf->proxy_lengths;
 4151|      1|        sc.values = &plcf->proxy_values;
 4152|      1|        sc.variables = n;
 4153|      1|        sc.complete_lengths = 1;
 4154|      1|        sc.complete_values = 1;
 4155|       |
 4156|      1|        if (ngx_http_script_compile(&sc) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (4156:13): [True: 0, False: 1]
  ------------------
 4157|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4158|      0|        }
 4159|       |
 4160|       |#if (NGX_HTTP_SSL)
 4161|       |        plcf->ssl = 1;
 4162|       |#endif
 4163|       |
 4164|      1|        return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 4165|      1|    }
 4166|       |
 4167|      0|    if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) {
  ------------------
  |  Branch (4167:9): [True: 0, False: 0]
  ------------------
 4168|      0|        add = 7;
 4169|      0|        port = 80;
 4170|       |
 4171|      0|    } else if (ngx_strncasecmp(url->data, (u_char *) "https://", 8) == 0) {
  ------------------
  |  Branch (4171:16): [True: 0, False: 0]
  ------------------
 4172|       |
 4173|       |#if (NGX_HTTP_SSL)
 4174|       |        plcf->ssl = 1;
 4175|       |
 4176|       |        add = 8;
 4177|       |        port = 443;
 4178|       |#else
 4179|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4180|      0|                           "https protocol requires SSL support");
 4181|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4182|      0|#endif
 4183|       |
 4184|      0|    } else {
 4185|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid URL prefix");
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4186|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4187|      0|    }
 4188|       |
 4189|      0|    ngx_memzero(&u, sizeof(ngx_url_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 4190|       |
 4191|      0|    u.url.len = url->len - add;
 4192|      0|    u.url.data = url->data + add;
 4193|      0|    u.default_port = port;
 4194|      0|    u.uri_part = 1;
 4195|      0|    u.no_resolve = 1;
 4196|       |
 4197|      0|    plcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
 4198|      0|    if (plcf->upstream.upstream == NULL) {
  ------------------
  |  Branch (4198:9): [True: 0, False: 0]
  ------------------
 4199|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4200|      0|    }
 4201|       |
 4202|      0|    plcf->vars.schema.len = add;
 4203|      0|    plcf->vars.schema.data = url->data;
 4204|      0|    plcf->vars.key_start = plcf->vars.schema;
 4205|       |
 4206|      0|    ngx_http_proxy_set_vars(&u, &plcf->vars);
 4207|       |
 4208|      0|    plcf->location = clcf->name;
 4209|       |
 4210|      0|    if (clcf->named
  ------------------
  |  Branch (4210:9): [True: 0, False: 0]
  ------------------
 4211|      0|#if (NGX_PCRE)
 4212|      0|        || clcf->regex
  ------------------
  |  Branch (4212:12): [True: 0, False: 0]
  ------------------
 4213|      0|#endif
 4214|      0|        || clcf->noname)
  ------------------
  |  Branch (4214:12): [True: 0, False: 0]
  ------------------
 4215|      0|    {
 4216|      0|        if (plcf->vars.uri.len) {
  ------------------
  |  Branch (4216:13): [True: 0, False: 0]
  ------------------
 4217|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4218|      0|                               "\"proxy_pass\" cannot have URI part in "
 4219|      0|                               "location given by regular expression, "
 4220|      0|                               "or inside named location, "
 4221|      0|                               "or inside \"if\" statement, "
 4222|      0|                               "or inside \"limit_except\" block");
 4223|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4224|      0|        }
 4225|       |
 4226|      0|        plcf->location.len = 0;
 4227|      0|    }
 4228|       |
 4229|      0|    plcf->url = *url;
 4230|       |
 4231|      0|    return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 4232|      0|}
ngx_http_proxy_module.c:ngx_http_proxy_cache:
 4776|      1|{
 4777|      1|    ngx_http_proxy_loc_conf_t *plcf = conf;
 4778|       |
 4779|      1|    ngx_str_t                         *value;
 4780|      1|    ngx_http_complex_value_t           cv;
 4781|      1|    ngx_http_compile_complex_value_t   ccv;
 4782|       |
 4783|      1|    value = cf->args->elts;
 4784|       |
 4785|      1|    if (plcf->upstream.cache != NGX_CONF_UNSET) {
  ------------------
  |  |   56|      1|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (4785:9): [True: 0, False: 1]
  ------------------
 4786|      0|        return "is duplicate";
 4787|      0|    }
 4788|       |
 4789|      1|    if (ngx_strcmp(value[1].data, "off") == 0) {
  ------------------
  |  |   57|      1|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4789:9): [True: 1, False: 0]
  ------------------
 4790|      1|        plcf->upstream.cache = 0;
 4791|      1|        return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 4792|      1|    }
 4793|       |
 4794|      0|    if (plcf->upstream.store > 0) {
  ------------------
  |  Branch (4794:9): [True: 0, False: 0]
  ------------------
 4795|      0|        return "is incompatible with \"proxy_store\"";
 4796|      0|    }
 4797|       |
 4798|      0|    plcf->upstream.cache = 1;
 4799|       |
 4800|      0|    ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 4801|       |
 4802|      0|    ccv.cf = cf;
 4803|      0|    ccv.value = &value[1];
 4804|      0|    ccv.complex_value = &cv;
 4805|       |
 4806|      0|    if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (4806:9): [True: 0, False: 0]
  ------------------
 4807|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4808|      0|    }
 4809|       |
 4810|      0|    if (cv.lengths != NULL) {
  ------------------
  |  Branch (4810:9): [True: 0, False: 0]
  ------------------
 4811|       |
 4812|      0|        plcf->upstream.cache_value = ngx_palloc(cf->pool,
 4813|      0|                                             sizeof(ngx_http_complex_value_t));
 4814|      0|        if (plcf->upstream.cache_value == NULL) {
  ------------------
  |  Branch (4814:13): [True: 0, False: 0]
  ------------------
 4815|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4816|      0|        }
 4817|       |
 4818|      0|        *plcf->upstream.cache_value = cv;
 4819|       |
 4820|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 4821|      0|    }
 4822|       |
 4823|      0|    plcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0,
 4824|      0|                                                      &ngx_http_proxy_module);
 4825|      0|    if (plcf->upstream.cache_zone == NULL) {
  ------------------
  |  Branch (4825:9): [True: 0, False: 0]
  ------------------
 4826|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4827|      0|    }
 4828|       |
 4829|      0|    return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 4830|      0|}

ngx_http_range_filter_module.c:ngx_http_range_header_filter_init:
  969|      1|{
  970|      1|    ngx_http_next_header_filter = ngx_http_top_header_filter;
  971|      1|    ngx_http_top_header_filter = ngx_http_range_header_filter;
  972|       |
  973|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  974|      1|}
ngx_http_range_filter_module.c:ngx_http_range_header_filter:
  148|      7|{
  149|      7|    time_t                        if_range_time;
  150|      7|    ngx_str_t                    *if_range, *etag;
  151|      7|    ngx_uint_t                    ranges;
  152|      7|    ngx_http_core_loc_conf_t     *clcf;
  153|      7|    ngx_http_range_filter_ctx_t  *ctx;
  154|       |
  155|      7|    if (r->http_version < NGX_HTTP_VERSION_10
  ------------------
  |  |   24|     14|#define NGX_HTTP_VERSION_10                1000
  ------------------
  |  Branch (155:9): [True: 4, False: 3]
  ------------------
  156|      7|        || r->headers_out.status != NGX_HTTP_OK
  ------------------
  |  |   78|     10|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (156:12): [True: 3, False: 0]
  ------------------
  157|      7|        || (r != r->main && !r->subrequest_ranges)
  ------------------
  |  Branch (157:13): [True: 0, False: 0]
  |  Branch (157:29): [True: 0, False: 0]
  ------------------
  158|      7|        || r->headers_out.content_length_n == -1
  ------------------
  |  Branch (158:12): [True: 0, False: 0]
  ------------------
  159|      7|        || !r->allow_ranges)
  ------------------
  |  Branch (159:12): [True: 0, False: 0]
  ------------------
  160|      7|    {
  161|      7|        return ngx_http_next_header_filter(r);
  162|      7|    }
  163|       |
  164|      0|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  165|       |
  166|      0|    if (clcf->max_ranges == 0) {
  ------------------
  |  Branch (166:9): [True: 0, False: 0]
  ------------------
  167|      0|        return ngx_http_next_header_filter(r);
  168|      0|    }
  169|       |
  170|      0|    if (r->headers_in.range == NULL
  ------------------
  |  Branch (170:9): [True: 0, False: 0]
  ------------------
  171|      0|        || r->headers_in.range->value.len < 7
  ------------------
  |  Branch (171:12): [True: 0, False: 0]
  ------------------
  172|      0|        || ngx_strncasecmp(r->headers_in.range->value.data,
  ------------------
  |  Branch (172:12): [True: 0, False: 0]
  ------------------
  173|      0|                           (u_char *) "bytes=", 6)
  174|      0|           != 0)
  175|      0|    {
  176|      0|        goto next_filter;
  177|      0|    }
  178|       |
  179|      0|    if (r->headers_in.if_range) {
  ------------------
  |  Branch (179:9): [True: 0, False: 0]
  ------------------
  180|       |
  181|      0|        if_range = &r->headers_in.if_range->value;
  182|       |
  183|      0|        if (if_range->len >= 2 && if_range->data[if_range->len - 1] == '"') {
  ------------------
  |  Branch (183:13): [True: 0, False: 0]
  |  Branch (183:35): [True: 0, False: 0]
  ------------------
  184|       |
  185|      0|            if (r->headers_out.etag == NULL) {
  ------------------
  |  Branch (185:17): [True: 0, False: 0]
  ------------------
  186|      0|                goto next_filter;
  187|      0|            }
  188|       |
  189|      0|            etag = &r->headers_out.etag->value;
  190|       |
  191|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  192|      0|                           "http ir:%V etag:%V", if_range, etag);
  193|       |
  194|      0|            if (if_range->len != etag->len
  ------------------
  |  Branch (194:17): [True: 0, False: 0]
  ------------------
  195|      0|                || ngx_strncmp(if_range->data, etag->data, etag->len) != 0)
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (195:20): [True: 0, False: 0]
  ------------------
  196|      0|            {
  197|      0|                goto next_filter;
  198|      0|            }
  199|       |
  200|      0|            goto parse;
  201|      0|        }
  202|       |
  203|      0|        if (r->headers_out.last_modified_time == (time_t) -1) {
  ------------------
  |  Branch (203:13): [True: 0, False: 0]
  ------------------
  204|      0|            goto next_filter;
  205|      0|        }
  206|       |
  207|      0|        if_range_time = ngx_parse_http_time(if_range->data, if_range->len);
  208|       |
  209|      0|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  210|      0|                       "http ir:%T lm:%T",
  211|      0|                       if_range_time, r->headers_out.last_modified_time);
  212|       |
  213|      0|        if (if_range_time != r->headers_out.last_modified_time) {
  ------------------
  |  Branch (213:13): [True: 0, False: 0]
  ------------------
  214|      0|            goto next_filter;
  215|      0|        }
  216|      0|    }
  217|       |
  218|      0|parse:
  219|       |
  220|      0|    ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_range_filter_ctx_t));
  221|      0|    if (ctx == NULL) {
  ------------------
  |  Branch (221:9): [True: 0, False: 0]
  ------------------
  222|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  223|      0|    }
  224|       |
  225|      0|    ctx->offset = r->headers_out.content_offset;
  226|       |
  227|      0|    ranges = r->single_range ? 1 : clcf->max_ranges;
  ------------------
  |  Branch (227:14): [True: 0, False: 0]
  ------------------
  228|       |
  229|      0|    switch (ngx_http_range_parse(r, ctx, ranges)) {
  230|       |
  231|      0|    case NGX_OK:
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (231:5): [True: 0, False: 0]
  ------------------
  232|      0|        ngx_http_set_ctx(r, ctx, ngx_http_range_body_filter_module);
  ------------------
  |  |   81|      0|#define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;
  ------------------
  233|       |
  234|      0|        r->headers_out.status = NGX_HTTP_PARTIAL_CONTENT;
  ------------------
  |  |   82|      0|#define NGX_HTTP_PARTIAL_CONTENT           206
  ------------------
  235|      0|        r->headers_out.status_line.len = 0;
  236|       |
  237|      0|        if (ctx->ranges.nelts == 1) {
  ------------------
  |  Branch (237:13): [True: 0, False: 0]
  ------------------
  238|      0|            return ngx_http_range_singlepart_header(r, ctx);
  239|      0|        }
  240|       |
  241|      0|        return ngx_http_range_multipart_header(r, ctx);
  242|       |
  243|      0|    case NGX_HTTP_RANGE_NOT_SATISFIABLE:
  ------------------
  |  |  104|      0|#define NGX_HTTP_RANGE_NOT_SATISFIABLE     416
  ------------------
  |  Branch (243:5): [True: 0, False: 0]
  ------------------
  244|      0|        return ngx_http_range_not_satisfiable(r);
  245|       |
  246|      0|    case NGX_ERROR:
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (246:5): [True: 0, False: 0]
  ------------------
  247|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  248|       |
  249|      0|    default: /* NGX_DECLINED */
  ------------------
  |  Branch (249:5): [True: 0, False: 0]
  ------------------
  250|      0|        break;
  251|      0|    }
  252|       |
  253|      0|next_filter:
  254|       |
  255|      0|    r->headers_out.accept_ranges = ngx_list_push(&r->headers_out.headers);
  256|      0|    if (r->headers_out.accept_ranges == NULL) {
  ------------------
  |  Branch (256:9): [True: 0, False: 0]
  ------------------
  257|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  258|      0|    }
  259|       |
  260|      0|    r->headers_out.accept_ranges->hash = 1;
  261|      0|    r->headers_out.accept_ranges->next = NULL;
  262|      0|    ngx_str_set(&r->headers_out.accept_ranges->key, "Accept-Ranges");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
  263|      0|    ngx_str_set(&r->headers_out.accept_ranges->value, "bytes");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
  264|       |
  265|      0|    return ngx_http_next_header_filter(r);
  266|      0|}
ngx_http_range_filter_module.c:ngx_http_range_body_filter_init:
  979|      1|{
  980|      1|    ngx_http_next_body_filter = ngx_http_top_body_filter;
  981|      1|    ngx_http_top_body_filter = ngx_http_range_body_filter;
  982|       |
  983|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  984|      1|}
ngx_http_range_filter_module.c:ngx_http_range_body_filter:
  641|     13|{
  642|     13|    ngx_http_range_filter_ctx_t  *ctx;
  643|       |
  644|     13|    if (in == NULL) {
  ------------------
  |  Branch (644:9): [True: 9, False: 4]
  ------------------
  645|      9|        return ngx_http_next_body_filter(r, in);
  646|      9|    }
  647|       |
  648|      4|    ctx = ngx_http_get_module_ctx(r, ngx_http_range_body_filter_module);
  ------------------
  |  |   80|      4|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
  649|       |
  650|      4|    if (ctx == NULL) {
  ------------------
  |  Branch (650:9): [True: 4, False: 0]
  ------------------
  651|      4|        return ngx_http_next_body_filter(r, in);
  652|      4|    }
  653|       |
  654|      0|    if (ctx->ranges.nelts == 1) {
  ------------------
  |  Branch (654:9): [True: 0, False: 0]
  ------------------
  655|      0|        return ngx_http_range_singlepart_body(r, ctx, in);
  656|      0|    }
  657|       |
  658|       |    /*
  659|       |     * multipart ranges are supported only if whole body is in a single buffer
  660|       |     */
  661|       |
  662|      0|    if (ngx_buf_special(in->buf)) {
  ------------------
  |  |  129|      0|    (((b)->flush || (b)->last_buf || (b)->sync)                              \
  |  |  ------------------
  |  |  |  Branch (129:7): [True: 0, False: 0]
  |  |  |  Branch (129:21): [True: 0, False: 0]
  |  |  |  Branch (129:38): [True: 0, False: 0]
  |  |  ------------------
  |  |  130|      0|     && !ngx_buf_in_memory(b) && !(b)->in_file)
  |  |  ------------------
  |  |  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (130:34): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  663|      0|        return ngx_http_next_body_filter(r, in);
  664|      0|    }
  665|       |
  666|      0|    if (ngx_http_range_test_overlapped(r, ctx, in) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  668|      0|    }
  669|       |
  670|      0|    return ngx_http_range_multipart_body(r, ctx, in);
  671|      0|}

ngx_http_referer_module.c:ngx_http_referer_add_variables:
  272|      1|{
  273|      1|    ngx_http_variable_t  *var;
  274|       |
  275|      1|    var = ngx_http_add_variable(cf, &ngx_http_invalid_referer_name,
  276|      1|                                NGX_HTTP_VAR_CHANGEABLE);
  ------------------
  |  |   29|      1|#define NGX_HTTP_VAR_CHANGEABLE   1
  ------------------
  277|      1|    if (var == NULL) {
  ------------------
  |  Branch (277:9): [True: 0, False: 1]
  ------------------
  278|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  279|      0|    }
  280|       |
  281|      1|    var->get_handler = ngx_http_referer_variable;
  282|       |
  283|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  284|      1|}
ngx_http_referer_module.c:ngx_http_referer_create_conf:
  289|      4|{
  290|      4|    ngx_http_referer_conf_t  *conf;
  291|       |
  292|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_referer_conf_t));
  293|      4|    if (conf == NULL) {
  ------------------
  |  Branch (293:9): [True: 0, False: 4]
  ------------------
  294|      0|        return NULL;
  295|      0|    }
  296|       |
  297|       |    /*
  298|       |     * set by ngx_pcalloc():
  299|       |     *
  300|       |     *     conf->hash = { NULL };
  301|       |     *     conf->server_names = 0;
  302|       |     *     conf->keys = NULL;
  303|       |     */
  304|       |
  305|      4|#if (NGX_PCRE)
  306|      4|    conf->regex = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  307|      4|    conf->server_name_regex = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  308|      4|#endif
  309|       |
  310|      4|    conf->no_referer = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  311|      4|    conf->blocked_referer = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  312|      4|    conf->referer_hash_max_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  313|      4|    conf->referer_hash_bucket_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  314|       |
  315|      4|    return conf;
  316|      4|}
ngx_http_referer_module.c:ngx_http_referer_merge_conf:
  321|      2|{
  322|      2|    ngx_http_referer_conf_t *prev = parent;
  323|      2|    ngx_http_referer_conf_t *conf = child;
  324|       |
  325|      2|    ngx_uint_t                 n;
  326|      2|    ngx_hash_init_t            hash;
  327|      2|    ngx_http_server_name_t    *sn;
  328|      2|    ngx_http_core_srv_conf_t  *cscf;
  329|       |
  330|      2|    if (conf->keys == NULL) {
  ------------------
  |  Branch (330:9): [True: 2, False: 0]
  ------------------
  331|      2|        conf->hash = prev->hash;
  332|       |
  333|      2|#if (NGX_PCRE)
  334|      2|        ngx_conf_merge_ptr_value(conf->regex, prev->regex, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
  335|      2|        ngx_conf_merge_ptr_value(conf->server_name_regex,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
  336|      2|                                 prev->server_name_regex, NULL);
  337|      2|#endif
  338|      2|        ngx_conf_merge_value(conf->no_referer, prev->no_referer, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  339|      2|        ngx_conf_merge_value(conf->blocked_referer, prev->blocked_referer, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  340|      2|        ngx_conf_merge_uint_value(conf->referer_hash_max_size,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  341|      2|                                  prev->referer_hash_max_size, 2048);
  342|      2|        ngx_conf_merge_uint_value(conf->referer_hash_bucket_size,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  343|      2|                                  prev->referer_hash_bucket_size, 64);
  344|       |
  345|      2|        return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  346|      2|    }
  347|       |
  348|      0|    if (conf->server_names == 1) {
  ------------------
  |  Branch (348:9): [True: 0, False: 0]
  ------------------
  349|      0|        cscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_core_module);
  ------------------
  |  |   64|      0|    ((ngx_http_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index]
  ------------------
  350|       |
  351|      0|        sn = cscf->server_names.elts;
  352|      0|        for (n = 0; n < cscf->server_names.nelts; n++) {
  ------------------
  |  Branch (352:21): [True: 0, False: 0]
  ------------------
  353|       |
  354|      0|#if (NGX_PCRE)
  355|      0|            if (sn[n].regex) {
  ------------------
  |  Branch (355:17): [True: 0, False: 0]
  ------------------
  356|       |
  357|      0|                if (ngx_http_add_regex_server_name(cf, conf, sn[n].regex)
  ------------------
  |  Branch (357:21): [True: 0, False: 0]
  ------------------
  358|      0|                    != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  359|      0|                {
  360|      0|                    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  361|      0|                }
  362|       |
  363|      0|                continue;
  364|      0|            }
  365|      0|#endif
  366|       |
  367|      0|            if (ngx_http_add_referer(cf, conf->keys, &sn[n].name, NULL)
  ------------------
  |  Branch (367:17): [True: 0, False: 0]
  ------------------
  368|      0|                != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  369|      0|            {
  370|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  371|      0|            }
  372|      0|        }
  373|      0|    }
  374|       |
  375|      0|    if ((conf->no_referer == 1 || conf->blocked_referer == 1)
  ------------------
  |  Branch (375:10): [True: 0, False: 0]
  |  Branch (375:35): [True: 0, False: 0]
  ------------------
  376|      0|        && conf->keys->keys.nelts == 0
  ------------------
  |  Branch (376:12): [True: 0, False: 0]
  ------------------
  377|      0|        && conf->keys->dns_wc_head.nelts == 0
  ------------------
  |  Branch (377:12): [True: 0, False: 0]
  ------------------
  378|      0|        && conf->keys->dns_wc_tail.nelts == 0)
  ------------------
  |  Branch (378:12): [True: 0, False: 0]
  ------------------
  379|      0|    {
  380|      0|        ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  381|      0|                      "the \"none\" or \"blocked\" referers are specified "
  382|      0|                      "in the \"valid_referers\" directive "
  383|      0|                      "without any valid referer");
  384|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  385|      0|    }
  386|       |
  387|      0|    ngx_conf_merge_uint_value(conf->referer_hash_max_size,
  ------------------
  |  |  216|      0|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      0|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  217|      0|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      0|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  218|      0|    }
  ------------------
  388|      0|                              prev->referer_hash_max_size, 2048);
  389|      0|    ngx_conf_merge_uint_value(conf->referer_hash_bucket_size,
  ------------------
  |  |  216|      0|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      0|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  217|      0|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      0|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  218|      0|    }
  ------------------
  390|      0|                              prev->referer_hash_bucket_size, 64);
  391|      0|    conf->referer_hash_bucket_size = ngx_align(conf->referer_hash_bucket_size,
  ------------------
  |  |  100|      0|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
  392|      0|                                               ngx_cacheline_size);
  393|       |
  394|      0|    hash.key = ngx_hash_key_lc;
  395|      0|    hash.max_size = conf->referer_hash_max_size;
  396|      0|    hash.bucket_size = conf->referer_hash_bucket_size;
  397|      0|    hash.name = "referer_hash";
  398|      0|    hash.pool = cf->pool;
  399|       |
  400|      0|    if (conf->keys->keys.nelts) {
  ------------------
  |  Branch (400:9): [True: 0, False: 0]
  ------------------
  401|      0|        hash.hash = &conf->hash.hash;
  402|      0|        hash.temp_pool = NULL;
  403|       |
  404|      0|        if (ngx_hash_init(&hash, conf->keys->keys.elts, conf->keys->keys.nelts)
  ------------------
  |  Branch (404:13): [True: 0, False: 0]
  ------------------
  405|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  406|      0|        {
  407|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  408|      0|        }
  409|      0|    }
  410|       |
  411|      0|    if (conf->keys->dns_wc_head.nelts) {
  ------------------
  |  Branch (411:9): [True: 0, False: 0]
  ------------------
  412|       |
  413|      0|        ngx_qsort(conf->keys->dns_wc_head.elts,
  ------------------
  |  |  231|      0|#define ngx_qsort             qsort
  ------------------
  414|      0|                  (size_t) conf->keys->dns_wc_head.nelts,
  415|      0|                  sizeof(ngx_hash_key_t),
  416|      0|                  ngx_http_cmp_referer_wildcards);
  417|       |
  418|      0|        hash.hash = NULL;
  419|      0|        hash.temp_pool = cf->temp_pool;
  420|       |
  421|      0|        if (ngx_hash_wildcard_init(&hash, conf->keys->dns_wc_head.elts,
  ------------------
  |  Branch (421:13): [True: 0, False: 0]
  ------------------
  422|      0|                                   conf->keys->dns_wc_head.nelts)
  423|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  424|      0|        {
  425|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  426|      0|        }
  427|       |
  428|      0|        conf->hash.wc_head = (ngx_hash_wildcard_t *) hash.hash;
  429|      0|    }
  430|       |
  431|      0|    if (conf->keys->dns_wc_tail.nelts) {
  ------------------
  |  Branch (431:9): [True: 0, False: 0]
  ------------------
  432|       |
  433|      0|        ngx_qsort(conf->keys->dns_wc_tail.elts,
  ------------------
  |  |  231|      0|#define ngx_qsort             qsort
  ------------------
  434|      0|                  (size_t) conf->keys->dns_wc_tail.nelts,
  435|      0|                  sizeof(ngx_hash_key_t),
  436|      0|                  ngx_http_cmp_referer_wildcards);
  437|       |
  438|      0|        hash.hash = NULL;
  439|      0|        hash.temp_pool = cf->temp_pool;
  440|       |
  441|      0|        if (ngx_hash_wildcard_init(&hash, conf->keys->dns_wc_tail.elts,
  ------------------
  |  Branch (441:13): [True: 0, False: 0]
  ------------------
  442|      0|                                   conf->keys->dns_wc_tail.nelts)
  443|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  444|      0|        {
  445|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  446|      0|        }
  447|       |
  448|      0|        conf->hash.wc_tail = (ngx_hash_wildcard_t *) hash.hash;
  449|      0|    }
  450|       |
  451|      0|#if (NGX_PCRE)
  452|      0|    ngx_conf_merge_ptr_value(conf->regex, prev->regex, NULL);
  ------------------
  |  |  211|      0|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      0|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  212|      0|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      0|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  213|      0|    }
  ------------------
  453|      0|    ngx_conf_merge_ptr_value(conf->server_name_regex, prev->server_name_regex,
  ------------------
  |  |  211|      0|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      0|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  212|      0|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      0|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  213|      0|    }
  ------------------
  454|      0|                             NULL);
  455|      0|#endif
  456|       |
  457|      0|    if (conf->no_referer == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      0|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (457:9): [True: 0, False: 0]
  ------------------
  458|      0|        conf->no_referer = 0;
  459|      0|    }
  460|       |
  461|      0|    if (conf->blocked_referer == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      0|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (461:9): [True: 0, False: 0]
  ------------------
  462|      0|        conf->blocked_referer = 0;
  463|      0|    }
  464|       |
  465|      0|    conf->keys = NULL;
  466|       |
  467|      0|    return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  468|      0|}

ngx_http_rewrite_module.c:ngx_http_rewrite_init:
  273|      1|{
  274|      1|    ngx_http_handler_pt        *h;
  275|      1|    ngx_http_core_main_conf_t  *cmcf;
  276|       |
  277|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  278|       |
  279|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_SERVER_REWRITE_PHASE].handlers);
  280|      1|    if (h == NULL) {
  ------------------
  |  Branch (280:9): [True: 0, False: 1]
  ------------------
  281|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  282|      0|    }
  283|       |
  284|      1|    *h = ngx_http_rewrite_handler;
  285|       |
  286|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers);
  287|      1|    if (h == NULL) {
  ------------------
  |  Branch (287:9): [True: 0, False: 1]
  ------------------
  288|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  289|      0|    }
  290|       |
  291|      1|    *h = ngx_http_rewrite_handler;
  292|       |
  293|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  294|      1|}
ngx_http_rewrite_module.c:ngx_http_rewrite_handler:
  138|     22|{
  139|     22|    ngx_int_t                     index;
  140|     22|    ngx_http_script_code_pt       code;
  141|     22|    ngx_http_script_engine_t     *e;
  142|     22|    ngx_http_core_srv_conf_t     *cscf;
  143|     22|    ngx_http_core_main_conf_t    *cmcf;
  144|     22|    ngx_http_rewrite_loc_conf_t  *rlcf;
  145|       |
  146|     22|    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  ------------------
  |  |   56|     22|    (r)->main_conf[module.ctx_index]
  ------------------
  147|     22|    cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|     22|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
  148|     22|    index = cmcf->phase_engine.location_rewrite_index;
  149|       |
  150|     22|    if (r->phase_handler == index && r->loc_conf == cscf->ctx->loc_conf) {
  ------------------
  |  Branch (150:9): [True: 11, False: 11]
  |  Branch (150:38): [True: 0, False: 11]
  ------------------
  151|       |        /* skipping location rewrite phase for server null location */
  152|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  153|      0|    }
  154|       |
  155|     22|    rlcf = ngx_http_get_module_loc_conf(r, ngx_http_rewrite_module);
  ------------------
  |  |   58|     22|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  156|       |
  157|     22|    if (rlcf->codes == NULL) {
  ------------------
  |  Branch (157:9): [True: 22, False: 0]
  ------------------
  158|     22|        return NGX_DECLINED;
  ------------------
  |  |   43|     22|#define  NGX_DECLINED   -5
  ------------------
  159|     22|    }
  160|       |
  161|      0|    e = ngx_pcalloc(r->pool, sizeof(ngx_http_script_engine_t));
  162|      0|    if (e == NULL) {
  ------------------
  |  Branch (162:9): [True: 0, False: 0]
  ------------------
  163|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  164|      0|    }
  165|       |
  166|      0|    e->sp = ngx_pcalloc(r->pool,
  167|      0|                        rlcf->stack_size * sizeof(ngx_http_variable_value_t));
  168|      0|    if (e->sp == NULL) {
  ------------------
  |  Branch (168:9): [True: 0, False: 0]
  ------------------
  169|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  170|      0|    }
  171|       |
  172|      0|    e->ip = rlcf->codes->elts;
  173|      0|    e->request = r;
  174|      0|    e->quote = 1;
  175|      0|    e->log = rlcf->log;
  176|      0|    e->status = NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  177|       |
  178|      0|    while (*(uintptr_t *) e->ip) {
  ------------------
  |  Branch (178:12): [True: 0, False: 0]
  ------------------
  179|      0|        code = *(ngx_http_script_code_pt *) e->ip;
  180|      0|        code(e);
  181|      0|    }
  182|       |
  183|      0|    return e->status;
  184|      0|}
ngx_http_rewrite_module.c:ngx_http_rewrite_create_loc_conf:
  223|      4|{
  224|      4|    ngx_http_rewrite_loc_conf_t  *conf;
  225|       |
  226|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_rewrite_loc_conf_t));
  227|      4|    if (conf == NULL) {
  ------------------
  |  Branch (227:9): [True: 0, False: 4]
  ------------------
  228|      0|        return NULL;
  229|      0|    }
  230|       |
  231|      4|    conf->stack_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  232|      4|    conf->log = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  233|      4|    conf->uninitialized_variable_warn = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  234|       |
  235|      4|    return conf;
  236|      4|}
ngx_http_rewrite_module.c:ngx_http_rewrite_merge_loc_conf:
  241|      2|{
  242|      2|    ngx_http_rewrite_loc_conf_t *prev = parent;
  243|      2|    ngx_http_rewrite_loc_conf_t *conf = child;
  244|       |
  245|      2|    uintptr_t  *code;
  246|       |
  247|      2|    ngx_conf_merge_value(conf->log, prev->log, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  248|      2|    ngx_conf_merge_value(conf->uninitialized_variable_warn,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  249|      2|                         prev->uninitialized_variable_warn, 1);
  250|      2|    ngx_conf_merge_uint_value(conf->stack_size, prev->stack_size, 10);
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  251|       |
  252|      2|    if (conf->codes == NULL) {
  ------------------
  |  Branch (252:9): [True: 2, False: 0]
  ------------------
  253|      2|        return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  254|      2|    }
  255|       |
  256|      0|    if (conf->codes == prev->codes) {
  ------------------
  |  Branch (256:9): [True: 0, False: 0]
  ------------------
  257|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  258|      0|    }
  259|       |
  260|      0|    code = ngx_array_push_n(conf->codes, sizeof(uintptr_t));
  261|      0|    if (code == NULL) {
  ------------------
  |  Branch (261:9): [True: 0, False: 0]
  ------------------
  262|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  263|      0|    }
  264|       |
  265|      0|    *code = (uintptr_t) NULL;
  266|       |
  267|      0|    return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
  268|      0|}

ngx_http_scgi_module.c:ngx_http_scgi_create_main_conf:
 1252|      1|{
 1253|      1|    ngx_http_scgi_main_conf_t  *conf;
 1254|       |
 1255|      1|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_scgi_main_conf_t));
 1256|      1|    if (conf == NULL) {
  ------------------
  |  Branch (1256:9): [True: 0, False: 1]
  ------------------
 1257|      0|        return NULL;
 1258|      0|    }
 1259|       |
 1260|      1|#if (NGX_HTTP_CACHE)
 1261|      1|    if (ngx_array_init(&conf->caches, cf->pool, 4,
  ------------------
  |  Branch (1261:9): [True: 0, False: 1]
  ------------------
 1262|      1|                       sizeof(ngx_http_file_cache_t *))
 1263|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1264|      0|    {
 1265|      0|        return NULL;
 1266|      0|    }
 1267|      1|#endif
 1268|       |
 1269|      1|    return conf;
 1270|      1|}
ngx_http_scgi_module.c:ngx_http_scgi_create_loc_conf:
 1275|      4|{
 1276|      4|    ngx_http_scgi_loc_conf_t  *conf;
 1277|       |
 1278|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_scgi_loc_conf_t));
 1279|      4|    if (conf == NULL) {
  ------------------
  |  Branch (1279:9): [True: 0, False: 4]
  ------------------
 1280|      0|        return NULL;
 1281|      0|    }
 1282|       |
 1283|      4|    conf->upstream.store = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1284|      4|    conf->upstream.store_access = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1285|      4|    conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1286|      4|    conf->upstream.buffering = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1287|      4|    conf->upstream.request_buffering = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1288|      4|    conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1289|      4|    conf->upstream.force_ranges = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1290|       |
 1291|      4|    conf->upstream.local = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1292|      4|    conf->upstream.socket_keepalive = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1293|       |
 1294|      4|    conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1295|      4|    conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1296|      4|    conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1297|      4|    conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1298|       |
 1299|      4|    conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1300|      4|    conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1301|      4|    conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1302|       |
 1303|      4|    conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1304|      4|    conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1305|      4|    conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1306|       |
 1307|      4|    conf->upstream.pass_request_headers = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1308|      4|    conf->upstream.pass_request_body = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1309|       |
 1310|      4|#if (NGX_HTTP_CACHE)
 1311|      4|    conf->upstream.cache = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1312|      4|    conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1313|      4|    conf->upstream.cache_max_range_offset = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1314|      4|    conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1315|      4|    conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1316|      4|    conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1317|      4|    conf->upstream.cache_lock = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1318|      4|    conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1319|      4|    conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1320|      4|    conf->upstream.cache_revalidate = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1321|      4|    conf->upstream.cache_background_update = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1322|      4|#endif
 1323|       |
 1324|      4|    conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1325|      4|    conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1326|       |
 1327|      4|    conf->upstream.intercept_errors = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1328|       |
 1329|       |    /* "scgi_cyclic_temp_file" is disabled */
 1330|      4|    conf->upstream.cyclic_temp_file = 0;
 1331|       |
 1332|      4|    conf->upstream.change_buffering = 1;
 1333|       |
 1334|      4|    ngx_str_set(&conf->upstream.module, "scgi");
  ------------------
  |  |   43|      4|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 1335|       |
 1336|      4|    return conf;
 1337|      4|}
ngx_http_scgi_module.c:ngx_http_scgi_merge_loc_conf:
 1342|      2|{
 1343|      2|    ngx_http_scgi_loc_conf_t *prev = parent;
 1344|      2|    ngx_http_scgi_loc_conf_t *conf = child;
 1345|       |
 1346|      2|    size_t                        size;
 1347|      2|    ngx_int_t                     rc;
 1348|      2|    ngx_hash_init_t               hash;
 1349|      2|    ngx_http_core_loc_conf_t     *clcf;
 1350|       |
 1351|      2|#if (NGX_HTTP_CACHE)
 1352|       |
 1353|      2|    if (conf->upstream.store > 0) {
  ------------------
  |  Branch (1353:9): [True: 0, False: 2]
  ------------------
 1354|      0|        conf->upstream.cache = 0;
 1355|      0|    }
 1356|       |
 1357|      2|    if (conf->upstream.cache > 0) {
  ------------------
  |  Branch (1357:9): [True: 0, False: 2]
  ------------------
 1358|      0|        conf->upstream.store = 0;
 1359|      0|    }
 1360|       |
 1361|      2|#endif
 1362|       |
 1363|      2|    if (conf->upstream.store == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      2|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (1363:9): [True: 2, False: 0]
  ------------------
 1364|      2|        ngx_conf_merge_value(conf->upstream.store, prev->upstream.store, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1365|       |
 1366|      2|        conf->upstream.store_lengths = prev->upstream.store_lengths;
 1367|      2|        conf->upstream.store_values = prev->upstream.store_values;
 1368|      2|    }
 1369|       |
 1370|      2|    ngx_conf_merge_uint_value(conf->upstream.store_access,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 1371|      2|                              prev->upstream.store_access, 0600);
 1372|       |
 1373|      2|    ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 1374|      2|                              prev->upstream.next_upstream_tries, 0);
 1375|       |
 1376|      2|    ngx_conf_merge_value(conf->upstream.buffering,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1377|      2|                              prev->upstream.buffering, 1);
 1378|       |
 1379|      2|    ngx_conf_merge_value(conf->upstream.request_buffering,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1380|      2|                              prev->upstream.request_buffering, 1);
 1381|       |
 1382|      2|    ngx_conf_merge_value(conf->upstream.ignore_client_abort,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1383|      2|                              prev->upstream.ignore_client_abort, 0);
 1384|       |
 1385|      2|    ngx_conf_merge_value(conf->upstream.force_ranges,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1386|      2|                              prev->upstream.force_ranges, 0);
 1387|       |
 1388|      2|    ngx_conf_merge_ptr_value(conf->upstream.local,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 1389|      2|                              prev->upstream.local, NULL);
 1390|       |
 1391|      2|    ngx_conf_merge_value(conf->upstream.socket_keepalive,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1392|      2|                              prev->upstream.socket_keepalive, 0);
 1393|       |
 1394|      2|    ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1395|      2|                              prev->upstream.connect_timeout, 60000);
 1396|       |
 1397|      2|    ngx_conf_merge_msec_value(conf->upstream.send_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1398|      2|                              prev->upstream.send_timeout, 60000);
 1399|       |
 1400|      2|    ngx_conf_merge_msec_value(conf->upstream.read_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1401|      2|                              prev->upstream.read_timeout, 60000);
 1402|       |
 1403|      2|    ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1404|      2|                              prev->upstream.next_upstream_timeout, 0);
 1405|       |
 1406|      2|    ngx_conf_merge_size_value(conf->upstream.send_lowat,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1407|      2|                              prev->upstream.send_lowat, 0);
 1408|       |
 1409|      2|    ngx_conf_merge_size_value(conf->upstream.buffer_size,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1410|      2|                              prev->upstream.buffer_size,
 1411|      2|                              (size_t) ngx_pagesize);
 1412|       |
 1413|      2|    ngx_conf_merge_size_value(conf->upstream.limit_rate,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1414|      2|                              prev->upstream.limit_rate, 0);
 1415|       |
 1416|       |
 1417|      2|    ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
  ------------------
  |  |  252|      2|    if (conf.num == 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  253|      2|        if (prev.num) {                                                      \
  |  |  ------------------
  |  |  |  Branch (253:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  254|      1|            conf.num = prev.num;                                             \
  |  |  255|      1|            conf.size = prev.size;                                           \
  |  |  256|      1|        } else {                                                             \
  |  |  257|      1|            conf.num = default_num;                                          \
  |  |  258|      1|            conf.size = default_size;                                        \
  |  |  259|      1|        }                                                                    \
  |  |  260|      2|    }
  ------------------
 1418|      2|                              8, ngx_pagesize);
 1419|       |
 1420|      2|    if (conf->upstream.bufs.num < 2) {
  ------------------
  |  Branch (1420:9): [True: 0, False: 2]
  ------------------
 1421|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1422|      0|                           "there must be at least 2 \"scgi_buffers\"");
 1423|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1424|      0|    }
 1425|       |
 1426|       |
 1427|      2|    size = conf->upstream.buffer_size;
 1428|      2|    if (size < conf->upstream.bufs.size) {
  ------------------
  |  Branch (1428:9): [True: 0, False: 2]
  ------------------
 1429|      0|        size = conf->upstream.bufs.size;
 1430|      0|    }
 1431|       |
 1432|       |
 1433|      2|    ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1434|      2|                              prev->upstream.busy_buffers_size_conf,
 1435|      2|                              NGX_CONF_UNSET_SIZE);
 1436|       |
 1437|      2|    if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (1437:9): [True: 2, False: 0]
  ------------------
 1438|      2|        conf->upstream.busy_buffers_size = 2 * size;
 1439|      2|    } else {
 1440|      0|        conf->upstream.busy_buffers_size =
 1441|      0|            conf->upstream.busy_buffers_size_conf;
 1442|      0|    }
 1443|       |
 1444|      2|    if (conf->upstream.busy_buffers_size < size) {
  ------------------
  |  Branch (1444:9): [True: 0, False: 2]
  ------------------
 1445|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1446|      0|            "\"scgi_busy_buffers_size\" must be equal to or greater "
 1447|      0|            "than the maximum of the value of \"scgi_buffer_size\" and "
 1448|      0|            "one of the \"scgi_buffers\"");
 1449|       |
 1450|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1451|      0|    }
 1452|       |
 1453|      2|    if (conf->upstream.busy_buffers_size
  ------------------
  |  Branch (1453:9): [True: 0, False: 2]
  ------------------
 1454|      2|        > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
 1455|      0|    {
 1456|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1457|      0|            "\"scgi_busy_buffers_size\" must be less than "
 1458|      0|            "the size of all \"scgi_buffers\" minus one buffer");
 1459|       |
 1460|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1461|      0|    }
 1462|       |
 1463|       |
 1464|      2|    ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1465|      2|                              prev->upstream.temp_file_write_size_conf,
 1466|      2|                              NGX_CONF_UNSET_SIZE);
 1467|       |
 1468|      2|    if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (1468:9): [True: 2, False: 0]
  ------------------
 1469|      2|        conf->upstream.temp_file_write_size = 2 * size;
 1470|      2|    } else {
 1471|      0|        conf->upstream.temp_file_write_size =
 1472|      0|            conf->upstream.temp_file_write_size_conf;
 1473|      0|    }
 1474|       |
 1475|      2|    if (conf->upstream.temp_file_write_size < size) {
  ------------------
  |  Branch (1475:9): [True: 0, False: 2]
  ------------------
 1476|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1477|      0|            "\"scgi_temp_file_write_size\" must be equal to or greater than "
 1478|      0|            "the maximum of the value of \"scgi_buffer_size\" and "
 1479|      0|            "one of the \"scgi_buffers\"");
 1480|       |
 1481|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1482|      0|    }
 1483|       |
 1484|       |
 1485|      2|    ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1486|      2|                              prev->upstream.max_temp_file_size_conf,
 1487|      2|                              NGX_CONF_UNSET_SIZE);
 1488|       |
 1489|      2|    if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (1489:9): [True: 2, False: 0]
  ------------------
 1490|      2|        conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
 1491|      2|    } else {
 1492|      0|        conf->upstream.max_temp_file_size =
 1493|      0|            conf->upstream.max_temp_file_size_conf;
 1494|      0|    }
 1495|       |
 1496|      2|    if (conf->upstream.max_temp_file_size != 0
  ------------------
  |  Branch (1496:9): [True: 2, False: 0]
  ------------------
 1497|      2|        && conf->upstream.max_temp_file_size < size)
  ------------------
  |  Branch (1497:12): [True: 0, False: 2]
  ------------------
 1498|      0|    {
 1499|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1500|      0|            "\"scgi_max_temp_file_size\" must be equal to zero to disable "
 1501|      0|            "temporary files usage or must be equal to or greater than "
 1502|      0|            "the maximum of the value of \"scgi_buffer_size\" and "
 1503|      0|            "one of the \"scgi_buffers\"");
 1504|       |
 1505|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1506|      0|    }
 1507|       |
 1508|       |
 1509|      2|    ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 1510|      2|                                 prev->upstream.ignore_headers,
 1511|      2|                                 NGX_CONF_BITMASK_SET);
 1512|       |
 1513|       |
 1514|      2|    ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 1515|      2|                                 prev->upstream.next_upstream,
 1516|      2|                                 (NGX_CONF_BITMASK_SET
 1517|      2|                                  |NGX_HTTP_UPSTREAM_FT_ERROR
 1518|      2|                                  |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
 1519|       |
 1520|      2|    if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (1520:9): [True: 0, False: 2]
  ------------------
 1521|      0|        conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      0|#define NGX_CONF_BITMASK_SET  1
  ------------------
 1522|      0|                                       |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      0|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
 1523|      0|    }
 1524|       |
 1525|      2|    if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
  ------------------
  |  Branch (1525:9): [True: 0, False: 2]
  ------------------
 1526|      2|                                  prev->upstream.temp_path,
 1527|      2|                                  &ngx_http_scgi_temp_path)
 1528|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 1529|      0|    {
 1530|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1531|      0|    }
 1532|       |
 1533|      2|#if (NGX_HTTP_CACHE)
 1534|       |
 1535|      2|    if (conf->upstream.cache == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      2|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (1535:9): [True: 2, False: 0]
  ------------------
 1536|      2|        ngx_conf_merge_value(conf->upstream.cache,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1537|      2|                              prev->upstream.cache, 0);
 1538|       |
 1539|      2|        conf->upstream.cache_zone = prev->upstream.cache_zone;
 1540|      2|        conf->upstream.cache_value = prev->upstream.cache_value;
 1541|      2|    }
 1542|       |
 1543|      2|    if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) {
  ------------------
  |  Branch (1543:9): [True: 0, False: 2]
  |  Branch (1543:38): [True: 0, False: 0]
  ------------------
 1544|      0|        ngx_shm_zone_t  *shm_zone;
 1545|       |
 1546|      0|        shm_zone = conf->upstream.cache_zone;
 1547|       |
 1548|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1549|      0|                           "\"scgi_cache\" zone \"%V\" is unknown",
 1550|      0|                           &shm_zone->shm.name);
 1551|       |
 1552|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1553|      0|    }
 1554|       |
 1555|      2|    ngx_conf_merge_uint_value(conf->upstream.cache_min_uses,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 1556|      2|                              prev->upstream.cache_min_uses, 1);
 1557|       |
 1558|      2|    ngx_conf_merge_off_value(conf->upstream.cache_max_range_offset,
  ------------------
  |  |  236|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (236:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  237|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (237:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  238|      2|    }
  ------------------
 1559|      2|                              prev->upstream.cache_max_range_offset,
 1560|      2|                              NGX_MAX_OFF_T_VALUE);
 1561|       |
 1562|      2|    ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 1563|      2|                              prev->upstream.cache_use_stale,
 1564|      2|                              (NGX_CONF_BITMASK_SET
 1565|      2|                               |NGX_HTTP_UPSTREAM_FT_OFF));
 1566|       |
 1567|      2|    if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (1567:9): [True: 2, False: 0]
  ------------------
 1568|      2|        conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      2|#define NGX_CONF_BITMASK_SET  1
  ------------------
 1569|      2|                                         |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
 1570|      2|    }
 1571|       |
 1572|      2|    if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_ERROR) {
  ------------------
  |  |   20|      2|#define NGX_HTTP_UPSTREAM_FT_ERROR           0x00000002
  ------------------
  |  Branch (1572:9): [True: 0, False: 2]
  ------------------
 1573|      0|        conf->upstream.cache_use_stale |= NGX_HTTP_UPSTREAM_FT_NOLIVE;
  ------------------
  |  |   34|      0|#define NGX_HTTP_UPSTREAM_FT_NOLIVE          0x40000000
  ------------------
 1574|      0|    }
 1575|       |
 1576|      2|    if (conf->upstream.cache_methods == 0) {
  ------------------
  |  Branch (1576:9): [True: 2, False: 0]
  ------------------
 1577|      2|        conf->upstream.cache_methods = prev->upstream.cache_methods;
 1578|      2|    }
 1579|       |
 1580|      2|    conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
  ------------------
  |  |   30|      2|#define NGX_HTTP_GET                       0x00000002
  ------------------
                  conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
  ------------------
  |  |   31|      2|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
 1581|       |
 1582|      2|    ngx_conf_merge_ptr_value(conf->upstream.cache_bypass,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 1583|      2|                             prev->upstream.cache_bypass, NULL);
 1584|       |
 1585|      2|    ngx_conf_merge_ptr_value(conf->upstream.no_cache,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 1586|      2|                             prev->upstream.no_cache, NULL);
 1587|       |
 1588|      2|    ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 1589|      2|                             prev->upstream.cache_valid, NULL);
 1590|       |
 1591|      2|    if (conf->cache_key.value.data == NULL) {
  ------------------
  |  Branch (1591:9): [True: 2, False: 0]
  ------------------
 1592|      2|        conf->cache_key = prev->cache_key;
 1593|      2|    }
 1594|       |
 1595|      2|    if (conf->upstream.cache && conf->cache_key.value.data == NULL) {
  ------------------
  |  Branch (1595:9): [True: 0, False: 2]
  |  Branch (1595:33): [True: 0, False: 0]
  ------------------
 1596|      0|        ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
  ------------------
  |  |   21|      0|#define NGX_LOG_WARN              5
  ------------------
 1597|      0|                           "no \"scgi_cache_key\" for \"scgi_cache\"");
 1598|      0|    }
 1599|       |
 1600|      2|    ngx_conf_merge_value(conf->upstream.cache_lock,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1601|      2|                              prev->upstream.cache_lock, 0);
 1602|       |
 1603|      2|    ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1604|      2|                              prev->upstream.cache_lock_timeout, 5000);
 1605|       |
 1606|      2|    ngx_conf_merge_msec_value(conf->upstream.cache_lock_age,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1607|      2|                              prev->upstream.cache_lock_age, 5000);
 1608|       |
 1609|      2|    ngx_conf_merge_value(conf->upstream.cache_revalidate,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1610|      2|                              prev->upstream.cache_revalidate, 0);
 1611|       |
 1612|      2|    ngx_conf_merge_value(conf->upstream.cache_background_update,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1613|      2|                              prev->upstream.cache_background_update, 0);
 1614|       |
 1615|      2|#endif
 1616|       |
 1617|      2|    ngx_conf_merge_value(conf->upstream.pass_request_headers,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1618|      2|                         prev->upstream.pass_request_headers, 1);
 1619|      2|    ngx_conf_merge_value(conf->upstream.pass_request_body,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1620|      2|                         prev->upstream.pass_request_body, 1);
 1621|       |
 1622|      2|    ngx_conf_merge_value(conf->upstream.intercept_errors,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1623|      2|                         prev->upstream.intercept_errors, 0);
 1624|       |
 1625|      2|    hash.max_size = 512;
 1626|      2|    hash.bucket_size = ngx_align(64, ngx_cacheline_size);
  ------------------
  |  |  100|      2|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
 1627|      2|    hash.name = "scgi_hide_headers_hash";
 1628|       |
 1629|      2|    if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
  ------------------
  |  Branch (1629:9): [True: 0, False: 2]
  ------------------
 1630|      2|            &prev->upstream, ngx_http_scgi_hide_headers, &hash)
 1631|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 1632|      0|    {
 1633|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1634|      0|    }
 1635|       |
 1636|      2|    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
  ------------------
  |  |   66|      2|    ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index]
  ------------------
 1637|       |
 1638|      2|    if (clcf->noname
  ------------------
  |  Branch (1638:9): [True: 0, False: 2]
  ------------------
 1639|      2|        && conf->upstream.upstream == NULL && conf->scgi_lengths == NULL)
  ------------------
  |  Branch (1639:12): [True: 0, False: 0]
  |  Branch (1639:47): [True: 0, False: 0]
  ------------------
 1640|      0|    {
 1641|      0|        conf->upstream.upstream = prev->upstream.upstream;
 1642|      0|        conf->scgi_lengths = prev->scgi_lengths;
 1643|      0|        conf->scgi_values = prev->scgi_values;
 1644|      0|    }
 1645|       |
 1646|      2|    if (clcf->lmt_excpt && clcf->handler == NULL
  ------------------
  |  Branch (1646:9): [True: 0, False: 2]
  |  Branch (1646:28): [True: 0, False: 0]
  ------------------
 1647|      2|        && (conf->upstream.upstream || conf->scgi_lengths))
  ------------------
  |  Branch (1647:13): [True: 0, False: 0]
  |  Branch (1647:40): [True: 0, False: 0]
  ------------------
 1648|      0|    {
 1649|      0|        clcf->handler = ngx_http_scgi_handler;
 1650|      0|    }
 1651|       |
 1652|      2|    if (conf->params_source == NULL) {
  ------------------
  |  Branch (1652:9): [True: 2, False: 0]
  ------------------
 1653|      2|        conf->params = prev->params;
 1654|      2|#if (NGX_HTTP_CACHE)
 1655|      2|        conf->params_cache = prev->params_cache;
 1656|      2|#endif
 1657|      2|        conf->params_source = prev->params_source;
 1658|      2|    }
 1659|       |
 1660|      2|    rc = ngx_http_scgi_init_params(cf, conf, &conf->params, NULL);
 1661|      2|    if (rc != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (1661:9): [True: 0, False: 2]
  ------------------
 1662|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1663|      0|    }
 1664|       |
 1665|      2|#if (NGX_HTTP_CACHE)
 1666|       |
 1667|      2|    if (conf->upstream.cache) {
  ------------------
  |  Branch (1667:9): [True: 0, False: 2]
  ------------------
 1668|      0|        rc = ngx_http_scgi_init_params(cf, conf, &conf->params_cache,
 1669|      0|                                       ngx_http_scgi_cache_headers);
 1670|      0|        if (rc != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1670:13): [True: 0, False: 0]
  ------------------
 1671|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1672|      0|        }
 1673|      0|    }
 1674|       |
 1675|      2|#endif
 1676|       |
 1677|       |    /*
 1678|       |     * special handling to preserve conf->params in the "http" section
 1679|       |     * to inherit it to all servers
 1680|       |     */
 1681|       |
 1682|      2|    if (prev->params.hash.buckets == NULL
  ------------------
  |  Branch (1682:9): [True: 1, False: 1]
  ------------------
 1683|      2|        && conf->params_source == prev->params_source)
  ------------------
  |  Branch (1683:12): [True: 1, False: 0]
  ------------------
 1684|      1|    {
 1685|      1|        prev->params = conf->params;
 1686|      1|#if (NGX_HTTP_CACHE)
 1687|      1|        prev->params_cache = conf->params_cache;
 1688|      1|#endif
 1689|      1|    }
 1690|       |
 1691|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 1692|      2|}
ngx_http_scgi_module.c:ngx_http_scgi_init_params:
 1698|      2|{
 1699|      2|    u_char                       *p;
 1700|      2|    size_t                        size;
 1701|      2|    uintptr_t                    *code;
 1702|      2|    ngx_uint_t                    i, nsrc;
 1703|      2|    ngx_array_t                   headers_names, params_merged;
 1704|      2|    ngx_keyval_t                 *h;
 1705|      2|    ngx_hash_key_t               *hk;
 1706|      2|    ngx_hash_init_t               hash;
 1707|      2|    ngx_http_upstream_param_t    *src, *s;
 1708|      2|    ngx_http_script_compile_t     sc;
 1709|      2|    ngx_http_script_copy_code_t  *copy;
 1710|       |
 1711|      2|    if (params->hash.buckets) {
  ------------------
  |  Branch (1711:9): [True: 1, False: 1]
  ------------------
 1712|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1713|      1|    }
 1714|       |
 1715|      1|    if (conf->params_source == NULL && default_params == NULL) {
  ------------------
  |  Branch (1715:9): [True: 1, False: 0]
  |  Branch (1715:40): [True: 1, False: 0]
  ------------------
 1716|      1|        params->hash.buckets = (void *) 1;
 1717|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1718|      1|    }
 1719|       |
 1720|      0|    params->lengths = ngx_array_create(cf->pool, 64, 1);
 1721|      0|    if (params->lengths == NULL) {
  ------------------
  |  Branch (1721:9): [True: 0, False: 0]
  ------------------
 1722|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1723|      0|    }
 1724|       |
 1725|      0|    params->values = ngx_array_create(cf->pool, 512, 1);
 1726|      0|    if (params->values == NULL) {
  ------------------
  |  Branch (1726:9): [True: 0, False: 0]
  ------------------
 1727|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1728|      0|    }
 1729|       |
 1730|      0|    if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
  ------------------
  |  Branch (1730:9): [True: 0, False: 0]
  ------------------
 1731|      0|        != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1732|      0|    {
 1733|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1734|      0|    }
 1735|       |
 1736|      0|    if (conf->params_source) {
  ------------------
  |  Branch (1736:9): [True: 0, False: 0]
  ------------------
 1737|      0|        src = conf->params_source->elts;
 1738|      0|        nsrc = conf->params_source->nelts;
 1739|       |
 1740|      0|    } else {
 1741|      0|        src = NULL;
 1742|      0|        nsrc = 0;
 1743|      0|    }
 1744|       |
 1745|      0|    if (default_params) {
  ------------------
  |  Branch (1745:9): [True: 0, False: 0]
  ------------------
 1746|      0|        if (ngx_array_init(&params_merged, cf->temp_pool, 4,
  ------------------
  |  Branch (1746:13): [True: 0, False: 0]
  ------------------
 1747|      0|                           sizeof(ngx_http_upstream_param_t))
 1748|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1749|      0|        {
 1750|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1751|      0|        }
 1752|       |
 1753|      0|        for (i = 0; i < nsrc; i++) {
  ------------------
  |  Branch (1753:21): [True: 0, False: 0]
  ------------------
 1754|       |
 1755|      0|            s = ngx_array_push(&params_merged);
 1756|      0|            if (s == NULL) {
  ------------------
  |  Branch (1756:17): [True: 0, False: 0]
  ------------------
 1757|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1758|      0|            }
 1759|       |
 1760|      0|            *s = src[i];
 1761|      0|        }
 1762|       |
 1763|      0|        h = default_params;
 1764|       |
 1765|      0|        while (h->key.len) {
  ------------------
  |  Branch (1765:16): [True: 0, False: 0]
  ------------------
 1766|       |
 1767|      0|            src = params_merged.elts;
 1768|      0|            nsrc = params_merged.nelts;
 1769|       |
 1770|      0|            for (i = 0; i < nsrc; i++) {
  ------------------
  |  Branch (1770:25): [True: 0, False: 0]
  ------------------
 1771|      0|                if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
  ------------------
  |  Branch (1771:21): [True: 0, False: 0]
  ------------------
 1772|      0|                    goto next;
 1773|      0|                }
 1774|      0|            }
 1775|       |
 1776|      0|            s = ngx_array_push(&params_merged);
 1777|      0|            if (s == NULL) {
  ------------------
  |  Branch (1777:17): [True: 0, False: 0]
  ------------------
 1778|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1779|      0|            }
 1780|       |
 1781|      0|            s->key = h->key;
 1782|      0|            s->value = h->value;
 1783|      0|            s->skip_empty = 1;
 1784|       |
 1785|      0|        next:
 1786|       |
 1787|      0|            h++;
 1788|      0|        }
 1789|       |
 1790|      0|        src = params_merged.elts;
 1791|      0|        nsrc = params_merged.nelts;
 1792|      0|    }
 1793|       |
 1794|      0|    for (i = 0; i < nsrc; i++) {
  ------------------
  |  Branch (1794:17): [True: 0, False: 0]
  ------------------
 1795|       |
 1796|      0|        if (src[i].key.len > sizeof("HTTP_") - 1
  ------------------
  |  Branch (1796:13): [True: 0, False: 0]
  ------------------
 1797|      0|            && ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0)
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (1797:16): [True: 0, False: 0]
  ------------------
 1798|      0|        {
 1799|      0|            hk = ngx_array_push(&headers_names);
 1800|      0|            if (hk == NULL) {
  ------------------
  |  Branch (1800:17): [True: 0, False: 0]
  ------------------
 1801|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1802|      0|            }
 1803|       |
 1804|      0|            hk->key.len = src[i].key.len - 5;
 1805|      0|            hk->key.data = src[i].key.data + 5;
 1806|      0|            hk->key_hash = ngx_hash_key_lc(hk->key.data, hk->key.len);
 1807|      0|            hk->value = (void *) 1;
 1808|       |
 1809|      0|            if (src[i].value.len == 0) {
  ------------------
  |  Branch (1809:17): [True: 0, False: 0]
  ------------------
 1810|      0|                continue;
 1811|      0|            }
 1812|      0|        }
 1813|       |
 1814|      0|        copy = ngx_array_push_n(params->lengths,
 1815|      0|                                sizeof(ngx_http_script_copy_code_t));
 1816|      0|        if (copy == NULL) {
  ------------------
  |  Branch (1816:13): [True: 0, False: 0]
  ------------------
 1817|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1818|      0|        }
 1819|       |
 1820|      0|        copy->code = (ngx_http_script_code_pt) (void *)
 1821|      0|                                                 ngx_http_script_copy_len_code;
 1822|      0|        copy->len = src[i].key.len + 1;
 1823|       |
 1824|      0|        copy = ngx_array_push_n(params->lengths,
 1825|      0|                                sizeof(ngx_http_script_copy_code_t));
 1826|      0|        if (copy == NULL) {
  ------------------
  |  Branch (1826:13): [True: 0, False: 0]
  ------------------
 1827|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1828|      0|        }
 1829|       |
 1830|      0|        copy->code = (ngx_http_script_code_pt) (void *)
 1831|      0|                                                 ngx_http_script_copy_len_code;
 1832|      0|        copy->len = src[i].skip_empty;
 1833|       |
 1834|       |
 1835|      0|        size = (sizeof(ngx_http_script_copy_code_t)
 1836|      0|                + src[i].key.len + 1 + sizeof(uintptr_t) - 1)
 1837|      0|               & ~(sizeof(uintptr_t) - 1);
 1838|       |
 1839|      0|        copy = ngx_array_push_n(params->values, size);
 1840|      0|        if (copy == NULL) {
  ------------------
  |  Branch (1840:13): [True: 0, False: 0]
  ------------------
 1841|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1842|      0|        }
 1843|       |
 1844|      0|        copy->code = ngx_http_script_copy_code;
 1845|      0|        copy->len = src[i].key.len + 1;
 1846|       |
 1847|      0|        p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
 1848|      0|        (void) ngx_cpystrn(p, src[i].key.data, src[i].key.len + 1);
 1849|       |
 1850|       |
 1851|      0|        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1852|       |
 1853|      0|        sc.cf = cf;
 1854|      0|        sc.source = &src[i].value;
 1855|      0|        sc.flushes = &params->flushes;
 1856|      0|        sc.lengths = &params->lengths;
 1857|      0|        sc.values = &params->values;
 1858|       |
 1859|      0|        if (ngx_http_script_compile(&sc) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1859:13): [True: 0, False: 0]
  ------------------
 1860|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1861|      0|        }
 1862|       |
 1863|      0|        code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
 1864|      0|        if (code == NULL) {
  ------------------
  |  Branch (1864:13): [True: 0, False: 0]
  ------------------
 1865|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1866|      0|        }
 1867|       |
 1868|      0|        *code = (uintptr_t) NULL;
 1869|       |
 1870|       |
 1871|      0|        code = ngx_array_push_n(params->values, sizeof(uintptr_t));
 1872|      0|        if (code == NULL) {
  ------------------
  |  Branch (1872:13): [True: 0, False: 0]
  ------------------
 1873|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1874|      0|        }
 1875|       |
 1876|      0|        *code = (uintptr_t) NULL;
 1877|      0|    }
 1878|       |
 1879|      0|    code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
 1880|      0|    if (code == NULL) {
  ------------------
  |  Branch (1880:9): [True: 0, False: 0]
  ------------------
 1881|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1882|      0|    }
 1883|       |
 1884|      0|    *code = (uintptr_t) NULL;
 1885|       |
 1886|      0|    params->number = headers_names.nelts;
 1887|       |
 1888|      0|    hash.hash = &params->hash;
 1889|      0|    hash.key = ngx_hash_key_lc;
 1890|      0|    hash.max_size = 512;
 1891|      0|    hash.bucket_size = 64;
 1892|      0|    hash.name = "scgi_params_hash";
 1893|      0|    hash.pool = cf->pool;
 1894|      0|    hash.temp_pool = NULL;
 1895|       |
 1896|      0|    return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
 1897|      0|}

ngx_http_ssi_filter_module.c:ngx_http_ssi_preconfiguration:
 2809|      1|{
 2810|      1|    ngx_int_t                  rc;
 2811|      1|    ngx_http_variable_t       *var, *v;
 2812|      1|    ngx_http_ssi_command_t    *cmd;
 2813|      1|    ngx_http_ssi_main_conf_t  *smcf;
 2814|       |
 2815|      3|    for (v = ngx_http_ssi_vars; v->name.len; v++) {
  ------------------
  |  Branch (2815:33): [True: 2, False: 1]
  ------------------
 2816|      2|        var = ngx_http_add_variable(cf, &v->name, v->flags);
 2817|      2|        if (var == NULL) {
  ------------------
  |  Branch (2817:13): [True: 0, False: 2]
  ------------------
 2818|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2819|      0|        }
 2820|       |
 2821|      2|        var->get_handler = v->get_handler;
 2822|      2|        var->data = v->data;
 2823|      2|    }
 2824|       |
 2825|      1|    smcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_ssi_filter_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 2826|       |
 2827|     11|    for (cmd = ngx_http_ssi_commands; cmd->name.len; cmd++) {
  ------------------
  |  Branch (2827:39): [True: 10, False: 1]
  ------------------
 2828|     10|        rc = ngx_hash_add_key(&smcf->commands, &cmd->name, cmd,
 2829|     10|                              NGX_HASH_READONLY_KEY);
  ------------------
  |  |   72|     10|#define NGX_HASH_READONLY_KEY     2
  ------------------
 2830|       |
 2831|     10|        if (rc == NGX_OK) {
  ------------------
  |  |   38|     10|#define  NGX_OK          0
  ------------------
  |  Branch (2831:13): [True: 10, False: 0]
  ------------------
 2832|     10|            continue;
 2833|     10|        }
 2834|       |
 2835|      0|        if (rc == NGX_BUSY) {
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  |  Branch (2835:13): [True: 0, False: 0]
  ------------------
 2836|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 2837|      0|                               "conflicting SSI command \"%V\"", &cmd->name);
 2838|      0|        }
 2839|       |
 2840|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2841|     10|    }
 2842|       |
 2843|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2844|      1|}
ngx_http_ssi_filter_module.c:ngx_http_ssi_filter_init:
 2952|      1|{
 2953|      1|    ngx_http_next_header_filter = ngx_http_top_header_filter;
 2954|      1|    ngx_http_top_header_filter = ngx_http_ssi_header_filter;
 2955|       |
 2956|      1|    ngx_http_next_body_filter = ngx_http_top_body_filter;
 2957|      1|    ngx_http_top_body_filter = ngx_http_ssi_body_filter;
 2958|       |
 2959|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2960|      1|}
ngx_http_ssi_filter_module.c:ngx_http_ssi_header_filter:
  331|      7|{
  332|      7|    ngx_http_ssi_ctx_t       *ctx, *mctx;
  333|      7|    ngx_http_ssi_loc_conf_t  *slcf;
  334|       |
  335|      7|    slcf = ngx_http_get_module_loc_conf(r, ngx_http_ssi_filter_module);
  ------------------
  |  |   58|      7|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  336|       |
  337|      7|    if (!slcf->enable
  ------------------
  |  Branch (337:9): [True: 7, False: 0]
  ------------------
  338|      7|        || r->headers_out.content_length_n == 0
  ------------------
  |  Branch (338:12): [True: 0, False: 0]
  ------------------
  339|      7|        || ngx_http_test_content_type(r, &slcf->types) == NULL)
  ------------------
  |  Branch (339:12): [True: 0, False: 0]
  ------------------
  340|      7|    {
  341|      7|        return ngx_http_next_header_filter(r);
  342|      7|    }
  343|       |
  344|      0|    mctx = ngx_http_get_module_ctx(r->main, ngx_http_ssi_filter_module);
  ------------------
  |  |   80|      0|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
  345|       |
  346|      0|    ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_ssi_ctx_t));
  347|      0|    if (ctx == NULL) {
  ------------------
  |  Branch (347:9): [True: 0, False: 0]
  ------------------
  348|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  349|      0|    }
  350|       |
  351|      0|    ngx_http_set_ctx(r, ctx, ngx_http_ssi_filter_module);
  ------------------
  |  |   81|      0|#define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;
  ------------------
  352|       |
  353|       |
  354|      0|    ctx->value_len = slcf->value_len;
  355|      0|    ctx->last_out = &ctx->out;
  356|       |
  357|      0|    ctx->encoding = NGX_HTTP_SSI_ENTITY_ENCODING;
  ------------------
  |  |   30|      0|#define NGX_HTTP_SSI_ENTITY_ENCODING  2
  ------------------
  358|      0|    ctx->output = 1;
  359|       |
  360|      0|    ctx->params.elts = ctx->params_array;
  361|      0|    ctx->params.size = sizeof(ngx_table_elt_t);
  362|      0|    ctx->params.nalloc = NGX_HTTP_SSI_PARAMS_N;
  ------------------
  |  |   21|      0|#define NGX_HTTP_SSI_PARAMS_N         4
  ------------------
  363|      0|    ctx->params.pool = r->pool;
  364|       |
  365|      0|    ctx->timefmt = ngx_http_ssi_timefmt;
  366|      0|    ngx_str_set(&ctx->errmsg,
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
  367|      0|                "[an error occurred while processing the directive]");
  368|       |
  369|      0|    r->filter_need_in_memory = 1;
  370|       |
  371|      0|    if (r == r->main) {
  ------------------
  |  Branch (371:9): [True: 0, False: 0]
  ------------------
  372|       |
  373|      0|        if (mctx) {
  ------------------
  |  Branch (373:13): [True: 0, False: 0]
  ------------------
  374|       |
  375|       |            /*
  376|       |             * if there was a shared context previously used as main,
  377|       |             * copy variables and blocks
  378|       |             */
  379|       |
  380|      0|            ctx->variables = mctx->variables;
  381|      0|            ctx->blocks = mctx->blocks;
  382|       |
  383|      0|#if (NGX_PCRE)
  384|      0|            ctx->ncaptures = mctx->ncaptures;
  385|      0|            ctx->captures = mctx->captures;
  386|      0|            ctx->captures_data = mctx->captures_data;
  387|      0|#endif
  388|       |
  389|      0|            mctx->shared = 0;
  390|      0|        }
  391|       |
  392|      0|        ngx_http_clear_content_length(r);
  ------------------
  |  |  555|      0|    r->headers_out.content_length_n = -1;                                     \
  |  |  556|      0|    if (r->headers_out.content_length) {                                      \
  |  |  ------------------
  |  |  |  Branch (556:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  557|      0|        r->headers_out.content_length->hash = 0;                              \
  |  |  558|      0|        r->headers_out.content_length = NULL;                                 \
  |  |  559|      0|    }
  ------------------
  393|      0|        ngx_http_clear_accept_ranges(r);
  ------------------
  |  |  563|      0|    r->allow_ranges = 0;                                                      \
  |  |  564|      0|    if (r->headers_out.accept_ranges) {                                       \
  |  |  ------------------
  |  |  |  Branch (564:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  565|      0|        r->headers_out.accept_ranges->hash = 0;                               \
  |  |  566|      0|        r->headers_out.accept_ranges = NULL;                                  \
  |  |  567|      0|    }
  ------------------
  394|       |
  395|      0|        r->preserve_body = 1;
  396|       |
  397|      0|        if (!slcf->last_modified) {
  ------------------
  |  Branch (397:13): [True: 0, False: 0]
  ------------------
  398|      0|            ngx_http_clear_last_modified(r);
  ------------------
  |  |  571|      0|    r->headers_out.last_modified_time = -1;                                   \
  |  |  572|      0|    if (r->headers_out.last_modified) {                                       \
  |  |  ------------------
  |  |  |  Branch (572:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  573|      0|        r->headers_out.last_modified->hash = 0;                               \
  |  |  574|      0|        r->headers_out.last_modified = NULL;                                  \
  |  |  575|      0|    }
  ------------------
  399|      0|            ngx_http_clear_etag(r);
  ------------------
  |  |  586|      0|    if (r->headers_out.etag) {                                                \
  |  |  ------------------
  |  |  |  Branch (586:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  587|      0|        r->headers_out.etag->hash = 0;                                        \
  |  |  588|      0|        r->headers_out.etag = NULL;                                           \
  |  |  589|      0|    }
  ------------------
  400|       |
  401|      0|        } else {
  402|      0|            ngx_http_weak_etag(r);
  403|      0|        }
  404|       |
  405|      0|    } else if (mctx == NULL) {
  ------------------
  |  Branch (405:16): [True: 0, False: 0]
  ------------------
  406|      0|        ngx_http_set_ctx(r->main, ctx, ngx_http_ssi_filter_module);
  ------------------
  |  |   81|      0|#define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;
  ------------------
  407|      0|        ctx->shared = 1;
  408|      0|    }
  409|       |
  410|      0|    return ngx_http_next_header_filter(r);
  411|      0|}
ngx_http_ssi_filter_module.c:ngx_http_ssi_body_filter:
  416|     13|{
  417|     13|    size_t                     len;
  418|     13|    ngx_int_t                  rc;
  419|     13|    ngx_buf_t                 *b;
  420|     13|    ngx_uint_t                 i, index;
  421|     13|    ngx_chain_t               *cl, **ll;
  422|     13|    ngx_table_elt_t           *param;
  423|     13|    ngx_http_ssi_ctx_t        *ctx, *mctx;
  424|     13|    ngx_http_ssi_block_t      *bl;
  425|     13|    ngx_http_ssi_param_t      *prm;
  426|     13|    ngx_http_ssi_command_t    *cmd;
  427|     13|    ngx_http_ssi_loc_conf_t   *slcf;
  428|     13|    ngx_http_ssi_main_conf_t  *smcf;
  429|     13|    ngx_str_t                 *params[NGX_HTTP_SSI_MAX_PARAMS + 1];
  430|       |
  431|     13|    ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module);
  ------------------
  |  |   80|     13|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
  432|       |
  433|     13|    if (ctx == NULL
  ------------------
  |  Branch (433:9): [True: 13, False: 0]
  ------------------
  434|     13|        || (ctx->shared && r == r->main)
  ------------------
  |  Branch (434:13): [True: 0, False: 0]
  |  Branch (434:28): [True: 0, False: 0]
  ------------------
  435|     13|        || (in == NULL
  ------------------
  |  Branch (435:13): [True: 0, False: 0]
  ------------------
  436|      0|            && ctx->buf == NULL
  ------------------
  |  Branch (436:16): [True: 0, False: 0]
  ------------------
  437|      0|            && ctx->in == NULL
  ------------------
  |  Branch (437:16): [True: 0, False: 0]
  ------------------
  438|      0|            && ctx->busy == NULL))
  ------------------
  |  Branch (438:16): [True: 0, False: 0]
  ------------------
  439|     13|    {
  440|     13|        return ngx_http_next_body_filter(r, in);
  441|     13|    }
  442|       |
  443|       |    /* add the incoming chain to the chain ctx->in */
  444|       |
  445|      0|    if (in) {
  ------------------
  |  Branch (445:9): [True: 0, False: 0]
  ------------------
  446|      0|        if (ngx_chain_add_copy(r->pool, &ctx->in, in) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (446:13): [True: 0, False: 0]
  ------------------
  447|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  448|      0|        }
  449|      0|    }
  450|       |
  451|      0|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  452|      0|                   "http ssi filter \"%V?%V\"", &r->uri, &r->args);
  453|       |
  454|      0|    if (ctx->wait) {
  ------------------
  |  Branch (454:9): [True: 0, False: 0]
  ------------------
  455|       |
  456|      0|        if (r != r->connection->data) {
  ------------------
  |  Branch (456:13): [True: 0, False: 0]
  ------------------
  457|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  458|      0|                           "http ssi filter wait \"%V?%V\" non-active",
  459|      0|                           &ctx->wait->uri, &ctx->wait->args);
  460|       |
  461|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  462|      0|        }
  463|       |
  464|      0|        if (ctx->wait->done) {
  ------------------
  |  Branch (464:13): [True: 0, False: 0]
  ------------------
  465|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  466|      0|                           "http ssi filter wait \"%V?%V\" done",
  467|      0|                           &ctx->wait->uri, &ctx->wait->args);
  468|       |
  469|      0|            ctx->wait = NULL;
  470|       |
  471|      0|        } else {
  472|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  473|      0|                           "http ssi filter wait \"%V?%V\"",
  474|      0|                           &ctx->wait->uri, &ctx->wait->args);
  475|       |
  476|      0|            return ngx_http_next_body_filter(r, NULL);
  477|      0|        }
  478|      0|    }
  479|       |
  480|      0|    slcf = ngx_http_get_module_loc_conf(r, ngx_http_ssi_filter_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  481|       |
  482|      0|    while (ctx->in || ctx->buf) {
  ------------------
  |  Branch (482:12): [True: 0, False: 0]
  |  Branch (482:23): [True: 0, False: 0]
  ------------------
  483|       |
  484|      0|        if (ctx->buf == NULL) {
  ------------------
  |  Branch (484:13): [True: 0, False: 0]
  ------------------
  485|      0|            ctx->buf = ctx->in->buf;
  486|      0|            ctx->in = ctx->in->next;
  487|      0|            ctx->pos = ctx->buf->pos;
  488|      0|        }
  489|       |
  490|      0|        if (ctx->state == ssi_start_state) {
  ------------------
  |  Branch (490:13): [True: 0, False: 0]
  ------------------
  491|      0|            ctx->copy_start = ctx->pos;
  492|      0|            ctx->copy_end = ctx->pos;
  493|      0|        }
  494|       |
  495|      0|        b = NULL;
  496|       |
  497|      0|        while (ctx->pos < ctx->buf->last) {
  ------------------
  |  Branch (497:16): [True: 0, False: 0]
  ------------------
  498|       |
  499|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  500|      0|                           "saved: %uz state: %ui", ctx->saved, ctx->state);
  501|       |
  502|      0|            rc = ngx_http_ssi_parse(r, ctx);
  503|       |
  504|      0|            ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  505|      0|                           "parse: %i, looked: %uz %p-%p",
  506|      0|                           rc, ctx->looked, ctx->copy_start, ctx->copy_end);
  507|       |
  508|      0|            if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (508:17): [True: 0, False: 0]
  ------------------
  509|      0|                return rc;
  510|      0|            }
  511|       |
  512|      0|            if (ctx->copy_start != ctx->copy_end) {
  ------------------
  |  Branch (512:17): [True: 0, False: 0]
  ------------------
  513|       |
  514|      0|                if (ctx->output) {
  ------------------
  |  Branch (514:21): [True: 0, False: 0]
  ------------------
  515|       |
  516|      0|                    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  517|      0|                                   "saved: %uz", ctx->saved);
  518|       |
  519|      0|                    if (ctx->saved) {
  ------------------
  |  Branch (519:25): [True: 0, False: 0]
  ------------------
  520|       |
  521|      0|                        if (ctx->free) {
  ------------------
  |  Branch (521:29): [True: 0, False: 0]
  ------------------
  522|      0|                            cl = ctx->free;
  523|      0|                            ctx->free = ctx->free->next;
  524|      0|                            b = cl->buf;
  525|      0|                            ngx_memzero(b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  526|       |
  527|      0|                        } else {
  528|      0|                            b = ngx_calloc_buf(r->pool);
  ------------------
  |  |  145|      0|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
  529|      0|                            if (b == NULL) {
  ------------------
  |  Branch (529:33): [True: 0, False: 0]
  ------------------
  530|      0|                                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  531|      0|                            }
  532|       |
  533|      0|                            cl = ngx_alloc_chain_link(r->pool);
  534|      0|                            if (cl == NULL) {
  ------------------
  |  Branch (534:33): [True: 0, False: 0]
  ------------------
  535|      0|                                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  536|      0|                            }
  537|       |
  538|      0|                            cl->buf = b;
  539|      0|                        }
  540|       |
  541|      0|                        b->memory = 1;
  542|      0|                        b->pos = ngx_http_ssi_string;
  543|      0|                        b->last = ngx_http_ssi_string + ctx->saved;
  544|       |
  545|      0|                        *ctx->last_out = cl;
  546|      0|                        ctx->last_out = &cl->next;
  547|       |
  548|      0|                        ctx->saved = 0;
  549|      0|                    }
  550|       |
  551|      0|                    if (ctx->free) {
  ------------------
  |  Branch (551:25): [True: 0, False: 0]
  ------------------
  552|      0|                        cl = ctx->free;
  553|      0|                        ctx->free = ctx->free->next;
  554|      0|                        b = cl->buf;
  555|       |
  556|      0|                    } else {
  557|      0|                        b = ngx_alloc_buf(r->pool);
  ------------------
  |  |  144|      0|#define ngx_alloc_buf(pool)  ngx_palloc(pool, sizeof(ngx_buf_t))
  ------------------
  558|      0|                        if (b == NULL) {
  ------------------
  |  Branch (558:29): [True: 0, False: 0]
  ------------------
  559|      0|                            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  560|      0|                        }
  561|       |
  562|      0|                        cl = ngx_alloc_chain_link(r->pool);
  563|      0|                        if (cl == NULL) {
  ------------------
  |  Branch (563:29): [True: 0, False: 0]
  ------------------
  564|      0|                            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  565|      0|                        }
  566|       |
  567|      0|                        cl->buf = b;
  568|      0|                    }
  569|       |
  570|      0|                    ngx_memcpy(b, ctx->buf, sizeof(ngx_buf_t));
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  571|       |
  572|      0|                    b->pos = ctx->copy_start;
  573|      0|                    b->last = ctx->copy_end;
  574|      0|                    b->shadow = NULL;
  575|      0|                    b->last_buf = 0;
  576|      0|                    b->recycled = 0;
  577|       |
  578|      0|                    if (b->in_file) {
  ------------------
  |  Branch (578:25): [True: 0, False: 0]
  ------------------
  579|      0|                        if (slcf->min_file_chunk < (size_t) (b->last - b->pos))
  ------------------
  |  Branch (579:29): [True: 0, False: 0]
  ------------------
  580|      0|                        {
  581|      0|                            b->file_last = b->file_pos
  582|      0|                                                   + (b->last - ctx->buf->pos);
  583|      0|                            b->file_pos += b->pos - ctx->buf->pos;
  584|       |
  585|      0|                        } else {
  586|      0|                            b->in_file = 0;
  587|      0|                        }
  588|      0|                    }
  589|       |
  590|      0|                    cl->next = NULL;
  591|      0|                    *ctx->last_out = cl;
  592|      0|                    ctx->last_out = &cl->next;
  593|       |
  594|      0|                } else {
  595|      0|                    if (ctx->block
  ------------------
  |  Branch (595:25): [True: 0, False: 0]
  ------------------
  596|      0|                        && ctx->saved + (ctx->copy_end - ctx->copy_start))
  ------------------
  |  Branch (596:28): [True: 0, False: 0]
  ------------------
  597|      0|                    {
  598|      0|                        b = ngx_create_temp_buf(r->pool,
  599|      0|                               ctx->saved + (ctx->copy_end - ctx->copy_start));
  600|       |
  601|      0|                        if (b == NULL) {
  ------------------
  |  Branch (601:29): [True: 0, False: 0]
  ------------------
  602|      0|                            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  603|      0|                        }
  604|       |
  605|      0|                        if (ctx->saved) {
  ------------------
  |  Branch (605:29): [True: 0, False: 0]
  ------------------
  606|      0|                            b->last = ngx_cpymem(b->pos, ngx_http_ssi_string,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  607|      0|                                                 ctx->saved);
  608|      0|                        }
  609|       |
  610|      0|                        b->last = ngx_cpymem(b->last, ctx->copy_start,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  611|      0|                                             ctx->copy_end - ctx->copy_start);
  612|       |
  613|      0|                        cl = ngx_alloc_chain_link(r->pool);
  614|      0|                        if (cl == NULL) {
  ------------------
  |  Branch (614:29): [True: 0, False: 0]
  ------------------
  615|      0|                            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  616|      0|                        }
  617|       |
  618|      0|                        cl->buf = b;
  619|      0|                        cl->next = NULL;
  620|       |
  621|      0|                        b = NULL;
  622|       |
  623|      0|                        mctx = ngx_http_get_module_ctx(r->main,
  ------------------
  |  |   80|      0|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
  624|      0|                                                   ngx_http_ssi_filter_module);
  625|      0|                        bl = mctx->blocks->elts;
  626|      0|                        for (ll = &bl[mctx->blocks->nelts - 1].bufs;
  627|      0|                             *ll;
  ------------------
  |  Branch (627:30): [True: 0, False: 0]
  ------------------
  628|      0|                             ll = &(*ll)->next)
  629|      0|                        {
  630|       |                            /* void */
  631|      0|                        }
  632|       |
  633|      0|                        *ll = cl;
  634|      0|                    }
  635|       |
  636|      0|                    ctx->saved = 0;
  637|      0|                }
  638|      0|            }
  639|       |
  640|      0|            if (ctx->state == ssi_start_state) {
  ------------------
  |  Branch (640:17): [True: 0, False: 0]
  ------------------
  641|      0|                ctx->copy_start = ctx->pos;
  642|      0|                ctx->copy_end = ctx->pos;
  643|       |
  644|      0|            } else {
  645|      0|                ctx->copy_start = NULL;
  646|      0|                ctx->copy_end = NULL;
  647|      0|            }
  648|       |
  649|      0|            if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (649:17): [True: 0, False: 0]
  ------------------
  650|      0|                continue;
  651|      0|            }
  652|       |
  653|       |
  654|      0|            b = NULL;
  655|       |
  656|      0|            if (rc == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (656:17): [True: 0, False: 0]
  ------------------
  657|       |
  658|      0|                smcf = ngx_http_get_module_main_conf(r,
  ------------------
  |  |   56|      0|    (r)->main_conf[module.ctx_index]
  ------------------
  659|      0|                                                   ngx_http_ssi_filter_module);
  660|       |
  661|      0|                cmd = ngx_hash_find(&smcf->hash, ctx->key, ctx->command.data,
  662|      0|                                    ctx->command.len);
  663|       |
  664|      0|                if (cmd == NULL) {
  ------------------
  |  Branch (664:21): [True: 0, False: 0]
  ------------------
  665|      0|                    if (ctx->output) {
  ------------------
  |  Branch (665:25): [True: 0, False: 0]
  ------------------
  666|      0|                        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  667|      0|                                      "invalid SSI command: \"%V\"",
  668|      0|                                      &ctx->command);
  669|      0|                        goto ssi_error;
  670|      0|                    }
  671|       |
  672|      0|                    continue;
  673|      0|                }
  674|       |
  675|      0|                if (!ctx->output && !cmd->block) {
  ------------------
  |  Branch (675:21): [True: 0, False: 0]
  |  Branch (675:37): [True: 0, False: 0]
  ------------------
  676|       |
  677|      0|                    if (ctx->block) {
  ------------------
  |  Branch (677:25): [True: 0, False: 0]
  ------------------
  678|       |
  679|       |                        /* reconstruct the SSI command text */
  680|       |
  681|      0|                        len = 5 + ctx->command.len + 4;
  682|       |
  683|      0|                        param = ctx->params.elts;
  684|      0|                        for (i = 0; i < ctx->params.nelts; i++) {
  ------------------
  |  Branch (684:37): [True: 0, False: 0]
  ------------------
  685|      0|                            len += 1 + param[i].key.len + 2
  686|      0|                                + param[i].value.len + 1;
  687|      0|                        }
  688|       |
  689|      0|                        b = ngx_create_temp_buf(r->pool, len);
  690|       |
  691|      0|                        if (b == NULL) {
  ------------------
  |  Branch (691:29): [True: 0, False: 0]
  ------------------
  692|      0|                            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  693|      0|                        }
  694|       |
  695|      0|                        cl = ngx_alloc_chain_link(r->pool);
  696|      0|                        if (cl == NULL) {
  ------------------
  |  Branch (696:29): [True: 0, False: 0]
  ------------------
  697|      0|                            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  698|      0|                        }
  699|       |
  700|      0|                        cl->buf = b;
  701|      0|                        cl->next = NULL;
  702|       |
  703|      0|                        *b->last++ = '<';
  704|      0|                        *b->last++ = '!';
  705|      0|                        *b->last++ = '-';
  706|      0|                        *b->last++ = '-';
  707|      0|                        *b->last++ = '#';
  708|       |
  709|      0|                        b->last = ngx_cpymem(b->last, ctx->command.data,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  710|      0|                                             ctx->command.len);
  711|       |
  712|      0|                        for (i = 0; i < ctx->params.nelts; i++) {
  ------------------
  |  Branch (712:37): [True: 0, False: 0]
  ------------------
  713|      0|                            *b->last++ = ' ';
  714|      0|                            b->last = ngx_cpymem(b->last, param[i].key.data,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  715|      0|                                                 param[i].key.len);
  716|      0|                            *b->last++ = '=';
  717|      0|                            *b->last++ = '"';
  718|      0|                            b->last = ngx_cpymem(b->last, param[i].value.data,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  719|      0|                                                 param[i].value.len);
  720|      0|                            *b->last++ = '"';
  721|      0|                        }
  722|       |
  723|      0|                        *b->last++ = ' ';
  724|      0|                        *b->last++ = '-';
  725|      0|                        *b->last++ = '-';
  726|      0|                        *b->last++ = '>';
  727|       |
  728|      0|                        mctx = ngx_http_get_module_ctx(r->main,
  ------------------
  |  |   80|      0|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
  729|      0|                                                   ngx_http_ssi_filter_module);
  730|      0|                        bl = mctx->blocks->elts;
  731|      0|                        for (ll = &bl[mctx->blocks->nelts - 1].bufs;
  732|      0|                             *ll;
  ------------------
  |  Branch (732:30): [True: 0, False: 0]
  ------------------
  733|      0|                             ll = &(*ll)->next)
  734|      0|                        {
  735|       |                            /* void */
  736|      0|                        }
  737|       |
  738|      0|                        *ll = cl;
  739|       |
  740|      0|                        b = NULL;
  741|       |
  742|      0|                        continue;
  743|      0|                    }
  744|       |
  745|      0|                    if (cmd->conditional == 0) {
  ------------------
  |  Branch (745:25): [True: 0, False: 0]
  ------------------
  746|      0|                        continue;
  747|      0|                    }
  748|      0|                }
  749|       |
  750|      0|                if (cmd->conditional
  ------------------
  |  Branch (750:21): [True: 0, False: 0]
  ------------------
  751|      0|                    && (ctx->conditional == 0
  ------------------
  |  Branch (751:25): [True: 0, False: 0]
  ------------------
  752|      0|                        || ctx->conditional > cmd->conditional))
  ------------------
  |  Branch (752:28): [True: 0, False: 0]
  ------------------
  753|      0|                {
  754|      0|                    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  755|      0|                                  "invalid context of SSI command: \"%V\"",
  756|      0|                                  &ctx->command);
  757|      0|                    goto ssi_error;
  758|      0|                }
  759|       |
  760|      0|                if (ctx->params.nelts > NGX_HTTP_SSI_MAX_PARAMS) {
  ------------------
  |  |   17|      0|#define NGX_HTTP_SSI_MAX_PARAMS       16
  ------------------
  |  Branch (760:21): [True: 0, False: 0]
  ------------------
  761|      0|                    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  762|      0|                                  "too many SSI command parameters: \"%V\"",
  763|      0|                                  &ctx->command);
  764|      0|                    goto ssi_error;
  765|      0|                }
  766|       |
  767|      0|                ngx_memzero(params,
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  768|      0|                           (NGX_HTTP_SSI_MAX_PARAMS + 1) * sizeof(ngx_str_t *));
  769|       |
  770|      0|                param = ctx->params.elts;
  771|       |
  772|      0|                for (i = 0; i < ctx->params.nelts; i++) {
  ------------------
  |  Branch (772:29): [True: 0, False: 0]
  ------------------
  773|       |
  774|      0|                    for (prm = cmd->params; prm->name.len; prm++) {
  ------------------
  |  Branch (774:45): [True: 0, False: 0]
  ------------------
  775|       |
  776|      0|                        if (param[i].key.len != prm->name.len
  ------------------
  |  Branch (776:29): [True: 0, False: 0]
  ------------------
  777|      0|                            || ngx_strncmp(param[i].key.data, prm->name.data,
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (777:32): [True: 0, False: 0]
  ------------------
  778|      0|                                           prm->name.len) != 0)
  779|      0|                        {
  780|      0|                            continue;
  781|      0|                        }
  782|       |
  783|      0|                        if (!prm->multiple) {
  ------------------
  |  Branch (783:29): [True: 0, False: 0]
  ------------------
  784|      0|                            if (params[prm->index]) {
  ------------------
  |  Branch (784:33): [True: 0, False: 0]
  ------------------
  785|      0|                                ngx_log_error(NGX_LOG_ERR,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  786|      0|                                              r->connection->log, 0,
  787|      0|                                              "duplicate \"%V\" parameter "
  788|      0|                                              "in \"%V\" SSI command",
  789|      0|                                              &param[i].key, &ctx->command);
  790|       |
  791|      0|                                goto ssi_error;
  792|      0|                            }
  793|       |
  794|      0|                            params[prm->index] = &param[i].value;
  795|       |
  796|      0|                            break;
  797|      0|                        }
  798|       |
  799|      0|                        for (index = prm->index; params[index]; index++) {
  ------------------
  |  Branch (799:50): [True: 0, False: 0]
  ------------------
  800|       |                            /* void */
  801|      0|                        }
  802|       |
  803|      0|                        params[index] = &param[i].value;
  804|       |
  805|      0|                        break;
  806|      0|                    }
  807|       |
  808|      0|                    if (prm->name.len == 0) {
  ------------------
  |  Branch (808:25): [True: 0, False: 0]
  ------------------
  809|      0|                        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  810|      0|                                      "invalid parameter name: \"%V\" "
  811|      0|                                      "in \"%V\" SSI command",
  812|      0|                                      &param[i].key, &ctx->command);
  813|       |
  814|      0|                        goto ssi_error;
  815|      0|                    }
  816|      0|                }
  817|       |
  818|      0|                for (prm = cmd->params; prm->name.len; prm++) {
  ------------------
  |  Branch (818:41): [True: 0, False: 0]
  ------------------
  819|      0|                    if (prm->mandatory && params[prm->index] == 0) {
  ------------------
  |  Branch (819:25): [True: 0, False: 0]
  |  Branch (819:43): [True: 0, False: 0]
  ------------------
  820|      0|                        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  821|      0|                                      "mandatory \"%V\" parameter is absent "
  822|      0|                                      "in \"%V\" SSI command",
  823|      0|                                      &prm->name, &ctx->command);
  824|       |
  825|      0|                        goto ssi_error;
  826|      0|                    }
  827|      0|                }
  828|       |
  829|      0|                if (cmd->flush && ctx->out) {
  ------------------
  |  Branch (829:21): [True: 0, False: 0]
  |  Branch (829:35): [True: 0, False: 0]
  ------------------
  830|       |
  831|      0|                    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  832|      0|                                   "ssi flush");
  833|       |
  834|      0|                    if (ngx_http_ssi_output(r, ctx) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (834:25): [True: 0, False: 0]
  ------------------
  835|      0|                        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  836|      0|                    }
  837|      0|                }
  838|       |
  839|      0|                rc = cmd->handler(r, ctx, params);
  840|       |
  841|      0|                if (rc == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (841:21): [True: 0, False: 0]
  ------------------
  842|      0|                    continue;
  843|      0|                }
  844|       |
  845|      0|                if (rc == NGX_DONE || rc == NGX_AGAIN || rc == NGX_ERROR) {
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
                              if (rc == NGX_DONE || rc == NGX_AGAIN || rc == NGX_ERROR) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
                              if (rc == NGX_DONE || rc == NGX_AGAIN || rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (845:21): [True: 0, False: 0]
  |  Branch (845:39): [True: 0, False: 0]
  |  Branch (845:58): [True: 0, False: 0]
  ------------------
  846|      0|                    ngx_http_ssi_buffered(r, ctx);
  847|      0|                    return rc;
  848|      0|                }
  849|      0|            }
  850|       |
  851|       |
  852|       |            /* rc == NGX_HTTP_SSI_ERROR */
  853|       |
  854|      0|    ssi_error:
  855|       |
  856|      0|            if (slcf->silent_errors) {
  ------------------
  |  Branch (856:17): [True: 0, False: 0]
  ------------------
  857|      0|                continue;
  858|      0|            }
  859|       |
  860|      0|            if (ctx->free) {
  ------------------
  |  Branch (860:17): [True: 0, False: 0]
  ------------------
  861|      0|                cl = ctx->free;
  862|      0|                ctx->free = ctx->free->next;
  863|      0|                b = cl->buf;
  864|      0|                ngx_memzero(b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  865|       |
  866|      0|            } else {
  867|      0|                b = ngx_calloc_buf(r->pool);
  ------------------
  |  |  145|      0|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
  868|      0|                if (b == NULL) {
  ------------------
  |  Branch (868:21): [True: 0, False: 0]
  ------------------
  869|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  870|      0|                }
  871|       |
  872|      0|                cl = ngx_alloc_chain_link(r->pool);
  873|      0|                if (cl == NULL) {
  ------------------
  |  Branch (873:21): [True: 0, False: 0]
  ------------------
  874|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  875|      0|                }
  876|       |
  877|      0|                cl->buf = b;
  878|      0|            }
  879|       |
  880|      0|            b->memory = 1;
  881|      0|            b->pos = ctx->errmsg.data;
  882|      0|            b->last = ctx->errmsg.data + ctx->errmsg.len;
  883|       |
  884|      0|            cl->next = NULL;
  885|      0|            *ctx->last_out = cl;
  886|      0|            ctx->last_out = &cl->next;
  887|       |
  888|      0|            continue;
  889|      0|        }
  890|       |
  891|      0|        if (ctx->buf->last_buf || ngx_buf_in_memory(ctx->buf)) {
  ------------------
  |  |  125|      0|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  ------------------
  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (891:13): [True: 0, False: 0]
  ------------------
  892|      0|            if (b == NULL) {
  ------------------
  |  Branch (892:17): [True: 0, False: 0]
  ------------------
  893|      0|                if (ctx->free) {
  ------------------
  |  Branch (893:21): [True: 0, False: 0]
  ------------------
  894|      0|                    cl = ctx->free;
  895|      0|                    ctx->free = ctx->free->next;
  896|      0|                    b = cl->buf;
  897|      0|                    ngx_memzero(b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  898|       |
  899|      0|                } else {
  900|      0|                    b = ngx_calloc_buf(r->pool);
  ------------------
  |  |  145|      0|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
  901|      0|                    if (b == NULL) {
  ------------------
  |  Branch (901:25): [True: 0, False: 0]
  ------------------
  902|      0|                        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  903|      0|                    }
  904|       |
  905|      0|                    cl = ngx_alloc_chain_link(r->pool);
  906|      0|                    if (cl == NULL) {
  ------------------
  |  Branch (906:25): [True: 0, False: 0]
  ------------------
  907|      0|                        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  908|      0|                    }
  909|       |
  910|      0|                    cl->buf = b;
  911|      0|                }
  912|       |
  913|      0|                b->sync = 1;
  914|       |
  915|      0|                cl->next = NULL;
  916|      0|                *ctx->last_out = cl;
  917|      0|                ctx->last_out = &cl->next;
  918|      0|            }
  919|       |
  920|      0|            b->last_buf = ctx->buf->last_buf;
  921|      0|            b->shadow = ctx->buf;
  922|       |
  923|      0|            if (slcf->ignore_recycled_buffers == 0)  {
  ------------------
  |  Branch (923:17): [True: 0, False: 0]
  ------------------
  924|      0|                b->recycled = ctx->buf->recycled;
  925|      0|            }
  926|      0|        }
  927|       |
  928|      0|        ctx->buf = NULL;
  929|       |
  930|      0|        ctx->saved = ctx->looked;
  931|      0|    }
  932|       |
  933|      0|    if (ctx->out == NULL && ctx->busy == NULL) {
  ------------------
  |  Branch (933:9): [True: 0, False: 0]
  |  Branch (933:29): [True: 0, False: 0]
  ------------------
  934|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  935|      0|    }
  936|       |
  937|      0|    return ngx_http_ssi_output(r, ctx);
  938|      0|}
ngx_http_ssi_filter_module.c:ngx_http_ssi_create_main_conf:
 2849|      1|{
 2850|      1|    ngx_http_ssi_main_conf_t  *smcf;
 2851|       |
 2852|      1|    smcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_main_conf_t));
 2853|      1|    if (smcf == NULL) {
  ------------------
  |  Branch (2853:9): [True: 0, False: 1]
  ------------------
 2854|      0|        return NULL;
 2855|      0|    }
 2856|       |
 2857|      1|    smcf->commands.pool = cf->pool;
 2858|      1|    smcf->commands.temp_pool = cf->temp_pool;
 2859|       |
 2860|      1|    if (ngx_hash_keys_array_init(&smcf->commands, NGX_HASH_SMALL) != NGX_OK) {
  ------------------
  |  |   65|      1|#define NGX_HASH_SMALL            1
  ------------------
                  if (ngx_hash_keys_array_init(&smcf->commands, NGX_HASH_SMALL) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (2860:9): [True: 0, False: 1]
  ------------------
 2861|      0|        return NULL;
 2862|      0|    }
 2863|       |
 2864|      1|    return smcf;
 2865|      1|}
ngx_http_ssi_filter_module.c:ngx_http_ssi_init_main_conf:
 2870|      1|{
 2871|      1|    ngx_http_ssi_main_conf_t *smcf = conf;
 2872|       |
 2873|      1|    ngx_hash_init_t  hash;
 2874|       |
 2875|      1|    hash.hash = &smcf->hash;
 2876|      1|    hash.key = ngx_hash_key;
 2877|      1|    hash.max_size = 1024;
 2878|      1|    hash.bucket_size = ngx_cacheline_size;
 2879|      1|    hash.name = "ssi_command_hash";
 2880|      1|    hash.pool = cf->pool;
 2881|      1|    hash.temp_pool = NULL;
 2882|       |
 2883|      1|    if (ngx_hash_init(&hash, smcf->commands.keys.elts,
  ------------------
  |  Branch (2883:9): [True: 0, False: 1]
  ------------------
 2884|      1|                      smcf->commands.keys.nelts)
 2885|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2886|      0|    {
 2887|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2888|      0|    }
 2889|       |
 2890|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 2891|      1|}
ngx_http_ssi_filter_module.c:ngx_http_ssi_create_loc_conf:
 2896|      4|{
 2897|      4|    ngx_http_ssi_loc_conf_t  *slcf;
 2898|       |
 2899|      4|    slcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_loc_conf_t));
 2900|      4|    if (slcf == NULL) {
  ------------------
  |  Branch (2900:9): [True: 0, False: 4]
  ------------------
 2901|      0|        return NULL;
 2902|      0|    }
 2903|       |
 2904|       |    /*
 2905|       |     * set by ngx_pcalloc():
 2906|       |     *
 2907|       |     *     conf->types = { NULL };
 2908|       |     *     conf->types_keys = NULL;
 2909|       |     */
 2910|       |
 2911|      4|    slcf->enable = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2912|      4|    slcf->silent_errors = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2913|      4|    slcf->ignore_recycled_buffers = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2914|      4|    slcf->last_modified = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 2915|       |
 2916|      4|    slcf->min_file_chunk = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 2917|      4|    slcf->value_len = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 2918|       |
 2919|      4|    return slcf;
 2920|      4|}
ngx_http_ssi_filter_module.c:ngx_http_ssi_merge_loc_conf:
 2925|      2|{
 2926|      2|    ngx_http_ssi_loc_conf_t *prev = parent;
 2927|      2|    ngx_http_ssi_loc_conf_t *conf = child;
 2928|       |
 2929|      2|    ngx_conf_merge_value(conf->enable, prev->enable, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2930|      2|    ngx_conf_merge_value(conf->silent_errors, prev->silent_errors, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2931|      2|    ngx_conf_merge_value(conf->ignore_recycled_buffers,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2932|      2|                         prev->ignore_recycled_buffers, 0);
 2933|      2|    ngx_conf_merge_value(conf->last_modified, prev->last_modified, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 2934|       |
 2935|      2|    ngx_conf_merge_size_value(conf->min_file_chunk, prev->min_file_chunk, 1024);
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 2936|      2|    ngx_conf_merge_size_value(conf->value_len, prev->value_len, 255);
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 2937|       |
 2938|      2|    if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
  ------------------
  |  Branch (2938:9): [True: 0, False: 2]
  ------------------
 2939|      2|                             &prev->types_keys, &prev->types,
 2940|      2|                             ngx_http_html_default_types)
 2941|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 2942|      0|    {
 2943|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2944|      0|    }
 2945|       |
 2946|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 2947|      2|}

ngx_http_static_module.c:ngx_http_static_init:
  283|      1|{
  284|      1|    ngx_http_handler_pt        *h;
  285|      1|    ngx_http_core_main_conf_t  *cmcf;
  286|       |
  287|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  288|       |
  289|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
  290|      1|    if (h == NULL) {
  ------------------
  |  Branch (290:9): [True: 0, False: 1]
  ------------------
  291|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  292|      0|    }
  293|       |
  294|      1|    *h = ngx_http_static_handler;
  295|       |
  296|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  297|      1|}

ngx_http_try_files_module.c:ngx_http_try_files_init:
  390|      1|{
  391|      1|    ngx_http_handler_pt        *h;
  392|      1|    ngx_http_core_main_conf_t  *cmcf;
  393|       |
  394|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  395|       |
  396|      1|    h = ngx_array_push(&cmcf->phases[NGX_HTTP_PRECONTENT_PHASE].handlers);
  397|      1|    if (h == NULL) {
  ------------------
  |  Branch (397:9): [True: 0, False: 1]
  ------------------
  398|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  399|      0|    }
  400|       |
  401|      1|    *h = ngx_http_try_files_handler;
  402|       |
  403|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  404|      1|}
ngx_http_try_files_module.c:ngx_http_try_files_handler:
   80|     11|{
   81|     11|    size_t                          len, root, alias, reserve, allocated;
   82|     11|    u_char                         *p, *name;
   83|     11|    ngx_str_t                       path, args;
   84|     11|    ngx_uint_t                      test_dir;
   85|     11|    ngx_http_try_file_t            *tf;
   86|     11|    ngx_open_file_info_t            of;
   87|     11|    ngx_http_script_code_pt         code;
   88|     11|    ngx_http_script_engine_t        e;
   89|     11|    ngx_http_core_loc_conf_t       *clcf;
   90|     11|    ngx_http_script_len_code_pt     lcode;
   91|     11|    ngx_http_try_files_loc_conf_t  *tlcf;
   92|       |
   93|     11|    tlcf = ngx_http_get_module_loc_conf(r, ngx_http_try_files_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
   94|       |
   95|     11|    if (tlcf->try_files == NULL) {
  ------------------
  |  Branch (95:9): [True: 11, False: 0]
  ------------------
   96|     11|        return NGX_DECLINED;
  ------------------
  |  |   43|     11|#define  NGX_DECLINED   -5
  ------------------
   97|     11|    }
   98|       |
   99|      0|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  100|      0|                   "try files handler");
  101|       |
  102|      0|    allocated = 0;
  103|      0|    root = 0;
  104|      0|    name = NULL;
  105|       |    /* suppress MSVC warning */
  106|      0|    path.data = NULL;
  107|       |
  108|      0|    tf = tlcf->try_files;
  109|       |
  110|      0|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  111|       |
  112|      0|    alias = clcf->alias;
  113|       |
  114|      0|    for ( ;; ) {
  115|       |
  116|      0|        if (tf->lengths) {
  ------------------
  |  Branch (116:13): [True: 0, False: 0]
  ------------------
  117|      0|            ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  118|       |
  119|      0|            e.ip = tf->lengths->elts;
  120|      0|            e.request = r;
  121|       |
  122|       |            /* 1 is for terminating '\0' as in static names */
  123|      0|            len = 1;
  124|       |
  125|      0|            while (*(uintptr_t *) e.ip) {
  ------------------
  |  Branch (125:20): [True: 0, False: 0]
  ------------------
  126|      0|                lcode = *(ngx_http_script_len_code_pt *) e.ip;
  127|      0|                len += lcode(&e);
  128|      0|            }
  129|       |
  130|      0|        } else {
  131|      0|            len = tf->name.len;
  132|      0|        }
  133|       |
  134|      0|        if (!alias) {
  ------------------
  |  Branch (134:13): [True: 0, False: 0]
  ------------------
  135|      0|            reserve = len > r->uri.len ? len - r->uri.len : 0;
  ------------------
  |  Branch (135:23): [True: 0, False: 0]
  ------------------
  136|       |
  137|      0|        } else if (alias == NGX_MAX_SIZE_T_VALUE) {
  ------------------
  |  |  187|      0|#define NGX_MAX_SIZE_T_VALUE  9223372036854775807LL
  ------------------
  |  Branch (137:20): [True: 0, False: 0]
  ------------------
  138|      0|            reserve = len;
  139|       |
  140|      0|        } else {
  141|      0|            reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0;
  ------------------
  |  Branch (141:23): [True: 0, False: 0]
  ------------------
  142|      0|        }
  143|       |
  144|      0|        if (reserve > allocated || !allocated) {
  ------------------
  |  Branch (144:13): [True: 0, False: 0]
  |  Branch (144:36): [True: 0, False: 0]
  ------------------
  145|       |
  146|       |            /* 16 bytes are preallocation */
  147|      0|            allocated = reserve + 16;
  148|       |
  149|      0|            if (ngx_http_map_uri_to_path(r, &path, &root, allocated) == NULL) {
  ------------------
  |  Branch (149:17): [True: 0, False: 0]
  ------------------
  150|      0|                return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  151|      0|            }
  152|       |
  153|      0|            name = path.data + root;
  154|      0|        }
  155|       |
  156|      0|        if (tf->values == NULL) {
  ------------------
  |  Branch (156:13): [True: 0, False: 0]
  ------------------
  157|       |
  158|       |            /* tf->name.len includes the terminating '\0' */
  159|       |
  160|      0|            ngx_memcpy(name, tf->name.data, tf->name.len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  161|       |
  162|      0|            path.len = (name + tf->name.len - 1) - path.data;
  163|       |
  164|      0|        } else {
  165|      0|            e.ip = tf->values->elts;
  166|      0|            e.pos = name;
  167|      0|            e.flushed = 1;
  168|       |
  169|      0|            while (*(uintptr_t *) e.ip) {
  ------------------
  |  Branch (169:20): [True: 0, False: 0]
  ------------------
  170|      0|                code = *(ngx_http_script_code_pt *) e.ip;
  171|      0|                code((ngx_http_script_engine_t *) &e);
  172|      0|            }
  173|       |
  174|      0|            path.len = e.pos - path.data;
  175|       |
  176|      0|            *e.pos = '\0';
  177|       |
  178|      0|            if (alias && alias != NGX_MAX_SIZE_T_VALUE
  ------------------
  |  |  187|      0|#define NGX_MAX_SIZE_T_VALUE  9223372036854775807LL
  ------------------
  |  Branch (178:17): [True: 0, False: 0]
  |  Branch (178:26): [True: 0, False: 0]
  ------------------
  179|      0|                && ngx_strncmp(name, r->uri.data, alias) == 0)
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (179:20): [True: 0, False: 0]
  ------------------
  180|      0|            {
  181|      0|                ngx_memmove(name, name + alias, len - alias);
  ------------------
  |  |  143|      0|#define ngx_memmove(dst, src, n)  (void) memmove(dst, src, n)
  ------------------
  182|      0|                path.len -= alias;
  183|      0|            }
  184|      0|        }
  185|       |
  186|      0|        test_dir = tf->test_dir;
  187|       |
  188|      0|        tf++;
  189|       |
  190|      0|        ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  191|      0|                       "trying to use %s: \"%s\" \"%s\"",
  192|      0|                       test_dir ? "dir" : "file", name, path.data);
  193|       |
  194|      0|        if (tf->lengths == NULL && tf->name.len == 0) {
  ------------------
  |  Branch (194:13): [True: 0, False: 0]
  |  Branch (194:36): [True: 0, False: 0]
  ------------------
  195|       |
  196|      0|            if (tf->code) {
  ------------------
  |  Branch (196:17): [True: 0, False: 0]
  ------------------
  197|      0|                return tf->code;
  198|      0|            }
  199|       |
  200|      0|            path.len -= root;
  201|      0|            path.data += root;
  202|       |
  203|      0|            if (path.data[0] == '@') {
  ------------------
  |  Branch (203:17): [True: 0, False: 0]
  ------------------
  204|      0|                (void) ngx_http_named_location(r, &path);
  205|       |
  206|      0|            } else {
  207|      0|                ngx_http_split_args(r, &path, &args);
  208|       |
  209|      0|                (void) ngx_http_internal_redirect(r, &path, &args);
  210|      0|            }
  211|       |
  212|      0|            ngx_http_finalize_request(r, NGX_DONE);
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  213|      0|            return NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  214|      0|        }
  215|       |
  216|      0|        ngx_memzero(&of, sizeof(ngx_open_file_info_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  217|       |
  218|      0|        of.read_ahead = clcf->read_ahead;
  219|      0|        of.directio = clcf->directio;
  220|      0|        of.valid = clcf->open_file_cache_valid;
  221|      0|        of.min_uses = clcf->open_file_cache_min_uses;
  222|      0|        of.test_only = 1;
  223|      0|        of.errors = clcf->open_file_cache_errors;
  224|      0|        of.events = clcf->open_file_cache_events;
  225|       |
  226|      0|        if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (226:13): [True: 0, False: 0]
  ------------------
  227|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  228|      0|        }
  229|       |
  230|      0|        if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  232|      0|        {
  233|      0|            if (of.err == 0) {
  ------------------
  |  Branch (233:17): [True: 0, False: 0]
  ------------------
  234|      0|                return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  235|      0|            }
  236|       |
  237|      0|            if (of.err != NGX_ENOENT
  ------------------
  |  |   19|      0|#define NGX_ENOENT        ENOENT
  ------------------
  |  Branch (237:17): [True: 0, False: 0]
  ------------------
  238|      0|                && of.err != NGX_ENOTDIR
  ------------------
  |  |   30|      0|#define NGX_ENOTDIR       ENOTDIR
  ------------------
  |  Branch (238:20): [True: 0, False: 0]
  ------------------
  239|      0|                && of.err != NGX_ENAMETOOLONG)
  ------------------
  |  |   46|      0|#define NGX_ENAMETOOLONG  ENAMETOOLONG
  ------------------
  |  Branch (239:20): [True: 0, False: 0]
  ------------------
  240|      0|            {
  241|      0|                ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  242|      0|                              "%s \"%s\" failed", of.failed, path.data);
  243|      0|            }
  244|       |
  245|      0|            continue;
  246|      0|        }
  247|       |
  248|      0|        if (of.is_dir != test_dir) {
  ------------------
  |  Branch (248:13): [True: 0, False: 0]
  ------------------
  249|      0|            continue;
  250|      0|        }
  251|       |
  252|      0|        path.len -= root;
  253|      0|        path.data += root;
  254|       |
  255|      0|        if (!alias) {
  ------------------
  |  Branch (255:13): [True: 0, False: 0]
  ------------------
  256|      0|            r->uri = path;
  257|       |
  258|      0|        } else if (alias == NGX_MAX_SIZE_T_VALUE) {
  ------------------
  |  |  187|      0|#define NGX_MAX_SIZE_T_VALUE  9223372036854775807LL
  ------------------
  |  Branch (258:20): [True: 0, False: 0]
  ------------------
  259|      0|            if (!test_dir) {
  ------------------
  |  Branch (259:17): [True: 0, False: 0]
  ------------------
  260|      0|                r->uri = path;
  261|      0|                r->add_uri_to_alias = 1;
  262|      0|            }
  263|       |
  264|      0|        } else {
  265|      0|            name = r->uri.data;
  266|       |
  267|      0|            r->uri.len = alias + path.len;
  268|      0|            r->uri.data = ngx_pnalloc(r->pool, r->uri.len);
  269|      0|            if (r->uri.data == NULL) {
  ------------------
  |  Branch (269:17): [True: 0, False: 0]
  ------------------
  270|      0|                r->uri.len = 0;
  271|      0|                return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  272|      0|            }
  273|       |
  274|      0|            p = ngx_copy(r->uri.data, name, alias);
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  275|      0|            ngx_memcpy(p, path.data, path.len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  276|      0|        }
  277|       |
  278|      0|        ngx_http_set_exten(r);
  279|       |
  280|      0|        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  281|      0|                       "try file uri: \"%V\"", &r->uri);
  282|       |
  283|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  284|      0|    }
  285|       |
  286|       |    /* not reached */
  287|      0|}
ngx_http_try_files_module.c:ngx_http_try_files_create_loc_conf:
  370|      4|{
  371|      4|    ngx_http_try_files_loc_conf_t  *tlcf;
  372|       |
  373|      4|    tlcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_try_files_loc_conf_t));
  374|      4|    if (tlcf == NULL) {
  ------------------
  |  Branch (374:9): [True: 0, False: 4]
  ------------------
  375|      0|        return NULL;
  376|      0|    }
  377|       |
  378|       |    /*
  379|       |     * set by ngx_pcalloc():
  380|       |     *
  381|       |     *     tlcf->try_files = NULL;
  382|       |     */
  383|       |
  384|      4|    return tlcf;
  385|      4|}

ngx_http_upstream_hash_module.c:ngx_http_upstream_hash_create_conf:
  624|      3|{
  625|      3|    ngx_http_upstream_hash_srv_conf_t  *conf;
  626|       |
  627|      3|    conf = ngx_palloc(cf->pool, sizeof(ngx_http_upstream_hash_srv_conf_t));
  628|      3|    if (conf == NULL) {
  ------------------
  |  Branch (628:9): [True: 0, False: 3]
  ------------------
  629|      0|        return NULL;
  630|      0|    }
  631|       |
  632|      3|    conf->points = NULL;
  633|       |
  634|      3|    return conf;
  635|      3|}

ngx_http_upstream_keepalive_module.c:ngx_http_upstream_keepalive_create_conf:
  512|      3|{
  513|      3|    ngx_http_upstream_keepalive_srv_conf_t  *conf;
  514|       |
  515|      3|    conf = ngx_pcalloc(cf->pool,
  516|      3|                       sizeof(ngx_http_upstream_keepalive_srv_conf_t));
  517|      3|    if (conf == NULL) {
  ------------------
  |  Branch (517:9): [True: 0, False: 3]
  ------------------
  518|      0|        return NULL;
  519|      0|    }
  520|       |
  521|       |    /*
  522|       |     * set by ngx_pcalloc():
  523|       |     *
  524|       |     *     conf->original_init_upstream = NULL;
  525|       |     *     conf->original_init_peer = NULL;
  526|       |     *     conf->max_cached = 0;
  527|       |     */
  528|       |
  529|      3|    conf->time = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      3|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
  530|      3|    conf->timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      3|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
  531|      3|    conf->requests = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      3|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  532|       |
  533|      3|    return conf;
  534|      3|}

ngx_http_upstream_random_module.c:ngx_http_upstream_random_create_conf:
  434|      3|{
  435|      3|    ngx_http_upstream_random_srv_conf_t  *conf;
  436|       |
  437|      3|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_random_srv_conf_t));
  438|      3|    if (conf == NULL) {
  ------------------
  |  Branch (438:9): [True: 0, False: 3]
  ------------------
  439|      0|        return NULL;
  440|      0|    }
  441|       |
  442|       |    /*
  443|       |     * set by ngx_pcalloc():
  444|       |     *
  445|       |     *     conf->two = 0;
  446|       |     */
  447|       |
  448|      3|    return conf;
  449|      3|}

ngx_http_userid_filter_module.c:ngx_http_userid_add_variables:
  678|      1|{
  679|      1|    ngx_int_t             n;
  680|      1|    ngx_http_variable_t  *var;
  681|       |
  682|      1|    var = ngx_http_add_variable(cf, &ngx_http_userid_got, 0);
  683|      1|    if (var == NULL) {
  ------------------
  |  Branch (683:9): [True: 0, False: 1]
  ------------------
  684|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  685|      0|    }
  686|       |
  687|      1|    var->get_handler = ngx_http_userid_got_variable;
  688|       |
  689|      1|    var = ngx_http_add_variable(cf, &ngx_http_userid_set, 0);
  690|      1|    if (var == NULL) {
  ------------------
  |  Branch (690:9): [True: 0, False: 1]
  ------------------
  691|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  692|      0|    }
  693|       |
  694|      1|    var->get_handler = ngx_http_userid_set_variable;
  695|       |
  696|      1|    var = ngx_http_add_variable(cf, &ngx_http_userid_reset,
  697|      1|                                NGX_HTTP_VAR_CHANGEABLE);
  ------------------
  |  |   29|      1|#define NGX_HTTP_VAR_CHANGEABLE   1
  ------------------
  698|      1|    if (var == NULL) {
  ------------------
  |  Branch (698:9): [True: 0, False: 1]
  ------------------
  699|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  700|      0|    }
  701|       |
  702|      1|    var->get_handler = ngx_http_userid_reset_variable;
  703|       |
  704|      1|    n = ngx_http_get_variable_index(cf, &ngx_http_userid_reset);
  705|      1|    if (n == NGX_ERROR) {
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
  |  Branch (705:9): [True: 0, False: 1]
  ------------------
  706|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  707|      0|    }
  708|       |
  709|      1|    ngx_http_userid_reset_index = n;
  710|       |
  711|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  712|      1|}
ngx_http_userid_filter_module.c:ngx_http_userid_init:
  778|      1|{
  779|      1|    ngx_http_next_header_filter = ngx_http_top_header_filter;
  780|      1|    ngx_http_top_header_filter = ngx_http_userid_filter;
  781|       |
  782|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  783|      1|}
ngx_http_userid_filter_module.c:ngx_http_userid_filter:
  228|      7|{
  229|      7|    ngx_http_userid_ctx_t   *ctx;
  230|      7|    ngx_http_userid_conf_t  *conf;
  231|       |
  232|      7|    if (r != r->main) {
  ------------------
  |  Branch (232:9): [True: 0, False: 7]
  ------------------
  233|      0|        return ngx_http_next_header_filter(r);
  234|      0|    }
  235|       |
  236|      7|    conf = ngx_http_get_module_loc_conf(r, ngx_http_userid_filter_module);
  ------------------
  |  |   58|      7|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  237|       |
  238|      7|    if (conf->enable < NGX_HTTP_USERID_V1) {
  ------------------
  |  |   15|      7|#define NGX_HTTP_USERID_V1    2
  ------------------
  |  Branch (238:9): [True: 7, False: 0]
  ------------------
  239|      7|        return ngx_http_next_header_filter(r);
  240|      7|    }
  241|       |
  242|      0|    ctx = ngx_http_userid_get_uid(r, conf);
  243|       |
  244|      0|    if (ctx == NULL) {
  ------------------
  |  Branch (244:9): [True: 0, False: 0]
  ------------------
  245|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  246|      0|    }
  247|       |
  248|      0|    if (ngx_http_userid_set_uid(r, ctx, conf) == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (248:9): [True: 0, False: 0]
  ------------------
  249|      0|        return ngx_http_next_header_filter(r);
  250|      0|    }
  251|       |
  252|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  253|      0|}
ngx_http_userid_filter_module.c:ngx_http_userid_create_conf:
  717|      4|{
  718|      4|    ngx_http_userid_conf_t  *conf;
  719|       |
  720|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_userid_conf_t));
  721|      4|    if (conf == NULL) {
  ------------------
  |  Branch (721:9): [True: 0, False: 4]
  ------------------
  722|      0|        return NULL;
  723|      0|    }
  724|       |
  725|       |    /*
  726|       |     * set by ngx_pcalloc():
  727|       |     *
  728|       |     *     conf->flags = 0;
  729|       |     *     conf->name = { 0, NULL };
  730|       |     *     conf->domain = { 0, NULL };
  731|       |     *     conf->path = { 0, NULL };
  732|       |     *     conf->p3p = { 0, NULL };
  733|       |     */
  734|       |
  735|      4|    conf->enable = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  736|      4|    conf->service = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  737|      4|    conf->expires = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  738|      4|    conf->mark = (u_char) '\xFF';
  739|       |
  740|      4|    return conf;
  741|      4|}
ngx_http_userid_filter_module.c:ngx_http_userid_merge_conf:
  746|      2|{
  747|      2|    ngx_http_userid_conf_t *prev = parent;
  748|      2|    ngx_http_userid_conf_t *conf = child;
  749|       |
  750|      2|    ngx_conf_merge_uint_value(conf->enable, prev->enable,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
  751|      2|                              NGX_HTTP_USERID_OFF);
  752|       |
  753|      2|    ngx_conf_merge_bitmask_value(conf->flags, prev->flags,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
  754|      2|                            (NGX_CONF_BITMASK_SET|NGX_HTTP_USERID_COOKIE_OFF));
  755|       |
  756|      2|    ngx_conf_merge_str_value(conf->name, prev->name, "uid");
  ------------------
  |  |  241|      2|    if (conf.data == NULL) {                                                 \
  |  |  ------------------
  |  |  |  Branch (241:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  242|      2|        if (prev.data) {                                                     \
  |  |  ------------------
  |  |  |  Branch (242:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  243|      1|            conf.len = prev.len;                                             \
  |  |  244|      1|            conf.data = prev.data;                                           \
  |  |  245|      1|        } else {                                                             \
  |  |  246|      1|            conf.len = sizeof(default) - 1;                                  \
  |  |  247|      1|            conf.data = (u_char *) default;                                  \
  |  |  248|      1|        }                                                                    \
  |  |  249|      2|    }
  ------------------
  757|      2|    ngx_conf_merge_str_value(conf->domain, prev->domain, "");
  ------------------
  |  |  241|      2|    if (conf.data == NULL) {                                                 \
  |  |  ------------------
  |  |  |  Branch (241:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  242|      2|        if (prev.data) {                                                     \
  |  |  ------------------
  |  |  |  Branch (242:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  243|      1|            conf.len = prev.len;                                             \
  |  |  244|      1|            conf.data = prev.data;                                           \
  |  |  245|      1|        } else {                                                             \
  |  |  246|      1|            conf.len = sizeof(default) - 1;                                  \
  |  |  247|      1|            conf.data = (u_char *) default;                                  \
  |  |  248|      1|        }                                                                    \
  |  |  249|      2|    }
  ------------------
  758|      2|    ngx_conf_merge_str_value(conf->path, prev->path, "; path=/");
  ------------------
  |  |  241|      2|    if (conf.data == NULL) {                                                 \
  |  |  ------------------
  |  |  |  Branch (241:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  242|      2|        if (prev.data) {                                                     \
  |  |  ------------------
  |  |  |  Branch (242:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  243|      1|            conf.len = prev.len;                                             \
  |  |  244|      1|            conf.data = prev.data;                                           \
  |  |  245|      1|        } else {                                                             \
  |  |  246|      1|            conf.len = sizeof(default) - 1;                                  \
  |  |  247|      1|            conf.data = (u_char *) default;                                  \
  |  |  248|      1|        }                                                                    \
  |  |  249|      2|    }
  ------------------
  759|      2|    ngx_conf_merge_str_value(conf->p3p, prev->p3p, "");
  ------------------
  |  |  241|      2|    if (conf.data == NULL) {                                                 \
  |  |  ------------------
  |  |  |  Branch (241:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  242|      2|        if (prev.data) {                                                     \
  |  |  ------------------
  |  |  |  Branch (242:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  243|      1|            conf.len = prev.len;                                             \
  |  |  244|      1|            conf.data = prev.data;                                           \
  |  |  245|      1|        } else {                                                             \
  |  |  246|      1|            conf.len = sizeof(default) - 1;                                  \
  |  |  247|      1|            conf.data = (u_char *) default;                                  \
  |  |  248|      1|        }                                                                    \
  |  |  249|      2|    }
  ------------------
  760|       |
  761|      2|    ngx_conf_merge_value(conf->service, prev->service, NGX_CONF_UNSET);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  762|      2|    ngx_conf_merge_sec_value(conf->expires, prev->expires, 0);
  ------------------
  |  |  226|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (226:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  227|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (227:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  228|      2|    }
  ------------------
  763|       |
  764|      2|    if (conf->mark == (u_char) '\xFF') {
  ------------------
  |  Branch (764:9): [True: 2, False: 0]
  ------------------
  765|      2|        if (prev->mark == (u_char) '\xFF') {
  ------------------
  |  Branch (765:13): [True: 1, False: 1]
  ------------------
  766|      1|            conf->mark = '\0';
  767|      1|        } else {
  768|      1|            conf->mark = prev->mark;
  769|      1|        }
  770|      2|    }
  771|       |
  772|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  773|      2|}

ngx_http_uwsgi_module.c:ngx_http_uwsgi_create_main_conf:
 1480|      1|{
 1481|      1|    ngx_http_uwsgi_main_conf_t  *conf;
 1482|       |
 1483|      1|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_uwsgi_main_conf_t));
 1484|      1|    if (conf == NULL) {
  ------------------
  |  Branch (1484:9): [True: 0, False: 1]
  ------------------
 1485|      0|        return NULL;
 1486|      0|    }
 1487|       |
 1488|      1|#if (NGX_HTTP_CACHE)
 1489|      1|    if (ngx_array_init(&conf->caches, cf->pool, 4,
  ------------------
  |  Branch (1489:9): [True: 0, False: 1]
  ------------------
 1490|      1|                       sizeof(ngx_http_file_cache_t *))
 1491|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1492|      0|    {
 1493|      0|        return NULL;
 1494|      0|    }
 1495|      1|#endif
 1496|       |
 1497|      1|    return conf;
 1498|      1|}
ngx_http_uwsgi_module.c:ngx_http_uwsgi_create_loc_conf:
 1503|      4|{
 1504|      4|    ngx_http_uwsgi_loc_conf_t  *conf;
 1505|       |
 1506|      4|    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_uwsgi_loc_conf_t));
 1507|      4|    if (conf == NULL) {
  ------------------
  |  Branch (1507:9): [True: 0, False: 4]
  ------------------
 1508|      0|        return NULL;
 1509|      0|    }
 1510|       |
 1511|      4|    conf->modifier1 = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1512|      4|    conf->modifier2 = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1513|       |
 1514|      4|    conf->upstream.store = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1515|      4|    conf->upstream.store_access = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1516|      4|    conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1517|      4|    conf->upstream.buffering = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1518|      4|    conf->upstream.request_buffering = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1519|      4|    conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1520|      4|    conf->upstream.force_ranges = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1521|       |
 1522|      4|    conf->upstream.local = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1523|      4|    conf->upstream.socket_keepalive = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1524|       |
 1525|      4|    conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1526|      4|    conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1527|      4|    conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1528|      4|    conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1529|       |
 1530|      4|    conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1531|      4|    conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1532|      4|    conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1533|       |
 1534|      4|    conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1535|      4|    conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1536|      4|    conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 1537|       |
 1538|      4|    conf->upstream.pass_request_headers = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1539|      4|    conf->upstream.pass_request_body = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1540|       |
 1541|      4|#if (NGX_HTTP_CACHE)
 1542|      4|    conf->upstream.cache = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1543|      4|    conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 1544|      4|    conf->upstream.cache_max_range_offset = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1545|      4|    conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1546|      4|    conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1547|      4|    conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1548|      4|    conf->upstream.cache_lock = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1549|      4|    conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1550|      4|    conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 1551|      4|    conf->upstream.cache_revalidate = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1552|      4|    conf->upstream.cache_background_update = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1553|      4|#endif
 1554|       |
 1555|      4|    conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1556|      4|    conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 1557|       |
 1558|      4|    conf->upstream.intercept_errors = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 1559|       |
 1560|       |#if (NGX_HTTP_SSL)
 1561|       |    conf->upstream.ssl_session_reuse = NGX_CONF_UNSET;
 1562|       |    conf->upstream.ssl_name = NGX_CONF_UNSET_PTR;
 1563|       |    conf->upstream.ssl_server_name = NGX_CONF_UNSET;
 1564|       |    conf->upstream.ssl_verify = NGX_CONF_UNSET;
 1565|       |    conf->ssl_verify_depth = NGX_CONF_UNSET_UINT;
 1566|       |    conf->upstream.ssl_certificate = NGX_CONF_UNSET_PTR;
 1567|       |    conf->upstream.ssl_certificate_key = NGX_CONF_UNSET_PTR;
 1568|       |    conf->upstream.ssl_passwords = NGX_CONF_UNSET_PTR;
 1569|       |    conf->ssl_conf_commands = NGX_CONF_UNSET_PTR;
 1570|       |#endif
 1571|       |
 1572|       |    /* "uwsgi_cyclic_temp_file" is disabled */
 1573|      4|    conf->upstream.cyclic_temp_file = 0;
 1574|       |
 1575|      4|    conf->upstream.change_buffering = 1;
 1576|       |
 1577|      4|    ngx_str_set(&conf->upstream.module, "uwsgi");
  ------------------
  |  |   43|      4|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 1578|       |
 1579|      4|    return conf;
 1580|      4|}
ngx_http_uwsgi_module.c:ngx_http_uwsgi_merge_loc_conf:
 1585|      2|{
 1586|      2|    ngx_http_uwsgi_loc_conf_t *prev = parent;
 1587|      2|    ngx_http_uwsgi_loc_conf_t *conf = child;
 1588|       |
 1589|      2|    size_t                        size;
 1590|      2|    ngx_int_t                     rc;
 1591|      2|    ngx_hash_init_t               hash;
 1592|      2|    ngx_http_core_loc_conf_t     *clcf;
 1593|       |
 1594|      2|#if (NGX_HTTP_CACHE)
 1595|       |
 1596|      2|    if (conf->upstream.store > 0) {
  ------------------
  |  Branch (1596:9): [True: 0, False: 2]
  ------------------
 1597|      0|        conf->upstream.cache = 0;
 1598|      0|    }
 1599|       |
 1600|      2|    if (conf->upstream.cache > 0) {
  ------------------
  |  Branch (1600:9): [True: 0, False: 2]
  ------------------
 1601|      0|        conf->upstream.store = 0;
 1602|      0|    }
 1603|       |
 1604|      2|#endif
 1605|       |
 1606|      2|    if (conf->upstream.store == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      2|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (1606:9): [True: 2, False: 0]
  ------------------
 1607|      2|        ngx_conf_merge_value(conf->upstream.store, prev->upstream.store, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1608|       |
 1609|      2|        conf->upstream.store_lengths = prev->upstream.store_lengths;
 1610|      2|        conf->upstream.store_values = prev->upstream.store_values;
 1611|      2|    }
 1612|       |
 1613|      2|    ngx_conf_merge_uint_value(conf->upstream.store_access,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 1614|      2|                              prev->upstream.store_access, 0600);
 1615|       |
 1616|      2|    ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 1617|      2|                              prev->upstream.next_upstream_tries, 0);
 1618|       |
 1619|      2|    ngx_conf_merge_value(conf->upstream.buffering,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1620|      2|                              prev->upstream.buffering, 1);
 1621|       |
 1622|      2|    ngx_conf_merge_value(conf->upstream.request_buffering,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1623|      2|                              prev->upstream.request_buffering, 1);
 1624|       |
 1625|      2|    ngx_conf_merge_value(conf->upstream.ignore_client_abort,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1626|      2|                              prev->upstream.ignore_client_abort, 0);
 1627|       |
 1628|      2|    ngx_conf_merge_value(conf->upstream.force_ranges,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1629|      2|                              prev->upstream.force_ranges, 0);
 1630|       |
 1631|      2|    ngx_conf_merge_ptr_value(conf->upstream.local,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 1632|      2|                              prev->upstream.local, NULL);
 1633|       |
 1634|      2|    ngx_conf_merge_value(conf->upstream.socket_keepalive,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1635|      2|                              prev->upstream.socket_keepalive, 0);
 1636|       |
 1637|      2|    ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1638|      2|                              prev->upstream.connect_timeout, 60000);
 1639|       |
 1640|      2|    ngx_conf_merge_msec_value(conf->upstream.send_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1641|      2|                              prev->upstream.send_timeout, 60000);
 1642|       |
 1643|      2|    ngx_conf_merge_msec_value(conf->upstream.read_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1644|      2|                              prev->upstream.read_timeout, 60000);
 1645|       |
 1646|      2|    ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1647|      2|                              prev->upstream.next_upstream_timeout, 0);
 1648|       |
 1649|      2|    ngx_conf_merge_size_value(conf->upstream.send_lowat,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1650|      2|                              prev->upstream.send_lowat, 0);
 1651|       |
 1652|      2|    ngx_conf_merge_size_value(conf->upstream.buffer_size,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1653|      2|                              prev->upstream.buffer_size,
 1654|      2|                              (size_t) ngx_pagesize);
 1655|       |
 1656|      2|    ngx_conf_merge_size_value(conf->upstream.limit_rate,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1657|      2|                              prev->upstream.limit_rate, 0);
 1658|       |
 1659|       |
 1660|      2|    ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
  ------------------
  |  |  252|      2|    if (conf.num == 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  253|      2|        if (prev.num) {                                                      \
  |  |  ------------------
  |  |  |  Branch (253:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  254|      1|            conf.num = prev.num;                                             \
  |  |  255|      1|            conf.size = prev.size;                                           \
  |  |  256|      1|        } else {                                                             \
  |  |  257|      1|            conf.num = default_num;                                          \
  |  |  258|      1|            conf.size = default_size;                                        \
  |  |  259|      1|        }                                                                    \
  |  |  260|      2|    }
  ------------------
 1661|      2|                              8, ngx_pagesize);
 1662|       |
 1663|      2|    if (conf->upstream.bufs.num < 2) {
  ------------------
  |  Branch (1663:9): [True: 0, False: 2]
  ------------------
 1664|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1665|      0|                           "there must be at least 2 \"uwsgi_buffers\"");
 1666|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1667|      0|    }
 1668|       |
 1669|       |
 1670|      2|    size = conf->upstream.buffer_size;
 1671|      2|    if (size < conf->upstream.bufs.size) {
  ------------------
  |  Branch (1671:9): [True: 0, False: 2]
  ------------------
 1672|      0|        size = conf->upstream.bufs.size;
 1673|      0|    }
 1674|       |
 1675|       |
 1676|      2|    ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1677|      2|                              prev->upstream.busy_buffers_size_conf,
 1678|      2|                              NGX_CONF_UNSET_SIZE);
 1679|       |
 1680|      2|    if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (1680:9): [True: 2, False: 0]
  ------------------
 1681|      2|        conf->upstream.busy_buffers_size = 2 * size;
 1682|      2|    } else {
 1683|      0|        conf->upstream.busy_buffers_size =
 1684|      0|            conf->upstream.busy_buffers_size_conf;
 1685|      0|    }
 1686|       |
 1687|      2|    if (conf->upstream.busy_buffers_size < size) {
  ------------------
  |  Branch (1687:9): [True: 0, False: 2]
  ------------------
 1688|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1689|      0|            "\"uwsgi_busy_buffers_size\" must be equal to or greater "
 1690|      0|            "than the maximum of the value of \"uwsgi_buffer_size\" and "
 1691|      0|            "one of the \"uwsgi_buffers\"");
 1692|       |
 1693|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1694|      0|    }
 1695|       |
 1696|      2|    if (conf->upstream.busy_buffers_size
  ------------------
  |  Branch (1696:9): [True: 0, False: 2]
  ------------------
 1697|      2|        > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
 1698|      0|    {
 1699|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1700|      0|            "\"uwsgi_busy_buffers_size\" must be less than "
 1701|      0|            "the size of all \"uwsgi_buffers\" minus one buffer");
 1702|       |
 1703|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1704|      0|    }
 1705|       |
 1706|       |
 1707|      2|    ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1708|      2|                              prev->upstream.temp_file_write_size_conf,
 1709|      2|                              NGX_CONF_UNSET_SIZE);
 1710|       |
 1711|      2|    if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (1711:9): [True: 2, False: 0]
  ------------------
 1712|      2|        conf->upstream.temp_file_write_size = 2 * size;
 1713|      2|    } else {
 1714|      0|        conf->upstream.temp_file_write_size =
 1715|      0|            conf->upstream.temp_file_write_size_conf;
 1716|      0|    }
 1717|       |
 1718|      2|    if (conf->upstream.temp_file_write_size < size) {
  ------------------
  |  Branch (1718:9): [True: 0, False: 2]
  ------------------
 1719|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1720|      0|            "\"uwsgi_temp_file_write_size\" must be equal to or greater than "
 1721|      0|            "the maximum of the value of \"uwsgi_buffer_size\" and "
 1722|      0|            "one of the \"uwsgi_buffers\"");
 1723|       |
 1724|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1725|      0|    }
 1726|       |
 1727|       |
 1728|      2|    ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 2, False: 0]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 1729|      2|                              prev->upstream.max_temp_file_size_conf,
 1730|      2|                              NGX_CONF_UNSET_SIZE);
 1731|       |
 1732|      2|    if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
  ------------------
  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  |  Branch (1732:9): [True: 2, False: 0]
  ------------------
 1733|      2|        conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
 1734|      2|    } else {
 1735|      0|        conf->upstream.max_temp_file_size =
 1736|      0|            conf->upstream.max_temp_file_size_conf;
 1737|      0|    }
 1738|       |
 1739|      2|    if (conf->upstream.max_temp_file_size != 0
  ------------------
  |  Branch (1739:9): [True: 2, False: 0]
  ------------------
 1740|      2|        && conf->upstream.max_temp_file_size < size)
  ------------------
  |  Branch (1740:12): [True: 0, False: 2]
  ------------------
 1741|      0|    {
 1742|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1743|      0|            "\"uwsgi_max_temp_file_size\" must be equal to zero to disable "
 1744|      0|            "temporary files usage or must be equal to or greater than "
 1745|      0|            "the maximum of the value of \"uwsgi_buffer_size\" and "
 1746|      0|            "one of the \"uwsgi_buffers\"");
 1747|       |
 1748|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1749|      0|    }
 1750|       |
 1751|       |
 1752|      2|    ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 1753|      2|                                 prev->upstream.ignore_headers,
 1754|      2|                                 NGX_CONF_BITMASK_SET);
 1755|       |
 1756|       |
 1757|      2|    ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 1758|      2|                                 prev->upstream.next_upstream,
 1759|      2|                                 (NGX_CONF_BITMASK_SET
 1760|      2|                                  |NGX_HTTP_UPSTREAM_FT_ERROR
 1761|      2|                                  |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
 1762|       |
 1763|      2|    if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (1763:9): [True: 0, False: 2]
  ------------------
 1764|      0|        conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      0|#define NGX_CONF_BITMASK_SET  1
  ------------------
 1765|      0|                                       |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      0|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
 1766|      0|    }
 1767|       |
 1768|      2|    if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
  ------------------
  |  Branch (1768:9): [True: 0, False: 2]
  ------------------
 1769|      2|                                  prev->upstream.temp_path,
 1770|      2|                                  &ngx_http_uwsgi_temp_path)
 1771|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 1772|      0|    {
 1773|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1774|      0|    }
 1775|       |
 1776|      2|#if (NGX_HTTP_CACHE)
 1777|       |
 1778|      2|    if (conf->upstream.cache == NGX_CONF_UNSET) {
  ------------------
  |  |   56|      2|#define NGX_CONF_UNSET       -1
  ------------------
  |  Branch (1778:9): [True: 2, False: 0]
  ------------------
 1779|      2|        ngx_conf_merge_value(conf->upstream.cache,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1780|      2|                              prev->upstream.cache, 0);
 1781|       |
 1782|      2|        conf->upstream.cache_zone = prev->upstream.cache_zone;
 1783|      2|        conf->upstream.cache_value = prev->upstream.cache_value;
 1784|      2|    }
 1785|       |
 1786|      2|    if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) {
  ------------------
  |  Branch (1786:9): [True: 0, False: 2]
  |  Branch (1786:38): [True: 0, False: 0]
  ------------------
 1787|      0|        ngx_shm_zone_t  *shm_zone;
 1788|       |
 1789|      0|        shm_zone = conf->upstream.cache_zone;
 1790|       |
 1791|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1792|      0|                           "\"uwsgi_cache\" zone \"%V\" is unknown",
 1793|      0|                           &shm_zone->shm.name);
 1794|       |
 1795|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1796|      0|    }
 1797|       |
 1798|      2|    ngx_conf_merge_uint_value(conf->upstream.cache_min_uses,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 1799|      2|                              prev->upstream.cache_min_uses, 1);
 1800|       |
 1801|      2|    ngx_conf_merge_off_value(conf->upstream.cache_max_range_offset,
  ------------------
  |  |  236|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (236:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  237|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (237:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  238|      2|    }
  ------------------
 1802|      2|                              prev->upstream.cache_max_range_offset,
 1803|      2|                              NGX_MAX_OFF_T_VALUE);
 1804|       |
 1805|      2|    ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 1806|      2|                              prev->upstream.cache_use_stale,
 1807|      2|                              (NGX_CONF_BITMASK_SET
 1808|      2|                               |NGX_HTTP_UPSTREAM_FT_OFF));
 1809|       |
 1810|      2|    if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) {
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
  |  Branch (1810:9): [True: 2, False: 0]
  ------------------
 1811|      2|        conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET
  ------------------
  |  |  163|      2|#define NGX_CONF_BITMASK_SET  1
  ------------------
 1812|      2|                                         |NGX_HTTP_UPSTREAM_FT_OFF;
  ------------------
  |  |   35|      2|#define NGX_HTTP_UPSTREAM_FT_OFF             0x80000000
  ------------------
 1813|      2|    }
 1814|       |
 1815|      2|    if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_ERROR) {
  ------------------
  |  |   20|      2|#define NGX_HTTP_UPSTREAM_FT_ERROR           0x00000002
  ------------------
  |  Branch (1815:9): [True: 0, False: 2]
  ------------------
 1816|      0|        conf->upstream.cache_use_stale |= NGX_HTTP_UPSTREAM_FT_NOLIVE;
  ------------------
  |  |   34|      0|#define NGX_HTTP_UPSTREAM_FT_NOLIVE          0x40000000
  ------------------
 1817|      0|    }
 1818|       |
 1819|      2|    if (conf->upstream.cache_methods == 0) {
  ------------------
  |  Branch (1819:9): [True: 2, False: 0]
  ------------------
 1820|      2|        conf->upstream.cache_methods = prev->upstream.cache_methods;
 1821|      2|    }
 1822|       |
 1823|      2|    conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
  ------------------
  |  |   30|      2|#define NGX_HTTP_GET                       0x00000002
  ------------------
                  conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
  ------------------
  |  |   31|      2|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
 1824|       |
 1825|      2|    ngx_conf_merge_ptr_value(conf->upstream.cache_bypass,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 1826|      2|                             prev->upstream.cache_bypass, NULL);
 1827|       |
 1828|      2|    ngx_conf_merge_ptr_value(conf->upstream.no_cache,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 1829|      2|                             prev->upstream.no_cache, NULL);
 1830|       |
 1831|      2|    ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 1832|      2|                             prev->upstream.cache_valid, NULL);
 1833|       |
 1834|      2|    if (conf->cache_key.value.data == NULL) {
  ------------------
  |  Branch (1834:9): [True: 2, False: 0]
  ------------------
 1835|      2|        conf->cache_key = prev->cache_key;
 1836|      2|    }
 1837|       |
 1838|      2|    if (conf->upstream.cache && conf->cache_key.value.data == NULL) {
  ------------------
  |  Branch (1838:9): [True: 0, False: 2]
  |  Branch (1838:33): [True: 0, False: 0]
  ------------------
 1839|      0|        ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
  ------------------
  |  |   21|      0|#define NGX_LOG_WARN              5
  ------------------
 1840|      0|                           "no \"uwsgi_cache_key\" for \"uwsgi_cache\"");
 1841|      0|    }
 1842|       |
 1843|      2|    ngx_conf_merge_value(conf->upstream.cache_lock,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1844|      2|                              prev->upstream.cache_lock, 0);
 1845|       |
 1846|      2|    ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1847|      2|                              prev->upstream.cache_lock_timeout, 5000);
 1848|       |
 1849|      2|    ngx_conf_merge_msec_value(conf->upstream.cache_lock_age,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 1850|      2|                              prev->upstream.cache_lock_age, 5000);
 1851|       |
 1852|      2|    ngx_conf_merge_value(conf->upstream.cache_revalidate,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1853|      2|                              prev->upstream.cache_revalidate, 0);
 1854|       |
 1855|      2|    ngx_conf_merge_value(conf->upstream.cache_background_update,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1856|      2|                              prev->upstream.cache_background_update, 0);
 1857|       |
 1858|      2|#endif
 1859|       |
 1860|      2|    ngx_conf_merge_value(conf->upstream.pass_request_headers,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1861|      2|                         prev->upstream.pass_request_headers, 1);
 1862|      2|    ngx_conf_merge_value(conf->upstream.pass_request_body,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1863|      2|                         prev->upstream.pass_request_body, 1);
 1864|       |
 1865|      2|    ngx_conf_merge_value(conf->upstream.intercept_errors,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 1866|      2|                         prev->upstream.intercept_errors, 0);
 1867|       |
 1868|       |#if (NGX_HTTP_SSL)
 1869|       |
 1870|       |    if (ngx_http_uwsgi_merge_ssl(cf, conf, prev) != NGX_OK) {
 1871|       |        return NGX_CONF_ERROR;
 1872|       |    }
 1873|       |
 1874|       |    ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
 1875|       |                              prev->upstream.ssl_session_reuse, 1);
 1876|       |
 1877|       |    ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
 1878|       |                                 (NGX_CONF_BITMASK_SET
 1879|       |                                  |NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
 1880|       |                                  |NGX_SSL_TLSv1_2|NGX_SSL_TLSv1_3));
 1881|       |
 1882|       |    ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
 1883|       |                             "DEFAULT");
 1884|       |
 1885|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_name,
 1886|       |                              prev->upstream.ssl_name, NULL);
 1887|       |    ngx_conf_merge_value(conf->upstream.ssl_server_name,
 1888|       |                              prev->upstream.ssl_server_name, 0);
 1889|       |    ngx_conf_merge_value(conf->upstream.ssl_verify,
 1890|       |                              prev->upstream.ssl_verify, 0);
 1891|       |    ngx_conf_merge_uint_value(conf->ssl_verify_depth,
 1892|       |                              prev->ssl_verify_depth, 1);
 1893|       |    ngx_conf_merge_str_value(conf->ssl_trusted_certificate,
 1894|       |                              prev->ssl_trusted_certificate, "");
 1895|       |    ngx_conf_merge_str_value(conf->ssl_crl, prev->ssl_crl, "");
 1896|       |
 1897|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_certificate,
 1898|       |                              prev->upstream.ssl_certificate, NULL);
 1899|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_certificate_key,
 1900|       |                              prev->upstream.ssl_certificate_key, NULL);
 1901|       |    ngx_conf_merge_ptr_value(conf->upstream.ssl_passwords,
 1902|       |                              prev->upstream.ssl_passwords, NULL);
 1903|       |
 1904|       |    ngx_conf_merge_ptr_value(conf->ssl_conf_commands,
 1905|       |                              prev->ssl_conf_commands, NULL);
 1906|       |
 1907|       |    if (conf->ssl && ngx_http_uwsgi_set_ssl(cf, conf) != NGX_OK) {
 1908|       |        return NGX_CONF_ERROR;
 1909|       |    }
 1910|       |
 1911|       |#endif
 1912|       |
 1913|      2|    ngx_conf_merge_str_value(conf->uwsgi_string, prev->uwsgi_string, "");
  ------------------
  |  |  241|      2|    if (conf.data == NULL) {                                                 \
  |  |  ------------------
  |  |  |  Branch (241:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  242|      2|        if (prev.data) {                                                     \
  |  |  ------------------
  |  |  |  Branch (242:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  243|      1|            conf.len = prev.len;                                             \
  |  |  244|      1|            conf.data = prev.data;                                           \
  |  |  245|      1|        } else {                                                             \
  |  |  246|      1|            conf.len = sizeof(default) - 1;                                  \
  |  |  247|      1|            conf.data = (u_char *) default;                                  \
  |  |  248|      1|        }                                                                    \
  |  |  249|      2|    }
  ------------------
 1914|       |
 1915|      2|    hash.max_size = 512;
 1916|      2|    hash.bucket_size = ngx_align(64, ngx_cacheline_size);
  ------------------
  |  |  100|      2|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
 1917|      2|    hash.name = "uwsgi_hide_headers_hash";
 1918|       |
 1919|      2|    if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
  ------------------
  |  Branch (1919:9): [True: 0, False: 2]
  ------------------
 1920|      2|            &prev->upstream, ngx_http_uwsgi_hide_headers, &hash)
 1921|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 1922|      0|    {
 1923|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1924|      0|    }
 1925|       |
 1926|      2|    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
  ------------------
  |  |   66|      2|    ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index]
  ------------------
 1927|       |
 1928|      2|    if (clcf->noname
  ------------------
  |  Branch (1928:9): [True: 0, False: 2]
  ------------------
 1929|      2|        && conf->upstream.upstream == NULL && conf->uwsgi_lengths == NULL)
  ------------------
  |  Branch (1929:12): [True: 0, False: 0]
  |  Branch (1929:47): [True: 0, False: 0]
  ------------------
 1930|      0|    {
 1931|      0|        conf->upstream.upstream = prev->upstream.upstream;
 1932|       |
 1933|      0|        conf->uwsgi_lengths = prev->uwsgi_lengths;
 1934|      0|        conf->uwsgi_values = prev->uwsgi_values;
 1935|       |
 1936|       |#if (NGX_HTTP_SSL)
 1937|       |        conf->ssl = prev->ssl;
 1938|       |#endif
 1939|      0|    }
 1940|       |
 1941|      2|    if (clcf->lmt_excpt && clcf->handler == NULL
  ------------------
  |  Branch (1941:9): [True: 0, False: 2]
  |  Branch (1941:28): [True: 0, False: 0]
  ------------------
 1942|      2|        && (conf->upstream.upstream || conf->uwsgi_lengths))
  ------------------
  |  Branch (1942:13): [True: 0, False: 0]
  |  Branch (1942:40): [True: 0, False: 0]
  ------------------
 1943|      0|    {
 1944|      0|        clcf->handler = ngx_http_uwsgi_handler;
 1945|      0|    }
 1946|       |
 1947|      2|    ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0);
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 1948|      2|    ngx_conf_merge_uint_value(conf->modifier2, prev->modifier2, 0);
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 1949|       |
 1950|      2|    if (conf->params_source == NULL) {
  ------------------
  |  Branch (1950:9): [True: 2, False: 0]
  ------------------
 1951|      2|        conf->params = prev->params;
 1952|      2|#if (NGX_HTTP_CACHE)
 1953|      2|        conf->params_cache = prev->params_cache;
 1954|      2|#endif
 1955|      2|        conf->params_source = prev->params_source;
 1956|      2|    }
 1957|       |
 1958|      2|    rc = ngx_http_uwsgi_init_params(cf, conf, &conf->params, NULL);
 1959|      2|    if (rc != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (1959:9): [True: 0, False: 2]
  ------------------
 1960|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1961|      0|    }
 1962|       |
 1963|      2|#if (NGX_HTTP_CACHE)
 1964|       |
 1965|      2|    if (conf->upstream.cache) {
  ------------------
  |  Branch (1965:9): [True: 0, False: 2]
  ------------------
 1966|      0|        rc = ngx_http_uwsgi_init_params(cf, conf, &conf->params_cache,
 1967|      0|                                        ngx_http_uwsgi_cache_headers);
 1968|      0|        if (rc != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1968:13): [True: 0, False: 0]
  ------------------
 1969|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 1970|      0|        }
 1971|      0|    }
 1972|       |
 1973|      2|#endif
 1974|       |
 1975|       |    /*
 1976|       |     * special handling to preserve conf->params in the "http" section
 1977|       |     * to inherit it to all servers
 1978|       |     */
 1979|       |
 1980|      2|    if (prev->params.hash.buckets == NULL
  ------------------
  |  Branch (1980:9): [True: 1, False: 1]
  ------------------
 1981|      2|        && conf->params_source == prev->params_source)
  ------------------
  |  Branch (1981:12): [True: 1, False: 0]
  ------------------
 1982|      1|    {
 1983|      1|        prev->params = conf->params;
 1984|      1|#if (NGX_HTTP_CACHE)
 1985|      1|        prev->params_cache = conf->params_cache;
 1986|      1|#endif
 1987|      1|    }
 1988|       |
 1989|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 1990|      2|}
ngx_http_uwsgi_module.c:ngx_http_uwsgi_init_params:
 1996|      2|{
 1997|      2|    u_char                       *p;
 1998|      2|    size_t                        size;
 1999|      2|    uintptr_t                    *code;
 2000|      2|    ngx_uint_t                    i, nsrc;
 2001|      2|    ngx_array_t                   headers_names, params_merged;
 2002|      2|    ngx_keyval_t                 *h;
 2003|      2|    ngx_hash_key_t               *hk;
 2004|      2|    ngx_hash_init_t               hash;
 2005|      2|    ngx_http_upstream_param_t    *src, *s;
 2006|      2|    ngx_http_script_compile_t     sc;
 2007|      2|    ngx_http_script_copy_code_t  *copy;
 2008|       |
 2009|      2|    if (params->hash.buckets) {
  ------------------
  |  Branch (2009:9): [True: 1, False: 1]
  ------------------
 2010|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2011|      1|    }
 2012|       |
 2013|      1|    if (conf->params_source == NULL && default_params == NULL) {
  ------------------
  |  Branch (2013:9): [True: 1, False: 0]
  |  Branch (2013:40): [True: 1, False: 0]
  ------------------
 2014|      1|        params->hash.buckets = (void *) 1;
 2015|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2016|      1|    }
 2017|       |
 2018|      0|    params->lengths = ngx_array_create(cf->pool, 64, 1);
 2019|      0|    if (params->lengths == NULL) {
  ------------------
  |  Branch (2019:9): [True: 0, False: 0]
  ------------------
 2020|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2021|      0|    }
 2022|       |
 2023|      0|    params->values = ngx_array_create(cf->pool, 512, 1);
 2024|      0|    if (params->values == NULL) {
  ------------------
  |  Branch (2024:9): [True: 0, False: 0]
  ------------------
 2025|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2026|      0|    }
 2027|       |
 2028|      0|    if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
  ------------------
  |  Branch (2028:9): [True: 0, False: 0]
  ------------------
 2029|      0|        != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2030|      0|    {
 2031|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2032|      0|    }
 2033|       |
 2034|      0|    if (conf->params_source) {
  ------------------
  |  Branch (2034:9): [True: 0, False: 0]
  ------------------
 2035|      0|        src = conf->params_source->elts;
 2036|      0|        nsrc = conf->params_source->nelts;
 2037|       |
 2038|      0|    } else {
 2039|      0|        src = NULL;
 2040|      0|        nsrc = 0;
 2041|      0|    }
 2042|       |
 2043|      0|    if (default_params) {
  ------------------
  |  Branch (2043:9): [True: 0, False: 0]
  ------------------
 2044|      0|        if (ngx_array_init(&params_merged, cf->temp_pool, 4,
  ------------------
  |  Branch (2044:13): [True: 0, False: 0]
  ------------------
 2045|      0|                           sizeof(ngx_http_upstream_param_t))
 2046|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2047|      0|        {
 2048|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2049|      0|        }
 2050|       |
 2051|      0|        for (i = 0; i < nsrc; i++) {
  ------------------
  |  Branch (2051:21): [True: 0, False: 0]
  ------------------
 2052|       |
 2053|      0|            s = ngx_array_push(&params_merged);
 2054|      0|            if (s == NULL) {
  ------------------
  |  Branch (2054:17): [True: 0, False: 0]
  ------------------
 2055|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2056|      0|            }
 2057|       |
 2058|      0|            *s = src[i];
 2059|      0|        }
 2060|       |
 2061|      0|        h = default_params;
 2062|       |
 2063|      0|        while (h->key.len) {
  ------------------
  |  Branch (2063:16): [True: 0, False: 0]
  ------------------
 2064|       |
 2065|      0|            src = params_merged.elts;
 2066|      0|            nsrc = params_merged.nelts;
 2067|       |
 2068|      0|            for (i = 0; i < nsrc; i++) {
  ------------------
  |  Branch (2068:25): [True: 0, False: 0]
  ------------------
 2069|      0|                if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
  ------------------
  |  Branch (2069:21): [True: 0, False: 0]
  ------------------
 2070|      0|                    goto next;
 2071|      0|                }
 2072|      0|            }
 2073|       |
 2074|      0|            s = ngx_array_push(&params_merged);
 2075|      0|            if (s == NULL) {
  ------------------
  |  Branch (2075:17): [True: 0, False: 0]
  ------------------
 2076|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2077|      0|            }
 2078|       |
 2079|      0|            s->key = h->key;
 2080|      0|            s->value = h->value;
 2081|      0|            s->skip_empty = 1;
 2082|       |
 2083|      0|        next:
 2084|       |
 2085|      0|            h++;
 2086|      0|        }
 2087|       |
 2088|      0|        src = params_merged.elts;
 2089|      0|        nsrc = params_merged.nelts;
 2090|      0|    }
 2091|       |
 2092|      0|    for (i = 0; i < nsrc; i++) {
  ------------------
  |  Branch (2092:17): [True: 0, False: 0]
  ------------------
 2093|       |
 2094|      0|        if (src[i].key.len > sizeof("HTTP_") - 1
  ------------------
  |  Branch (2094:13): [True: 0, False: 0]
  ------------------
 2095|      0|            && ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0)
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (2095:16): [True: 0, False: 0]
  ------------------
 2096|      0|        {
 2097|      0|            hk = ngx_array_push(&headers_names);
 2098|      0|            if (hk == NULL) {
  ------------------
  |  Branch (2098:17): [True: 0, False: 0]
  ------------------
 2099|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2100|      0|            }
 2101|       |
 2102|      0|            hk->key.len = src[i].key.len - 5;
 2103|      0|            hk->key.data = src[i].key.data + 5;
 2104|      0|            hk->key_hash = ngx_hash_key_lc(hk->key.data, hk->key.len);
 2105|      0|            hk->value = (void *) 1;
 2106|       |
 2107|      0|            if (src[i].value.len == 0) {
  ------------------
  |  Branch (2107:17): [True: 0, False: 0]
  ------------------
 2108|      0|                continue;
 2109|      0|            }
 2110|      0|        }
 2111|       |
 2112|      0|        copy = ngx_array_push_n(params->lengths,
 2113|      0|                                sizeof(ngx_http_script_copy_code_t));
 2114|      0|        if (copy == NULL) {
  ------------------
  |  Branch (2114:13): [True: 0, False: 0]
  ------------------
 2115|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2116|      0|        }
 2117|       |
 2118|      0|        copy->code = (ngx_http_script_code_pt) (void *)
 2119|      0|                                                 ngx_http_script_copy_len_code;
 2120|      0|        copy->len = src[i].key.len;
 2121|       |
 2122|      0|        copy = ngx_array_push_n(params->lengths,
 2123|      0|                                sizeof(ngx_http_script_copy_code_t));
 2124|      0|        if (copy == NULL) {
  ------------------
  |  Branch (2124:13): [True: 0, False: 0]
  ------------------
 2125|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2126|      0|        }
 2127|       |
 2128|      0|        copy->code = (ngx_http_script_code_pt) (void *)
 2129|      0|                                                 ngx_http_script_copy_len_code;
 2130|      0|        copy->len = src[i].skip_empty;
 2131|       |
 2132|       |
 2133|      0|        size = (sizeof(ngx_http_script_copy_code_t)
 2134|      0|                + src[i].key.len + sizeof(uintptr_t) - 1)
 2135|      0|               & ~(sizeof(uintptr_t) - 1);
 2136|       |
 2137|      0|        copy = ngx_array_push_n(params->values, size);
 2138|      0|        if (copy == NULL) {
  ------------------
  |  Branch (2138:13): [True: 0, False: 0]
  ------------------
 2139|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2140|      0|        }
 2141|       |
 2142|      0|        copy->code = ngx_http_script_copy_code;
 2143|      0|        copy->len = src[i].key.len;
 2144|       |
 2145|      0|        p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
 2146|      0|        ngx_memcpy(p, src[i].key.data, src[i].key.len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 2147|       |
 2148|       |
 2149|      0|        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 2150|       |
 2151|      0|        sc.cf = cf;
 2152|      0|        sc.source = &src[i].value;
 2153|      0|        sc.flushes = &params->flushes;
 2154|      0|        sc.lengths = &params->lengths;
 2155|      0|        sc.values = &params->values;
 2156|       |
 2157|      0|        if (ngx_http_script_compile(&sc) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2157:13): [True: 0, False: 0]
  ------------------
 2158|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2159|      0|        }
 2160|       |
 2161|      0|        code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
 2162|      0|        if (code == NULL) {
  ------------------
  |  Branch (2162:13): [True: 0, False: 0]
  ------------------
 2163|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2164|      0|        }
 2165|       |
 2166|      0|        *code = (uintptr_t) NULL;
 2167|       |
 2168|       |
 2169|      0|        code = ngx_array_push_n(params->values, sizeof(uintptr_t));
 2170|      0|        if (code == NULL) {
  ------------------
  |  Branch (2170:13): [True: 0, False: 0]
  ------------------
 2171|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2172|      0|        }
 2173|       |
 2174|      0|        *code = (uintptr_t) NULL;
 2175|      0|    }
 2176|       |
 2177|      0|    code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
 2178|      0|    if (code == NULL) {
  ------------------
  |  Branch (2178:9): [True: 0, False: 0]
  ------------------
 2179|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2180|      0|    }
 2181|       |
 2182|      0|    *code = (uintptr_t) NULL;
 2183|       |
 2184|      0|    params->number = headers_names.nelts;
 2185|       |
 2186|      0|    hash.hash = &params->hash;
 2187|      0|    hash.key = ngx_hash_key_lc;
 2188|      0|    hash.max_size = 512;
 2189|      0|    hash.bucket_size = 64;
 2190|      0|    hash.name = "uwsgi_params_hash";
 2191|      0|    hash.pool = cf->pool;
 2192|      0|    hash.temp_pool = NULL;
 2193|       |
 2194|      0|    return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
 2195|      0|}

ngx_http_add_location:
  847|      1|{
  848|      1|    ngx_http_location_queue_t  *lq;
  849|       |
  850|      1|    if (*locations == NULL) {
  ------------------
  |  Branch (850:9): [True: 1, False: 0]
  ------------------
  851|      1|        *locations = ngx_palloc(cf->temp_pool,
  852|      1|                                sizeof(ngx_http_location_queue_t));
  853|      1|        if (*locations == NULL) {
  ------------------
  |  Branch (853:13): [True: 0, False: 1]
  ------------------
  854|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  855|      0|        }
  856|       |
  857|      1|        ngx_queue_init(*locations);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  858|      1|    }
  859|       |
  860|      1|    lq = ngx_palloc(cf->temp_pool, sizeof(ngx_http_location_queue_t));
  861|      1|    if (lq == NULL) {
  ------------------
  |  Branch (861:9): [True: 0, False: 1]
  ------------------
  862|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  863|      0|    }
  864|       |
  865|      1|    if (clcf->exact_match
  ------------------
  |  Branch (865:9): [True: 0, False: 1]
  ------------------
  866|      1|#if (NGX_PCRE)
  867|      1|        || clcf->regex
  ------------------
  |  Branch (867:12): [True: 0, False: 1]
  ------------------
  868|      1|#endif
  869|      1|        || clcf->named || clcf->noname)
  ------------------
  |  Branch (869:12): [True: 0, False: 1]
  |  Branch (869:27): [True: 0, False: 1]
  ------------------
  870|      0|    {
  871|      0|        lq->exact = clcf;
  872|      0|        lq->inclusive = NULL;
  873|       |
  874|      1|    } else {
  875|      1|        lq->exact = NULL;
  876|      1|        lq->inclusive = clcf;
  877|      1|    }
  878|       |
  879|      1|    lq->name = &clcf->name;
  880|      1|    lq->file_name = cf->conf_file->file.name.data;
  881|      1|    lq->line = cf->conf_file->line;
  882|       |
  883|      1|    ngx_queue_init(&lq->list);
  ------------------
  |  |   25|      1|    (q)->prev = q;                                                            \
  |  |   26|      1|    (q)->next = q
  ------------------
  884|       |
  885|      1|    ngx_queue_insert_tail(*locations, &lq->queue);
  ------------------
  |  |   44|      1|    (x)->prev = (h)->prev;                                                    \
  |  |   45|      1|    (x)->prev->next = x;                                                      \
  |  |   46|      1|    (x)->next = h;                                                            \
  |  |   47|      1|    (h)->prev = x
  ------------------
  886|       |
  887|      1|    if (ngx_http_escape_location_name(cf, clcf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (887:9): [True: 0, False: 1]
  ------------------
  888|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  889|      0|    }
  890|       |
  891|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  892|      1|}
ngx_http_add_listen:
 1180|      1|{
 1181|      1|    in_port_t                   p;
 1182|      1|    ngx_uint_t                  i;
 1183|      1|    struct sockaddr            *sa;
 1184|      1|    ngx_http_conf_port_t       *port;
 1185|      1|    ngx_http_core_main_conf_t  *cmcf;
 1186|       |
 1187|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 1188|       |
 1189|      1|    if (cmcf->ports == NULL) {
  ------------------
  |  Branch (1189:9): [True: 1, False: 0]
  ------------------
 1190|      1|        cmcf->ports = ngx_array_create(cf->temp_pool, 2,
 1191|      1|                                       sizeof(ngx_http_conf_port_t));
 1192|      1|        if (cmcf->ports == NULL) {
  ------------------
  |  Branch (1192:13): [True: 0, False: 1]
  ------------------
 1193|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1194|      0|        }
 1195|      1|    }
 1196|       |
 1197|      1|    sa = lsopt->sockaddr;
 1198|      1|    p = ngx_inet_get_port(sa);
 1199|       |
 1200|      1|    port = cmcf->ports->elts;
 1201|      1|    for (i = 0; i < cmcf->ports->nelts; i++) {
  ------------------
  |  Branch (1201:17): [True: 0, False: 1]
  ------------------
 1202|       |
 1203|      0|        if (p != port[i].port
  ------------------
  |  Branch (1203:13): [True: 0, False: 0]
  ------------------
 1204|      0|            || lsopt->type != port[i].type
  ------------------
  |  Branch (1204:16): [True: 0, False: 0]
  ------------------
 1205|      0|            || sa->sa_family != port[i].family)
  ------------------
  |  Branch (1205:16): [True: 0, False: 0]
  ------------------
 1206|      0|        {
 1207|      0|            continue;
 1208|      0|        }
 1209|       |
 1210|       |        /* a port is already in the port list */
 1211|       |
 1212|      0|        return ngx_http_add_addresses(cf, cscf, &port[i], lsopt);
 1213|      0|    }
 1214|       |
 1215|       |    /* add a port to the port list */
 1216|       |
 1217|      1|    port = ngx_array_push(cmcf->ports);
 1218|      1|    if (port == NULL) {
  ------------------
  |  Branch (1218:9): [True: 0, False: 1]
  ------------------
 1219|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1220|      0|    }
 1221|       |
 1222|      1|    port->family = sa->sa_family;
 1223|      1|    port->type = lsopt->type;
 1224|      1|    port->port = p;
 1225|      1|    port->addrs.elts = NULL;
 1226|       |
 1227|      1|    return ngx_http_add_address(cf, cscf, port, lsopt);
 1228|      1|}
ngx_http_merge_types:
 2110|      6|{
 2111|      6|    ngx_hash_init_t  hash;
 2112|       |
 2113|      6|    if (*keys) {
  ------------------
  |  Branch (2113:9): [True: 0, False: 6]
  ------------------
 2114|       |
 2115|      0|        if (*keys == (void *) -1) {
  ------------------
  |  Branch (2115:13): [True: 0, False: 0]
  ------------------
 2116|      0|            return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 2117|      0|        }
 2118|       |
 2119|      0|        hash.hash = types_hash;
 2120|      0|        hash.key = NULL;
 2121|      0|        hash.max_size = 2048;
 2122|      0|        hash.bucket_size = 64;
 2123|      0|        hash.name = "test_types_hash";
 2124|      0|        hash.pool = cf->pool;
 2125|      0|        hash.temp_pool = NULL;
 2126|       |
 2127|      0|        if (ngx_hash_init(&hash, (*keys)->elts, (*keys)->nelts) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2127:13): [True: 0, False: 0]
  ------------------
 2128|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2129|      0|        }
 2130|       |
 2131|      0|        return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 2132|      0|    }
 2133|       |
 2134|      6|    if (prev_types_hash->buckets == NULL) {
  ------------------
  |  Branch (2134:9): [True: 3, False: 3]
  ------------------
 2135|       |
 2136|      3|        if (*prev_keys == NULL) {
  ------------------
  |  Branch (2136:13): [True: 3, False: 0]
  ------------------
 2137|       |
 2138|      3|            if (ngx_http_set_default_types(cf, prev_keys, default_types)
  ------------------
  |  Branch (2138:17): [True: 0, False: 3]
  ------------------
 2139|      3|                != NGX_OK)
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
 2140|      0|            {
 2141|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2142|      0|            }
 2143|       |
 2144|      3|        } else if (*prev_keys == (void *) -1) {
  ------------------
  |  Branch (2144:20): [True: 0, False: 0]
  ------------------
 2145|      0|            *keys = *prev_keys;
 2146|      0|            return NGX_CONF_OK;
  ------------------
  |  |   63|      0|#define NGX_CONF_OK          NULL
  ------------------
 2147|      0|        }
 2148|       |
 2149|      3|        hash.hash = prev_types_hash;
 2150|      3|        hash.key = NULL;
 2151|      3|        hash.max_size = 2048;
 2152|      3|        hash.bucket_size = 64;
 2153|      3|        hash.name = "test_types_hash";
 2154|      3|        hash.pool = cf->pool;
 2155|      3|        hash.temp_pool = NULL;
 2156|       |
 2157|      3|        if (ngx_hash_init(&hash, (*prev_keys)->elts, (*prev_keys)->nelts)
  ------------------
  |  Branch (2157:13): [True: 0, False: 3]
  ------------------
 2158|      3|            != NGX_OK)
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
 2159|      0|        {
 2160|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2161|      0|        }
 2162|      3|    }
 2163|       |
 2164|      6|    *types_hash = *prev_types_hash;
 2165|       |
 2166|      6|    return NGX_CONF_OK;
  ------------------
  |  |   63|      6|#define NGX_CONF_OK          NULL
  ------------------
 2167|       |
 2168|      6|}
ngx_http_set_default_types:
 2174|      3|{
 2175|      3|    ngx_hash_key_t  *type;
 2176|       |
 2177|      3|    *types = ngx_array_create(cf->temp_pool, 1, sizeof(ngx_hash_key_t));
 2178|      3|    if (*types == NULL) {
  ------------------
  |  Branch (2178:9): [True: 0, False: 3]
  ------------------
 2179|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2180|      0|    }
 2181|       |
 2182|     11|    while (default_type->len) {
  ------------------
  |  Branch (2182:12): [True: 8, False: 3]
  ------------------
 2183|       |
 2184|      8|        type = ngx_array_push(*types);
 2185|      8|        if (type == NULL) {
  ------------------
  |  Branch (2185:13): [True: 0, False: 8]
  ------------------
 2186|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2187|      0|        }
 2188|       |
 2189|      8|        type->key = *default_type;
 2190|      8|        type->key_hash = ngx_hash_key(default_type->data,
 2191|      8|                                      default_type->len);
 2192|      8|        type->value = (void *) 4;
 2193|       |
 2194|      8|        default_type++;
 2195|      8|    }
 2196|       |
 2197|      3|    return NGX_OK;
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
 2198|      3|}
ngx_http.c:ngx_http_block:
  123|      1|{
  124|      1|    char                        *rv;
  125|      1|    ngx_uint_t                   mi, m, s;
  126|      1|    ngx_conf_t                   pcf;
  127|      1|    ngx_http_module_t           *module;
  128|      1|    ngx_http_conf_ctx_t         *ctx;
  129|      1|    ngx_http_core_loc_conf_t    *clcf;
  130|      1|    ngx_http_core_srv_conf_t   **cscfp;
  131|      1|    ngx_http_core_main_conf_t   *cmcf;
  132|       |
  133|      1|    if (*(ngx_http_conf_ctx_t **) conf) {
  ------------------
  |  Branch (133:9): [True: 0, False: 1]
  ------------------
  134|      0|        return "is duplicate";
  135|      0|    }
  136|       |
  137|       |    /* the main http context */
  138|       |
  139|      1|    ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
  140|      1|    if (ctx == NULL) {
  ------------------
  |  Branch (140:9): [True: 0, False: 1]
  ------------------
  141|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  142|      0|    }
  143|       |
  144|      1|    *(ngx_http_conf_ctx_t **) conf = ctx;
  145|       |
  146|       |
  147|       |    /* count the number of the http modules and set up their indices */
  148|       |
  149|      1|    ngx_http_max_module = ngx_count_modules(cf->cycle, NGX_HTTP_MODULE);
  ------------------
  |  |   39|      1|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  150|       |
  151|       |
  152|       |    /* the http main_conf context, it is the same in the all http contexts */
  153|       |
  154|      1|    ctx->main_conf = ngx_pcalloc(cf->pool,
  155|      1|                                 sizeof(void *) * ngx_http_max_module);
  156|      1|    if (ctx->main_conf == NULL) {
  ------------------
  |  Branch (156:9): [True: 0, False: 1]
  ------------------
  157|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  158|      0|    }
  159|       |
  160|       |
  161|       |    /*
  162|       |     * the http null srv_conf context, it is used to merge
  163|       |     * the server{}s' srv_conf's
  164|       |     */
  165|       |
  166|      1|    ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
  167|      1|    if (ctx->srv_conf == NULL) {
  ------------------
  |  Branch (167:9): [True: 0, False: 1]
  ------------------
  168|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  169|      0|    }
  170|       |
  171|       |
  172|       |    /*
  173|       |     * the http null loc_conf context, it is used to merge
  174|       |     * the server{}s' loc_conf's
  175|       |     */
  176|       |
  177|      1|    ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
  178|      1|    if (ctx->loc_conf == NULL) {
  ------------------
  |  Branch (178:9): [True: 0, False: 1]
  ------------------
  179|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  180|      0|    }
  181|       |
  182|       |
  183|       |    /*
  184|       |     * create the main_conf's, the null srv_conf's, and the null loc_conf's
  185|       |     * of the all http modules
  186|       |     */
  187|       |
  188|     55|    for (m = 0; cf->cycle->modules[m]; m++) {
  ------------------
  |  Branch (188:17): [True: 54, False: 1]
  ------------------
  189|     54|        if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
  ------------------
  |  |   39|     54|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  |  Branch (189:13): [True: 8, False: 46]
  ------------------
  190|      8|            continue;
  191|      8|        }
  192|       |
  193|     46|        module = cf->cycle->modules[m]->ctx;
  194|     46|        mi = cf->cycle->modules[m]->ctx_index;
  195|       |
  196|     46|        if (module->create_main_conf) {
  ------------------
  |  Branch (196:13): [True: 11, False: 35]
  ------------------
  197|     11|            ctx->main_conf[mi] = module->create_main_conf(cf);
  198|     11|            if (ctx->main_conf[mi] == NULL) {
  ------------------
  |  Branch (198:17): [True: 0, False: 11]
  ------------------
  199|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  200|      0|            }
  201|     11|        }
  202|       |
  203|     46|        if (module->create_srv_conf) {
  ------------------
  |  Branch (203:13): [True: 5, False: 41]
  ------------------
  204|      5|            ctx->srv_conf[mi] = module->create_srv_conf(cf);
  205|      5|            if (ctx->srv_conf[mi] == NULL) {
  ------------------
  |  Branch (205:17): [True: 0, False: 5]
  ------------------
  206|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  207|      0|            }
  208|      5|        }
  209|       |
  210|     46|        if (module->create_loc_conf) {
  ------------------
  |  Branch (210:13): [True: 26, False: 20]
  ------------------
  211|     26|            ctx->loc_conf[mi] = module->create_loc_conf(cf);
  212|     26|            if (ctx->loc_conf[mi] == NULL) {
  ------------------
  |  Branch (212:17): [True: 0, False: 26]
  ------------------
  213|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  214|      0|            }
  215|     26|        }
  216|     46|    }
  217|       |
  218|      1|    pcf = *cf;
  219|      1|    cf->ctx = ctx;
  220|       |
  221|     55|    for (m = 0; cf->cycle->modules[m]; m++) {
  ------------------
  |  Branch (221:17): [True: 54, False: 1]
  ------------------
  222|     54|        if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
  ------------------
  |  |   39|     54|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  |  Branch (222:13): [True: 8, False: 46]
  ------------------
  223|      8|            continue;
  224|      8|        }
  225|       |
  226|     46|        module = cf->cycle->modules[m]->ctx;
  227|       |
  228|     46|        if (module->preconfiguration) {
  ------------------
  |  Branch (228:13): [True: 13, False: 33]
  ------------------
  229|     13|            if (module->preconfiguration(cf) != NGX_OK) {
  ------------------
  |  |   38|     13|#define  NGX_OK          0
  ------------------
  |  Branch (229:17): [True: 0, False: 13]
  ------------------
  230|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  231|      0|            }
  232|     13|        }
  233|     46|    }
  234|       |
  235|       |    /* parse inside the http{} block */
  236|       |
  237|      1|    cf->module_type = NGX_HTTP_MODULE;
  ------------------
  |  |   39|      1|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  238|      1|    cf->cmd_type = NGX_HTTP_MAIN_CONF;
  ------------------
  |  |   41|      1|#define NGX_HTTP_MAIN_CONF        0x02000000
  ------------------
  239|      1|    rv = ngx_conf_parse(cf, NULL);
  240|       |
  241|      1|    if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (241:9): [True: 0, False: 1]
  ------------------
  242|      0|        goto failed;
  243|      0|    }
  244|       |
  245|       |    /*
  246|       |     * init http{} main_conf's, merge the server{}s' srv_conf's
  247|       |     * and its location{}s' loc_conf's
  248|       |     */
  249|       |
  250|      1|    cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
  251|      1|    cscfp = cmcf->servers.elts;
  252|       |
  253|     55|    for (m = 0; cf->cycle->modules[m]; m++) {
  ------------------
  |  Branch (253:17): [True: 54, False: 1]
  ------------------
  254|     54|        if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
  ------------------
  |  |   39|     54|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  |  Branch (254:13): [True: 8, False: 46]
  ------------------
  255|      8|            continue;
  256|      8|        }
  257|       |
  258|     46|        module = cf->cycle->modules[m]->ctx;
  259|     46|        mi = cf->cycle->modules[m]->ctx_index;
  260|       |
  261|       |        /* init http{} main_conf's */
  262|       |
  263|     46|        if (module->init_main_conf) {
  ------------------
  |  Branch (263:13): [True: 4, False: 42]
  ------------------
  264|      4|            rv = module->init_main_conf(cf, ctx->main_conf[mi]);
  265|      4|            if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|      4|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (265:17): [True: 0, False: 4]
  ------------------
  266|      0|                goto failed;
  267|      0|            }
  268|      4|        }
  269|       |
  270|     46|        rv = ngx_http_merge_servers(cf, cmcf, module, mi);
  271|     46|        if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|     46|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (271:13): [True: 0, False: 46]
  ------------------
  272|      0|            goto failed;
  273|      0|        }
  274|     46|    }
  275|       |
  276|       |
  277|       |    /* create location trees */
  278|       |
  279|      2|    for (s = 0; s < cmcf->servers.nelts; s++) {
  ------------------
  |  Branch (279:17): [True: 1, False: 1]
  ------------------
  280|       |
  281|      1|        clcf = cscfp[s]->ctx->loc_conf[ngx_http_core_module.ctx_index];
  282|       |
  283|      1|        if (ngx_http_init_locations(cf, cscfp[s], clcf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (283:13): [True: 0, False: 1]
  ------------------
  284|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  285|      0|        }
  286|       |
  287|      1|        if (ngx_http_init_static_location_trees(cf, clcf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (287:13): [True: 0, False: 1]
  ------------------
  288|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  289|      0|        }
  290|      1|    }
  291|       |
  292|       |
  293|      1|    if (ngx_http_init_phases(cf, cmcf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (293:9): [True: 0, False: 1]
  ------------------
  294|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  295|      0|    }
  296|       |
  297|      1|    if (ngx_http_init_headers_in_hash(cf, cmcf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (297:9): [True: 0, False: 1]
  ------------------
  298|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  299|      0|    }
  300|       |
  301|       |
  302|     55|    for (m = 0; cf->cycle->modules[m]; m++) {
  ------------------
  |  Branch (302:17): [True: 54, False: 1]
  ------------------
  303|     54|        if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
  ------------------
  |  |   39|     54|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  |  Branch (303:13): [True: 8, False: 46]
  ------------------
  304|      8|            continue;
  305|      8|        }
  306|       |
  307|     46|        module = cf->cycle->modules[m]->ctx;
  308|       |
  309|     46|        if (module->postconfiguration) {
  ------------------
  |  Branch (309:13): [True: 26, False: 20]
  ------------------
  310|     26|            if (module->postconfiguration(cf) != NGX_OK) {
  ------------------
  |  |   38|     26|#define  NGX_OK          0
  ------------------
  |  Branch (310:17): [True: 0, False: 26]
  ------------------
  311|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  312|      0|            }
  313|     26|        }
  314|     46|    }
  315|       |
  316|      1|    if (ngx_http_variables_init_vars(cf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (316:9): [True: 0, False: 1]
  ------------------
  317|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  318|      0|    }
  319|       |
  320|       |    /*
  321|       |     * http{}'s cf->ctx was needed while the configuration merging
  322|       |     * and in postconfiguration process
  323|       |     */
  324|       |
  325|      1|    *cf = pcf;
  326|       |
  327|       |
  328|      1|    if (ngx_http_init_phase_handlers(cf, cmcf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (328:9): [True: 0, False: 1]
  ------------------
  329|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  330|      0|    }
  331|       |
  332|       |
  333|       |    /* optimize the lists of ports, addresses and server names */
  334|       |
  335|      1|    if (ngx_http_optimize_servers(cf, cmcf, cmcf->ports) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (335:9): [True: 0, False: 1]
  ------------------
  336|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
  337|      0|    }
  338|       |
  339|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  340|       |
  341|      0|failed:
  342|       |
  343|      0|    *cf = pcf;
  344|       |
  345|      0|    return rv;
  346|      1|}
ngx_http.c:ngx_http_merge_servers:
  565|     46|{
  566|     46|    char                        *rv;
  567|     46|    ngx_uint_t                   s;
  568|     46|    ngx_http_conf_ctx_t         *ctx, saved;
  569|     46|    ngx_http_core_loc_conf_t    *clcf;
  570|     46|    ngx_http_core_srv_conf_t   **cscfp;
  571|       |
  572|     46|    cscfp = cmcf->servers.elts;
  573|     46|    ctx = (ngx_http_conf_ctx_t *) cf->ctx;
  574|     46|    saved = *ctx;
  575|     46|    rv = NGX_CONF_OK;
  ------------------
  |  |   63|     46|#define NGX_CONF_OK          NULL
  ------------------
  576|       |
  577|     92|    for (s = 0; s < cmcf->servers.nelts; s++) {
  ------------------
  |  Branch (577:17): [True: 46, False: 46]
  ------------------
  578|       |
  579|       |        /* merge the server{}s' srv_conf's */
  580|       |
  581|     46|        ctx->srv_conf = cscfp[s]->ctx->srv_conf;
  582|       |
  583|     46|        if (module->merge_srv_conf) {
  ------------------
  |  Branch (583:13): [True: 2, False: 44]
  ------------------
  584|      2|            rv = module->merge_srv_conf(cf, saved.srv_conf[ctx_index],
  585|      2|                                        cscfp[s]->ctx->srv_conf[ctx_index]);
  586|      2|            if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (586:17): [True: 0, False: 2]
  ------------------
  587|      0|                goto failed;
  588|      0|            }
  589|      2|        }
  590|       |
  591|     46|        if (module->merge_loc_conf) {
  ------------------
  |  Branch (591:13): [True: 25, False: 21]
  ------------------
  592|       |
  593|       |            /* merge the server{}'s loc_conf */
  594|       |
  595|     25|            ctx->loc_conf = cscfp[s]->ctx->loc_conf;
  596|       |
  597|     25|            rv = module->merge_loc_conf(cf, saved.loc_conf[ctx_index],
  598|     25|                                        cscfp[s]->ctx->loc_conf[ctx_index]);
  599|     25|            if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|     25|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (599:17): [True: 0, False: 25]
  ------------------
  600|      0|                goto failed;
  601|      0|            }
  602|       |
  603|       |            /* merge the locations{}' loc_conf's */
  604|       |
  605|     25|            clcf = cscfp[s]->ctx->loc_conf[ngx_http_core_module.ctx_index];
  606|       |
  607|     25|            rv = ngx_http_merge_locations(cf, clcf->locations,
  608|     25|                                          cscfp[s]->ctx->loc_conf,
  609|     25|                                          module, ctx_index);
  610|     25|            if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|     25|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (610:17): [True: 0, False: 25]
  ------------------
  611|      0|                goto failed;
  612|      0|            }
  613|     25|        }
  614|     46|    }
  615|       |
  616|     46|failed:
  617|       |
  618|     46|    *ctx = saved;
  619|       |
  620|     46|    return rv;
  621|     46|}
ngx_http.c:ngx_http_merge_locations:
  627|     50|{
  628|     50|    char                       *rv;
  629|     50|    ngx_queue_t                *q;
  630|     50|    ngx_http_conf_ctx_t        *ctx, saved;
  631|     50|    ngx_http_core_loc_conf_t   *clcf;
  632|     50|    ngx_http_location_queue_t  *lq;
  633|       |
  634|     50|    if (locations == NULL) {
  ------------------
  |  Branch (634:9): [True: 25, False: 25]
  ------------------
  635|     25|        return NGX_CONF_OK;
  ------------------
  |  |   63|     25|#define NGX_CONF_OK          NULL
  ------------------
  636|     25|    }
  637|       |
  638|     25|    ctx = (ngx_http_conf_ctx_t *) cf->ctx;
  639|     25|    saved = *ctx;
  640|       |
  641|     25|    for (q = ngx_queue_head(locations);
  ------------------
  |  |   51|     25|    (h)->next
  ------------------
  642|     50|         q != ngx_queue_sentinel(locations);
  ------------------
  |  |   59|     50|    (h)
  ------------------
  |  Branch (642:10): [True: 25, False: 25]
  ------------------
  643|     25|         q = ngx_queue_next(q))
  ------------------
  |  |   63|     25|    (q)->next
  ------------------
  644|     25|    {
  645|     25|        lq = (ngx_http_location_queue_t *) q;
  646|       |
  647|     25|        clcf = lq->exact ? lq->exact : lq->inclusive;
  ------------------
  |  Branch (647:16): [True: 0, False: 25]
  ------------------
  648|     25|        ctx->loc_conf = clcf->loc_conf;
  649|       |
  650|     25|        rv = module->merge_loc_conf(cf, loc_conf[ctx_index],
  651|     25|                                    clcf->loc_conf[ctx_index]);
  652|     25|        if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|     25|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (652:13): [True: 0, False: 25]
  ------------------
  653|      0|            return rv;
  654|      0|        }
  655|       |
  656|     25|        rv = ngx_http_merge_locations(cf, clcf->locations, clcf->loc_conf,
  657|     25|                                      module, ctx_index);
  658|     25|        if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|     25|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (658:13): [True: 0, False: 25]
  ------------------
  659|      0|            return rv;
  660|      0|        }
  661|     25|    }
  662|       |
  663|     25|    *ctx = saved;
  664|       |
  665|     25|    return NGX_CONF_OK;
  ------------------
  |  |   63|     25|#define NGX_CONF_OK          NULL
  ------------------
  666|     25|}
ngx_http.c:ngx_http_init_locations:
  672|      2|{
  673|      2|    ngx_uint_t                   n;
  674|      2|    ngx_queue_t                 *q, *locations, *named, tail;
  675|      2|    ngx_http_core_loc_conf_t    *clcf;
  676|      2|    ngx_http_location_queue_t   *lq;
  677|      2|    ngx_http_core_loc_conf_t   **clcfp;
  678|      2|#if (NGX_PCRE)
  679|      2|    ngx_uint_t                   r;
  680|      2|    ngx_queue_t                 *regex;
  681|      2|#endif
  682|       |
  683|      2|    locations = pclcf->locations;
  684|       |
  685|      2|    if (locations == NULL) {
  ------------------
  |  Branch (685:9): [True: 1, False: 1]
  ------------------
  686|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  687|      1|    }
  688|       |
  689|      1|    ngx_queue_sort(locations, ngx_http_cmp_locations);
  690|       |
  691|      1|    named = NULL;
  692|      1|    n = 0;
  693|      1|#if (NGX_PCRE)
  694|      1|    regex = NULL;
  695|      1|    r = 0;
  696|      1|#endif
  697|       |
  698|      1|    for (q = ngx_queue_head(locations);
  ------------------
  |  |   51|      1|    (h)->next
  ------------------
  699|      2|         q != ngx_queue_sentinel(locations);
  ------------------
  |  |   59|      2|    (h)
  ------------------
  |  Branch (699:10): [True: 1, False: 1]
  ------------------
  700|      1|         q = ngx_queue_next(q))
  ------------------
  |  |   63|      1|    (q)->next
  ------------------
  701|      1|    {
  702|      1|        lq = (ngx_http_location_queue_t *) q;
  703|       |
  704|      1|        clcf = lq->exact ? lq->exact : lq->inclusive;
  ------------------
  |  Branch (704:16): [True: 0, False: 1]
  ------------------
  705|       |
  706|      1|        if (ngx_http_init_locations(cf, NULL, clcf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (706:13): [True: 0, False: 1]
  ------------------
  707|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  708|      0|        }
  709|       |
  710|      1|#if (NGX_PCRE)
  711|       |
  712|      1|        if (clcf->regex) {
  ------------------
  |  Branch (712:13): [True: 0, False: 1]
  ------------------
  713|      0|            r++;
  714|       |
  715|      0|            if (regex == NULL) {
  ------------------
  |  Branch (715:17): [True: 0, False: 0]
  ------------------
  716|      0|                regex = q;
  717|      0|            }
  718|       |
  719|      0|            continue;
  720|      0|        }
  721|       |
  722|      1|#endif
  723|       |
  724|      1|        if (clcf->named) {
  ------------------
  |  Branch (724:13): [True: 0, False: 1]
  ------------------
  725|      0|            n++;
  726|       |
  727|      0|            if (named == NULL) {
  ------------------
  |  Branch (727:17): [True: 0, False: 0]
  ------------------
  728|      0|                named = q;
  729|      0|            }
  730|       |
  731|      0|            continue;
  732|      0|        }
  733|       |
  734|      1|        if (clcf->noname) {
  ------------------
  |  Branch (734:13): [True: 0, False: 1]
  ------------------
  735|      0|            break;
  736|      0|        }
  737|      1|    }
  738|       |
  739|      1|    if (q != ngx_queue_sentinel(locations)) {
  ------------------
  |  |   59|      1|    (h)
  ------------------
  |  Branch (739:9): [True: 0, False: 1]
  ------------------
  740|      0|        ngx_queue_split(locations, q, &tail);
  ------------------
  |  |   88|      0|    (n)->prev = (h)->prev;                                                    \
  |  |   89|      0|    (n)->prev->next = n;                                                      \
  |  |   90|      0|    (n)->next = q;                                                            \
  |  |   91|      0|    (h)->prev = (q)->prev;                                                    \
  |  |   92|      0|    (h)->prev->next = h;                                                      \
  |  |   93|      0|    (q)->prev = n;
  ------------------
  741|      0|    }
  742|       |
  743|      1|    if (named) {
  ------------------
  |  Branch (743:9): [True: 0, False: 1]
  ------------------
  744|      0|        clcfp = ngx_palloc(cf->pool,
  745|      0|                           (n + 1) * sizeof(ngx_http_core_loc_conf_t *));
  746|      0|        if (clcfp == NULL) {
  ------------------
  |  Branch (746:13): [True: 0, False: 0]
  ------------------
  747|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  748|      0|        }
  749|       |
  750|      0|        cscf->named_locations = clcfp;
  751|       |
  752|      0|        for (q = named;
  753|      0|             q != ngx_queue_sentinel(locations);
  ------------------
  |  |   59|      0|    (h)
  ------------------
  |  Branch (753:14): [True: 0, False: 0]
  ------------------
  754|      0|             q = ngx_queue_next(q))
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
  755|      0|        {
  756|      0|            lq = (ngx_http_location_queue_t *) q;
  757|       |
  758|      0|            *(clcfp++) = lq->exact;
  759|      0|        }
  760|       |
  761|      0|        *clcfp = NULL;
  762|       |
  763|      0|        ngx_queue_split(locations, named, &tail);
  ------------------
  |  |   88|      0|    (n)->prev = (h)->prev;                                                    \
  |  |   89|      0|    (n)->prev->next = n;                                                      \
  |  |   90|      0|    (n)->next = q;                                                            \
  |  |   91|      0|    (h)->prev = (q)->prev;                                                    \
  |  |   92|      0|    (h)->prev->next = h;                                                      \
  |  |   93|      0|    (q)->prev = n;
  ------------------
  764|      0|    }
  765|       |
  766|      1|#if (NGX_PCRE)
  767|       |
  768|      1|    if (regex) {
  ------------------
  |  Branch (768:9): [True: 0, False: 1]
  ------------------
  769|       |
  770|      0|        clcfp = ngx_palloc(cf->pool,
  771|      0|                           (r + 1) * sizeof(ngx_http_core_loc_conf_t *));
  772|      0|        if (clcfp == NULL) {
  ------------------
  |  Branch (772:13): [True: 0, False: 0]
  ------------------
  773|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  774|      0|        }
  775|       |
  776|      0|        pclcf->regex_locations = clcfp;
  777|       |
  778|      0|        for (q = regex;
  779|      0|             q != ngx_queue_sentinel(locations);
  ------------------
  |  |   59|      0|    (h)
  ------------------
  |  Branch (779:14): [True: 0, False: 0]
  ------------------
  780|      0|             q = ngx_queue_next(q))
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
  781|      0|        {
  782|      0|            lq = (ngx_http_location_queue_t *) q;
  783|       |
  784|      0|            *(clcfp++) = lq->exact;
  785|      0|        }
  786|       |
  787|      0|        *clcfp = NULL;
  788|       |
  789|      0|        ngx_queue_split(locations, regex, &tail);
  ------------------
  |  |   88|      0|    (n)->prev = (h)->prev;                                                    \
  |  |   89|      0|    (n)->prev->next = n;                                                      \
  |  |   90|      0|    (n)->next = q;                                                            \
  |  |   91|      0|    (h)->prev = (q)->prev;                                                    \
  |  |   92|      0|    (h)->prev->next = h;                                                      \
  |  |   93|      0|    (q)->prev = n;
  ------------------
  790|      0|    }
  791|       |
  792|      1|#endif
  793|       |
  794|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  795|      1|}
ngx_http.c:ngx_http_init_static_location_trees:
  801|      2|{
  802|      2|    ngx_queue_t                *q, *locations;
  803|      2|    ngx_http_core_loc_conf_t   *clcf;
  804|      2|    ngx_http_location_queue_t  *lq;
  805|       |
  806|      2|    locations = pclcf->locations;
  807|       |
  808|      2|    if (locations == NULL) {
  ------------------
  |  Branch (808:9): [True: 1, False: 1]
  ------------------
  809|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  810|      1|    }
  811|       |
  812|      1|    if (ngx_queue_empty(locations)) {
  ------------------
  |  |   30|      1|    (h == (h)->prev)
  |  |  ------------------
  |  |  |  Branch (30:5): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  813|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  814|      0|    }
  815|       |
  816|      1|    for (q = ngx_queue_head(locations);
  ------------------
  |  |   51|      1|    (h)->next
  ------------------
  817|      2|         q != ngx_queue_sentinel(locations);
  ------------------
  |  |   59|      2|    (h)
  ------------------
  |  Branch (817:10): [True: 1, False: 1]
  ------------------
  818|      1|         q = ngx_queue_next(q))
  ------------------
  |  |   63|      1|    (q)->next
  ------------------
  819|      1|    {
  820|      1|        lq = (ngx_http_location_queue_t *) q;
  821|       |
  822|      1|        clcf = lq->exact ? lq->exact : lq->inclusive;
  ------------------
  |  Branch (822:16): [True: 0, False: 1]
  ------------------
  823|       |
  824|      1|        if (ngx_http_init_static_location_trees(cf, clcf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (824:13): [True: 0, False: 1]
  ------------------
  825|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  826|      0|        }
  827|      1|    }
  828|       |
  829|      1|    if (ngx_http_join_exact_locations(cf, locations) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (829:9): [True: 0, False: 1]
  ------------------
  830|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  831|      0|    }
  832|       |
  833|      1|    ngx_http_create_locations_list(locations, ngx_queue_head(locations));
  ------------------
  |  |   51|      1|    (h)->next
  ------------------
  834|       |
  835|      1|    pclcf->static_locations = ngx_http_create_locations_tree(cf, locations, 0);
  836|      1|    if (pclcf->static_locations == NULL) {
  ------------------
  |  Branch (836:9): [True: 0, False: 1]
  ------------------
  837|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  838|      0|    }
  839|       |
  840|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  841|      1|}
ngx_http.c:ngx_http_join_exact_locations:
 1001|      1|{
 1002|      1|    ngx_queue_t                *q, *x;
 1003|      1|    ngx_http_location_queue_t  *lq, *lx;
 1004|       |
 1005|      1|    q = ngx_queue_head(locations);
  ------------------
  |  |   51|      1|    (h)->next
  ------------------
 1006|       |
 1007|      1|    while (q != ngx_queue_last(locations)) {
  ------------------
  |  |   55|      1|    (h)->prev
  ------------------
  |  Branch (1007:12): [True: 0, False: 1]
  ------------------
 1008|       |
 1009|      0|        x = ngx_queue_next(q);
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
 1010|       |
 1011|      0|        lq = (ngx_http_location_queue_t *) q;
 1012|      0|        lx = (ngx_http_location_queue_t *) x;
 1013|       |
 1014|      0|        if (lq->name->len == lx->name->len
  ------------------
  |  Branch (1014:13): [True: 0, False: 0]
  ------------------
 1015|      0|            && ngx_filename_cmp(lq->name->data, lx->name->data, lx->name->len)
  ------------------
  |  Branch (1015:16): [True: 0, False: 0]
  ------------------
 1016|      0|               == 0)
 1017|      0|        {
 1018|      0|            if ((lq->exact && lx->exact) || (lq->inclusive && lx->inclusive)) {
  ------------------
  |  Branch (1018:18): [True: 0, False: 0]
  |  Branch (1018:31): [True: 0, False: 0]
  |  Branch (1018:46): [True: 0, False: 0]
  |  Branch (1018:63): [True: 0, False: 0]
  ------------------
 1019|      0|                ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1020|      0|                              "duplicate location \"%V\" in %s:%ui",
 1021|      0|                              lx->name, lx->file_name, lx->line);
 1022|       |
 1023|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1024|      0|            }
 1025|       |
 1026|      0|            lq->inclusive = lx->inclusive;
 1027|       |
 1028|      0|            ngx_queue_remove(x);
  ------------------
  |  |   81|      0|    (x)->next->prev = (x)->prev;                                              \
  |  |   82|      0|    (x)->prev->next = (x)->next
  ------------------
 1029|       |
 1030|      0|            continue;
 1031|      0|        }
 1032|       |
 1033|      0|        q = ngx_queue_next(q);
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
 1034|      0|    }
 1035|       |
 1036|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1037|      1|}
ngx_http.c:ngx_http_create_locations_list:
 1042|      1|{
 1043|      1|    u_char                     *name;
 1044|      1|    size_t                      len;
 1045|      1|    ngx_queue_t                *x, tail;
 1046|      1|    ngx_http_location_queue_t  *lq, *lx;
 1047|       |
 1048|      1|    if (q == ngx_queue_last(locations)) {
  ------------------
  |  |   55|      1|    (h)->prev
  ------------------
  |  Branch (1048:9): [True: 1, False: 0]
  ------------------
 1049|      1|        return;
 1050|      1|    }
 1051|       |
 1052|      0|    lq = (ngx_http_location_queue_t *) q;
 1053|       |
 1054|      0|    if (lq->inclusive == NULL) {
  ------------------
  |  Branch (1054:9): [True: 0, False: 0]
  ------------------
 1055|      0|        ngx_http_create_locations_list(locations, ngx_queue_next(q));
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
 1056|      0|        return;
 1057|      0|    }
 1058|       |
 1059|      0|    len = lq->name->len;
 1060|      0|    name = lq->name->data;
 1061|       |
 1062|      0|    for (x = ngx_queue_next(q);
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
 1063|      0|         x != ngx_queue_sentinel(locations);
  ------------------
  |  |   59|      0|    (h)
  ------------------
  |  Branch (1063:10): [True: 0, False: 0]
  ------------------
 1064|      0|         x = ngx_queue_next(x))
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
 1065|      0|    {
 1066|      0|        lx = (ngx_http_location_queue_t *) x;
 1067|       |
 1068|      0|        if (len > lx->name->len
  ------------------
  |  Branch (1068:13): [True: 0, False: 0]
  ------------------
 1069|      0|            || ngx_filename_cmp(name, lx->name->data, len) != 0)
  ------------------
  |  Branch (1069:16): [True: 0, False: 0]
  ------------------
 1070|      0|        {
 1071|      0|            break;
 1072|      0|        }
 1073|      0|    }
 1074|       |
 1075|      0|    q = ngx_queue_next(q);
  ------------------
  |  |   63|      0|    (q)->next
  ------------------
 1076|       |
 1077|      0|    if (q == x) {
  ------------------
  |  Branch (1077:9): [True: 0, False: 0]
  ------------------
 1078|      0|        ngx_http_create_locations_list(locations, x);
 1079|      0|        return;
 1080|      0|    }
 1081|       |
 1082|      0|    ngx_queue_split(locations, q, &tail);
  ------------------
  |  |   88|      0|    (n)->prev = (h)->prev;                                                    \
  |  |   89|      0|    (n)->prev->next = n;                                                      \
  |  |   90|      0|    (n)->next = q;                                                            \
  |  |   91|      0|    (h)->prev = (q)->prev;                                                    \
  |  |   92|      0|    (h)->prev->next = h;                                                      \
  |  |   93|      0|    (q)->prev = n;
  ------------------
 1083|      0|    ngx_queue_add(&lq->list, &tail);
  ------------------
  |  |   97|      0|    (h)->prev->next = (n)->next;                                              \
  |  |   98|      0|    (n)->next->prev = (h)->prev;                                              \
  |  |   99|      0|    (h)->prev = (n)->prev;                                                    \
  |  |  100|      0|    (h)->prev->next = h;
  ------------------
 1084|       |
 1085|      0|    if (x == ngx_queue_sentinel(locations)) {
  ------------------
  |  |   59|      0|    (h)
  ------------------
  |  Branch (1085:9): [True: 0, False: 0]
  ------------------
 1086|      0|        ngx_http_create_locations_list(&lq->list, ngx_queue_head(&lq->list));
  ------------------
  |  |   51|      0|    (h)->next
  ------------------
 1087|      0|        return;
 1088|      0|    }
 1089|       |
 1090|      0|    ngx_queue_split(&lq->list, x, &tail);
  ------------------
  |  |   88|      0|    (n)->prev = (h)->prev;                                                    \
  |  |   89|      0|    (n)->prev->next = n;                                                      \
  |  |   90|      0|    (n)->next = q;                                                            \
  |  |   91|      0|    (h)->prev = (q)->prev;                                                    \
  |  |   92|      0|    (h)->prev->next = h;                                                      \
  |  |   93|      0|    (q)->prev = n;
  ------------------
 1091|      0|    ngx_queue_add(locations, &tail);
  ------------------
  |  |   97|      0|    (h)->prev->next = (n)->next;                                              \
  |  |   98|      0|    (n)->next->prev = (h)->prev;                                              \
  |  |   99|      0|    (h)->prev = (n)->prev;                                                    \
  |  |  100|      0|    (h)->prev->next = h;
  ------------------
 1092|       |
 1093|      0|    ngx_http_create_locations_list(&lq->list, ngx_queue_head(&lq->list));
  ------------------
  |  |   51|      0|    (h)->next
  ------------------
 1094|       |
 1095|      0|    ngx_http_create_locations_list(locations, x);
 1096|      0|}
ngx_http.c:ngx_http_create_locations_tree:
 1107|      1|{
 1108|      1|    size_t                          len;
 1109|      1|    ngx_queue_t                    *q, tail;
 1110|      1|    ngx_http_location_queue_t      *lq;
 1111|      1|    ngx_http_location_tree_node_t  *node;
 1112|       |
 1113|      1|    q = ngx_queue_middle(locations);
 1114|       |
 1115|      1|    lq = (ngx_http_location_queue_t *) q;
 1116|      1|    len = lq->name->len - prefix;
 1117|       |
 1118|      1|    node = ngx_palloc(cf->pool,
 1119|      1|                      offsetof(ngx_http_location_tree_node_t, name) + len);
 1120|      1|    if (node == NULL) {
  ------------------
  |  Branch (1120:9): [True: 0, False: 1]
  ------------------
 1121|      0|        return NULL;
 1122|      0|    }
 1123|       |
 1124|      1|    node->left = NULL;
 1125|      1|    node->right = NULL;
 1126|      1|    node->tree = NULL;
 1127|      1|    node->exact = lq->exact;
 1128|      1|    node->inclusive = lq->inclusive;
 1129|       |
 1130|      1|    node->auto_redirect = (u_char) ((lq->exact && lq->exact->auto_redirect)
  ------------------
  |  Branch (1130:38): [True: 0, False: 1]
  |  Branch (1130:51): [True: 0, False: 0]
  ------------------
 1131|      1|                           || (lq->inclusive && lq->inclusive->auto_redirect));
  ------------------
  |  Branch (1131:32): [True: 1, False: 0]
  |  Branch (1131:49): [True: 1, False: 0]
  ------------------
 1132|       |
 1133|      1|    node->len = (u_short) len;
 1134|      1|    ngx_memcpy(node->name, &lq->name->data[prefix], len);
  ------------------
  |  |  106|      1|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1135|       |
 1136|      1|    ngx_queue_split(locations, q, &tail);
  ------------------
  |  |   88|      1|    (n)->prev = (h)->prev;                                                    \
  |  |   89|      1|    (n)->prev->next = n;                                                      \
  |  |   90|      1|    (n)->next = q;                                                            \
  |  |   91|      1|    (h)->prev = (q)->prev;                                                    \
  |  |   92|      1|    (h)->prev->next = h;                                                      \
  |  |   93|      1|    (q)->prev = n;
  ------------------
 1137|       |
 1138|      1|    if (ngx_queue_empty(locations)) {
  ------------------
  |  |   30|      1|    (h == (h)->prev)
  |  |  ------------------
  |  |  |  Branch (30:5): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 1139|       |        /*
 1140|       |         * ngx_queue_split() insures that if left part is empty,
 1141|       |         * then right one is empty too
 1142|       |         */
 1143|      1|        goto inclusive;
 1144|      1|    }
 1145|       |
 1146|      0|    node->left = ngx_http_create_locations_tree(cf, locations, prefix);
 1147|      0|    if (node->left == NULL) {
  ------------------
  |  Branch (1147:9): [True: 0, False: 0]
  ------------------
 1148|      0|        return NULL;
 1149|      0|    }
 1150|       |
 1151|      0|    ngx_queue_remove(q);
  ------------------
  |  |   81|      0|    (x)->next->prev = (x)->prev;                                              \
  |  |   82|      0|    (x)->prev->next = (x)->next
  ------------------
 1152|       |
 1153|      0|    if (ngx_queue_empty(&tail)) {
  ------------------
  |  |   30|      0|    (h == (h)->prev)
  |  |  ------------------
  |  |  |  Branch (30:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1154|      0|        goto inclusive;
 1155|      0|    }
 1156|       |
 1157|      0|    node->right = ngx_http_create_locations_tree(cf, &tail, prefix);
 1158|      0|    if (node->right == NULL) {
  ------------------
  |  Branch (1158:9): [True: 0, False: 0]
  ------------------
 1159|      0|        return NULL;
 1160|      0|    }
 1161|       |
 1162|      1|inclusive:
 1163|       |
 1164|      1|    if (ngx_queue_empty(&lq->list)) {
  ------------------
  |  |   30|      1|    (h == (h)->prev)
  |  |  ------------------
  |  |  |  Branch (30:5): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 1165|      1|        return node;
 1166|      1|    }
 1167|       |
 1168|      0|    node->tree = ngx_http_create_locations_tree(cf, &lq->list, prefix + len);
 1169|      0|    if (node->tree == NULL) {
  ------------------
  |  Branch (1169:9): [True: 0, False: 0]
  ------------------
 1170|      0|        return NULL;
 1171|      0|    }
 1172|       |
 1173|      0|    return node;
 1174|      0|}
ngx_http.c:ngx_http_init_phases:
  351|      1|{
  352|      1|    if (ngx_array_init(&cmcf->phases[NGX_HTTP_POST_READ_PHASE].handlers,
  ------------------
  |  Branch (352:9): [True: 0, False: 1]
  ------------------
  353|      1|                       cf->pool, 1, sizeof(ngx_http_handler_pt))
  354|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  355|      0|    {
  356|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  357|      0|    }
  358|       |
  359|      1|    if (ngx_array_init(&cmcf->phases[NGX_HTTP_SERVER_REWRITE_PHASE].handlers,
  ------------------
  |  Branch (359:9): [True: 0, False: 1]
  ------------------
  360|      1|                       cf->pool, 1, sizeof(ngx_http_handler_pt))
  361|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  362|      0|    {
  363|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  364|      0|    }
  365|       |
  366|      1|    if (ngx_array_init(&cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers,
  ------------------
  |  Branch (366:9): [True: 0, False: 1]
  ------------------
  367|      1|                       cf->pool, 1, sizeof(ngx_http_handler_pt))
  368|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  369|      0|    {
  370|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  371|      0|    }
  372|       |
  373|      1|    if (ngx_array_init(&cmcf->phases[NGX_HTTP_PREACCESS_PHASE].handlers,
  ------------------
  |  Branch (373:9): [True: 0, False: 1]
  ------------------
  374|      1|                       cf->pool, 1, sizeof(ngx_http_handler_pt))
  375|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  376|      0|    {
  377|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  378|      0|    }
  379|       |
  380|      1|    if (ngx_array_init(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers,
  ------------------
  |  Branch (380:9): [True: 0, False: 1]
  ------------------
  381|      1|                       cf->pool, 2, sizeof(ngx_http_handler_pt))
  382|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  383|      0|    {
  384|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  385|      0|    }
  386|       |
  387|      1|    if (ngx_array_init(&cmcf->phases[NGX_HTTP_PRECONTENT_PHASE].handlers,
  ------------------
  |  Branch (387:9): [True: 0, False: 1]
  ------------------
  388|      1|                       cf->pool, 2, sizeof(ngx_http_handler_pt))
  389|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  390|      0|    {
  391|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  392|      0|    }
  393|       |
  394|      1|    if (ngx_array_init(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers,
  ------------------
  |  Branch (394:9): [True: 0, False: 1]
  ------------------
  395|      1|                       cf->pool, 4, sizeof(ngx_http_handler_pt))
  396|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  397|      0|    {
  398|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  399|      0|    }
  400|       |
  401|      1|    if (ngx_array_init(&cmcf->phases[NGX_HTTP_LOG_PHASE].handlers,
  ------------------
  |  Branch (401:9): [True: 0, False: 1]
  ------------------
  402|      1|                       cf->pool, 1, sizeof(ngx_http_handler_pt))
  403|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  404|      0|    {
  405|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  406|      0|    }
  407|       |
  408|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  409|      1|}
ngx_http.c:ngx_http_init_headers_in_hash:
  414|      1|{
  415|      1|    ngx_array_t         headers_in;
  416|      1|    ngx_hash_key_t     *hk;
  417|      1|    ngx_hash_init_t     hash;
  418|      1|    ngx_http_header_t  *header;
  419|       |
  420|      1|    if (ngx_array_init(&headers_in, cf->temp_pool, 32, sizeof(ngx_hash_key_t))
  ------------------
  |  Branch (420:9): [True: 0, False: 1]
  ------------------
  421|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  422|      0|    {
  423|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  424|      0|    }
  425|       |
  426|     26|    for (header = ngx_http_headers_in; header->name.len; header++) {
  ------------------
  |  Branch (426:40): [True: 25, False: 1]
  ------------------
  427|     25|        hk = ngx_array_push(&headers_in);
  428|     25|        if (hk == NULL) {
  ------------------
  |  Branch (428:13): [True: 0, False: 25]
  ------------------
  429|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  430|      0|        }
  431|       |
  432|     25|        hk->key = header->name;
  433|     25|        hk->key_hash = ngx_hash_key_lc(header->name.data, header->name.len);
  434|     25|        hk->value = header;
  435|     25|    }
  436|       |
  437|      1|    hash.hash = &cmcf->headers_in_hash;
  438|      1|    hash.key = ngx_hash_key_lc;
  439|      1|    hash.max_size = 512;
  440|      1|    hash.bucket_size = ngx_align(64, ngx_cacheline_size);
  ------------------
  |  |  100|      1|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
  441|      1|    hash.name = "headers_in_hash";
  442|      1|    hash.pool = cf->pool;
  443|      1|    hash.temp_pool = NULL;
  444|       |
  445|      1|    if (ngx_hash_init(&hash, headers_in.elts, headers_in.nelts) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (445:9): [True: 0, False: 1]
  ------------------
  446|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  447|      0|    }
  448|       |
  449|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  450|      1|}
ngx_http.c:ngx_http_init_phase_handlers:
  455|      1|{
  456|      1|    ngx_int_t                   j;
  457|      1|    ngx_uint_t                  i, n;
  458|      1|    ngx_uint_t                  find_config_index, use_rewrite, use_access;
  459|      1|    ngx_http_handler_pt        *h;
  460|      1|    ngx_http_phase_handler_t   *ph;
  461|      1|    ngx_http_phase_handler_pt   checker;
  462|       |
  463|      1|    cmcf->phase_engine.server_rewrite_index = (ngx_uint_t) -1;
  464|      1|    cmcf->phase_engine.location_rewrite_index = (ngx_uint_t) -1;
  465|      1|    find_config_index = 0;
  466|      1|    use_rewrite = cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers.nelts ? 1 : 0;
  ------------------
  |  Branch (466:19): [True: 1, False: 0]
  ------------------
  467|      1|    use_access = cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers.nelts ? 1 : 0;
  ------------------
  |  Branch (467:18): [True: 1, False: 0]
  ------------------
  468|       |
  469|      1|    n = 1                  /* find config phase */
  470|      1|        + use_rewrite      /* post rewrite phase */
  471|      1|        + use_access;      /* post access phase */
  472|       |
  473|     11|    for (i = 0; i < NGX_HTTP_LOG_PHASE; i++) {
  ------------------
  |  Branch (473:17): [True: 10, False: 1]
  ------------------
  474|     10|        n += cmcf->phases[i].handlers.nelts;
  475|     10|    }
  476|       |
  477|      1|    ph = ngx_pcalloc(cf->pool,
  478|      1|                     n * sizeof(ngx_http_phase_handler_t) + sizeof(void *));
  479|      1|    if (ph == NULL) {
  ------------------
  |  Branch (479:9): [True: 0, False: 1]
  ------------------
  480|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  481|      0|    }
  482|       |
  483|      1|    cmcf->phase_engine.handlers = ph;
  484|      1|    n = 0;
  485|       |
  486|     11|    for (i = 0; i < NGX_HTTP_LOG_PHASE; i++) {
  ------------------
  |  Branch (486:17): [True: 10, False: 1]
  ------------------
  487|     10|        h = cmcf->phases[i].handlers.elts;
  488|       |
  489|     10|        switch (i) {
  490|       |
  491|      1|        case NGX_HTTP_SERVER_REWRITE_PHASE:
  ------------------
  |  Branch (491:9): [True: 1, False: 9]
  ------------------
  492|      1|            if (cmcf->phase_engine.server_rewrite_index == (ngx_uint_t) -1) {
  ------------------
  |  Branch (492:17): [True: 1, False: 0]
  ------------------
  493|      1|                cmcf->phase_engine.server_rewrite_index = n;
  494|      1|            }
  495|      1|            checker = ngx_http_core_rewrite_phase;
  496|       |
  497|      1|            break;
  498|       |
  499|      1|        case NGX_HTTP_FIND_CONFIG_PHASE:
  ------------------
  |  Branch (499:9): [True: 1, False: 9]
  ------------------
  500|      1|            find_config_index = n;
  501|       |
  502|      1|            ph->checker = ngx_http_core_find_config_phase;
  503|      1|            n++;
  504|      1|            ph++;
  505|       |
  506|      1|            continue;
  507|       |
  508|      1|        case NGX_HTTP_REWRITE_PHASE:
  ------------------
  |  Branch (508:9): [True: 1, False: 9]
  ------------------
  509|      1|            if (cmcf->phase_engine.location_rewrite_index == (ngx_uint_t) -1) {
  ------------------
  |  Branch (509:17): [True: 1, False: 0]
  ------------------
  510|      1|                cmcf->phase_engine.location_rewrite_index = n;
  511|      1|            }
  512|      1|            checker = ngx_http_core_rewrite_phase;
  513|       |
  514|      1|            break;
  515|       |
  516|      1|        case NGX_HTTP_POST_REWRITE_PHASE:
  ------------------
  |  Branch (516:9): [True: 1, False: 9]
  ------------------
  517|      1|            if (use_rewrite) {
  ------------------
  |  Branch (517:17): [True: 1, False: 0]
  ------------------
  518|      1|                ph->checker = ngx_http_core_post_rewrite_phase;
  519|      1|                ph->next = find_config_index;
  520|      1|                n++;
  521|      1|                ph++;
  522|      1|            }
  523|       |
  524|      1|            continue;
  525|       |
  526|      1|        case NGX_HTTP_ACCESS_PHASE:
  ------------------
  |  Branch (526:9): [True: 1, False: 9]
  ------------------
  527|      1|            checker = ngx_http_core_access_phase;
  528|      1|            n++;
  529|      1|            break;
  530|       |
  531|      1|        case NGX_HTTP_POST_ACCESS_PHASE:
  ------------------
  |  Branch (531:9): [True: 1, False: 9]
  ------------------
  532|      1|            if (use_access) {
  ------------------
  |  Branch (532:17): [True: 1, False: 0]
  ------------------
  533|      1|                ph->checker = ngx_http_core_post_access_phase;
  534|      1|                ph->next = n;
  535|      1|                ph++;
  536|      1|            }
  537|       |
  538|      1|            continue;
  539|       |
  540|      1|        case NGX_HTTP_CONTENT_PHASE:
  ------------------
  |  Branch (540:9): [True: 1, False: 9]
  ------------------
  541|      1|            checker = ngx_http_core_content_phase;
  542|      1|            break;
  543|       |
  544|      3|        default:
  ------------------
  |  Branch (544:9): [True: 3, False: 7]
  ------------------
  545|      3|            checker = ngx_http_core_generic_phase;
  546|     10|        }
  547|       |
  548|      7|        n += cmcf->phases[i].handlers.nelts;
  549|       |
  550|     18|        for (j = cmcf->phases[i].handlers.nelts - 1; j >= 0; j--) {
  ------------------
  |  Branch (550:54): [True: 11, False: 7]
  ------------------
  551|     11|            ph->checker = checker;
  552|     11|            ph->handler = h[j];
  553|     11|            ph->next = n;
  554|     11|            ph++;
  555|     11|        }
  556|      7|    }
  557|       |
  558|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  559|      1|}
ngx_http.c:ngx_http_optimize_servers:
 1490|      1|{
 1491|      1|    ngx_uint_t             p, a;
 1492|      1|    ngx_http_conf_port_t  *port;
 1493|      1|    ngx_http_conf_addr_t  *addr;
 1494|       |
 1495|      1|    if (ports == NULL) {
  ------------------
  |  Branch (1495:9): [True: 0, False: 1]
  ------------------
 1496|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1497|      0|    }
 1498|       |
 1499|      1|    port = ports->elts;
 1500|      2|    for (p = 0; p < ports->nelts; p++) {
  ------------------
  |  Branch (1500:17): [True: 1, False: 1]
  ------------------
 1501|       |
 1502|      1|        ngx_sort(port[p].addrs.elts, (size_t) port[p].addrs.nelts,
 1503|      1|                 sizeof(ngx_http_conf_addr_t), ngx_http_cmp_conf_addrs);
 1504|       |
 1505|       |        /*
 1506|       |         * check whether all name-based servers have the same
 1507|       |         * configuration as a default server for given address:port
 1508|       |         */
 1509|       |
 1510|      1|        addr = port[p].addrs.elts;
 1511|      2|        for (a = 0; a < port[p].addrs.nelts; a++) {
  ------------------
  |  Branch (1511:21): [True: 1, False: 1]
  ------------------
 1512|       |
 1513|      1|            if (addr[a].servers.nelts > 1
  ------------------
  |  Branch (1513:17): [True: 0, False: 1]
  ------------------
 1514|      1|#if (NGX_PCRE)
 1515|      1|                || addr[a].default_server->captures
  ------------------
  |  Branch (1515:20): [True: 1, False: 0]
  ------------------
 1516|      1|#endif
 1517|      1|               )
 1518|      1|            {
 1519|      1|                if (ngx_http_server_names(cf, cmcf, &addr[a]) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (1519:21): [True: 0, False: 1]
  ------------------
 1520|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1521|      0|                }
 1522|      1|            }
 1523|      1|        }
 1524|       |
 1525|      1|        if (ngx_http_init_listening(cf, &port[p]) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (1525:13): [True: 0, False: 1]
  ------------------
 1526|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1527|      0|        }
 1528|      1|    }
 1529|       |
 1530|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1531|      1|}
ngx_http.c:ngx_http_server_names:
 1537|      1|{
 1538|      1|    ngx_int_t                   rc;
 1539|      1|    ngx_uint_t                  n, s;
 1540|      1|    ngx_hash_init_t             hash;
 1541|      1|    ngx_hash_keys_arrays_t      ha;
 1542|      1|    ngx_http_server_name_t     *name;
 1543|      1|    ngx_http_core_srv_conf_t  **cscfp;
 1544|      1|#if (NGX_PCRE)
 1545|      1|    ngx_uint_t                  regex, i;
 1546|       |
 1547|      1|    regex = 0;
 1548|      1|#endif
 1549|       |
 1550|      1|    ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1551|       |
 1552|      1|    ha.temp_pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, cf->log);
  ------------------
  |  |   22|      1|#define NGX_DEFAULT_POOL_SIZE    (16 * 1024)
  ------------------
 1553|      1|    if (ha.temp_pool == NULL) {
  ------------------
  |  Branch (1553:9): [True: 0, False: 1]
  ------------------
 1554|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1555|      0|    }
 1556|       |
 1557|      1|    ha.pool = cf->pool;
 1558|       |
 1559|      1|    if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) {
  ------------------
  |  |   66|      1|#define NGX_HASH_LARGE            2
  ------------------
                  if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (1559:9): [True: 0, False: 1]
  ------------------
 1560|      0|        goto failed;
 1561|      0|    }
 1562|       |
 1563|      1|    cscfp = addr->servers.elts;
 1564|       |
 1565|      2|    for (s = 0; s < addr->servers.nelts; s++) {
  ------------------
  |  Branch (1565:17): [True: 1, False: 1]
  ------------------
 1566|       |
 1567|      1|        name = cscfp[s]->server_names.elts;
 1568|       |
 1569|      2|        for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
  ------------------
  |  Branch (1569:21): [True: 1, False: 1]
  ------------------
 1570|       |
 1571|      1|#if (NGX_PCRE)
 1572|      1|            if (name[n].regex) {
  ------------------
  |  Branch (1572:17): [True: 1, False: 0]
  ------------------
 1573|      1|                regex++;
 1574|      1|                continue;
 1575|      1|            }
 1576|      0|#endif
 1577|       |
 1578|      0|            rc = ngx_hash_add_key(&ha, &name[n].name, name[n].server,
 1579|      0|                                  NGX_HASH_WILDCARD_KEY);
  ------------------
  |  |   71|      0|#define NGX_HASH_WILDCARD_KEY     1
  ------------------
 1580|       |
 1581|      0|            if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1581:17): [True: 0, False: 0]
  ------------------
 1582|      0|                goto failed;
 1583|      0|            }
 1584|       |
 1585|      0|            if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (1585:17): [True: 0, False: 0]
  ------------------
 1586|      0|                ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1587|      0|                              "invalid server name or wildcard \"%V\" on %V",
 1588|      0|                              &name[n].name, &addr->opt.addr_text);
 1589|      0|                goto failed;
 1590|      0|            }
 1591|       |
 1592|      0|            if (rc == NGX_BUSY) {
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  |  Branch (1592:17): [True: 0, False: 0]
  ------------------
 1593|      0|                ngx_log_error(NGX_LOG_WARN, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1594|      0|                              "conflicting server name \"%V\" on %V, ignored",
 1595|      0|                              &name[n].name, &addr->opt.addr_text);
 1596|      0|            }
 1597|      0|        }
 1598|      1|    }
 1599|       |
 1600|      1|    hash.key = ngx_hash_key_lc;
 1601|      1|    hash.max_size = cmcf->server_names_hash_max_size;
 1602|      1|    hash.bucket_size = cmcf->server_names_hash_bucket_size;
 1603|      1|    hash.name = "server_names_hash";
 1604|      1|    hash.pool = cf->pool;
 1605|       |
 1606|      1|    if (ha.keys.nelts) {
  ------------------
  |  Branch (1606:9): [True: 0, False: 1]
  ------------------
 1607|      0|        hash.hash = &addr->hash;
 1608|      0|        hash.temp_pool = NULL;
 1609|       |
 1610|      0|        if (ngx_hash_init(&hash, ha.keys.elts, ha.keys.nelts) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1610:13): [True: 0, False: 0]
  ------------------
 1611|      0|            goto failed;
 1612|      0|        }
 1613|      0|    }
 1614|       |
 1615|      1|    if (ha.dns_wc_head.nelts) {
  ------------------
  |  Branch (1615:9): [True: 0, False: 1]
  ------------------
 1616|       |
 1617|      0|        ngx_qsort(ha.dns_wc_head.elts, (size_t) ha.dns_wc_head.nelts,
  ------------------
  |  |  231|      0|#define ngx_qsort             qsort
  ------------------
 1618|      0|                  sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
 1619|       |
 1620|      0|        hash.hash = NULL;
 1621|      0|        hash.temp_pool = ha.temp_pool;
 1622|       |
 1623|      0|        if (ngx_hash_wildcard_init(&hash, ha.dns_wc_head.elts,
  ------------------
  |  Branch (1623:13): [True: 0, False: 0]
  ------------------
 1624|      0|                                   ha.dns_wc_head.nelts)
 1625|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1626|      0|        {
 1627|      0|            goto failed;
 1628|      0|        }
 1629|       |
 1630|      0|        addr->wc_head = (ngx_hash_wildcard_t *) hash.hash;
 1631|      0|    }
 1632|       |
 1633|      1|    if (ha.dns_wc_tail.nelts) {
  ------------------
  |  Branch (1633:9): [True: 0, False: 1]
  ------------------
 1634|       |
 1635|      0|        ngx_qsort(ha.dns_wc_tail.elts, (size_t) ha.dns_wc_tail.nelts,
  ------------------
  |  |  231|      0|#define ngx_qsort             qsort
  ------------------
 1636|      0|                  sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);
 1637|       |
 1638|      0|        hash.hash = NULL;
 1639|      0|        hash.temp_pool = ha.temp_pool;
 1640|       |
 1641|      0|        if (ngx_hash_wildcard_init(&hash, ha.dns_wc_tail.elts,
  ------------------
  |  Branch (1641:13): [True: 0, False: 0]
  ------------------
 1642|      0|                                   ha.dns_wc_tail.nelts)
 1643|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1644|      0|        {
 1645|      0|            goto failed;
 1646|      0|        }
 1647|       |
 1648|      0|        addr->wc_tail = (ngx_hash_wildcard_t *) hash.hash;
 1649|      0|    }
 1650|       |
 1651|      1|    ngx_destroy_pool(ha.temp_pool);
 1652|       |
 1653|      1|#if (NGX_PCRE)
 1654|       |
 1655|      1|    if (regex == 0) {
  ------------------
  |  Branch (1655:9): [True: 0, False: 1]
  ------------------
 1656|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1657|      0|    }
 1658|       |
 1659|      1|    addr->nregex = regex;
 1660|      1|    addr->regex = ngx_palloc(cf->pool, regex * sizeof(ngx_http_server_name_t));
 1661|      1|    if (addr->regex == NULL) {
  ------------------
  |  Branch (1661:9): [True: 0, False: 1]
  ------------------
 1662|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1663|      0|    }
 1664|       |
 1665|      1|    i = 0;
 1666|       |
 1667|      2|    for (s = 0; s < addr->servers.nelts; s++) {
  ------------------
  |  Branch (1667:17): [True: 1, False: 1]
  ------------------
 1668|       |
 1669|      1|        name = cscfp[s]->server_names.elts;
 1670|       |
 1671|      2|        for (n = 0; n < cscfp[s]->server_names.nelts; n++) {
  ------------------
  |  Branch (1671:21): [True: 1, False: 1]
  ------------------
 1672|      1|            if (name[n].regex) {
  ------------------
  |  Branch (1672:17): [True: 1, False: 0]
  ------------------
 1673|      1|                addr->regex[i++] = name[n];
 1674|      1|            }
 1675|      1|        }
 1676|      1|    }
 1677|       |
 1678|      1|#endif
 1679|       |
 1680|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1681|       |
 1682|      0|failed:
 1683|       |
 1684|      0|    ngx_destroy_pool(ha.temp_pool);
 1685|       |
 1686|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1687|      1|}
ngx_http.c:ngx_http_init_listening:
 1738|      1|{
 1739|      1|    ngx_uint_t                 i, last, bind_wildcard;
 1740|      1|    ngx_listening_t           *ls;
 1741|      1|    ngx_http_port_t           *hport;
 1742|      1|    ngx_http_conf_addr_t      *addr;
 1743|       |
 1744|      1|    addr = port->addrs.elts;
 1745|      1|    last = port->addrs.nelts;
 1746|       |
 1747|       |    /*
 1748|       |     * If there is a binding to an "*:port" then we need to bind() to
 1749|       |     * the "*:port" only and ignore other implicit bindings.  The bindings
 1750|       |     * have been already sorted: explicit bindings are on the start, then
 1751|       |     * implicit bindings go, and wildcard binding is in the end.
 1752|       |     */
 1753|       |
 1754|      1|    if (addr[last - 1].opt.wildcard) {
  ------------------
  |  Branch (1754:9): [True: 0, False: 1]
  ------------------
 1755|      0|        addr[last - 1].opt.bind = 1;
 1756|      0|        bind_wildcard = 1;
 1757|       |
 1758|      1|    } else {
 1759|      1|        bind_wildcard = 0;
 1760|      1|    }
 1761|       |
 1762|      1|    i = 0;
 1763|       |
 1764|      2|    while (i < last) {
  ------------------
  |  Branch (1764:12): [True: 1, False: 1]
  ------------------
 1765|       |
 1766|      1|        if (bind_wildcard && !addr[i].opt.bind) {
  ------------------
  |  Branch (1766:13): [True: 0, False: 1]
  |  Branch (1766:30): [True: 0, False: 0]
  ------------------
 1767|      0|            i++;
 1768|      0|            continue;
 1769|      0|        }
 1770|       |
 1771|      1|        ls = ngx_http_add_listening(cf, &addr[i]);
 1772|      1|        if (ls == NULL) {
  ------------------
  |  Branch (1772:13): [True: 0, False: 1]
  ------------------
 1773|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1774|      0|        }
 1775|       |
 1776|      1|        hport = ngx_pcalloc(cf->pool, sizeof(ngx_http_port_t));
 1777|      1|        if (hport == NULL) {
  ------------------
  |  Branch (1777:13): [True: 0, False: 1]
  ------------------
 1778|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1779|      0|        }
 1780|       |
 1781|      1|        ls->servers = hport;
 1782|       |
 1783|      1|        hport->naddrs = i + 1;
 1784|       |
 1785|      1|        switch (ls->sockaddr->sa_family) {
 1786|       |
 1787|      0|#if (NGX_HAVE_INET6)
 1788|      0|        case AF_INET6:
  ------------------
  |  Branch (1788:9): [True: 0, False: 1]
  ------------------
 1789|      0|            if (ngx_http_add_addrs6(cf, hport, addr) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1789:17): [True: 0, False: 0]
  ------------------
 1790|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1791|      0|            }
 1792|      0|            break;
 1793|      0|#endif
 1794|      1|        default: /* AF_INET */
  ------------------
  |  Branch (1794:9): [True: 1, False: 0]
  ------------------
 1795|      1|            if (ngx_http_add_addrs(cf, hport, addr) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (1795:17): [True: 0, False: 1]
  ------------------
 1796|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1797|      0|            }
 1798|      1|            break;
 1799|      1|        }
 1800|       |
 1801|      1|        addr++;
 1802|      1|        last--;
 1803|      1|    }
 1804|       |
 1805|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1806|      1|}
ngx_http.c:ngx_http_add_listening:
 1811|      1|{
 1812|      1|    ngx_listening_t           *ls;
 1813|      1|    ngx_http_core_loc_conf_t  *clcf;
 1814|      1|    ngx_http_core_srv_conf_t  *cscf;
 1815|       |
 1816|      1|    ls = ngx_create_listening(cf, addr->opt.sockaddr, addr->opt.socklen);
 1817|      1|    if (ls == NULL) {
  ------------------
  |  Branch (1817:9): [True: 0, False: 1]
  ------------------
 1818|      0|        return NULL;
 1819|      0|    }
 1820|       |
 1821|      1|    ls->addr_ntop = 1;
 1822|       |
 1823|      1|    ls->handler = ngx_http_init_connection;
 1824|       |
 1825|      1|    cscf = addr->default_server;
 1826|      1|    ls->pool_size = cscf->connection_pool_size;
 1827|       |
 1828|      1|    clcf = cscf->ctx->loc_conf[ngx_http_core_module.ctx_index];
 1829|       |
 1830|      1|    ls->logp = clcf->error_log;
 1831|      1|    ls->log.data = &ls->addr_text;
 1832|      1|    ls->log.handler = ngx_accept_log_error;
 1833|       |
 1834|       |#if (NGX_WIN32)
 1835|       |    {
 1836|       |    ngx_iocp_conf_t  *iocpcf = NULL;
 1837|       |
 1838|       |    if (ngx_get_conf(cf->cycle->conf_ctx, ngx_events_module)) {
 1839|       |        iocpcf = ngx_event_get_conf(cf->cycle->conf_ctx, ngx_iocp_module);
 1840|       |    }
 1841|       |    if (iocpcf && iocpcf->acceptex_read) {
 1842|       |        ls->post_accept_buffer_size = cscf->client_header_buffer_size;
 1843|       |    }
 1844|       |    }
 1845|       |#endif
 1846|       |
 1847|      1|    ls->type = addr->opt.type;
 1848|      1|    ls->backlog = addr->opt.backlog;
 1849|      1|    ls->rcvbuf = addr->opt.rcvbuf;
 1850|      1|    ls->sndbuf = addr->opt.sndbuf;
 1851|       |
 1852|      1|    ls->keepalive = addr->opt.so_keepalive;
 1853|       |#if (NGX_HAVE_KEEPALIVE_TUNABLE)
 1854|       |    ls->keepidle = addr->opt.tcp_keepidle;
 1855|       |    ls->keepintvl = addr->opt.tcp_keepintvl;
 1856|       |    ls->keepcnt = addr->opt.tcp_keepcnt;
 1857|       |#endif
 1858|       |
 1859|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
 1860|       |    ls->accept_filter = addr->opt.accept_filter;
 1861|       |#endif
 1862|       |
 1863|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
 1864|       |    ls->deferred_accept = addr->opt.deferred_accept;
 1865|       |#endif
 1866|       |
 1867|      1|#if (NGX_HAVE_INET6)
 1868|      1|    ls->ipv6only = addr->opt.ipv6only;
 1869|      1|#endif
 1870|       |
 1871|       |#if (NGX_HAVE_SETFIB)
 1872|       |    ls->setfib = addr->opt.setfib;
 1873|       |#endif
 1874|       |
 1875|       |#if (NGX_HAVE_TCP_FASTOPEN)
 1876|       |    ls->fastopen = addr->opt.fastopen;
 1877|       |#endif
 1878|       |
 1879|       |#if (NGX_HAVE_REUSEPORT)
 1880|       |    ls->reuseport = addr->opt.reuseport;
 1881|       |#endif
 1882|       |
 1883|      1|    ls->wildcard = addr->opt.wildcard;
 1884|       |
 1885|       |#if (NGX_HTTP_V3)
 1886|       |    ls->quic = addr->opt.quic;
 1887|       |#endif
 1888|       |
 1889|      1|    return ls;
 1890|      1|}
ngx_http.c:ngx_http_add_addrs:
 1896|      1|{
 1897|      1|    ngx_uint_t                 i;
 1898|      1|    ngx_http_in_addr_t        *addrs;
 1899|      1|    struct sockaddr_in        *sin;
 1900|      1|    ngx_http_virtual_names_t  *vn;
 1901|       |
 1902|      1|    hport->addrs = ngx_pcalloc(cf->pool,
 1903|      1|                               hport->naddrs * sizeof(ngx_http_in_addr_t));
 1904|      1|    if (hport->addrs == NULL) {
  ------------------
  |  Branch (1904:9): [True: 0, False: 1]
  ------------------
 1905|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1906|      0|    }
 1907|       |
 1908|      1|    addrs = hport->addrs;
 1909|       |
 1910|      2|    for (i = 0; i < hport->naddrs; i++) {
  ------------------
  |  Branch (1910:17): [True: 1, False: 1]
  ------------------
 1911|       |
 1912|      1|        sin = (struct sockaddr_in *) addr[i].opt.sockaddr;
 1913|      1|        addrs[i].addr = sin->sin_addr.s_addr;
 1914|      1|        addrs[i].conf.default_server = addr[i].default_server;
 1915|       |#if (NGX_HTTP_SSL)
 1916|       |        addrs[i].conf.ssl = addr[i].opt.ssl;
 1917|       |#endif
 1918|      1|#if (NGX_HTTP_V2)
 1919|      1|        addrs[i].conf.http2 = addr[i].opt.http2;
 1920|      1|#endif
 1921|       |#if (NGX_HTTP_V3)
 1922|       |        addrs[i].conf.quic = addr[i].opt.quic;
 1923|       |#endif
 1924|      1|        addrs[i].conf.proxy_protocol = addr[i].opt.proxy_protocol;
 1925|       |
 1926|      1|        if (addr[i].hash.buckets == NULL
  ------------------
  |  Branch (1926:13): [True: 1, False: 0]
  ------------------
 1927|      1|            && (addr[i].wc_head == NULL
  ------------------
  |  Branch (1927:17): [True: 1, False: 0]
  ------------------
 1928|      1|                || addr[i].wc_head->hash.buckets == NULL)
  ------------------
  |  Branch (1928:20): [True: 0, False: 0]
  ------------------
 1929|      1|            && (addr[i].wc_tail == NULL
  ------------------
  |  Branch (1929:17): [True: 1, False: 0]
  ------------------
 1930|      1|                || addr[i].wc_tail->hash.buckets == NULL)
  ------------------
  |  Branch (1930:20): [True: 0, False: 0]
  ------------------
 1931|      1|#if (NGX_PCRE)
 1932|      1|            && addr[i].nregex == 0
  ------------------
  |  Branch (1932:16): [True: 0, False: 1]
  ------------------
 1933|      1|#endif
 1934|      1|            )
 1935|      0|        {
 1936|      0|            continue;
 1937|      0|        }
 1938|       |
 1939|      1|        vn = ngx_palloc(cf->pool, sizeof(ngx_http_virtual_names_t));
 1940|      1|        if (vn == NULL) {
  ------------------
  |  Branch (1940:13): [True: 0, False: 1]
  ------------------
 1941|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1942|      0|        }
 1943|       |
 1944|      1|        addrs[i].conf.virtual_names = vn;
 1945|       |
 1946|      1|        vn->names.hash = addr[i].hash;
 1947|      1|        vn->names.wc_head = addr[i].wc_head;
 1948|      1|        vn->names.wc_tail = addr[i].wc_tail;
 1949|      1|#if (NGX_PCRE)
 1950|      1|        vn->nregex = addr[i].nregex;
 1951|      1|        vn->regex = addr[i].regex;
 1952|      1|#endif
 1953|      1|    }
 1954|       |
 1955|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1956|      1|}
ngx_http.c:ngx_http_escape_location_name:
  897|      1|{
  898|      1|    u_char     *p;
  899|      1|    size_t      len;
  900|      1|    uintptr_t   escape;
  901|       |
  902|      1|    escape = 2 * ngx_escape_uri(NULL, clcf->name.data, clcf->name.len,
  903|      1|                                NGX_ESCAPE_URI);
  ------------------
  |  |  199|      1|#define NGX_ESCAPE_URI            0
  ------------------
  904|       |
  905|      1|    if (escape) {
  ------------------
  |  Branch (905:9): [True: 0, False: 1]
  ------------------
  906|      0|        len = clcf->name.len + escape;
  907|       |
  908|      0|        p = ngx_pnalloc(cf->pool, len);
  909|      0|        if (p == NULL) {
  ------------------
  |  Branch (909:13): [True: 0, False: 0]
  ------------------
  910|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  911|      0|        }
  912|       |
  913|      0|        clcf->escaped_name.len = len;
  914|      0|        clcf->escaped_name.data = p;
  915|       |
  916|      0|        ngx_escape_uri(p, clcf->name.data, clcf->name.len, NGX_ESCAPE_URI);
  ------------------
  |  |  199|      0|#define NGX_ESCAPE_URI            0
  ------------------
  917|       |
  918|      1|    } else {
  919|      1|        clcf->escaped_name = clcf->name;
  920|      1|    }
  921|       |
  922|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  923|      1|}
ngx_http.c:ngx_http_add_server:
 1452|      1|{
 1453|      1|    ngx_uint_t                  i;
 1454|      1|    ngx_http_core_srv_conf_t  **server;
 1455|       |
 1456|      1|    if (addr->servers.elts == NULL) {
  ------------------
  |  Branch (1456:9): [True: 1, False: 0]
  ------------------
 1457|      1|        if (ngx_array_init(&addr->servers, cf->temp_pool, 4,
  ------------------
  |  Branch (1457:13): [True: 0, False: 1]
  ------------------
 1458|      1|                           sizeof(ngx_http_core_srv_conf_t *))
 1459|      1|            != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1460|      0|        {
 1461|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1462|      0|        }
 1463|       |
 1464|      1|    } else {
 1465|      0|        server = addr->servers.elts;
 1466|      0|        for (i = 0; i < addr->servers.nelts; i++) {
  ------------------
  |  Branch (1466:21): [True: 0, False: 0]
  ------------------
 1467|      0|            if (server[i] == cscf) {
  ------------------
  |  Branch (1467:17): [True: 0, False: 0]
  ------------------
 1468|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 1469|      0|                                   "a duplicate listen %V",
 1470|      0|                                   &addr->opt.addr_text);
 1471|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1472|      0|            }
 1473|      0|        }
 1474|      0|    }
 1475|       |
 1476|      1|    server = ngx_array_push(&addr->servers);
 1477|      1|    if (server == NULL) {
  ------------------
  |  Branch (1477:9): [True: 0, False: 1]
  ------------------
 1478|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1479|      0|    }
 1480|       |
 1481|      1|    *server = cscf;
 1482|       |
 1483|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1484|      1|}
ngx_http.c:ngx_http_add_address:
 1399|      1|{
 1400|      1|    ngx_http_conf_addr_t  *addr;
 1401|       |
 1402|      1|    if (port->addrs.elts == NULL) {
  ------------------
  |  Branch (1402:9): [True: 1, False: 0]
  ------------------
 1403|      1|        if (ngx_array_init(&port->addrs, cf->temp_pool, 4,
  ------------------
  |  Branch (1403:13): [True: 0, False: 1]
  ------------------
 1404|      1|                           sizeof(ngx_http_conf_addr_t))
 1405|      1|            != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1406|      0|        {
 1407|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1408|      0|        }
 1409|      1|    }
 1410|       |
 1411|       |#if (NGX_HTTP_V2 && NGX_HTTP_SSL                                              \
 1412|       |     && !defined TLSEXT_TYPE_application_layer_protocol_negotiation)
 1413|       |
 1414|       |    if (lsopt->http2 && lsopt->ssl) {
 1415|       |        ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
 1416|       |                           "nginx was built with OpenSSL that lacks ALPN "
 1417|       |                           "support, HTTP/2 is not enabled for %V",
 1418|       |                           &lsopt->addr_text);
 1419|       |    }
 1420|       |
 1421|       |#endif
 1422|       |
 1423|      1|    addr = ngx_array_push(&port->addrs);
 1424|      1|    if (addr == NULL) {
  ------------------
  |  Branch (1424:9): [True: 0, False: 1]
  ------------------
 1425|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1426|      0|    }
 1427|       |
 1428|      1|    addr->opt = *lsopt;
 1429|      1|    addr->protocols = 0;
 1430|      1|    addr->protocols_set = 0;
 1431|      1|    addr->protocols_changed = 0;
 1432|      1|    addr->hash.buckets = NULL;
 1433|      1|    addr->hash.size = 0;
 1434|      1|    addr->wc_head = NULL;
 1435|      1|    addr->wc_tail = NULL;
 1436|      1|#if (NGX_PCRE)
 1437|      1|    addr->nregex = 0;
 1438|      1|    addr->regex = NULL;
 1439|      1|#endif
 1440|      1|    addr->default_server = cscf;
 1441|      1|    addr->servers.elts = NULL;
 1442|       |
 1443|      1|    return ngx_http_add_server(cf, cscf, addr);
 1444|      1|}

ngx_http_copy_filter_module.c:ngx_http_copy_filter_init:
  356|      1|{
  357|      1|    ngx_http_next_body_filter = ngx_http_top_body_filter;
  358|      1|    ngx_http_top_body_filter = ngx_http_copy_filter;
  359|       |
  360|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  361|      1|}
ngx_http_copy_filter_module.c:ngx_http_copy_filter:
   84|     13|{
   85|     13|    ngx_int_t                     rc;
   86|     13|    ngx_connection_t             *c;
   87|     13|    ngx_output_chain_ctx_t       *ctx;
   88|     13|    ngx_http_core_loc_conf_t     *clcf;
   89|     13|    ngx_http_copy_filter_conf_t  *conf;
   90|       |
   91|     13|    c = r->connection;
   92|       |
   93|     13|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
   94|     13|                   "http copy filter: \"%V?%V\"", &r->uri, &r->args);
   95|       |
   96|     13|    ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module);
  ------------------
  |  |   80|     13|#define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  ------------------
   97|       |
   98|     13|    if (ctx == NULL) {
  ------------------
  |  Branch (98:9): [True: 5, False: 8]
  ------------------
   99|      5|        ctx = ngx_pcalloc(r->pool, sizeof(ngx_output_chain_ctx_t));
  100|      5|        if (ctx == NULL) {
  ------------------
  |  Branch (100:13): [True: 0, False: 5]
  ------------------
  101|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  102|      0|        }
  103|       |
  104|      5|        ngx_http_set_ctx(r, ctx, ngx_http_copy_filter_module);
  ------------------
  |  |   81|      5|#define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;
  ------------------
  105|       |
  106|      5|        conf = ngx_http_get_module_loc_conf(r, ngx_http_copy_filter_module);
  ------------------
  |  |   58|      5|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  107|      5|        clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      5|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  108|       |
  109|      5|        ctx->sendfile = c->sendfile;
  110|      5|        ctx->need_in_memory = r->main_filter_need_in_memory
  ------------------
  |  Branch (110:31): [True: 0, False: 5]
  ------------------
  111|      5|                              || r->filter_need_in_memory;
  ------------------
  |  Branch (111:34): [True: 0, False: 5]
  ------------------
  112|      5|        ctx->need_in_temp = r->filter_need_temporary;
  113|       |
  114|      5|        ctx->alignment = clcf->directio_alignment;
  115|       |
  116|      5|        ctx->pool = r->pool;
  117|      5|        ctx->bufs = conf->bufs;
  118|      5|        ctx->tag = (ngx_buf_tag_t) &ngx_http_copy_filter_module;
  119|       |
  120|      5|        ctx->output_filter = (ngx_output_chain_filter_pt)
  121|      5|                                  ngx_http_next_body_filter;
  122|      5|        ctx->filter_ctx = r;
  123|       |
  124|       |#if (NGX_HAVE_FILE_AIO)
  125|       |        if (ngx_file_aio && clcf->aio == NGX_HTTP_AIO_ON) {
  126|       |            ctx->aio_handler = ngx_http_copy_aio_handler;
  127|       |        }
  128|       |#endif
  129|       |
  130|       |#if (NGX_THREADS)
  131|       |        if (clcf->aio == NGX_HTTP_AIO_THREADS) {
  132|       |            ctx->thread_handler = ngx_http_copy_thread_handler;
  133|       |        }
  134|       |#endif
  135|       |
  136|      5|        if (in && in->buf && ngx_buf_size(in->buf)) {
  ------------------
  |  |  137|      4|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      4|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 4]
  |  |  |  |  |  Branch (125:55): [True: 3, False: 1]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (137:5): [True: 3, False: 1]
  |  |  ------------------
  |  |  138|      4|                            ((b)->file_last - (b)->file_pos))
  ------------------
  |  Branch (136:13): [True: 4, False: 1]
  |  Branch (136:19): [True: 4, False: 0]
  ------------------
  137|      3|            r->request_output = 1;
  138|      3|        }
  139|      5|    }
  140|       |
  141|       |#if (NGX_HAVE_FILE_AIO || NGX_THREADS)
  142|       |    ctx->aio = r->aio;
  143|       |#endif
  144|       |
  145|     13|    rc = ngx_output_chain(ctx, in);
  146|       |
  147|     13|    if (ctx->in == NULL) {
  ------------------
  |  Branch (147:9): [True: 13, False: 0]
  ------------------
  148|     13|        r->buffered &= ~NGX_HTTP_COPY_BUFFERED;
  ------------------
  |  |  152|     13|#define NGX_HTTP_COPY_BUFFERED             0x04
  ------------------
  149|       |
  150|     13|    } else {
  151|      0|        r->buffered |= NGX_HTTP_COPY_BUFFERED;
  ------------------
  |  |  152|      0|#define NGX_HTTP_COPY_BUFFERED             0x04
  ------------------
  152|      0|    }
  153|       |
  154|     13|    ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
  155|     13|                   "http copy filter: %i \"%V?%V\"", rc, &r->uri, &r->args);
  156|       |
  157|     13|    return rc;
  158|     13|}
ngx_http_copy_filter_module.c:ngx_http_copy_filter_create_conf:
  328|      4|{
  329|      4|    ngx_http_copy_filter_conf_t *conf;
  330|       |
  331|      4|    conf = ngx_palloc(cf->pool, sizeof(ngx_http_copy_filter_conf_t));
  332|      4|    if (conf == NULL) {
  ------------------
  |  Branch (332:9): [True: 0, False: 4]
  ------------------
  333|      0|        return NULL;
  334|      0|    }
  335|       |
  336|      4|    conf->bufs.num = 0;
  337|       |
  338|      4|    return conf;
  339|      4|}
ngx_http_copy_filter_module.c:ngx_http_copy_filter_merge_conf:
  344|      2|{
  345|      2|    ngx_http_copy_filter_conf_t *prev = parent;
  346|      2|    ngx_http_copy_filter_conf_t *conf = child;
  347|       |
  348|      2|    ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 2, 32768);
  ------------------
  |  |  252|      2|    if (conf.num == 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  253|      2|        if (prev.num) {                                                      \
  |  |  ------------------
  |  |  |  Branch (253:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  254|      1|            conf.num = prev.num;                                             \
  |  |  255|      1|            conf.size = prev.size;                                           \
  |  |  256|      1|        } else {                                                             \
  |  |  257|      1|            conf.num = default_num;                                          \
  |  |  258|      1|            conf.size = default_size;                                        \
  |  |  259|      1|        }                                                                    \
  |  |  260|      2|    }
  ------------------
  349|       |
  350|      2|    return NULL;
  351|      2|}

ngx_http_handler:
  821|     11|{
  822|     11|    ngx_http_core_main_conf_t  *cmcf;
  823|       |
  824|     11|    r->connection->log->action = NULL;
  825|       |
  826|     11|    if (!r->internal) {
  ------------------
  |  Branch (826:9): [True: 11, False: 0]
  ------------------
  827|     11|        switch (r->headers_in.connection_type) {
  ------------------
  |  Branch (827:17): [True: 0, False: 11]
  ------------------
  828|     11|        case 0:
  ------------------
  |  Branch (828:9): [True: 11, False: 0]
  ------------------
  829|     11|            r->keepalive = (r->http_version > NGX_HTTP_VERSION_10);
  ------------------
  |  |   24|     11|#define NGX_HTTP_VERSION_10                1000
  ------------------
  830|     11|            break;
  831|       |
  832|      0|        case NGX_HTTP_CONNECTION_CLOSE:
  ------------------
  |  |   47|      0|#define NGX_HTTP_CONNECTION_CLOSE          1
  ------------------
  |  Branch (832:9): [True: 0, False: 11]
  ------------------
  833|      0|            r->keepalive = 0;
  834|      0|            break;
  835|       |
  836|      0|        case NGX_HTTP_CONNECTION_KEEP_ALIVE:
  ------------------
  |  |   48|      0|#define NGX_HTTP_CONNECTION_KEEP_ALIVE     2
  ------------------
  |  Branch (836:9): [True: 0, False: 11]
  ------------------
  837|      0|            r->keepalive = 1;
  838|      0|            break;
  839|     11|        }
  840|       |
  841|     11|        r->lingering_close = (r->headers_in.content_length_n > 0
  ------------------
  |  Branch (841:31): [True: 4, False: 7]
  ------------------
  842|     11|                              || r->headers_in.chunked);
  ------------------
  |  Branch (842:34): [True: 2, False: 5]
  ------------------
  843|     11|        r->phase_handler = 0;
  844|       |
  845|     11|    } else {
  846|      0|        cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  ------------------
  |  |   56|      0|    (r)->main_conf[module.ctx_index]
  ------------------
  847|      0|        r->phase_handler = cmcf->phase_engine.server_rewrite_index;
  848|      0|    }
  849|       |
  850|     11|    r->valid_location = 1;
  851|     11|#if (NGX_HTTP_GZIP)
  852|     11|    r->gzip_tested = 0;
  853|     11|    r->gzip_ok = 0;
  854|     11|    r->gzip_vary = 0;
  855|     11|#endif
  856|       |
  857|     11|    r->write_event_handler = ngx_http_core_run_phases;
  858|     11|    ngx_http_core_run_phases(r);
  859|     11|}
ngx_http_core_run_phases:
  864|     11|{
  865|     11|    ngx_int_t                   rc;
  866|     11|    ngx_http_phase_handler_t   *ph;
  867|     11|    ngx_http_core_main_conf_t  *cmcf;
  868|       |
  869|     11|    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  ------------------
  |  |   56|     11|    (r)->main_conf[module.ctx_index]
  ------------------
  870|       |
  871|     11|    ph = cmcf->phase_engine.handlers;
  872|       |
  873|    132|    while (ph[r->phase_handler].checker) {
  ------------------
  |  Branch (873:12): [True: 132, False: 0]
  ------------------
  874|       |
  875|    132|        rc = ph[r->phase_handler].checker(r, &ph[r->phase_handler]);
  876|       |
  877|    132|        if (rc == NGX_OK) {
  ------------------
  |  |   38|    132|#define  NGX_OK          0
  ------------------
  |  Branch (877:13): [True: 11, False: 121]
  ------------------
  878|     11|            return;
  879|     11|        }
  880|    132|    }
  881|     11|}
ngx_http_core_generic_phase:
  886|     44|{
  887|     44|    ngx_int_t  rc;
  888|       |
  889|       |    /*
  890|       |     * generic phase checker,
  891|       |     * used by the post read and pre-access phases
  892|       |     */
  893|       |
  894|     44|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  895|     44|                   "generic phase: %ui", r->phase_handler);
  896|       |
  897|     44|    rc = ph->handler(r);
  898|       |
  899|     44|    if (rc == NGX_OK) {
  ------------------
  |  |   38|     44|#define  NGX_OK          0
  ------------------
  |  Branch (899:9): [True: 0, False: 44]
  ------------------
  900|      0|        r->phase_handler = ph->next;
  901|      0|        return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  902|      0|    }
  903|       |
  904|     44|    if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|     44|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (904:9): [True: 44, False: 0]
  ------------------
  905|     44|        r->phase_handler++;
  906|     44|        return NGX_AGAIN;
  ------------------
  |  |   40|     44|#define  NGX_AGAIN      -2
  ------------------
  907|     44|    }
  908|       |
  909|      0|    if (rc == NGX_AGAIN || rc == NGX_DONE) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
                  if (rc == NGX_AGAIN || rc == NGX_DONE) {
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  |  Branch (909:9): [True: 0, False: 0]
  |  Branch (909:28): [True: 0, False: 0]
  ------------------
  910|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  911|      0|    }
  912|       |
  913|       |    /* rc == NGX_ERROR || rc == NGX_HTTP_...  */
  914|       |
  915|      0|    ngx_http_finalize_request(r, rc);
  916|       |
  917|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  918|      0|}
ngx_http_core_rewrite_phase:
  923|     22|{
  924|     22|    ngx_int_t  rc;
  925|       |
  926|     22|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  927|     22|                   "rewrite phase: %ui", r->phase_handler);
  928|       |
  929|     22|    rc = ph->handler(r);
  930|       |
  931|     22|    if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|     22|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (931:9): [True: 22, False: 0]
  ------------------
  932|     22|        r->phase_handler++;
  933|     22|        return NGX_AGAIN;
  ------------------
  |  |   40|     22|#define  NGX_AGAIN      -2
  ------------------
  934|     22|    }
  935|       |
  936|      0|    if (rc == NGX_DONE) {
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  |  Branch (936:9): [True: 0, False: 0]
  ------------------
  937|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  938|      0|    }
  939|       |
  940|       |    /* NGX_OK, NGX_AGAIN, NGX_ERROR, NGX_HTTP_...  */
  941|       |
  942|      0|    ngx_http_finalize_request(r, rc);
  943|       |
  944|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  945|      0|}
ngx_http_core_find_config_phase:
  951|     11|{
  952|     11|    u_char                    *p;
  953|     11|    size_t                     len;
  954|     11|    ngx_int_t                  rc;
  955|     11|    ngx_http_core_loc_conf_t  *clcf;
  956|       |
  957|     11|    r->content_handler = NULL;
  958|     11|    r->uri_changed = 0;
  959|       |
  960|     11|    rc = ngx_http_core_find_location(r);
  961|       |
  962|     11|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|     11|#define  NGX_ERROR      -1
  ------------------
  |  Branch (962:9): [True: 0, False: 11]
  ------------------
  963|      0|        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  964|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  965|      0|    }
  966|       |
  967|     11|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  968|       |
  969|     11|    if (!r->internal && clcf->internal) {
  ------------------
  |  Branch (969:9): [True: 11, False: 0]
  |  Branch (969:25): [True: 0, False: 11]
  ------------------
  970|      0|        ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND);
  ------------------
  |  |   95|      0|#define NGX_HTTP_NOT_FOUND                 404
  ------------------
  971|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  972|      0|    }
  973|       |
  974|     11|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  975|     11|                   "using configuration \"%s%V\"",
  976|     11|                   (clcf->noname ? "*" : (clcf->exact_match ? "=" : "")),
  977|     11|                   &clcf->name);
  978|       |
  979|     11|    ngx_http_update_location_config(r);
  980|       |
  981|     11|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  982|     11|                   "http cl:%O max:%O",
  983|     11|                   r->headers_in.content_length_n, clcf->client_max_body_size);
  984|       |
  985|     11|    if (r->headers_in.content_length_n != -1
  ------------------
  |  Branch (985:9): [True: 4, False: 7]
  ------------------
  986|     11|        && !r->discard_body
  ------------------
  |  Branch (986:12): [True: 4, False: 0]
  ------------------
  987|     11|        && clcf->client_max_body_size
  ------------------
  |  Branch (987:12): [True: 4, False: 0]
  ------------------
  988|     11|        && clcf->client_max_body_size < r->headers_in.content_length_n)
  ------------------
  |  Branch (988:12): [True: 0, False: 4]
  ------------------
  989|      0|    {
  990|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  991|      0|                      "client intended to send too large body: %O bytes",
  992|      0|                      r->headers_in.content_length_n);
  993|       |
  994|      0|        r->expect_tested = 1;
  995|      0|        (void) ngx_http_discard_request_body(r);
  996|      0|        ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);
  ------------------
  |  |  101|      0|#define NGX_HTTP_REQUEST_ENTITY_TOO_LARGE  413
  ------------------
  997|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  998|      0|    }
  999|       |
 1000|     11|    if (rc == NGX_DONE) {
  ------------------
  |  |   42|     11|#define  NGX_DONE       -4
  ------------------
  |  Branch (1000:9): [True: 0, False: 11]
  ------------------
 1001|      0|        ngx_http_clear_location(r);
  ------------------
  |  |  579|      0|    if (r->headers_out.location) {                                            \
  |  |  ------------------
  |  |  |  Branch (579:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|        r->headers_out.location->hash = 0;                                    \
  |  |  581|      0|        r->headers_out.location = NULL;                                       \
  |  |  582|      0|    }
  ------------------
 1002|       |
 1003|      0|        r->headers_out.location = ngx_list_push(&r->headers_out.headers);
 1004|      0|        if (r->headers_out.location == NULL) {
  ------------------
  |  Branch (1004:13): [True: 0, False: 0]
  ------------------
 1005|      0|            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1006|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1007|      0|        }
 1008|       |
 1009|      0|        r->headers_out.location->hash = 1;
 1010|      0|        r->headers_out.location->next = NULL;
 1011|      0|        ngx_str_set(&r->headers_out.location->key, "Location");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 1012|       |
 1013|      0|        if (r->args.len == 0) {
  ------------------
  |  Branch (1013:13): [True: 0, False: 0]
  ------------------
 1014|      0|            r->headers_out.location->value = clcf->escaped_name;
 1015|       |
 1016|      0|        } else {
 1017|      0|            len = clcf->escaped_name.len + 1 + r->args.len;
 1018|      0|            p = ngx_pnalloc(r->pool, len);
 1019|       |
 1020|      0|            if (p == NULL) {
  ------------------
  |  Branch (1020:17): [True: 0, False: 0]
  ------------------
 1021|      0|                ngx_http_clear_location(r);
  ------------------
  |  |  579|      0|    if (r->headers_out.location) {                                            \
  |  |  ------------------
  |  |  |  Branch (579:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  580|      0|        r->headers_out.location->hash = 0;                                    \
  |  |  581|      0|        r->headers_out.location = NULL;                                       \
  |  |  582|      0|    }
  ------------------
 1022|      0|                ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1023|      0|                return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1024|      0|            }
 1025|       |
 1026|      0|            r->headers_out.location->value.len = len;
 1027|      0|            r->headers_out.location->value.data = p;
 1028|       |
 1029|      0|            p = ngx_cpymem(p, clcf->escaped_name.data, clcf->escaped_name.len);
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
 1030|      0|            *p++ = '?';
 1031|      0|            ngx_memcpy(p, r->args.data, r->args.len);
  ------------------
  |  |  106|      0|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1032|      0|        }
 1033|       |
 1034|      0|        ngx_http_finalize_request(r, NGX_HTTP_MOVED_PERMANENTLY);
  ------------------
  |  |   85|      0|#define NGX_HTTP_MOVED_PERMANENTLY         301
  ------------------
 1035|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1036|      0|    }
 1037|       |
 1038|     11|    r->phase_handler++;
 1039|     11|    return NGX_AGAIN;
  ------------------
  |  |   40|     11|#define  NGX_AGAIN      -2
  ------------------
 1040|     11|}
ngx_http_core_post_rewrite_phase:
 1046|     11|{
 1047|     11|    ngx_http_core_srv_conf_t  *cscf;
 1048|       |
 1049|     11|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1050|     11|                   "post rewrite phase: %ui", r->phase_handler);
 1051|       |
 1052|     11|    if (!r->uri_changed) {
  ------------------
  |  Branch (1052:9): [True: 11, False: 0]
  ------------------
 1053|     11|        r->phase_handler++;
 1054|     11|        return NGX_AGAIN;
  ------------------
  |  |   40|     11|#define  NGX_AGAIN      -2
  ------------------
 1055|     11|    }
 1056|       |
 1057|      0|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1058|      0|                   "uri changes: %d", r->uri_changes);
 1059|       |
 1060|       |    /*
 1061|       |     * gcc before 3.3 compiles the broken code for
 1062|       |     *     if (r->uri_changes-- == 0)
 1063|       |     * if the r->uri_changes is defined as
 1064|       |     *     unsigned  uri_changes:4
 1065|       |     */
 1066|       |
 1067|      0|    r->uri_changes--;
 1068|       |
 1069|      0|    if (r->uri_changes == 0) {
  ------------------
  |  Branch (1069:9): [True: 0, False: 0]
  ------------------
 1070|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1071|      0|                      "rewrite or internal redirection cycle "
 1072|      0|                      "while processing \"%V\"", &r->uri);
 1073|       |
 1074|      0|        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1075|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1076|      0|    }
 1077|       |
 1078|      0|    r->phase_handler = ph->next;
 1079|       |
 1080|      0|    cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|      0|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
 1081|      0|    r->loc_conf = cscf->ctx->loc_conf;
 1082|       |
 1083|      0|    return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1084|      0|}
ngx_http_core_access_phase:
 1089|     22|{
 1090|     22|    ngx_int_t                  rc;
 1091|     22|    ngx_table_elt_t           *h;
 1092|     22|    ngx_http_core_loc_conf_t  *clcf;
 1093|       |
 1094|     22|    if (r != r->main) {
  ------------------
  |  Branch (1094:9): [True: 0, False: 22]
  ------------------
 1095|      0|        r->phase_handler = ph->next;
 1096|      0|        return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1097|      0|    }
 1098|       |
 1099|     22|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1100|     22|                   "access phase: %ui", r->phase_handler);
 1101|       |
 1102|     22|    rc = ph->handler(r);
 1103|       |
 1104|     22|    if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|     22|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (1104:9): [True: 22, False: 0]
  ------------------
 1105|     22|        r->phase_handler++;
 1106|     22|        return NGX_AGAIN;
  ------------------
  |  |   40|     22|#define  NGX_AGAIN      -2
  ------------------
 1107|     22|    }
 1108|       |
 1109|      0|    if (rc == NGX_AGAIN || rc == NGX_DONE) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
                  if (rc == NGX_AGAIN || rc == NGX_DONE) {
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  |  Branch (1109:9): [True: 0, False: 0]
  |  Branch (1109:28): [True: 0, False: 0]
  ------------------
 1110|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1111|      0|    }
 1112|       |
 1113|      0|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 1114|       |
 1115|      0|    if (clcf->satisfy == NGX_HTTP_SATISFY_ALL) {
  ------------------
  |  |   39|      0|#define NGX_HTTP_SATISFY_ALL            0
  ------------------
  |  Branch (1115:9): [True: 0, False: 0]
  ------------------
 1116|       |
 1117|      0|        if (rc == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1117:13): [True: 0, False: 0]
  ------------------
 1118|      0|            r->phase_handler++;
 1119|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1120|      0|        }
 1121|       |
 1122|      0|    } else {
 1123|      0|        if (rc == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1123:13): [True: 0, False: 0]
  ------------------
 1124|      0|            r->access_code = 0;
 1125|       |
 1126|      0|            for (h = r->headers_out.www_authenticate; h; h = h->next) {
  ------------------
  |  Branch (1126:55): [True: 0, False: 0]
  ------------------
 1127|      0|                h->hash = 0;
 1128|      0|            }
 1129|       |
 1130|      0|            r->phase_handler = ph->next;
 1131|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1132|      0|        }
 1133|       |
 1134|      0|        if (rc == NGX_HTTP_FORBIDDEN || rc == NGX_HTTP_UNAUTHORIZED) {
  ------------------
  |  |   94|      0|#define NGX_HTTP_FORBIDDEN                 403
  ------------------
                      if (rc == NGX_HTTP_FORBIDDEN || rc == NGX_HTTP_UNAUTHORIZED) {
  ------------------
  |  |   93|      0|#define NGX_HTTP_UNAUTHORIZED              401
  ------------------
  |  Branch (1134:13): [True: 0, False: 0]
  |  Branch (1134:41): [True: 0, False: 0]
  ------------------
 1135|      0|            if (r->access_code != NGX_HTTP_UNAUTHORIZED) {
  ------------------
  |  |   93|      0|#define NGX_HTTP_UNAUTHORIZED              401
  ------------------
  |  Branch (1135:17): [True: 0, False: 0]
  ------------------
 1136|      0|                r->access_code = rc;
 1137|      0|            }
 1138|       |
 1139|      0|            r->phase_handler++;
 1140|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1141|      0|        }
 1142|      0|    }
 1143|       |
 1144|       |    /* rc == NGX_ERROR || rc == NGX_HTTP_...  */
 1145|       |
 1146|      0|    if (rc == NGX_HTTP_UNAUTHORIZED) {
  ------------------
  |  |   93|      0|#define NGX_HTTP_UNAUTHORIZED              401
  ------------------
  |  Branch (1146:9): [True: 0, False: 0]
  ------------------
 1147|      0|        return ngx_http_core_auth_delay(r);
 1148|      0|    }
 1149|       |
 1150|      0|    ngx_http_finalize_request(r, rc);
 1151|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1152|      0|}
ngx_http_core_post_access_phase:
 1158|     11|{
 1159|     11|    ngx_int_t  access_code;
 1160|       |
 1161|     11|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1162|     11|                   "post access phase: %ui", r->phase_handler);
 1163|       |
 1164|     11|    access_code = r->access_code;
 1165|       |
 1166|     11|    if (access_code) {
  ------------------
  |  Branch (1166:9): [True: 0, False: 11]
  ------------------
 1167|      0|        r->access_code = 0;
 1168|       |
 1169|      0|        if (access_code == NGX_HTTP_FORBIDDEN) {
  ------------------
  |  |   94|      0|#define NGX_HTTP_FORBIDDEN                 403
  ------------------
  |  Branch (1169:13): [True: 0, False: 0]
  ------------------
 1170|      0|            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1171|      0|                          "access forbidden by rule");
 1172|      0|        }
 1173|       |
 1174|      0|        if (access_code == NGX_HTTP_UNAUTHORIZED) {
  ------------------
  |  |   93|      0|#define NGX_HTTP_UNAUTHORIZED              401
  ------------------
  |  Branch (1174:13): [True: 0, False: 0]
  ------------------
 1175|      0|            return ngx_http_core_auth_delay(r);
 1176|      0|        }
 1177|       |
 1178|      0|        ngx_http_finalize_request(r, access_code);
 1179|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1180|      0|    }
 1181|       |
 1182|     11|    r->phase_handler++;
 1183|     11|    return NGX_AGAIN;
  ------------------
  |  |   40|     11|#define  NGX_AGAIN      -2
  ------------------
 1184|     11|}
ngx_http_core_content_phase:
 1254|     11|{
 1255|     11|    size_t     root;
 1256|     11|    ngx_int_t  rc;
 1257|     11|    ngx_str_t  path;
 1258|       |
 1259|     11|    if (r->content_handler) {
  ------------------
  |  Branch (1259:9): [True: 11, False: 0]
  ------------------
 1260|     11|        r->write_event_handler = ngx_http_request_empty_handler;
 1261|     11|        ngx_http_finalize_request(r, r->content_handler(r));
 1262|     11|        return NGX_OK;
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
 1263|     11|    }
 1264|       |
 1265|      0|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1266|      0|                   "content phase: %ui", r->phase_handler);
 1267|       |
 1268|      0|    rc = ph->handler(r);
 1269|       |
 1270|      0|    if (rc != NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (1270:9): [True: 0, False: 0]
  ------------------
 1271|      0|        ngx_http_finalize_request(r, rc);
 1272|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1273|      0|    }
 1274|       |
 1275|       |    /* rc == NGX_DECLINED */
 1276|       |
 1277|      0|    ph++;
 1278|       |
 1279|      0|    if (ph->checker) {
  ------------------
  |  Branch (1279:9): [True: 0, False: 0]
  ------------------
 1280|      0|        r->phase_handler++;
 1281|      0|        return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1282|      0|    }
 1283|       |
 1284|       |    /* no content handler was found */
 1285|       |
 1286|      0|    if (r->uri.data[r->uri.len - 1] == '/') {
  ------------------
  |  Branch (1286:9): [True: 0, False: 0]
  ------------------
 1287|       |
 1288|      0|        if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) {
  ------------------
  |  Branch (1288:13): [True: 0, False: 0]
  ------------------
 1289|      0|            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1290|      0|                          "directory index of \"%s\" is forbidden", path.data);
 1291|      0|        }
 1292|       |
 1293|      0|        ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN);
  ------------------
  |  |   94|      0|#define NGX_HTTP_FORBIDDEN                 403
  ------------------
 1294|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1295|      0|    }
 1296|       |
 1297|      0|    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no handler found");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1298|       |
 1299|      0|    ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND);
  ------------------
  |  |   95|      0|#define NGX_HTTP_NOT_FOUND                 404
  ------------------
 1300|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1301|      0|}
ngx_http_update_location_config:
 1306|     11|{
 1307|     11|    ngx_http_core_loc_conf_t  *clcf;
 1308|       |
 1309|     11|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 1310|       |
 1311|     11|    if (r->method & clcf->limit_except) {
  ------------------
  |  Branch (1311:9): [True: 0, False: 11]
  ------------------
 1312|      0|        r->loc_conf = clcf->limit_except_loc_conf;
 1313|      0|        clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 1314|      0|    }
 1315|       |
 1316|     11|    if (r == r->main) {
  ------------------
  |  Branch (1316:9): [True: 11, False: 0]
  ------------------
 1317|     11|        ngx_set_connection_log(r->connection, clcf->error_log);
  ------------------
  |  |  207|     11|    c->log->file = l->file;                                                  \
  |  |  208|     11|    c->log->next = l->next;                                                  \
  |  |  209|     11|    c->log->writer = l->writer;                                              \
  |  |  210|     11|    c->log->wdata = l->wdata;                                                \
  |  |  211|     11|    if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {                   \
  |  |  ------------------
  |  |  |  |   41|     11|#define NGX_LOG_DEBUG_CONNECTION  0x80000000
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 11, False: 0]
  |  |  ------------------
  |  |  212|     11|        c->log->log_level = l->log_level;                                    \
  |  |  213|     11|    }
  ------------------
 1318|     11|    }
 1319|       |
 1320|     11|    if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
  ------------------
  |  |   16|     11|#define NGX_IO_SENDFILE    1
  ------------------
  |  Branch (1320:9): [True: 0, False: 11]
  |  Branch (1320:45): [True: 0, False: 0]
  ------------------
 1321|      0|        r->connection->sendfile = 1;
 1322|       |
 1323|     11|    } else {
 1324|     11|        r->connection->sendfile = 0;
 1325|     11|    }
 1326|       |
 1327|     11|    if (clcf->client_body_in_file_only) {
  ------------------
  |  Branch (1327:9): [True: 0, False: 11]
  ------------------
 1328|      0|        r->request_body_in_file_only = 1;
 1329|      0|        r->request_body_in_persistent_file = 1;
 1330|      0|        r->request_body_in_clean_file =
 1331|      0|            clcf->client_body_in_file_only == NGX_HTTP_REQUEST_BODY_FILE_CLEAN;
  ------------------
  |  |   21|      0|#define NGX_HTTP_REQUEST_BODY_FILE_CLEAN  2
  ------------------
 1332|      0|        r->request_body_file_log_level = NGX_LOG_NOTICE;
  ------------------
  |  |   22|      0|#define NGX_LOG_NOTICE            6
  ------------------
 1333|       |
 1334|     11|    } else {
 1335|     11|        r->request_body_file_log_level = NGX_LOG_WARN;
  ------------------
  |  |   21|     11|#define NGX_LOG_WARN              5
  ------------------
 1336|     11|    }
 1337|       |
 1338|     11|    r->request_body_in_single_buf = clcf->client_body_in_single_buffer;
 1339|       |
 1340|     11|    if (r->keepalive) {
  ------------------
  |  Branch (1340:9): [True: 2, False: 9]
  ------------------
 1341|      2|        if (clcf->keepalive_timeout == 0) {
  ------------------
  |  Branch (1341:13): [True: 0, False: 2]
  ------------------
 1342|      0|            r->keepalive = 0;
 1343|       |
 1344|      2|        } else if (r->connection->requests >= clcf->keepalive_requests) {
  ------------------
  |  Branch (1344:20): [True: 0, False: 2]
  ------------------
 1345|      0|            r->keepalive = 0;
 1346|       |
 1347|      2|        } else if (ngx_current_msec - r->connection->start_time
  ------------------
  |  Branch (1347:20): [True: 0, False: 2]
  ------------------
 1348|      2|                   > clcf->keepalive_time)
 1349|      0|        {
 1350|      0|            r->keepalive = 0;
 1351|       |
 1352|      2|        } else if (r->headers_in.msie6
  ------------------
  |  Branch (1352:20): [True: 0, False: 2]
  ------------------
 1353|      2|                   && r->method == NGX_HTTP_POST
  ------------------
  |  |   32|      2|#define NGX_HTTP_POST                      0x00000008
  ------------------
  |  Branch (1353:23): [True: 0, False: 0]
  ------------------
 1354|      2|                   && (clcf->keepalive_disable
  ------------------
  |  Branch (1354:23): [True: 0, False: 0]
  ------------------
 1355|      0|                       & NGX_HTTP_KEEPALIVE_DISABLE_MSIE6))
  ------------------
  |  |   54|      0|#define NGX_HTTP_KEEPALIVE_DISABLE_MSIE6   0x0004
  ------------------
 1356|      0|        {
 1357|       |            /*
 1358|       |             * MSIE may wait for some time if an response for
 1359|       |             * a POST request was sent over a keepalive connection
 1360|       |             */
 1361|      0|            r->keepalive = 0;
 1362|       |
 1363|      2|        } else if (r->headers_in.safari
  ------------------
  |  Branch (1363:20): [True: 0, False: 2]
  ------------------
 1364|      2|                   && (clcf->keepalive_disable
  ------------------
  |  Branch (1364:23): [True: 0, False: 0]
  ------------------
 1365|      0|                       & NGX_HTTP_KEEPALIVE_DISABLE_SAFARI))
  ------------------
  |  |   55|      0|#define NGX_HTTP_KEEPALIVE_DISABLE_SAFARI  0x0008
  ------------------
 1366|      0|        {
 1367|       |            /*
 1368|       |             * Safari may send a POST request to a closed keepalive
 1369|       |             * connection and may stall for some time, see
 1370|       |             *     https://bugs.webkit.org/show_bug.cgi?id=5760
 1371|       |             */
 1372|      0|            r->keepalive = 0;
 1373|      0|        }
 1374|      2|    }
 1375|       |
 1376|     11|    if (!clcf->tcp_nopush) {
  ------------------
  |  Branch (1376:9): [True: 11, False: 0]
  ------------------
 1377|       |        /* disable TCP_NOPUSH/TCP_CORK use */
 1378|     11|        r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
 1379|     11|    }
 1380|       |
 1381|     11|    if (clcf->handler) {
  ------------------
  |  Branch (1381:9): [True: 11, False: 0]
  ------------------
 1382|     11|        r->content_handler = clcf->handler;
 1383|     11|    }
 1384|     11|}
ngx_http_send_header:
 1833|      7|{
 1834|      7|    if (r->post_action) {
  ------------------
  |  Branch (1834:9): [True: 0, False: 7]
  ------------------
 1835|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1836|      0|    }
 1837|       |
 1838|      7|    if (r->header_sent) {
  ------------------
  |  Branch (1838:9): [True: 0, False: 7]
  ------------------
 1839|      0|        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1840|      0|                      "header already sent");
 1841|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1842|      0|    }
 1843|       |
 1844|      7|    if (r->err_status) {
  ------------------
  |  Branch (1844:9): [True: 2, False: 5]
  ------------------
 1845|      2|        r->headers_out.status = r->err_status;
 1846|      2|        r->headers_out.status_line.len = 0;
 1847|      2|    }
 1848|       |
 1849|      7|    return ngx_http_top_header_filter(r);
 1850|      7|}
ngx_http_output_filter:
 1855|     13|{
 1856|     13|    ngx_int_t          rc;
 1857|     13|    ngx_connection_t  *c;
 1858|       |
 1859|     13|    c = r->connection;
 1860|       |
 1861|     13|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
 1862|     13|                   "http output filter \"%V?%V\"", &r->uri, &r->args);
 1863|       |
 1864|     13|    rc = ngx_http_top_body_filter(r, in);
 1865|       |
 1866|     13|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|     13|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1866:9): [True: 0, False: 13]
  ------------------
 1867|       |        /* NGX_ERROR may be returned by any filter */
 1868|      0|        c->error = 1;
 1869|      0|    }
 1870|       |
 1871|     13|    return rc;
 1872|     13|}
ngx_http_cleanup_add:
 2631|      5|{
 2632|      5|    ngx_http_cleanup_t  *cln;
 2633|       |
 2634|      5|    r = r->main;
 2635|       |
 2636|      5|    cln = ngx_palloc(r->pool, sizeof(ngx_http_cleanup_t));
 2637|      5|    if (cln == NULL) {
  ------------------
  |  Branch (2637:9): [True: 0, False: 5]
  ------------------
 2638|      0|        return NULL;
 2639|      0|    }
 2640|       |
 2641|      5|    if (size) {
  ------------------
  |  Branch (2641:9): [True: 0, False: 5]
  ------------------
 2642|      0|        cln->data = ngx_palloc(r->pool, size);
 2643|      0|        if (cln->data == NULL) {
  ------------------
  |  Branch (2643:13): [True: 0, False: 0]
  ------------------
 2644|      0|            return NULL;
 2645|      0|        }
 2646|       |
 2647|      5|    } else {
 2648|      5|        cln->data = NULL;
 2649|      5|    }
 2650|       |
 2651|      5|    cln->handler = NULL;
 2652|      5|    cln->next = r->cleanup;
 2653|       |
 2654|      5|    r->cleanup = cln;
 2655|       |
 2656|      5|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2657|      5|                   "http cleanup add: %p", cln);
 2658|       |
 2659|      5|    return cln;
 2660|      5|}
ngx_http_core_module.c:ngx_http_core_preconfiguration:
 3368|      1|{
 3369|      1|    return ngx_http_variables_add_core_vars(cf);
 3370|      1|}
ngx_http_core_module.c:ngx_http_core_postconfiguration:
 3375|      1|{
 3376|      1|    ngx_http_top_request_body_filter = ngx_http_request_body_save_filter;
 3377|       |
 3378|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 3379|      1|}
ngx_http_core_module.c:ngx_http_core_create_main_conf:
 3384|      1|{
 3385|      1|    ngx_http_core_main_conf_t  *cmcf;
 3386|       |
 3387|      1|    cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_main_conf_t));
 3388|      1|    if (cmcf == NULL) {
  ------------------
  |  Branch (3388:9): [True: 0, False: 1]
  ------------------
 3389|      0|        return NULL;
 3390|      0|    }
 3391|       |
 3392|      1|    if (ngx_array_init(&cmcf->servers, cf->pool, 4,
  ------------------
  |  Branch (3392:9): [True: 0, False: 1]
  ------------------
 3393|      1|                       sizeof(ngx_http_core_srv_conf_t *))
 3394|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 3395|      0|    {
 3396|      0|        return NULL;
 3397|      0|    }
 3398|       |
 3399|      1|    cmcf->server_names_hash_max_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3400|      1|    cmcf->server_names_hash_bucket_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3401|       |
 3402|      1|    cmcf->variables_hash_max_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3403|      1|    cmcf->variables_hash_bucket_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3404|       |
 3405|      1|    return cmcf;
 3406|      1|}
ngx_http_core_module.c:ngx_http_core_init_main_conf:
 3411|      1|{
 3412|      1|    ngx_http_core_main_conf_t *cmcf = conf;
 3413|       |
 3414|      1|    ngx_conf_init_uint_value(cmcf->server_names_hash_max_size, 512);
  ------------------
  |  |  191|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (191:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  192|      1|        conf = default;                                                      \
  |  |  193|      1|    }
  ------------------
 3415|      1|    ngx_conf_init_uint_value(cmcf->server_names_hash_bucket_size,
  ------------------
  |  |  191|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (191:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  192|      1|        conf = default;                                                      \
  |  |  193|      1|    }
  ------------------
 3416|      1|                             ngx_cacheline_size);
 3417|       |
 3418|      1|    cmcf->server_names_hash_bucket_size =
 3419|      1|            ngx_align(cmcf->server_names_hash_bucket_size, ngx_cacheline_size);
  ------------------
  |  |  100|      1|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
 3420|       |
 3421|       |
 3422|      1|    ngx_conf_init_uint_value(cmcf->variables_hash_max_size, 1024);
  ------------------
  |  |  191|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (191:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  192|      1|        conf = default;                                                      \
  |  |  193|      1|    }
  ------------------
 3423|      1|    ngx_conf_init_uint_value(cmcf->variables_hash_bucket_size, 64);
  ------------------
  |  |  191|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (191:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  192|      1|        conf = default;                                                      \
  |  |  193|      1|    }
  ------------------
 3424|       |
 3425|      1|    cmcf->variables_hash_bucket_size =
 3426|      1|               ngx_align(cmcf->variables_hash_bucket_size, ngx_cacheline_size);
  ------------------
  |  |  100|      1|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
 3427|       |
 3428|      1|    if (cmcf->ncaptures) {
  ------------------
  |  Branch (3428:9): [True: 1, False: 0]
  ------------------
 3429|      1|        cmcf->ncaptures = (cmcf->ncaptures + 1) * 3;
 3430|      1|    }
 3431|       |
 3432|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 3433|      1|}
ngx_http_core_module.c:ngx_http_core_create_srv_conf:
 3438|      3|{
 3439|      3|    ngx_http_core_srv_conf_t  *cscf;
 3440|       |
 3441|      3|    cscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_srv_conf_t));
 3442|      3|    if (cscf == NULL) {
  ------------------
  |  Branch (3442:9): [True: 0, False: 3]
  ------------------
 3443|      0|        return NULL;
 3444|      0|    }
 3445|       |
 3446|       |    /*
 3447|       |     * set by ngx_pcalloc():
 3448|       |     *
 3449|       |     *     conf->client_large_buffers.num = 0;
 3450|       |     */
 3451|       |
 3452|      3|    if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4,
  ------------------
  |  Branch (3452:9): [True: 0, False: 3]
  ------------------
 3453|      3|                       sizeof(ngx_http_server_name_t))
 3454|      3|        != NGX_OK)
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
 3455|      0|    {
 3456|      0|        return NULL;
 3457|      0|    }
 3458|       |
 3459|      3|    cscf->connection_pool_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      3|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3460|      3|    cscf->request_pool_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      3|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3461|      3|    cscf->client_header_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      3|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3462|      3|    cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      3|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3463|      3|    cscf->ignore_invalid_headers = NGX_CONF_UNSET;
  ------------------
  |  |   56|      3|#define NGX_CONF_UNSET       -1
  ------------------
 3464|      3|    cscf->merge_slashes = NGX_CONF_UNSET;
  ------------------
  |  |   56|      3|#define NGX_CONF_UNSET       -1
  ------------------
 3465|      3|    cscf->underscores_in_headers = NGX_CONF_UNSET;
  ------------------
  |  |   56|      3|#define NGX_CONF_UNSET       -1
  ------------------
 3466|       |
 3467|      3|    cscf->file_name = cf->conf_file->file.name.data;
 3468|      3|    cscf->line = cf->conf_file->line;
 3469|       |
 3470|      3|    return cscf;
 3471|      3|}
ngx_http_core_module.c:ngx_http_core_merge_srv_conf:
 3476|      1|{
 3477|      1|    ngx_http_core_srv_conf_t *prev = parent;
 3478|      1|    ngx_http_core_srv_conf_t *conf = child;
 3479|       |
 3480|      1|    ngx_str_t                name;
 3481|      1|    ngx_http_server_name_t  *sn;
 3482|       |
 3483|       |    /* TODO: it does not merge, it inits only */
 3484|       |
 3485|      1|    ngx_conf_merge_size_value(conf->connection_pool_size,
  ------------------
  |  |  231|      1|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  232|      1|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      1|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  233|      1|    }
  ------------------
 3486|      1|                              prev->connection_pool_size, 64 * sizeof(void *));
 3487|      1|    ngx_conf_merge_size_value(conf->request_pool_size,
  ------------------
  |  |  231|      1|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  232|      1|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      1|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  233|      1|    }
  ------------------
 3488|      1|                              prev->request_pool_size, 4096);
 3489|      1|    ngx_conf_merge_msec_value(conf->client_header_timeout,
  ------------------
  |  |  221|      1|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  222|      1|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      1|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  223|      1|    }
  ------------------
 3490|      1|                              prev->client_header_timeout, 60000);
 3491|      1|    ngx_conf_merge_size_value(conf->client_header_buffer_size,
  ------------------
  |  |  231|      1|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  232|      1|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      1|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  233|      1|    }
  ------------------
 3492|      1|                              prev->client_header_buffer_size, 1024);
 3493|      1|    ngx_conf_merge_bufs_value(conf->large_client_header_buffers,
  ------------------
  |  |  252|      1|    if (conf.num == 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  253|      1|        if (prev.num) {                                                      \
  |  |  ------------------
  |  |  |  Branch (253:13): [True: 0, False: 1]
  |  |  ------------------
  |  |  254|      0|            conf.num = prev.num;                                             \
  |  |  255|      0|            conf.size = prev.size;                                           \
  |  |  256|      1|        } else {                                                             \
  |  |  257|      1|            conf.num = default_num;                                          \
  |  |  258|      1|            conf.size = default_size;                                        \
  |  |  259|      1|        }                                                                    \
  |  |  260|      1|    }
  ------------------
 3494|      1|                              prev->large_client_header_buffers,
 3495|      1|                              4, 8192);
 3496|       |
 3497|      1|    if (conf->large_client_header_buffers.size < conf->connection_pool_size) {
  ------------------
  |  Branch (3497:9): [True: 0, False: 1]
  ------------------
 3498|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3499|      0|                           "the \"large_client_header_buffers\" size must be "
 3500|      0|                           "equal to or greater than \"connection_pool_size\"");
 3501|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3502|      0|    }
 3503|       |
 3504|      1|    ngx_conf_merge_value(conf->ignore_invalid_headers,
  ------------------
  |  |  206|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  207|      1|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      1|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  208|      1|    }
  ------------------
 3505|      1|                              prev->ignore_invalid_headers, 1);
 3506|       |
 3507|      1|    ngx_conf_merge_value(conf->merge_slashes, prev->merge_slashes, 1);
  ------------------
  |  |  206|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  207|      1|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      1|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  208|      1|    }
  ------------------
 3508|       |
 3509|      1|    ngx_conf_merge_value(conf->underscores_in_headers,
  ------------------
  |  |  206|      1|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  207|      1|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      1|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  208|      1|    }
  ------------------
 3510|      1|                              prev->underscores_in_headers, 0);
 3511|       |
 3512|      1|    if (conf->server_names.nelts == 0) {
  ------------------
  |  Branch (3512:9): [True: 0, False: 1]
  ------------------
 3513|       |        /* the array has 4 empty preallocated elements, so push cannot fail */
 3514|      0|        sn = ngx_array_push(&conf->server_names);
 3515|      0|#if (NGX_PCRE)
 3516|      0|        sn->regex = NULL;
 3517|      0|#endif
 3518|      0|        sn->server = conf;
 3519|      0|        ngx_str_set(&sn->name, "");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 3520|      0|    }
 3521|       |
 3522|      1|    sn = conf->server_names.elts;
 3523|      1|    name = sn[0].name;
 3524|       |
 3525|      1|#if (NGX_PCRE)
 3526|      1|    if (sn->regex) {
  ------------------
  |  Branch (3526:9): [True: 1, False: 0]
  ------------------
 3527|      1|        name.len++;
 3528|      1|        name.data--;
 3529|      1|    } else
 3530|      0|#endif
 3531|       |
 3532|      0|    if (name.data[0] == '.') {
  ------------------
  |  Branch (3532:9): [True: 0, False: 0]
  ------------------
 3533|      0|        name.len--;
 3534|      0|        name.data++;
 3535|      0|    }
 3536|       |
 3537|      1|    conf->server_name.len = name.len;
 3538|      1|    conf->server_name.data = ngx_pstrdup(cf->pool, &name);
 3539|      1|    if (conf->server_name.data == NULL) {
  ------------------
  |  Branch (3539:9): [True: 0, False: 1]
  ------------------
 3540|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3541|      0|    }
 3542|       |
 3543|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 3544|      1|}
ngx_http_core_module.c:ngx_http_core_create_loc_conf:
 3549|      4|{
 3550|      4|    ngx_http_core_loc_conf_t  *clcf;
 3551|       |
 3552|      4|    clcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_loc_conf_t));
 3553|      4|    if (clcf == NULL) {
  ------------------
  |  Branch (3553:9): [True: 0, False: 4]
  ------------------
 3554|      0|        return NULL;
 3555|      0|    }
 3556|       |
 3557|       |    /*
 3558|       |     * set by ngx_pcalloc():
 3559|       |     *
 3560|       |     *     clcf->escaped_name = { 0, NULL };
 3561|       |     *     clcf->root = { 0, NULL };
 3562|       |     *     clcf->limit_except = 0;
 3563|       |     *     clcf->post_action = { 0, NULL };
 3564|       |     *     clcf->types = NULL;
 3565|       |     *     clcf->default_type = { 0, NULL };
 3566|       |     *     clcf->error_log = NULL;
 3567|       |     *     clcf->error_pages = NULL;
 3568|       |     *     clcf->client_body_path = NULL;
 3569|       |     *     clcf->regex = NULL;
 3570|       |     *     clcf->exact_match = 0;
 3571|       |     *     clcf->auto_redirect = 0;
 3572|       |     *     clcf->alias = 0;
 3573|       |     *     clcf->gzip_proxied = 0;
 3574|       |     *     clcf->keepalive_disable = 0;
 3575|       |     */
 3576|       |
 3577|      4|    clcf->client_max_body_size = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3578|      4|    clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3579|      4|    clcf->client_body_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3580|      4|    clcf->satisfy = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3581|      4|    clcf->auth_delay = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3582|      4|    clcf->if_modified_since = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3583|      4|    clcf->max_ranges = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3584|      4|    clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3585|      4|    clcf->client_body_in_single_buffer = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3586|      4|    clcf->internal = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3587|      4|    clcf->sendfile = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3588|      4|    clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3589|      4|    clcf->subrequest_output_buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3590|      4|    clcf->aio = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3591|      4|    clcf->aio_write = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3592|       |#if (NGX_THREADS)
 3593|       |    clcf->thread_pool = NGX_CONF_UNSET_PTR;
 3594|       |    clcf->thread_pool_value = NGX_CONF_UNSET_PTR;
 3595|       |#endif
 3596|      4|    clcf->read_ahead = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3597|      4|    clcf->directio = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3598|      4|    clcf->directio_alignment = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3599|      4|    clcf->tcp_nopush = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3600|      4|    clcf->tcp_nodelay = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3601|      4|    clcf->send_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3602|      4|    clcf->send_lowat = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3603|      4|    clcf->postpone_output = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
 3604|      4|    clcf->limit_rate = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3605|      4|    clcf->limit_rate_after = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3606|      4|    clcf->keepalive_time = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3607|      4|    clcf->keepalive_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3608|      4|    clcf->keepalive_header = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3609|      4|    clcf->keepalive_requests = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3610|      4|    clcf->lingering_close = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3611|      4|    clcf->lingering_time = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3612|      4|    clcf->lingering_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3613|      4|    clcf->resolver_timeout = NGX_CONF_UNSET_MSEC;
  ------------------
  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  ------------------
 3614|      4|    clcf->reset_timedout_connection = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3615|      4|    clcf->absolute_redirect = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3616|      4|    clcf->server_name_in_redirect = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3617|      4|    clcf->port_in_redirect = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3618|      4|    clcf->msie_padding = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3619|      4|    clcf->msie_refresh = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3620|      4|    clcf->log_not_found = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3621|      4|    clcf->log_subrequest = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3622|      4|    clcf->recursive_error_pages = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3623|      4|    clcf->chunked_transfer_encoding = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3624|      4|    clcf->etag = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3625|      4|    clcf->server_tokens = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3626|      4|    clcf->types_hash_max_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3627|      4|    clcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3628|       |
 3629|      4|    clcf->open_file_cache = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3630|      4|    clcf->open_file_cache_valid = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3631|      4|    clcf->open_file_cache_min_uses = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3632|      4|    clcf->open_file_cache_errors = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3633|      4|    clcf->open_file_cache_events = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3634|       |
 3635|      4|#if (NGX_HTTP_GZIP)
 3636|      4|    clcf->gzip_vary = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
 3637|      4|    clcf->gzip_http_version = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3638|      4|#if (NGX_PCRE)
 3639|      4|    clcf->gzip_disable = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3640|      4|#endif
 3641|      4|    clcf->gzip_disable_msie6 = 3;
 3642|       |#if (NGX_HTTP_DEGRADATION)
 3643|       |    clcf->gzip_disable_degradation = 3;
 3644|       |#endif
 3645|      4|#endif
 3646|       |
 3647|      4|#if (NGX_HAVE_OPENAT)
 3648|      4|    clcf->disable_symlinks = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
 3649|      4|    clcf->disable_symlinks_from = NGX_CONF_UNSET_PTR;
  ------------------
  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
 3650|      4|#endif
 3651|       |
 3652|      4|    return clcf;
 3653|      4|}
ngx_http_core_module.c:ngx_http_core_merge_loc_conf:
 3670|      2|{
 3671|      2|    ngx_http_core_loc_conf_t *prev = parent;
 3672|      2|    ngx_http_core_loc_conf_t *conf = child;
 3673|       |
 3674|      2|    ngx_uint_t        i;
 3675|      2|    ngx_hash_key_t   *type;
 3676|      2|    ngx_hash_init_t   types_hash;
 3677|       |
 3678|      2|    if (conf->root.data == NULL) {
  ------------------
  |  Branch (3678:9): [True: 2, False: 0]
  ------------------
 3679|       |
 3680|      2|        conf->alias = prev->alias;
 3681|      2|        conf->root = prev->root;
 3682|      2|        conf->root_lengths = prev->root_lengths;
 3683|      2|        conf->root_values = prev->root_values;
 3684|       |
 3685|      2|        if (prev->root.data == NULL) {
  ------------------
  |  Branch (3685:13): [True: 1, False: 1]
  ------------------
 3686|      1|            ngx_str_set(&conf->root, "html");
  ------------------
  |  |   43|      1|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
 3687|       |
 3688|      1|            if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (3688:17): [True: 0, False: 1]
  ------------------
 3689|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3690|      0|            }
 3691|      1|        }
 3692|      2|    }
 3693|       |
 3694|      2|    if (conf->post_action.data == NULL) {
  ------------------
  |  Branch (3694:9): [True: 2, False: 0]
  ------------------
 3695|      2|        conf->post_action = prev->post_action;
 3696|      2|    }
 3697|       |
 3698|      2|    ngx_conf_merge_uint_value(conf->types_hash_max_size,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3699|      2|                              prev->types_hash_max_size, 1024);
 3700|       |
 3701|      2|    ngx_conf_merge_uint_value(conf->types_hash_bucket_size,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3702|      2|                              prev->types_hash_bucket_size, 64);
 3703|       |
 3704|      2|    conf->types_hash_bucket_size = ngx_align(conf->types_hash_bucket_size,
  ------------------
  |  |  100|      2|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
 3705|      2|                                             ngx_cacheline_size);
 3706|       |
 3707|       |    /*
 3708|       |     * the special handling of the "types" directive in the "http" section
 3709|       |     * to inherit the http's conf->types_hash to all servers
 3710|       |     */
 3711|       |
 3712|      2|    if (prev->types && prev->types_hash.buckets == NULL) {
  ------------------
  |  Branch (3712:9): [True: 1, False: 1]
  |  Branch (3712:24): [True: 0, False: 1]
  ------------------
 3713|       |
 3714|      0|        types_hash.hash = &prev->types_hash;
 3715|      0|        types_hash.key = ngx_hash_key_lc;
 3716|      0|        types_hash.max_size = conf->types_hash_max_size;
 3717|      0|        types_hash.bucket_size = conf->types_hash_bucket_size;
 3718|      0|        types_hash.name = "types_hash";
 3719|      0|        types_hash.pool = cf->pool;
 3720|      0|        types_hash.temp_pool = NULL;
 3721|       |
 3722|      0|        if (ngx_hash_init(&types_hash, prev->types->elts, prev->types->nelts)
  ------------------
  |  Branch (3722:13): [True: 0, False: 0]
  ------------------
 3723|      0|            != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 3724|      0|        {
 3725|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3726|      0|        }
 3727|      0|    }
 3728|       |
 3729|      2|    if (conf->types == NULL) {
  ------------------
  |  Branch (3729:9): [True: 2, False: 0]
  ------------------
 3730|      2|        conf->types = prev->types;
 3731|      2|        conf->types_hash = prev->types_hash;
 3732|      2|    }
 3733|       |
 3734|      2|    if (conf->types == NULL) {
  ------------------
  |  Branch (3734:9): [True: 1, False: 1]
  ------------------
 3735|      1|        conf->types = ngx_array_create(cf->pool, 3, sizeof(ngx_hash_key_t));
 3736|      1|        if (conf->types == NULL) {
  ------------------
  |  Branch (3736:13): [True: 0, False: 1]
  ------------------
 3737|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3738|      0|        }
 3739|       |
 3740|      4|        for (i = 0; ngx_http_core_default_types[i].key.len; i++) {
  ------------------
  |  Branch (3740:21): [True: 3, False: 1]
  ------------------
 3741|      3|            type = ngx_array_push(conf->types);
 3742|      3|            if (type == NULL) {
  ------------------
  |  Branch (3742:17): [True: 0, False: 3]
  ------------------
 3743|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3744|      0|            }
 3745|       |
 3746|      3|            type->key = ngx_http_core_default_types[i].key;
 3747|      3|            type->key_hash =
 3748|      3|                       ngx_hash_key_lc(ngx_http_core_default_types[i].key.data,
 3749|      3|                                       ngx_http_core_default_types[i].key.len);
 3750|      3|            type->value = ngx_http_core_default_types[i].value;
 3751|      3|        }
 3752|      1|    }
 3753|       |
 3754|      2|    if (conf->types_hash.buckets == NULL) {
  ------------------
  |  Branch (3754:9): [True: 1, False: 1]
  ------------------
 3755|       |
 3756|      1|        types_hash.hash = &conf->types_hash;
 3757|      1|        types_hash.key = ngx_hash_key_lc;
 3758|      1|        types_hash.max_size = conf->types_hash_max_size;
 3759|      1|        types_hash.bucket_size = conf->types_hash_bucket_size;
 3760|      1|        types_hash.name = "types_hash";
 3761|      1|        types_hash.pool = cf->pool;
 3762|      1|        types_hash.temp_pool = NULL;
 3763|       |
 3764|      1|        if (ngx_hash_init(&types_hash, conf->types->elts, conf->types->nelts)
  ------------------
  |  Branch (3764:13): [True: 0, False: 1]
  ------------------
 3765|      1|            != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 3766|      0|        {
 3767|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3768|      0|        }
 3769|      1|    }
 3770|       |
 3771|      2|    if (conf->error_log == NULL) {
  ------------------
  |  Branch (3771:9): [True: 2, False: 0]
  ------------------
 3772|      2|        if (prev->error_log) {
  ------------------
  |  Branch (3772:13): [True: 2, False: 0]
  ------------------
 3773|      2|            conf->error_log = prev->error_log;
 3774|      2|        } else {
 3775|      0|            conf->error_log = &cf->cycle->new_log;
 3776|      0|        }
 3777|      2|    }
 3778|       |
 3779|      2|    if (conf->error_pages == NULL && prev->error_pages) {
  ------------------
  |  Branch (3779:9): [True: 2, False: 0]
  |  Branch (3779:38): [True: 0, False: 2]
  ------------------
 3780|      0|        conf->error_pages = prev->error_pages;
 3781|      0|    }
 3782|       |
 3783|      2|    ngx_conf_merge_str_value(conf->default_type,
  ------------------
  |  |  241|      2|    if (conf.data == NULL) {                                                 \
  |  |  ------------------
  |  |  |  Branch (241:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  242|      2|        if (prev.data) {                                                     \
  |  |  ------------------
  |  |  |  Branch (242:13): [True: 2, False: 0]
  |  |  ------------------
  |  |  243|      2|            conf.len = prev.len;                                             \
  |  |  244|      2|            conf.data = prev.data;                                           \
  |  |  245|      2|        } else {                                                             \
  |  |  246|      0|            conf.len = sizeof(default) - 1;                                  \
  |  |  247|      0|            conf.data = (u_char *) default;                                  \
  |  |  248|      0|        }                                                                    \
  |  |  249|      2|    }
  ------------------
 3784|      2|                              prev->default_type, "text/plain");
 3785|       |
 3786|      2|    ngx_conf_merge_off_value(conf->client_max_body_size,
  ------------------
  |  |  236|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (236:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  237|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (237:16): [True: 0, False: 2]
  |  |  ------------------
  |  |  238|      2|    }
  ------------------
 3787|      2|                              prev->client_max_body_size, 1 * 1024 * 1024);
 3788|      2|    ngx_conf_merge_size_value(conf->client_body_buffer_size,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3789|      2|                              prev->client_body_buffer_size,
 3790|      2|                              (size_t) 2 * ngx_pagesize);
 3791|      2|    ngx_conf_merge_msec_value(conf->client_body_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3792|      2|                              prev->client_body_timeout, 60000);
 3793|       |
 3794|      2|    ngx_conf_merge_bitmask_value(conf->keepalive_disable,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 3795|      2|                              prev->keepalive_disable,
 3796|      2|                              (NGX_CONF_BITMASK_SET
 3797|      2|                               |NGX_HTTP_KEEPALIVE_DISABLE_MSIE6));
 3798|      2|    ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3799|      2|                              NGX_HTTP_SATISFY_ALL);
 3800|      2|    ngx_conf_merge_msec_value(conf->auth_delay, prev->auth_delay, 0);
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3801|      2|    ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3802|      2|                              NGX_HTTP_IMS_EXACT);
 3803|      2|    ngx_conf_merge_uint_value(conf->max_ranges, prev->max_ranges,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3804|      2|                              NGX_MAX_INT32_VALUE);
 3805|      2|    ngx_conf_merge_uint_value(conf->client_body_in_file_only,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3806|      2|                              prev->client_body_in_file_only,
 3807|      2|                              NGX_HTTP_REQUEST_BODY_FILE_OFF);
 3808|      2|    ngx_conf_merge_value(conf->client_body_in_single_buffer,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3809|      2|                              prev->client_body_in_single_buffer, 0);
 3810|      2|    ngx_conf_merge_value(conf->internal, prev->internal, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3811|      2|    ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3812|      2|    ngx_conf_merge_size_value(conf->sendfile_max_chunk,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3813|      2|                              prev->sendfile_max_chunk, 2 * 1024 * 1024);
 3814|      2|    ngx_conf_merge_size_value(conf->subrequest_output_buffer_size,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3815|      2|                              prev->subrequest_output_buffer_size,
 3816|      2|                              (size_t) ngx_pagesize);
 3817|      2|    ngx_conf_merge_value(conf->aio, prev->aio, NGX_HTTP_AIO_OFF);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3818|      2|    ngx_conf_merge_value(conf->aio_write, prev->aio_write, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3819|       |#if (NGX_THREADS)
 3820|       |    ngx_conf_merge_ptr_value(conf->thread_pool, prev->thread_pool, NULL);
 3821|       |    ngx_conf_merge_ptr_value(conf->thread_pool_value, prev->thread_pool_value,
 3822|       |                             NULL);
 3823|       |#endif
 3824|      2|    ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0);
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3825|      2|    ngx_conf_merge_off_value(conf->directio, prev->directio,
  ------------------
  |  |  236|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (236:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  237|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (237:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  238|      2|    }
  ------------------
 3826|      2|                              NGX_OPEN_FILE_DIRECTIO_OFF);
 3827|      2|    ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment,
  ------------------
  |  |  236|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (236:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  237|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (237:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  238|      2|    }
  ------------------
 3828|      2|                              512);
 3829|      2|    ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3830|      2|    ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3831|       |
 3832|      2|    ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 60000);
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3833|      2|    ngx_conf_merge_size_value(conf->send_lowat, prev->send_lowat, 0);
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3834|      2|    ngx_conf_merge_size_value(conf->postpone_output, prev->postpone_output,
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
 3835|      2|                              1460);
 3836|       |
 3837|      2|    ngx_conf_merge_ptr_value(conf->limit_rate, prev->limit_rate, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3838|      2|    ngx_conf_merge_ptr_value(conf->limit_rate_after,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3839|      2|                              prev->limit_rate_after, NULL);
 3840|       |
 3841|      2|    ngx_conf_merge_msec_value(conf->keepalive_time,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3842|      2|                              prev->keepalive_time, 3600000);
 3843|      2|    ngx_conf_merge_msec_value(conf->keepalive_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3844|      2|                              prev->keepalive_timeout, 75000);
 3845|      2|    ngx_conf_merge_sec_value(conf->keepalive_header,
  ------------------
  |  |  226|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (226:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  227|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (227:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  228|      2|    }
  ------------------
 3846|      2|                              prev->keepalive_header, 0);
 3847|      2|    ngx_conf_merge_uint_value(conf->keepalive_requests,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3848|      2|                              prev->keepalive_requests, 1000);
 3849|      2|    ngx_conf_merge_uint_value(conf->lingering_close,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3850|      2|                              prev->lingering_close, NGX_HTTP_LINGERING_ON);
 3851|      2|    ngx_conf_merge_msec_value(conf->lingering_time,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3852|      2|                              prev->lingering_time, 30000);
 3853|      2|    ngx_conf_merge_msec_value(conf->lingering_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3854|      2|                              prev->lingering_timeout, 5000);
 3855|      2|    ngx_conf_merge_msec_value(conf->resolver_timeout,
  ------------------
  |  |  221|      2|    if (conf == NGX_CONF_UNSET_MSEC) {                                       \
  |  |  ------------------
  |  |  |  |   60|      4|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (221:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  222|      2|        conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   60|      2|#define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
  |  |  ------------------
  |  |  |  Branch (222:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  223|      2|    }
  ------------------
 3856|      2|                              prev->resolver_timeout, 30000);
 3857|       |
 3858|      2|    if (conf->resolver == NULL) {
  ------------------
  |  Branch (3858:9): [True: 2, False: 0]
  ------------------
 3859|       |
 3860|      2|        if (prev->resolver == NULL) {
  ------------------
  |  Branch (3860:13): [True: 1, False: 1]
  ------------------
 3861|       |
 3862|       |            /*
 3863|       |             * create dummy resolver in http {} context
 3864|       |             * to inherit it in all servers
 3865|       |             */
 3866|       |
 3867|      1|            prev->resolver = ngx_resolver_create(cf, NULL, 0);
 3868|      1|            if (prev->resolver == NULL) {
  ------------------
  |  Branch (3868:17): [True: 0, False: 1]
  ------------------
 3869|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3870|      0|            }
 3871|      1|        }
 3872|       |
 3873|      2|        conf->resolver = prev->resolver;
 3874|      2|    }
 3875|       |
 3876|      2|    if (ngx_conf_merge_path_value(cf, &conf->client_body_temp_path,
  ------------------
  |  Branch (3876:9): [True: 0, False: 2]
  ------------------
 3877|      2|                              prev->client_body_temp_path,
 3878|      2|                              &ngx_http_client_temp_path)
 3879|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 3880|      0|    {
 3881|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3882|      0|    }
 3883|       |
 3884|      2|    ngx_conf_merge_value(conf->reset_timedout_connection,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3885|      2|                              prev->reset_timedout_connection, 0);
 3886|      2|    ngx_conf_merge_value(conf->absolute_redirect,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3887|      2|                              prev->absolute_redirect, 1);
 3888|      2|    ngx_conf_merge_value(conf->server_name_in_redirect,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3889|      2|                              prev->server_name_in_redirect, 0);
 3890|      2|    ngx_conf_merge_value(conf->port_in_redirect, prev->port_in_redirect, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3891|      2|    ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3892|      2|    ngx_conf_merge_value(conf->msie_refresh, prev->msie_refresh, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3893|      2|    ngx_conf_merge_value(conf->log_not_found, prev->log_not_found, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3894|      2|    ngx_conf_merge_value(conf->log_subrequest, prev->log_subrequest, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3895|      2|    ngx_conf_merge_value(conf->recursive_error_pages,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3896|      2|                              prev->recursive_error_pages, 0);
 3897|      2|    ngx_conf_merge_value(conf->chunked_transfer_encoding,
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 1, False: 1]
  |  |  ------------------
  |  |  207|      1|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      1|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  208|      1|    }
  ------------------
 3898|      2|                              prev->chunked_transfer_encoding, 1);
 3899|      2|    ngx_conf_merge_value(conf->etag, prev->etag, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3900|       |
 3901|      2|    ngx_conf_merge_uint_value(conf->server_tokens, prev->server_tokens,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 0, False: 2]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3902|      2|                              NGX_HTTP_SERVER_TOKENS_ON);
 3903|       |
 3904|      2|    ngx_conf_merge_ptr_value(conf->open_file_cache,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3905|      2|                              prev->open_file_cache, NULL);
 3906|       |
 3907|      2|    ngx_conf_merge_sec_value(conf->open_file_cache_valid,
  ------------------
  |  |  226|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (226:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  227|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (227:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  228|      2|    }
  ------------------
 3908|      2|                              prev->open_file_cache_valid, 60);
 3909|       |
 3910|      2|    ngx_conf_merge_uint_value(conf->open_file_cache_min_uses,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3911|      2|                              prev->open_file_cache_min_uses, 1);
 3912|       |
 3913|      2|    ngx_conf_merge_sec_value(conf->open_file_cache_errors,
  ------------------
  |  |  226|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (226:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  227|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (227:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  228|      2|    }
  ------------------
 3914|      2|                              prev->open_file_cache_errors, 0);
 3915|       |
 3916|      2|    ngx_conf_merge_sec_value(conf->open_file_cache_events,
  ------------------
  |  |  226|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (226:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  227|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (227:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  228|      2|    }
  ------------------
 3917|      2|                              prev->open_file_cache_events, 0);
 3918|      2|#if (NGX_HTTP_GZIP)
 3919|       |
 3920|      2|    ngx_conf_merge_value(conf->gzip_vary, prev->gzip_vary, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
 3921|      2|    ngx_conf_merge_uint_value(conf->gzip_http_version, prev->gzip_http_version,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3922|      2|                              NGX_HTTP_VERSION_11);
 3923|      2|    ngx_conf_merge_bitmask_value(conf->gzip_proxied, prev->gzip_proxied,
  ------------------
  |  |  263|      2|    if (conf == 0) {                                                         \
  |  |  ------------------
  |  |  |  Branch (263:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  264|      2|        conf = (prev == 0) ? default : prev;                                 \
  |  |  ------------------
  |  |  |  Branch (264:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  265|      2|    }
  ------------------
 3924|      2|                              (NGX_CONF_BITMASK_SET|NGX_HTTP_GZIP_PROXIED_OFF));
 3925|       |
 3926|      2|#if (NGX_PCRE)
 3927|      2|    ngx_conf_merge_ptr_value(conf->gzip_disable, prev->gzip_disable, NULL);
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3928|      2|#endif
 3929|       |
 3930|      2|    if (conf->gzip_disable_msie6 == 3) {
  ------------------
  |  Branch (3930:9): [True: 2, False: 0]
  ------------------
 3931|      2|        conf->gzip_disable_msie6 =
 3932|      2|            (prev->gzip_disable_msie6 == 3) ? 0 : prev->gzip_disable_msie6;
  ------------------
  |  Branch (3932:13): [True: 1, False: 1]
  ------------------
 3933|      2|    }
 3934|       |
 3935|       |#if (NGX_HTTP_DEGRADATION)
 3936|       |
 3937|       |    if (conf->gzip_disable_degradation == 3) {
 3938|       |        conf->gzip_disable_degradation =
 3939|       |            (prev->gzip_disable_degradation == 3) ?
 3940|       |                 0 : prev->gzip_disable_degradation;
 3941|       |    }
 3942|       |
 3943|       |#endif
 3944|      2|#endif
 3945|       |
 3946|      2|#if (NGX_HAVE_OPENAT)
 3947|      2|    ngx_conf_merge_uint_value(conf->disable_symlinks, prev->disable_symlinks,
  ------------------
  |  |  216|      2|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      4|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  217|      2|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  218|      2|    }
  ------------------
 3948|      2|                              NGX_DISABLE_SYMLINKS_OFF);
 3949|      2|    ngx_conf_merge_ptr_value(conf->disable_symlinks_from,
  ------------------
  |  |  211|      2|    if (conf == NGX_CONF_UNSET_PTR) {                                        \
  |  |  ------------------
  |  |  |  |   58|      4|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  212|      2|        conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
  |  |  ------------------
  |  |  |  |   58|      2|#define NGX_CONF_UNSET_PTR   (void *) -1
  |  |  ------------------
  |  |  |  Branch (212:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  213|      2|    }
  ------------------
 3950|      2|                             prev->disable_symlinks_from, NULL);
 3951|      2|#endif
 3952|       |
 3953|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
 3954|      2|}
ngx_http_core_module.c:ngx_http_core_server:
 2896|      1|{
 2897|      1|    char                        *rv;
 2898|      1|    void                        *mconf;
 2899|      1|    size_t                       len;
 2900|      1|    u_char                      *p;
 2901|      1|    ngx_uint_t                   i;
 2902|      1|    ngx_conf_t                   pcf;
 2903|      1|    ngx_http_module_t           *module;
 2904|      1|    struct sockaddr_in          *sin;
 2905|      1|    ngx_http_conf_ctx_t         *ctx, *http_ctx;
 2906|      1|    ngx_http_listen_opt_t        lsopt;
 2907|      1|    ngx_http_core_srv_conf_t    *cscf, **cscfp;
 2908|      1|    ngx_http_core_main_conf_t   *cmcf;
 2909|       |
 2910|      1|    ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
 2911|      1|    if (ctx == NULL) {
  ------------------
  |  Branch (2911:9): [True: 0, False: 1]
  ------------------
 2912|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2913|      0|    }
 2914|       |
 2915|      1|    http_ctx = cf->ctx;
 2916|      1|    ctx->main_conf = http_ctx->main_conf;
 2917|       |
 2918|       |    /* the server{}'s srv_conf */
 2919|       |
 2920|      1|    ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
 2921|      1|    if (ctx->srv_conf == NULL) {
  ------------------
  |  Branch (2921:9): [True: 0, False: 1]
  ------------------
 2922|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2923|      0|    }
 2924|       |
 2925|       |    /* the server{}'s loc_conf */
 2926|       |
 2927|      1|    ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
 2928|      1|    if (ctx->loc_conf == NULL) {
  ------------------
  |  Branch (2928:9): [True: 0, False: 1]
  ------------------
 2929|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2930|      0|    }
 2931|       |
 2932|     55|    for (i = 0; cf->cycle->modules[i]; i++) {
  ------------------
  |  Branch (2932:17): [True: 54, False: 1]
  ------------------
 2933|     54|        if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
  ------------------
  |  |   39|     54|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  |  Branch (2933:13): [True: 8, False: 46]
  ------------------
 2934|      8|            continue;
 2935|      8|        }
 2936|       |
 2937|     46|        module = cf->cycle->modules[i]->ctx;
 2938|       |
 2939|     46|        if (module->create_srv_conf) {
  ------------------
  |  Branch (2939:13): [True: 5, False: 41]
  ------------------
 2940|      5|            mconf = module->create_srv_conf(cf);
 2941|      5|            if (mconf == NULL) {
  ------------------
  |  Branch (2941:17): [True: 0, False: 5]
  ------------------
 2942|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2943|      0|            }
 2944|       |
 2945|      5|            ctx->srv_conf[cf->cycle->modules[i]->ctx_index] = mconf;
 2946|      5|        }
 2947|       |
 2948|     46|        if (module->create_loc_conf) {
  ------------------
  |  Branch (2948:13): [True: 26, False: 20]
  ------------------
 2949|     26|            mconf = module->create_loc_conf(cf);
 2950|     26|            if (mconf == NULL) {
  ------------------
  |  Branch (2950:17): [True: 0, False: 26]
  ------------------
 2951|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2952|      0|            }
 2953|       |
 2954|     26|            ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
 2955|     26|        }
 2956|     46|    }
 2957|       |
 2958|       |
 2959|       |    /* the server configuration context */
 2960|       |
 2961|      1|    cscf = ctx->srv_conf[ngx_http_core_module.ctx_index];
 2962|      1|    cscf->ctx = ctx;
 2963|       |
 2964|       |
 2965|      1|    cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
 2966|       |
 2967|      1|    cscfp = ngx_array_push(&cmcf->servers);
 2968|      1|    if (cscfp == NULL) {
  ------------------
  |  Branch (2968:9): [True: 0, False: 1]
  ------------------
 2969|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2970|      0|    }
 2971|       |
 2972|      1|    *cscfp = cscf;
 2973|       |
 2974|       |
 2975|       |    /* parse inside server{} */
 2976|       |
 2977|      1|    pcf = *cf;
 2978|      1|    cf->ctx = ctx;
 2979|      1|    cf->cmd_type = NGX_HTTP_SRV_CONF;
  ------------------
  |  |   42|      1|#define NGX_HTTP_SRV_CONF         0x04000000
  ------------------
 2980|       |
 2981|      1|    rv = ngx_conf_parse(cf, NULL);
 2982|       |
 2983|      1|    *cf = pcf;
 2984|       |
 2985|      1|    if (rv == NGX_CONF_OK && !cscf->listen) {
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (2985:9): [True: 1, False: 0]
  |  Branch (2985:30): [True: 0, False: 1]
  ------------------
 2986|      0|        ngx_memzero(&lsopt, sizeof(ngx_http_listen_opt_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 2987|       |
 2988|      0|        p = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in));
 2989|      0|        if (p == NULL) {
  ------------------
  |  Branch (2989:13): [True: 0, False: 0]
  ------------------
 2990|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 2991|      0|        }
 2992|       |
 2993|      0|        lsopt.sockaddr = (struct sockaddr *) p;
 2994|       |
 2995|      0|        sin = (struct sockaddr_in *) p;
 2996|       |
 2997|      0|        sin->sin_family = AF_INET;
 2998|       |#if (NGX_WIN32)
 2999|       |        sin->sin_port = htons(80);
 3000|       |#else
 3001|      0|        sin->sin_port = htons((getuid() == 0) ? 80 : 8000);
 3002|      0|#endif
 3003|      0|        sin->sin_addr.s_addr = INADDR_ANY;
 3004|       |
 3005|      0|        lsopt.socklen = sizeof(struct sockaddr_in);
 3006|       |
 3007|      0|        lsopt.backlog = NGX_LISTEN_BACKLOG;
  ------------------
  |  |  111|      0|#define NGX_LISTEN_BACKLOG        511
  ------------------
 3008|      0|        lsopt.type = SOCK_STREAM;
 3009|      0|        lsopt.rcvbuf = -1;
 3010|      0|        lsopt.sndbuf = -1;
 3011|       |#if (NGX_HAVE_SETFIB)
 3012|       |        lsopt.setfib = -1;
 3013|       |#endif
 3014|       |#if (NGX_HAVE_TCP_FASTOPEN)
 3015|       |        lsopt.fastopen = -1;
 3016|       |#endif
 3017|      0|        lsopt.wildcard = 1;
 3018|       |
 3019|      0|        len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1;
  ------------------
  |  |   16|      0|#define NGX_INET_ADDRSTRLEN   (sizeof("255.255.255.255") - 1)
  ------------------
 3020|       |
 3021|      0|        p = ngx_pnalloc(cf->pool, len);
 3022|      0|        if (p == NULL) {
  ------------------
  |  Branch (3022:13): [True: 0, False: 0]
  ------------------
 3023|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3024|      0|        }
 3025|       |
 3026|      0|        lsopt.addr_text.data = p;
 3027|      0|        lsopt.addr_text.len = ngx_sock_ntop(lsopt.sockaddr, lsopt.socklen, p,
 3028|      0|                                            len, 1);
 3029|       |
 3030|      0|        if (ngx_http_add_listen(cf, cscf, &lsopt) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3030:13): [True: 0, False: 0]
  ------------------
 3031|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3032|      0|        }
 3033|      0|    }
 3034|       |
 3035|      1|    return rv;
 3036|      1|}
ngx_http_core_module.c:ngx_http_core_location:
 3041|      1|{
 3042|      1|    char                      *rv;
 3043|      1|    u_char                    *mod;
 3044|      1|    size_t                     len;
 3045|      1|    ngx_str_t                 *value, *name;
 3046|      1|    ngx_uint_t                 i;
 3047|      1|    ngx_conf_t                 save;
 3048|      1|    ngx_http_module_t         *module;
 3049|      1|    ngx_http_conf_ctx_t       *ctx, *pctx;
 3050|      1|    ngx_http_core_loc_conf_t  *clcf, *pclcf;
 3051|       |
 3052|      1|    ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
 3053|      1|    if (ctx == NULL) {
  ------------------
  |  Branch (3053:9): [True: 0, False: 1]
  ------------------
 3054|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3055|      0|    }
 3056|       |
 3057|      1|    pctx = cf->ctx;
 3058|      1|    ctx->main_conf = pctx->main_conf;
 3059|      1|    ctx->srv_conf = pctx->srv_conf;
 3060|       |
 3061|      1|    ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
 3062|      1|    if (ctx->loc_conf == NULL) {
  ------------------
  |  Branch (3062:9): [True: 0, False: 1]
  ------------------
 3063|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3064|      0|    }
 3065|       |
 3066|     55|    for (i = 0; cf->cycle->modules[i]; i++) {
  ------------------
  |  Branch (3066:17): [True: 54, False: 1]
  ------------------
 3067|     54|        if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
  ------------------
  |  |   39|     54|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  |  Branch (3067:13): [True: 8, False: 46]
  ------------------
 3068|      8|            continue;
 3069|      8|        }
 3070|       |
 3071|     46|        module = cf->cycle->modules[i]->ctx;
 3072|       |
 3073|     46|        if (module->create_loc_conf) {
  ------------------
  |  Branch (3073:13): [True: 26, False: 20]
  ------------------
 3074|     26|            ctx->loc_conf[cf->cycle->modules[i]->ctx_index] =
 3075|     26|                                                   module->create_loc_conf(cf);
 3076|     26|            if (ctx->loc_conf[cf->cycle->modules[i]->ctx_index] == NULL) {
  ------------------
  |  Branch (3076:17): [True: 0, False: 26]
  ------------------
 3077|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3078|      0|            }
 3079|     26|        }
 3080|     46|    }
 3081|       |
 3082|      1|    clcf = ctx->loc_conf[ngx_http_core_module.ctx_index];
 3083|      1|    clcf->loc_conf = ctx->loc_conf;
 3084|       |
 3085|      1|    value = cf->args->elts;
 3086|       |
 3087|      1|    if (cf->args->nelts == 3) {
  ------------------
  |  Branch (3087:9): [True: 0, False: 1]
  ------------------
 3088|       |
 3089|      0|        len = value[1].len;
 3090|      0|        mod = value[1].data;
 3091|      0|        name = &value[2];
 3092|       |
 3093|      0|        if (len == 1 && mod[0] == '=') {
  ------------------
  |  Branch (3093:13): [True: 0, False: 0]
  |  Branch (3093:25): [True: 0, False: 0]
  ------------------
 3094|       |
 3095|      0|            clcf->name = *name;
 3096|      0|            clcf->exact_match = 1;
 3097|       |
 3098|      0|        } else if (len == 2 && mod[0] == '^' && mod[1] == '~') {
  ------------------
  |  Branch (3098:20): [True: 0, False: 0]
  |  Branch (3098:32): [True: 0, False: 0]
  |  Branch (3098:49): [True: 0, False: 0]
  ------------------
 3099|       |
 3100|      0|            clcf->name = *name;
 3101|      0|            clcf->noregex = 1;
 3102|       |
 3103|      0|        } else if (len == 1 && mod[0] == '~') {
  ------------------
  |  Branch (3103:20): [True: 0, False: 0]
  |  Branch (3103:32): [True: 0, False: 0]
  ------------------
 3104|       |
 3105|      0|            if (ngx_http_core_regex_location(cf, clcf, name, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3105:17): [True: 0, False: 0]
  ------------------
 3106|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3107|      0|            }
 3108|       |
 3109|      0|        } else if (len == 2 && mod[0] == '~' && mod[1] == '*') {
  ------------------
  |  Branch (3109:20): [True: 0, False: 0]
  |  Branch (3109:32): [True: 0, False: 0]
  |  Branch (3109:49): [True: 0, False: 0]
  ------------------
 3110|       |
 3111|      0|            if (ngx_http_core_regex_location(cf, clcf, name, 1) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3111:17): [True: 0, False: 0]
  ------------------
 3112|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3113|      0|            }
 3114|       |
 3115|      0|        } else {
 3116|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3117|      0|                               "invalid location modifier \"%V\"", &value[1]);
 3118|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3119|      0|        }
 3120|       |
 3121|      1|    } else {
 3122|       |
 3123|      1|        name = &value[1];
 3124|       |
 3125|      1|        if (name->data[0] == '=') {
  ------------------
  |  Branch (3125:13): [True: 0, False: 1]
  ------------------
 3126|       |
 3127|      0|            clcf->name.len = name->len - 1;
 3128|      0|            clcf->name.data = name->data + 1;
 3129|      0|            clcf->exact_match = 1;
 3130|       |
 3131|      1|        } else if (name->data[0] == '^' && name->data[1] == '~') {
  ------------------
  |  Branch (3131:20): [True: 0, False: 1]
  |  Branch (3131:44): [True: 0, False: 0]
  ------------------
 3132|       |
 3133|      0|            clcf->name.len = name->len - 2;
 3134|      0|            clcf->name.data = name->data + 2;
 3135|      0|            clcf->noregex = 1;
 3136|       |
 3137|      1|        } else if (name->data[0] == '~') {
  ------------------
  |  Branch (3137:20): [True: 0, False: 1]
  ------------------
 3138|       |
 3139|      0|            name->len--;
 3140|      0|            name->data++;
 3141|       |
 3142|      0|            if (name->data[0] == '*') {
  ------------------
  |  Branch (3142:17): [True: 0, False: 0]
  ------------------
 3143|       |
 3144|      0|                name->len--;
 3145|      0|                name->data++;
 3146|       |
 3147|      0|                if (ngx_http_core_regex_location(cf, clcf, name, 1) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3147:21): [True: 0, False: 0]
  ------------------
 3148|      0|                    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3149|      0|                }
 3150|       |
 3151|      0|            } else {
 3152|      0|                if (ngx_http_core_regex_location(cf, clcf, name, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3152:21): [True: 0, False: 0]
  ------------------
 3153|      0|                    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3154|      0|                }
 3155|      0|            }
 3156|       |
 3157|      1|        } else {
 3158|       |
 3159|      1|            clcf->name = *name;
 3160|       |
 3161|      1|            if (name->data[0] == '@') {
  ------------------
  |  Branch (3161:17): [True: 0, False: 1]
  ------------------
 3162|      0|                clcf->named = 1;
 3163|      0|            }
 3164|      1|        }
 3165|      1|    }
 3166|       |
 3167|      1|    pclcf = pctx->loc_conf[ngx_http_core_module.ctx_index];
 3168|       |
 3169|      1|    if (cf->cmd_type == NGX_HTTP_LOC_CONF) {
  ------------------
  |  |   43|      1|#define NGX_HTTP_LOC_CONF         0x08000000
  ------------------
  |  Branch (3169:9): [True: 0, False: 1]
  ------------------
 3170|       |
 3171|       |        /* nested location */
 3172|       |
 3173|       |#if 0
 3174|       |        clcf->prev_location = pclcf;
 3175|       |#endif
 3176|       |
 3177|      0|        if (pclcf->exact_match) {
  ------------------
  |  Branch (3177:13): [True: 0, False: 0]
  ------------------
 3178|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3179|      0|                               "location \"%V\" cannot be inside "
 3180|      0|                               "the exact location \"%V\"",
 3181|      0|                               &clcf->name, &pclcf->name);
 3182|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3183|      0|        }
 3184|       |
 3185|      0|        if (pclcf->named) {
  ------------------
  |  Branch (3185:13): [True: 0, False: 0]
  ------------------
 3186|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3187|      0|                               "location \"%V\" cannot be inside "
 3188|      0|                               "the named location \"%V\"",
 3189|      0|                               &clcf->name, &pclcf->name);
 3190|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3191|      0|        }
 3192|       |
 3193|      0|        if (clcf->named) {
  ------------------
  |  Branch (3193:13): [True: 0, False: 0]
  ------------------
 3194|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3195|      0|                               "named location \"%V\" can be "
 3196|      0|                               "on the server level only",
 3197|      0|                               &clcf->name);
 3198|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3199|      0|        }
 3200|       |
 3201|      0|        len = pclcf->name.len;
 3202|       |
 3203|      0|#if (NGX_PCRE)
 3204|      0|        if (clcf->regex == NULL
  ------------------
  |  Branch (3204:13): [True: 0, False: 0]
  ------------------
 3205|      0|            && ngx_filename_cmp(clcf->name.data, pclcf->name.data, len) != 0)
  ------------------
  |  Branch (3205:16): [True: 0, False: 0]
  ------------------
 3206|       |#else
 3207|       |        if (ngx_filename_cmp(clcf->name.data, pclcf->name.data, len) != 0)
 3208|       |#endif
 3209|      0|        {
 3210|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3211|      0|                               "location \"%V\" is outside location \"%V\"",
 3212|      0|                               &clcf->name, &pclcf->name);
 3213|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3214|      0|        }
 3215|      0|    }
 3216|       |
 3217|      1|    if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (3217:9): [True: 0, False: 1]
  ------------------
 3218|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3219|      0|    }
 3220|       |
 3221|      1|    save = *cf;
 3222|      1|    cf->ctx = ctx;
 3223|      1|    cf->cmd_type = NGX_HTTP_LOC_CONF;
  ------------------
  |  |   43|      1|#define NGX_HTTP_LOC_CONF         0x08000000
  ------------------
 3224|       |
 3225|      1|    rv = ngx_conf_parse(cf, NULL);
 3226|       |
 3227|      1|    *cf = save;
 3228|       |
 3229|      1|    return rv;
 3230|      1|}
ngx_http_core_module.c:ngx_http_core_listen:
 3959|      1|{
 3960|      1|    ngx_http_core_srv_conf_t *cscf = conf;
 3961|       |
 3962|      1|    ngx_str_t              *value, size;
 3963|      1|    ngx_url_t               u;
 3964|      1|    ngx_uint_t              n, i;
 3965|      1|    ngx_http_listen_opt_t   lsopt;
 3966|       |
 3967|      1|    cscf->listen = 1;
 3968|       |
 3969|      1|    value = cf->args->elts;
 3970|       |
 3971|      1|    ngx_memzero(&u, sizeof(ngx_url_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 3972|       |
 3973|      1|    u.url = value[1];
 3974|      1|    u.listen = 1;
 3975|      1|    u.default_port = 80;
 3976|       |
 3977|      1|    if (ngx_parse_url(cf->pool, &u) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (3977:9): [True: 0, False: 1]
  ------------------
 3978|      0|        if (u.err) {
  ------------------
  |  Branch (3978:13): [True: 0, False: 0]
  ------------------
 3979|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 3980|      0|                               "%s in \"%V\" of the \"listen\" directive",
 3981|      0|                               u.err, &u.url);
 3982|      0|        }
 3983|       |
 3984|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 3985|      0|    }
 3986|       |
 3987|      1|    ngx_memzero(&lsopt, sizeof(ngx_http_listen_opt_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 3988|       |
 3989|      1|    lsopt.backlog = NGX_LISTEN_BACKLOG;
  ------------------
  |  |  111|      1|#define NGX_LISTEN_BACKLOG        511
  ------------------
 3990|      1|    lsopt.type = SOCK_STREAM;
 3991|      1|    lsopt.rcvbuf = -1;
 3992|      1|    lsopt.sndbuf = -1;
 3993|       |#if (NGX_HAVE_SETFIB)
 3994|       |    lsopt.setfib = -1;
 3995|       |#endif
 3996|       |#if (NGX_HAVE_TCP_FASTOPEN)
 3997|       |    lsopt.fastopen = -1;
 3998|       |#endif
 3999|      1|#if (NGX_HAVE_INET6)
 4000|      1|    lsopt.ipv6only = 1;
 4001|      1|#endif
 4002|       |
 4003|      1|    for (n = 2; n < cf->args->nelts; n++) {
  ------------------
  |  Branch (4003:17): [True: 0, False: 1]
  ------------------
 4004|       |
 4005|      0|        if (ngx_strcmp(value[n].data, "default_server") == 0
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4005:13): [True: 0, False: 0]
  ------------------
 4006|      0|            || ngx_strcmp(value[n].data, "default") == 0)
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4006:16): [True: 0, False: 0]
  ------------------
 4007|      0|        {
 4008|      0|            lsopt.default_server = 1;
 4009|      0|            continue;
 4010|      0|        }
 4011|       |
 4012|      0|        if (ngx_strcmp(value[n].data, "bind") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4012:13): [True: 0, False: 0]
  ------------------
 4013|      0|            lsopt.set = 1;
 4014|      0|            lsopt.bind = 1;
 4015|      0|            continue;
 4016|      0|        }
 4017|       |
 4018|       |#if (NGX_HAVE_SETFIB)
 4019|       |        if (ngx_strncmp(value[n].data, "setfib=", 7) == 0) {
 4020|       |            lsopt.setfib = ngx_atoi(value[n].data + 7, value[n].len - 7);
 4021|       |            lsopt.set = 1;
 4022|       |            lsopt.bind = 1;
 4023|       |
 4024|       |            if (lsopt.setfib == NGX_ERROR) {
 4025|       |                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
 4026|       |                                   "invalid setfib \"%V\"", &value[n]);
 4027|       |                return NGX_CONF_ERROR;
 4028|       |            }
 4029|       |
 4030|       |            continue;
 4031|       |        }
 4032|       |#endif
 4033|       |
 4034|       |#if (NGX_HAVE_TCP_FASTOPEN)
 4035|       |        if (ngx_strncmp(value[n].data, "fastopen=", 9) == 0) {
 4036|       |            lsopt.fastopen = ngx_atoi(value[n].data + 9, value[n].len - 9);
 4037|       |            lsopt.set = 1;
 4038|       |            lsopt.bind = 1;
 4039|       |
 4040|       |            if (lsopt.fastopen == NGX_ERROR) {
 4041|       |                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
 4042|       |                                   "invalid fastopen \"%V\"", &value[n]);
 4043|       |                return NGX_CONF_ERROR;
 4044|       |            }
 4045|       |
 4046|       |            continue;
 4047|       |        }
 4048|       |#endif
 4049|       |
 4050|      0|        if (ngx_strncmp(value[n].data, "backlog=", 8) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (4050:13): [True: 0, False: 0]
  ------------------
 4051|      0|            lsopt.backlog = ngx_atoi(value[n].data + 8, value[n].len - 8);
 4052|      0|            lsopt.set = 1;
 4053|      0|            lsopt.bind = 1;
 4054|       |
 4055|      0|            if (lsopt.backlog == NGX_ERROR || lsopt.backlog == 0) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (4055:17): [True: 0, False: 0]
  |  Branch (4055:47): [True: 0, False: 0]
  ------------------
 4056|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4057|      0|                                   "invalid backlog \"%V\"", &value[n]);
 4058|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4059|      0|            }
 4060|       |
 4061|      0|            continue;
 4062|      0|        }
 4063|       |
 4064|      0|        if (ngx_strncmp(value[n].data, "rcvbuf=", 7) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (4064:13): [True: 0, False: 0]
  ------------------
 4065|      0|            size.len = value[n].len - 7;
 4066|      0|            size.data = value[n].data + 7;
 4067|       |
 4068|      0|            lsopt.rcvbuf = ngx_parse_size(&size);
 4069|      0|            lsopt.set = 1;
 4070|      0|            lsopt.bind = 1;
 4071|       |
 4072|      0|            if (lsopt.rcvbuf == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (4072:17): [True: 0, False: 0]
  ------------------
 4073|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4074|      0|                                   "invalid rcvbuf \"%V\"", &value[n]);
 4075|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4076|      0|            }
 4077|       |
 4078|      0|            continue;
 4079|      0|        }
 4080|       |
 4081|      0|        if (ngx_strncmp(value[n].data, "sndbuf=", 7) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (4081:13): [True: 0, False: 0]
  ------------------
 4082|      0|            size.len = value[n].len - 7;
 4083|      0|            size.data = value[n].data + 7;
 4084|       |
 4085|      0|            lsopt.sndbuf = ngx_parse_size(&size);
 4086|      0|            lsopt.set = 1;
 4087|      0|            lsopt.bind = 1;
 4088|       |
 4089|      0|            if (lsopt.sndbuf == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (4089:17): [True: 0, False: 0]
  ------------------
 4090|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4091|      0|                                   "invalid sndbuf \"%V\"", &value[n]);
 4092|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4093|      0|            }
 4094|       |
 4095|      0|            continue;
 4096|      0|        }
 4097|       |
 4098|      0|        if (ngx_strncmp(value[n].data, "accept_filter=", 14) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (4098:13): [True: 0, False: 0]
  ------------------
 4099|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
 4100|       |            lsopt.accept_filter = (char *) &value[n].data[14];
 4101|       |            lsopt.set = 1;
 4102|       |            lsopt.bind = 1;
 4103|       |#else
 4104|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4105|      0|                               "accept filters \"%V\" are not supported "
 4106|      0|                               "on this platform, ignored",
 4107|      0|                               &value[n]);
 4108|      0|#endif
 4109|      0|            continue;
 4110|      0|        }
 4111|       |
 4112|      0|        if (ngx_strcmp(value[n].data, "deferred") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4112:13): [True: 0, False: 0]
  ------------------
 4113|       |#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
 4114|       |            lsopt.deferred_accept = 1;
 4115|       |            lsopt.set = 1;
 4116|       |            lsopt.bind = 1;
 4117|       |#else
 4118|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4119|      0|                               "the deferred accept is not supported "
 4120|      0|                               "on this platform, ignored");
 4121|      0|#endif
 4122|      0|            continue;
 4123|      0|        }
 4124|       |
 4125|      0|        if (ngx_strncmp(value[n].data, "ipv6only=o", 10) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (4125:13): [True: 0, False: 0]
  ------------------
 4126|      0|#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
 4127|      0|            if (ngx_strcmp(&value[n].data[10], "n") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4127:17): [True: 0, False: 0]
  ------------------
 4128|      0|                lsopt.ipv6only = 1;
 4129|       |
 4130|      0|            } else if (ngx_strcmp(&value[n].data[10], "ff") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4130:24): [True: 0, False: 0]
  ------------------
 4131|      0|                lsopt.ipv6only = 0;
 4132|       |
 4133|      0|            } else {
 4134|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4135|      0|                                   "invalid ipv6only flags \"%s\"",
 4136|      0|                                   &value[n].data[9]);
 4137|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4138|      0|            }
 4139|       |
 4140|      0|            lsopt.set = 1;
 4141|      0|            lsopt.bind = 1;
 4142|       |
 4143|      0|            continue;
 4144|       |#else
 4145|       |            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
 4146|       |                               "ipv6only is not supported "
 4147|       |                               "on this platform");
 4148|       |            return NGX_CONF_ERROR;
 4149|       |#endif
 4150|      0|        }
 4151|       |
 4152|      0|        if (ngx_strcmp(value[n].data, "reuseport") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4152:13): [True: 0, False: 0]
  ------------------
 4153|       |#if (NGX_HAVE_REUSEPORT)
 4154|       |            lsopt.reuseport = 1;
 4155|       |            lsopt.set = 1;
 4156|       |            lsopt.bind = 1;
 4157|       |#else
 4158|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4159|      0|                               "reuseport is not supported "
 4160|      0|                               "on this platform, ignored");
 4161|      0|#endif
 4162|      0|            continue;
 4163|      0|        }
 4164|       |
 4165|      0|        if (ngx_strcmp(value[n].data, "ssl") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4165:13): [True: 0, False: 0]
  ------------------
 4166|       |#if (NGX_HTTP_SSL)
 4167|       |            lsopt.ssl = 1;
 4168|       |            continue;
 4169|       |#else
 4170|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4171|      0|                               "the \"ssl\" parameter requires "
 4172|      0|                               "ngx_http_ssl_module");
 4173|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4174|      0|#endif
 4175|      0|        }
 4176|       |
 4177|      0|        if (ngx_strcmp(value[n].data, "http2") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4177:13): [True: 0, False: 0]
  ------------------
 4178|      0|#if (NGX_HTTP_V2)
 4179|      0|            lsopt.http2 = 1;
 4180|      0|            continue;
 4181|       |#else
 4182|       |            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
 4183|       |                               "the \"http2\" parameter requires "
 4184|       |                               "ngx_http_v2_module");
 4185|       |            return NGX_CONF_ERROR;
 4186|       |#endif
 4187|      0|        }
 4188|       |
 4189|      0|        if (ngx_strcmp(value[n].data, "quic") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4189:13): [True: 0, False: 0]
  ------------------
 4190|       |#if (NGX_HTTP_V3)
 4191|       |            lsopt.quic = 1;
 4192|       |            lsopt.type = SOCK_DGRAM;
 4193|       |            continue;
 4194|       |#else
 4195|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4196|      0|                               "the \"quic\" parameter requires "
 4197|      0|                               "ngx_http_v3_module");
 4198|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4199|      0|#endif
 4200|      0|        }
 4201|       |
 4202|      0|        if (ngx_strncmp(value[n].data, "so_keepalive=", 13) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (4202:13): [True: 0, False: 0]
  ------------------
 4203|       |
 4204|      0|            if (ngx_strcmp(&value[n].data[13], "on") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4204:17): [True: 0, False: 0]
  ------------------
 4205|      0|                lsopt.so_keepalive = 1;
 4206|       |
 4207|      0|            } else if (ngx_strcmp(&value[n].data[13], "off") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4207:24): [True: 0, False: 0]
  ------------------
 4208|      0|                lsopt.so_keepalive = 2;
 4209|       |
 4210|      0|            } else {
 4211|       |
 4212|       |#if (NGX_HAVE_KEEPALIVE_TUNABLE)
 4213|       |                u_char     *p, *end;
 4214|       |                ngx_str_t   s;
 4215|       |
 4216|       |                end = value[n].data + value[n].len;
 4217|       |                s.data = value[n].data + 13;
 4218|       |
 4219|       |                p = ngx_strlchr(s.data, end, ':');
 4220|       |                if (p == NULL) {
 4221|       |                    p = end;
 4222|       |                }
 4223|       |
 4224|       |                if (p > s.data) {
 4225|       |                    s.len = p - s.data;
 4226|       |
 4227|       |                    lsopt.tcp_keepidle = ngx_parse_time(&s, 1);
 4228|       |                    if (lsopt.tcp_keepidle == (time_t) NGX_ERROR) {
 4229|       |                        goto invalid_so_keepalive;
 4230|       |                    }
 4231|       |                }
 4232|       |
 4233|       |                s.data = (p < end) ? (p + 1) : end;
 4234|       |
 4235|       |                p = ngx_strlchr(s.data, end, ':');
 4236|       |                if (p == NULL) {
 4237|       |                    p = end;
 4238|       |                }
 4239|       |
 4240|       |                if (p > s.data) {
 4241|       |                    s.len = p - s.data;
 4242|       |
 4243|       |                    lsopt.tcp_keepintvl = ngx_parse_time(&s, 1);
 4244|       |                    if (lsopt.tcp_keepintvl == (time_t) NGX_ERROR) {
 4245|       |                        goto invalid_so_keepalive;
 4246|       |                    }
 4247|       |                }
 4248|       |
 4249|       |                s.data = (p < end) ? (p + 1) : end;
 4250|       |
 4251|       |                if (s.data < end) {
 4252|       |                    s.len = end - s.data;
 4253|       |
 4254|       |                    lsopt.tcp_keepcnt = ngx_atoi(s.data, s.len);
 4255|       |                    if (lsopt.tcp_keepcnt == NGX_ERROR) {
 4256|       |                        goto invalid_so_keepalive;
 4257|       |                    }
 4258|       |                }
 4259|       |
 4260|       |                if (lsopt.tcp_keepidle == 0 && lsopt.tcp_keepintvl == 0
 4261|       |                    && lsopt.tcp_keepcnt == 0)
 4262|       |                {
 4263|       |                    goto invalid_so_keepalive;
 4264|       |                }
 4265|       |
 4266|       |                lsopt.so_keepalive = 1;
 4267|       |
 4268|       |#else
 4269|       |
 4270|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4271|      0|                                   "the \"so_keepalive\" parameter accepts "
 4272|      0|                                   "only \"on\" or \"off\" on this platform");
 4273|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4274|       |
 4275|      0|#endif
 4276|      0|            }
 4277|       |
 4278|      0|            lsopt.set = 1;
 4279|      0|            lsopt.bind = 1;
 4280|       |
 4281|      0|            continue;
 4282|       |
 4283|       |#if (NGX_HAVE_KEEPALIVE_TUNABLE)
 4284|       |        invalid_so_keepalive:
 4285|       |
 4286|       |            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
 4287|       |                               "invalid so_keepalive value: \"%s\"",
 4288|       |                               &value[n].data[13]);
 4289|       |            return NGX_CONF_ERROR;
 4290|       |#endif
 4291|      0|        }
 4292|       |
 4293|      0|        if (ngx_strcmp(value[n].data, "proxy_protocol") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (4293:13): [True: 0, False: 0]
  ------------------
 4294|      0|            lsopt.proxy_protocol = 1;
 4295|      0|            continue;
 4296|      0|        }
 4297|       |
 4298|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4299|      0|                           "invalid parameter \"%V\"", &value[n]);
 4300|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4301|      0|    }
 4302|       |
 4303|       |#if (NGX_HTTP_V3)
 4304|       |
 4305|       |    if (lsopt.quic) {
 4306|       |#if (NGX_HTTP_SSL)
 4307|       |        if (lsopt.ssl) {
 4308|       |            return "\"ssl\" parameter is incompatible with \"quic\"";
 4309|       |        }
 4310|       |#endif
 4311|       |
 4312|       |#if (NGX_HTTP_V2)
 4313|       |        if (lsopt.http2) {
 4314|       |            return "\"http2\" parameter is incompatible with \"quic\"";
 4315|       |        }
 4316|       |#endif
 4317|       |
 4318|       |        if (lsopt.proxy_protocol) {
 4319|       |            return "\"proxy_protocol\" parameter is incompatible with \"quic\"";
 4320|       |        }
 4321|       |    }
 4322|       |
 4323|       |#endif
 4324|       |
 4325|      2|    for (n = 0; n < u.naddrs; n++) {
  ------------------
  |  Branch (4325:17): [True: 1, False: 1]
  ------------------
 4326|       |
 4327|      1|        for (i = 0; i < n; i++) {
  ------------------
  |  Branch (4327:21): [True: 0, False: 1]
  ------------------
 4328|      0|            if (ngx_cmp_sockaddr(u.addrs[n].sockaddr, u.addrs[n].socklen,
  ------------------
  |  Branch (4328:17): [True: 0, False: 0]
  ------------------
 4329|      0|                                 u.addrs[i].sockaddr, u.addrs[i].socklen, 1)
 4330|      0|                == NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 4331|      0|            {
 4332|      0|                goto next;
 4333|      0|            }
 4334|      0|        }
 4335|       |
 4336|      1|        lsopt.sockaddr = u.addrs[n].sockaddr;
 4337|      1|        lsopt.socklen = u.addrs[n].socklen;
 4338|      1|        lsopt.addr_text = u.addrs[n].name;
 4339|      1|        lsopt.wildcard = ngx_inet_wildcard(lsopt.sockaddr);
 4340|       |
 4341|      1|        if (ngx_http_add_listen(cf, cscf, &lsopt) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (4341:13): [True: 0, False: 1]
  ------------------
 4342|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4343|      0|        }
 4344|       |
 4345|      1|    next:
 4346|      1|        continue;
 4347|      1|    }
 4348|       |
 4349|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 4350|      1|}
ngx_http_core_module.c:ngx_http_core_server_name:
 4355|      1|{
 4356|      1|    ngx_http_core_srv_conf_t *cscf = conf;
 4357|       |
 4358|      1|    u_char                   ch;
 4359|      1|    ngx_str_t               *value;
 4360|      1|    ngx_uint_t               i;
 4361|      1|    ngx_http_server_name_t  *sn;
 4362|       |
 4363|      1|    value = cf->args->elts;
 4364|       |
 4365|      2|    for (i = 1; i < cf->args->nelts; i++) {
  ------------------
  |  Branch (4365:17): [True: 1, False: 1]
  ------------------
 4366|       |
 4367|      1|        ch = value[i].data[0];
 4368|       |
 4369|      1|        if ((ch == '*' && (value[i].len < 3 || value[i].data[1] != '.'))
  ------------------
  |  Branch (4369:14): [True: 0, False: 1]
  |  Branch (4369:28): [True: 0, False: 0]
  |  Branch (4369:48): [True: 0, False: 0]
  ------------------
 4370|      1|            || (ch == '.' && value[i].len < 2))
  ------------------
  |  Branch (4370:17): [True: 0, False: 1]
  |  Branch (4370:30): [True: 0, False: 0]
  ------------------
 4371|      0|        {
 4372|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4373|      0|                               "server name \"%V\" is invalid", &value[i]);
 4374|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4375|      0|        }
 4376|       |
 4377|      1|        if (ngx_strchr(value[i].data, '/')) {
  ------------------
  |  |   65|      1|#define ngx_strchr(s1, c)   strchr((const char *) s1, (int) c)
  |  |  ------------------
  |  |  |  Branch (65:29): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4378|      0|            ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
  ------------------
  |  |   21|      0|#define NGX_LOG_WARN              5
  ------------------
 4379|      0|                               "server name \"%V\" has suspicious symbols",
 4380|      0|                               &value[i]);
 4381|      0|        }
 4382|       |
 4383|      1|        sn = ngx_array_push(&cscf->server_names);
 4384|      1|        if (sn == NULL) {
  ------------------
  |  Branch (4384:13): [True: 0, False: 1]
  ------------------
 4385|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4386|      0|        }
 4387|       |
 4388|      1|#if (NGX_PCRE)
 4389|      1|        sn->regex = NULL;
 4390|      1|#endif
 4391|      1|        sn->server = cscf;
 4392|       |
 4393|      1|        if (ngx_strcasecmp(value[i].data, (u_char *) "$hostname") == 0) {
  ------------------
  |  Branch (4393:13): [True: 0, False: 1]
  ------------------
 4394|      0|            sn->name = cf->cycle->hostname;
 4395|       |
 4396|      1|        } else {
 4397|      1|            sn->name = value[i];
 4398|      1|        }
 4399|       |
 4400|      1|        if (value[i].data[0] != '~') {
  ------------------
  |  Branch (4400:13): [True: 0, False: 1]
  ------------------
 4401|      0|            ngx_strlow(sn->name.data, sn->name.data, sn->name.len);
 4402|      0|            continue;
 4403|      0|        }
 4404|       |
 4405|      1|#if (NGX_PCRE)
 4406|      1|        {
 4407|      1|        u_char               *p;
 4408|      1|        ngx_regex_compile_t   rc;
 4409|      1|        u_char                errstr[NGX_MAX_CONF_ERRSTR];
 4410|       |
 4411|      1|        if (value[i].len == 1) {
  ------------------
  |  Branch (4411:13): [True: 0, False: 1]
  ------------------
 4412|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 4413|      0|                               "empty regex in server name \"%V\"", &value[i]);
 4414|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4415|      0|        }
 4416|       |
 4417|      1|        value[i].len--;
 4418|      1|        value[i].data++;
 4419|       |
 4420|      1|        ngx_memzero(&rc, sizeof(ngx_regex_compile_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 4421|       |
 4422|      1|        rc.pattern = value[i];
 4423|      1|        rc.err.len = NGX_MAX_CONF_ERRSTR;
  ------------------
  |  |   74|      1|#define NGX_MAX_CONF_ERRSTR  1024
  ------------------
 4424|      1|        rc.err.data = errstr;
 4425|       |
 4426|     28|        for (p = value[i].data; p < value[i].data + value[i].len; p++) {
  ------------------
  |  Branch (4426:33): [True: 27, False: 1]
  ------------------
 4427|     27|            if (*p >= 'A' && *p <= 'Z') {
  ------------------
  |  Branch (4427:17): [True: 17, False: 10]
  |  Branch (4427:30): [True: 0, False: 17]
  ------------------
 4428|      0|                rc.options = NGX_REGEX_CASELESS;
  ------------------
  |  |   39|      0|#define NGX_REGEX_CASELESS     0x00000001
  ------------------
 4429|      0|                break;
 4430|      0|            }
 4431|     27|        }
 4432|       |
 4433|      1|        sn->regex = ngx_http_regex_compile(cf, &rc);
 4434|      1|        if (sn->regex == NULL) {
  ------------------
  |  Branch (4434:13): [True: 0, False: 1]
  ------------------
 4435|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 4436|      0|        }
 4437|       |
 4438|      1|        sn->name = value[i];
 4439|      1|        cscf->captures = (rc.captures > 0);
 4440|      1|        }
 4441|       |#else
 4442|       |        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
 4443|       |                           "using regex \"%V\" "
 4444|       |                           "requires PCRE library", &value[i]);
 4445|       |
 4446|       |        return NGX_CONF_ERROR;
 4447|       |#endif
 4448|      1|    }
 4449|       |
 4450|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 4451|      1|}
ngx_http_core_module.c:ngx_http_core_error_log:
 4998|      1|{
 4999|      1|    ngx_http_core_loc_conf_t *clcf = conf;
 5000|       |
 5001|      1|    return ngx_log_set_log(cf, &clcf->error_log);
 5002|      1|}
ngx_http_core_module.c:ngx_http_core_find_location:
 1397|     22|{
 1398|     22|    ngx_int_t                  rc;
 1399|     22|    ngx_http_core_loc_conf_t  *pclcf;
 1400|     22|#if (NGX_PCRE)
 1401|     22|    ngx_int_t                  n;
 1402|     22|    ngx_uint_t                 noregex;
 1403|     22|    ngx_http_core_loc_conf_t  *clcf, **clcfp;
 1404|       |
 1405|     22|    noregex = 0;
 1406|     22|#endif
 1407|       |
 1408|     22|    pclcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|     22|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 1409|       |
 1410|     22|    rc = ngx_http_core_find_static_location(r, pclcf->static_locations);
 1411|       |
 1412|     22|    if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|     22|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (1412:9): [True: 11, False: 11]
  ------------------
 1413|       |
 1414|     11|#if (NGX_PCRE)
 1415|     11|        clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|     11|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 1416|       |
 1417|     11|        noregex = clcf->noregex;
 1418|     11|#endif
 1419|       |
 1420|       |        /* look up nested locations */
 1421|       |
 1422|     11|        rc = ngx_http_core_find_location(r);
 1423|     11|    }
 1424|       |
 1425|     22|    if (rc == NGX_OK || rc == NGX_DONE) {
  ------------------
  |  |   38|     44|#define  NGX_OK          0
  ------------------
                  if (rc == NGX_OK || rc == NGX_DONE) {
  ------------------
  |  |   42|     22|#define  NGX_DONE       -4
  ------------------
  |  Branch (1425:9): [True: 0, False: 22]
  |  Branch (1425:25): [True: 0, False: 22]
  ------------------
 1426|      0|        return rc;
 1427|      0|    }
 1428|       |
 1429|       |    /* rc == NGX_DECLINED or rc == NGX_AGAIN in nested location */
 1430|       |
 1431|     22|#if (NGX_PCRE)
 1432|       |
 1433|     22|    if (noregex == 0 && pclcf->regex_locations) {
  ------------------
  |  Branch (1433:9): [True: 22, False: 0]
  |  Branch (1433:25): [True: 0, False: 22]
  ------------------
 1434|       |
 1435|      0|        for (clcfp = pclcf->regex_locations; *clcfp; clcfp++) {
  ------------------
  |  Branch (1435:46): [True: 0, False: 0]
  ------------------
 1436|       |
 1437|      0|            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1438|      0|                           "test location: ~ \"%V\"", &(*clcfp)->name);
 1439|       |
 1440|      0|            n = ngx_http_regex_exec(r, (*clcfp)->regex, &r->uri);
 1441|       |
 1442|      0|            if (n == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1442:17): [True: 0, False: 0]
  ------------------
 1443|      0|                r->loc_conf = (*clcfp)->loc_conf;
 1444|       |
 1445|       |                /* look up nested locations */
 1446|       |
 1447|      0|                rc = ngx_http_core_find_location(r);
 1448|       |
 1449|      0|                return (rc == NGX_ERROR) ? rc : NGX_OK;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
                              return (rc == NGX_ERROR) ? rc : NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1449:24): [True: 0, False: 0]
  ------------------
 1450|      0|            }
 1451|       |
 1452|      0|            if (n == NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (1452:17): [True: 0, False: 0]
  ------------------
 1453|      0|                continue;
 1454|      0|            }
 1455|       |
 1456|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1457|      0|        }
 1458|      0|    }
 1459|     22|#endif
 1460|       |
 1461|     22|    return rc;
 1462|     22|}
ngx_http_core_module.c:ngx_http_core_find_static_location:
 1475|     22|{
 1476|     22|    u_char     *uri;
 1477|     22|    size_t      len, n;
 1478|     22|    ngx_int_t   rc, rv;
 1479|       |
 1480|     22|    len = r->uri.len;
 1481|     22|    uri = r->uri.data;
 1482|       |
 1483|     22|    rv = NGX_DECLINED;
  ------------------
  |  |   43|     22|#define  NGX_DECLINED   -5
  ------------------
 1484|       |
 1485|     26|    for ( ;; ) {
 1486|       |
 1487|     26|        if (node == NULL) {
  ------------------
  |  Branch (1487:13): [True: 15, False: 11]
  ------------------
 1488|     15|            return rv;
 1489|     15|        }
 1490|       |
 1491|     11|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1492|     11|                       "test location: \"%*s\"",
 1493|     11|                       (size_t) node->len, node->name);
 1494|       |
 1495|     11|        n = (len <= (size_t) node->len) ? len : node->len;
  ------------------
  |  Branch (1495:13): [True: 7, False: 4]
  ------------------
 1496|       |
 1497|     11|        rc = ngx_filename_cmp(uri, node->name, n);
 1498|       |
 1499|     11|        if (rc != 0) {
  ------------------
  |  Branch (1499:13): [True: 0, False: 11]
  ------------------
 1500|      0|            node = (rc < 0) ? node->left : node->right;
  ------------------
  |  Branch (1500:20): [True: 0, False: 0]
  ------------------
 1501|       |
 1502|      0|            continue;
 1503|      0|        }
 1504|       |
 1505|     11|        if (len > (size_t) node->len) {
  ------------------
  |  Branch (1505:13): [True: 4, False: 7]
  ------------------
 1506|       |
 1507|      4|            if (node->inclusive) {
  ------------------
  |  Branch (1507:17): [True: 4, False: 0]
  ------------------
 1508|       |
 1509|      4|                r->loc_conf = node->inclusive->loc_conf;
 1510|      4|                rv = NGX_AGAIN;
  ------------------
  |  |   40|      4|#define  NGX_AGAIN      -2
  ------------------
 1511|       |
 1512|      4|                node = node->tree;
 1513|      4|                uri += n;
 1514|      4|                len -= n;
 1515|       |
 1516|      4|                continue;
 1517|      4|            }
 1518|       |
 1519|       |            /* exact only */
 1520|       |
 1521|      0|            node = node->right;
 1522|       |
 1523|      0|            continue;
 1524|      4|        }
 1525|       |
 1526|      7|        if (len == (size_t) node->len) {
  ------------------
  |  Branch (1526:13): [True: 7, False: 0]
  ------------------
 1527|       |
 1528|      7|            if (node->exact) {
  ------------------
  |  Branch (1528:17): [True: 0, False: 7]
  ------------------
 1529|      0|                r->loc_conf = node->exact->loc_conf;
 1530|      0|                return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1531|       |
 1532|      7|            } else {
 1533|      7|                r->loc_conf = node->inclusive->loc_conf;
 1534|      7|                return NGX_AGAIN;
  ------------------
  |  |   40|      7|#define  NGX_AGAIN      -2
  ------------------
 1535|      7|            }
 1536|      7|        }
 1537|       |
 1538|       |        /* len < node->len */
 1539|       |
 1540|      0|        if (len + 1 == (size_t) node->len && node->auto_redirect) {
  ------------------
  |  Branch (1540:13): [True: 0, False: 0]
  |  Branch (1540:46): [True: 0, False: 0]
  ------------------
 1541|       |
 1542|      0|            r->loc_conf = (node->exact) ? node->exact->loc_conf:
  ------------------
  |  Branch (1542:27): [True: 0, False: 0]
  ------------------
 1543|      0|                                          node->inclusive->loc_conf;
 1544|      0|            rv = NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
 1545|      0|        }
 1546|       |
 1547|      0|        node = node->left;
 1548|      0|    }
 1549|     22|}

ngx_http_header_filter_module.c:ngx_http_header_filter_init:
  630|      1|{
  631|      1|    ngx_http_top_header_filter = ngx_http_header_filter;
  632|       |
  633|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  634|      1|}
ngx_http_header_filter_module.c:ngx_http_header_filter:
  158|      7|{
  159|      7|    u_char                    *p;
  160|      7|    size_t                     len;
  161|      7|    ngx_str_t                  host, *status_line;
  162|      7|    ngx_buf_t                 *b;
  163|      7|    ngx_uint_t                 status, i, port;
  164|      7|    ngx_chain_t                out;
  165|      7|    ngx_list_part_t           *part;
  166|      7|    ngx_table_elt_t           *header;
  167|      7|    ngx_connection_t          *c;
  168|      7|    ngx_http_core_loc_conf_t  *clcf;
  169|      7|    ngx_http_core_srv_conf_t  *cscf;
  170|      7|    u_char                     addr[NGX_SOCKADDR_STRLEN];
  171|       |
  172|      7|    if (r->header_sent) {
  ------------------
  |  Branch (172:9): [True: 0, False: 7]
  ------------------
  173|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  174|      0|    }
  175|       |
  176|      7|    r->header_sent = 1;
  177|       |
  178|      7|    if (r != r->main) {
  ------------------
  |  Branch (178:9): [True: 0, False: 7]
  ------------------
  179|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  180|      0|    }
  181|       |
  182|      7|    if (r->http_version < NGX_HTTP_VERSION_10) {
  ------------------
  |  |   24|      7|#define NGX_HTTP_VERSION_10                1000
  ------------------
  |  Branch (182:9): [True: 4, False: 3]
  ------------------
  183|      4|        return NGX_OK;
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
  184|      4|    }
  185|       |
  186|      3|    if (r->method == NGX_HTTP_HEAD) {
  ------------------
  |  |   31|      3|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
  |  Branch (186:9): [True: 0, False: 3]
  ------------------
  187|      0|        r->header_only = 1;
  188|      0|    }
  189|       |
  190|      3|    if (r->headers_out.last_modified_time != -1) {
  ------------------
  |  Branch (190:9): [True: 0, False: 3]
  ------------------
  191|      0|        if (r->headers_out.status != NGX_HTTP_OK
  ------------------
  |  |   78|      0|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (191:13): [True: 0, False: 0]
  ------------------
  192|      0|            && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT
  ------------------
  |  |   82|      0|#define NGX_HTTP_PARTIAL_CONTENT           206
  ------------------
  |  Branch (192:16): [True: 0, False: 0]
  ------------------
  193|      0|            && r->headers_out.status != NGX_HTTP_NOT_MODIFIED)
  ------------------
  |  |   88|      0|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
  |  Branch (193:16): [True: 0, False: 0]
  ------------------
  194|      0|        {
  195|      0|            r->headers_out.last_modified_time = -1;
  196|      0|            r->headers_out.last_modified = NULL;
  197|      0|        }
  198|      0|    }
  199|       |
  200|      3|    if (r->keepalive && (ngx_terminate || ngx_exiting)) {
  ------------------
  |  Branch (200:9): [True: 0, False: 3]
  |  Branch (200:26): [True: 0, False: 0]
  |  Branch (200:43): [True: 0, False: 0]
  ------------------
  201|      0|        r->keepalive = 0;
  202|      0|    }
  203|       |
  204|      3|    len = sizeof("HTTP/1.x ") - 1 + sizeof(CRLF) - 1
  ------------------
  |  |  105|      3|#define CRLF   "\r\n"
  ------------------
  205|       |          /* the end of the header */
  206|      3|          + sizeof(CRLF) - 1;
  ------------------
  |  |  105|      3|#define CRLF   "\r\n"
  ------------------
  207|       |
  208|       |    /* status line */
  209|       |
  210|      3|    if (r->headers_out.status_line.len) {
  ------------------
  |  Branch (210:9): [True: 1, False: 2]
  ------------------
  211|      1|        len += r->headers_out.status_line.len;
  212|      1|        status_line = &r->headers_out.status_line;
  213|      1|#if (NGX_SUPPRESS_WARN)
  214|      1|        status = 0;
  215|      1|#endif
  216|       |
  217|      2|    } else {
  218|       |
  219|      2|        status = r->headers_out.status;
  220|       |
  221|      2|        if (status >= NGX_HTTP_OK
  ------------------
  |  |   78|      4|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (221:13): [True: 2, False: 0]
  ------------------
  222|      2|            && status < NGX_HTTP_LAST_2XX)
  ------------------
  |  |   66|      2|#define NGX_HTTP_LAST_2XX  207
  ------------------
  |  Branch (222:16): [True: 0, False: 2]
  ------------------
  223|      0|        {
  224|       |            /* 2XX */
  225|       |
  226|      0|            if (status == NGX_HTTP_NO_CONTENT) {
  ------------------
  |  |   81|      0|#define NGX_HTTP_NO_CONTENT                204
  ------------------
  |  Branch (226:17): [True: 0, False: 0]
  ------------------
  227|      0|                r->header_only = 1;
  228|      0|                ngx_str_null(&r->headers_out.content_type);
  ------------------
  |  |   44|      0|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
  229|      0|                r->headers_out.last_modified_time = -1;
  230|      0|                r->headers_out.last_modified = NULL;
  231|      0|                r->headers_out.content_length = NULL;
  232|      0|                r->headers_out.content_length_n = -1;
  233|      0|            }
  234|       |
  235|      0|            status -= NGX_HTTP_OK;
  ------------------
  |  |   78|      0|#define NGX_HTTP_OK                        200
  ------------------
  236|      0|            status_line = &ngx_http_status_lines[status];
  237|      0|            len += ngx_http_status_lines[status].len;
  238|       |
  239|      2|        } else if (status >= NGX_HTTP_MOVED_PERMANENTLY
  ------------------
  |  |   85|      4|#define NGX_HTTP_MOVED_PERMANENTLY         301
  ------------------
  |  Branch (239:20): [True: 2, False: 0]
  ------------------
  240|      2|                   && status < NGX_HTTP_LAST_3XX)
  ------------------
  |  |   80|      2|#define NGX_HTTP_LAST_3XX  309
  ------------------
  |  Branch (240:23): [True: 0, False: 2]
  ------------------
  241|      0|        {
  242|       |            /* 3XX */
  243|       |
  244|      0|            if (status == NGX_HTTP_NOT_MODIFIED) {
  ------------------
  |  |   88|      0|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
  |  Branch (244:17): [True: 0, False: 0]
  ------------------
  245|      0|                r->header_only = 1;
  246|      0|            }
  247|       |
  248|      0|            status = status - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_OFF_3XX;
  ------------------
  |  |   85|      0|#define NGX_HTTP_MOVED_PERMANENTLY         301
  ------------------
                          status = status - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_OFF_3XX;
  ------------------
  |  |   67|      0|#define NGX_HTTP_OFF_3XX   (NGX_HTTP_LAST_2XX - 200)
  |  |  ------------------
  |  |  |  |   66|      0|#define NGX_HTTP_LAST_2XX  207
  |  |  ------------------
  ------------------
  249|      0|            status_line = &ngx_http_status_lines[status];
  250|      0|            len += ngx_http_status_lines[status].len;
  251|       |
  252|      2|        } else if (status >= NGX_HTTP_BAD_REQUEST
  ------------------
  |  |   92|      4|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
  |  Branch (252:20): [True: 2, False: 0]
  ------------------
  253|      2|                   && status < NGX_HTTP_LAST_4XX)
  ------------------
  |  |  114|      2|#define NGX_HTTP_LAST_4XX  430
  ------------------
  |  Branch (253:23): [True: 2, False: 0]
  ------------------
  254|      2|        {
  255|       |            /* 4XX */
  256|      2|            status = status - NGX_HTTP_BAD_REQUEST
  ------------------
  |  |   92|      2|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
  257|      2|                            + NGX_HTTP_OFF_4XX;
  ------------------
  |  |   81|      2|#define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  ------------------
  |  |  |  |   80|      2|#define NGX_HTTP_LAST_3XX  309
  |  |  ------------------
  |  |               #define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  ------------------
  |  |  |  |   67|      2|#define NGX_HTTP_OFF_3XX   (NGX_HTTP_LAST_2XX - 200)
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      2|#define NGX_HTTP_LAST_2XX  207
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  258|       |
  259|      2|            status_line = &ngx_http_status_lines[status];
  260|      2|            len += ngx_http_status_lines[status].len;
  261|       |
  262|      2|        } else if (status >= NGX_HTTP_INTERNAL_SERVER_ERROR
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  |  Branch (262:20): [True: 0, False: 0]
  ------------------
  263|      0|                   && status < NGX_HTTP_LAST_5XX)
  ------------------
  |  |  130|      0|#define NGX_HTTP_LAST_5XX  508
  ------------------
  |  Branch (263:23): [True: 0, False: 0]
  ------------------
  264|      0|        {
  265|       |            /* 5XX */
  266|      0|            status = status - NGX_HTTP_INTERNAL_SERVER_ERROR
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  267|      0|                            + NGX_HTTP_OFF_5XX;
  ------------------
  |  |  115|      0|#define NGX_HTTP_OFF_5XX   (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
  |  |  ------------------
  |  |  |  |  114|      0|#define NGX_HTTP_LAST_4XX  430
  |  |  ------------------
  |  |               #define NGX_HTTP_OFF_5XX   (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
  |  |  ------------------
  |  |  |  |   81|      0|#define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|#define NGX_HTTP_LAST_3XX  309
  |  |  |  |  ------------------
  |  |  |  |               #define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  |  |  ------------------
  |  |  |  |  |  |   67|      0|#define NGX_HTTP_OFF_3XX   (NGX_HTTP_LAST_2XX - 200)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   66|      0|#define NGX_HTTP_LAST_2XX  207
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  268|       |
  269|      0|            status_line = &ngx_http_status_lines[status];
  270|      0|            len += ngx_http_status_lines[status].len;
  271|       |
  272|      0|        } else {
  273|      0|            len += NGX_INT_T_LEN + 1 /* SP */;
  ------------------
  |  |   91|      0|#define NGX_INT_T_LEN   NGX_INT64_LEN
  |  |  ------------------
  |  |  |  |   84|      0|#define NGX_INT64_LEN   (sizeof("-9223372036854775808") - 1)
  |  |  ------------------
  ------------------
  274|      0|            status_line = NULL;
  275|      0|        }
  276|       |
  277|      2|        if (status_line && status_line->len == 0) {
  ------------------
  |  Branch (277:13): [True: 2, False: 0]
  |  Branch (277:28): [True: 0, False: 2]
  ------------------
  278|      0|            status = r->headers_out.status;
  279|      0|            len += NGX_INT_T_LEN + 1 /* SP */;
  ------------------
  |  |   91|      0|#define NGX_INT_T_LEN   NGX_INT64_LEN
  |  |  ------------------
  |  |  |  |   84|      0|#define NGX_INT64_LEN   (sizeof("-9223372036854775808") - 1)
  |  |  ------------------
  ------------------
  280|      0|            status_line = NULL;
  281|      0|        }
  282|      2|    }
  283|       |
  284|      3|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      3|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  285|       |
  286|      3|    if (r->headers_out.server == NULL) {
  ------------------
  |  Branch (286:9): [True: 3, False: 0]
  ------------------
  287|      3|        if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
  ------------------
  |  |   59|      3|#define NGX_HTTP_SERVER_TOKENS_ON       1
  ------------------
  |  Branch (287:13): [True: 0, False: 3]
  ------------------
  288|      0|            len += sizeof(ngx_http_server_full_string) - 1;
  289|       |
  290|      3|        } else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) {
  ------------------
  |  |   60|      3|#define NGX_HTTP_SERVER_TOKENS_BUILD    2
  ------------------
  |  Branch (290:20): [True: 0, False: 3]
  ------------------
  291|      0|            len += sizeof(ngx_http_server_build_string) - 1;
  292|       |
  293|      3|        } else {
  294|      3|            len += sizeof(ngx_http_server_string) - 1;
  295|      3|        }
  296|      3|    }
  297|       |
  298|      3|    if (r->headers_out.date == NULL) {
  ------------------
  |  Branch (298:9): [True: 3, False: 0]
  ------------------
  299|      3|        len += sizeof("Date: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1;
  ------------------
  |  |  105|      3|#define CRLF   "\r\n"
  ------------------
  300|      3|    }
  301|       |
  302|      3|    if (r->headers_out.content_type.len) {
  ------------------
  |  Branch (302:9): [True: 2, False: 1]
  ------------------
  303|      2|        len += sizeof("Content-Type: ") - 1
  304|      2|               + r->headers_out.content_type.len + 2;
  305|       |
  306|      2|        if (r->headers_out.content_type_len == r->headers_out.content_type.len
  ------------------
  |  Branch (306:13): [True: 2, False: 0]
  ------------------
  307|      2|            && r->headers_out.charset.len)
  ------------------
  |  Branch (307:16): [True: 0, False: 2]
  ------------------
  308|      0|        {
  309|      0|            len += sizeof("; charset=") - 1 + r->headers_out.charset.len;
  310|      0|        }
  311|      2|    }
  312|       |
  313|      3|    if (r->headers_out.content_length == NULL
  ------------------
  |  Branch (313:9): [True: 3, False: 0]
  ------------------
  314|      3|        && r->headers_out.content_length_n >= 0)
  ------------------
  |  Branch (314:12): [True: 2, False: 1]
  ------------------
  315|      2|    {
  316|      2|        len += sizeof("Content-Length: ") - 1 + NGX_OFF_T_LEN + 2;
  ------------------
  |  |  202|      2|#define NGX_OFF_T_LEN  (sizeof("-9223372036854775808") - 1)
  ------------------
  317|      2|    }
  318|       |
  319|      3|    if (r->headers_out.last_modified == NULL
  ------------------
  |  Branch (319:9): [True: 2, False: 1]
  ------------------
  320|      3|        && r->headers_out.last_modified_time != -1)
  ------------------
  |  Branch (320:12): [True: 0, False: 2]
  ------------------
  321|      0|    {
  322|      0|        len += sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1;
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  323|      0|    }
  324|       |
  325|      3|    c = r->connection;
  326|       |
  327|      3|    if (r->headers_out.location
  ------------------
  |  Branch (327:9): [True: 0, False: 3]
  ------------------
  328|      3|        && r->headers_out.location->value.len
  ------------------
  |  Branch (328:12): [True: 0, False: 0]
  ------------------
  329|      3|        && r->headers_out.location->value.data[0] == '/'
  ------------------
  |  Branch (329:12): [True: 0, False: 0]
  ------------------
  330|      3|        && clcf->absolute_redirect)
  ------------------
  |  Branch (330:12): [True: 0, False: 0]
  ------------------
  331|      0|    {
  332|      0|        r->headers_out.location->hash = 0;
  333|       |
  334|      0|        if (clcf->server_name_in_redirect) {
  ------------------
  |  Branch (334:13): [True: 0, False: 0]
  ------------------
  335|      0|            cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|      0|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
  336|      0|            host = cscf->server_name;
  337|       |
  338|      0|        } else if (r->headers_in.server.len) {
  ------------------
  |  Branch (338:20): [True: 0, False: 0]
  ------------------
  339|      0|            host = r->headers_in.server;
  340|       |
  341|      0|        } else {
  342|      0|            host.len = NGX_SOCKADDR_STRLEN;
  ------------------
  |  |   24|      0|#define NGX_SOCKADDR_STRLEN   NGX_UNIX_ADDRSTRLEN
  |  |  ------------------
  |  |  |  |   20|      0|    (sizeof("unix:") - 1 +                                                   \
  |  |  |  |   21|      0|     sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path))
  |  |  ------------------
  ------------------
  343|      0|            host.data = addr;
  344|       |
  345|      0|            if (ngx_connection_local_sockaddr(c, &host, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (345:17): [True: 0, False: 0]
  ------------------
  346|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  347|      0|            }
  348|      0|        }
  349|       |
  350|      0|        port = ngx_inet_get_port(c->local_sockaddr);
  351|       |
  352|      0|        len += sizeof("Location: https://") - 1
  353|      0|               + host.len
  354|      0|               + r->headers_out.location->value.len + 2;
  355|       |
  356|      0|        if (clcf->port_in_redirect) {
  ------------------
  |  Branch (356:13): [True: 0, False: 0]
  ------------------
  357|       |
  358|       |#if (NGX_HTTP_SSL)
  359|       |            if (c->ssl)
  360|       |                port = (port == 443) ? 0 : port;
  361|       |            else
  362|       |#endif
  363|      0|                port = (port == 80) ? 0 : port;
  ------------------
  |  Branch (363:24): [True: 0, False: 0]
  ------------------
  364|       |
  365|      0|        } else {
  366|      0|            port = 0;
  367|      0|        }
  368|       |
  369|      0|        if (port) {
  ------------------
  |  Branch (369:13): [True: 0, False: 0]
  ------------------
  370|      0|            len += sizeof(":65535") - 1;
  371|      0|        }
  372|       |
  373|      3|    } else {
  374|      3|        ngx_str_null(&host);
  ------------------
  |  |   44|      3|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
  375|      3|        port = 0;
  376|      3|    }
  377|       |
  378|      3|    if (r->chunked) {
  ------------------
  |  Branch (378:9): [True: 0, False: 3]
  ------------------
  379|      0|        len += sizeof("Transfer-Encoding: chunked" CRLF) - 1;
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  380|      0|    }
  381|       |
  382|      3|    if (r->headers_out.status == NGX_HTTP_SWITCHING_PROTOCOLS) {
  ------------------
  |  |   75|      3|#define NGX_HTTP_SWITCHING_PROTOCOLS       101
  ------------------
  |  Branch (382:9): [True: 0, False: 3]
  ------------------
  383|      0|        len += sizeof("Connection: upgrade" CRLF) - 1;
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  384|       |
  385|      3|    } else if (r->keepalive) {
  ------------------
  |  Branch (385:16): [True: 0, False: 3]
  ------------------
  386|      0|        len += sizeof("Connection: keep-alive" CRLF) - 1;
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  387|       |
  388|       |        /*
  389|       |         * MSIE and Opera ignore the "Keep-Alive: timeout=<N>" header.
  390|       |         * MSIE keeps the connection alive for about 60-65 seconds.
  391|       |         * Opera keeps the connection alive very long.
  392|       |         * Mozilla keeps the connection alive for N plus about 1-10 seconds.
  393|       |         * Konqueror keeps the connection alive for about N seconds.
  394|       |         */
  395|       |
  396|      0|        if (clcf->keepalive_header) {
  ------------------
  |  Branch (396:13): [True: 0, False: 0]
  ------------------
  397|      0|            len += sizeof("Keep-Alive: timeout=") - 1 + NGX_TIME_T_LEN + 2;
  ------------------
  |  |  212|      0|#define NGX_TIME_T_LEN  (sizeof("-9223372036854775808") - 1)
  ------------------
  398|      0|        }
  399|       |
  400|      3|    } else {
  401|      3|        len += sizeof("Connection: close" CRLF) - 1;
  ------------------
  |  |  105|      3|#define CRLF   "\r\n"
  ------------------
  402|      3|    }
  403|       |
  404|      3|#if (NGX_HTTP_GZIP)
  405|      3|    if (r->gzip_vary) {
  ------------------
  |  Branch (405:9): [True: 0, False: 3]
  ------------------
  406|      0|        if (clcf->gzip_vary) {
  ------------------
  |  Branch (406:13): [True: 0, False: 0]
  ------------------
  407|      0|            len += sizeof("Vary: Accept-Encoding" CRLF) - 1;
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  408|       |
  409|      0|        } else {
  410|      0|            r->gzip_vary = 0;
  411|      0|        }
  412|      0|    }
  413|      3|#endif
  414|       |
  415|      3|    part = &r->headers_out.headers.part;
  416|      3|    header = part->elts;
  417|       |
  418|      7|    for (i = 0; /* void */; i++) {
  419|       |
  420|      7|        if (i >= part->nelts) {
  ------------------
  |  Branch (420:13): [True: 3, False: 4]
  ------------------
  421|      3|            if (part->next == NULL) {
  ------------------
  |  Branch (421:17): [True: 3, False: 0]
  ------------------
  422|      3|                break;
  423|      3|            }
  424|       |
  425|      0|            part = part->next;
  426|      0|            header = part->elts;
  427|      0|            i = 0;
  428|      0|        }
  429|       |
  430|      4|        if (header[i].hash == 0) {
  ------------------
  |  Branch (430:13): [True: 0, False: 4]
  ------------------
  431|      0|            continue;
  432|      0|        }
  433|       |
  434|      4|        len += header[i].key.len + sizeof(": ") - 1 + header[i].value.len
  435|      4|               + sizeof(CRLF) - 1;
  ------------------
  |  |  105|      4|#define CRLF   "\r\n"
  ------------------
  436|      4|    }
  437|       |
  438|      3|    b = ngx_create_temp_buf(r->pool, len);
  439|      3|    if (b == NULL) {
  ------------------
  |  Branch (439:9): [True: 0, False: 3]
  ------------------
  440|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  441|      0|    }
  442|       |
  443|       |    /* "HTTP/1.x " */
  444|      3|    b->last = ngx_cpymem(b->last, "HTTP/1.1 ", sizeof("HTTP/1.x ") - 1);
  ------------------
  |  |  107|      3|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  445|       |
  446|       |    /* status line */
  447|      3|    if (status_line) {
  ------------------
  |  Branch (447:9): [True: 3, False: 0]
  ------------------
  448|      3|        b->last = ngx_copy(b->last, status_line->data, status_line->len);
  ------------------
  |  |  138|      3|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      3|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  449|       |
  450|      3|    } else {
  451|      0|        b->last = ngx_sprintf(b->last, "%03ui ", status);
  452|      0|    }
  453|      3|    *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  104|      3|#define CR     (u_char) '\r'
  ------------------
                  *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  103|      3|#define LF     (u_char) '\n'
  ------------------
  454|       |
  455|      3|    if (r->headers_out.server == NULL) {
  ------------------
  |  Branch (455:9): [True: 3, False: 0]
  ------------------
  456|      3|        if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
  ------------------
  |  |   59|      3|#define NGX_HTTP_SERVER_TOKENS_ON       1
  ------------------
  |  Branch (456:13): [True: 0, False: 3]
  ------------------
  457|      0|            p = ngx_http_server_full_string;
  458|      0|            len = sizeof(ngx_http_server_full_string) - 1;
  459|       |
  460|      3|        } else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) {
  ------------------
  |  |   60|      3|#define NGX_HTTP_SERVER_TOKENS_BUILD    2
  ------------------
  |  Branch (460:20): [True: 0, False: 3]
  ------------------
  461|      0|            p = ngx_http_server_build_string;
  462|      0|            len = sizeof(ngx_http_server_build_string) - 1;
  463|       |
  464|      3|        } else {
  465|      3|            p = ngx_http_server_string;
  466|      3|            len = sizeof(ngx_http_server_string) - 1;
  467|      3|        }
  468|       |
  469|      3|        b->last = ngx_cpymem(b->last, p, len);
  ------------------
  |  |  107|      3|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  470|      3|    }
  471|       |
  472|      3|    if (r->headers_out.date == NULL) {
  ------------------
  |  Branch (472:9): [True: 3, False: 0]
  ------------------
  473|      3|        b->last = ngx_cpymem(b->last, "Date: ", sizeof("Date: ") - 1);
  ------------------
  |  |  107|      3|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  474|      3|        b->last = ngx_cpymem(b->last, ngx_cached_http_time.data,
  ------------------
  |  |  107|      3|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  475|      3|                             ngx_cached_http_time.len);
  476|       |
  477|      3|        *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  104|      3|#define CR     (u_char) '\r'
  ------------------
                      *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  103|      3|#define LF     (u_char) '\n'
  ------------------
  478|      3|    }
  479|       |
  480|      3|    if (r->headers_out.content_type.len) {
  ------------------
  |  Branch (480:9): [True: 2, False: 1]
  ------------------
  481|      2|        b->last = ngx_cpymem(b->last, "Content-Type: ",
  ------------------
  |  |  107|      2|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  482|      2|                             sizeof("Content-Type: ") - 1);
  483|      2|        p = b->last;
  484|      2|        b->last = ngx_copy(b->last, r->headers_out.content_type.data,
  ------------------
  |  |  138|      2|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      2|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  485|      2|                           r->headers_out.content_type.len);
  486|       |
  487|      2|        if (r->headers_out.content_type_len == r->headers_out.content_type.len
  ------------------
  |  Branch (487:13): [True: 2, False: 0]
  ------------------
  488|      2|            && r->headers_out.charset.len)
  ------------------
  |  Branch (488:16): [True: 0, False: 2]
  ------------------
  489|      0|        {
  490|      0|            b->last = ngx_cpymem(b->last, "; charset=",
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  491|      0|                                 sizeof("; charset=") - 1);
  492|      0|            b->last = ngx_copy(b->last, r->headers_out.charset.data,
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  493|      0|                               r->headers_out.charset.len);
  494|       |
  495|       |            /* update r->headers_out.content_type for possible logging */
  496|       |
  497|      0|            r->headers_out.content_type.len = b->last - p;
  498|      0|            r->headers_out.content_type.data = p;
  499|      0|        }
  500|       |
  501|      2|        *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  104|      2|#define CR     (u_char) '\r'
  ------------------
                      *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  103|      2|#define LF     (u_char) '\n'
  ------------------
  502|      2|    }
  503|       |
  504|      3|    if (r->headers_out.content_length == NULL
  ------------------
  |  Branch (504:9): [True: 3, False: 0]
  ------------------
  505|      3|        && r->headers_out.content_length_n >= 0)
  ------------------
  |  Branch (505:12): [True: 2, False: 1]
  ------------------
  506|      2|    {
  507|      2|        b->last = ngx_sprintf(b->last, "Content-Length: %O" CRLF,
  ------------------
  |  |  105|      2|#define CRLF   "\r\n"
  ------------------
  508|      2|                              r->headers_out.content_length_n);
  509|      2|    }
  510|       |
  511|      3|    if (r->headers_out.last_modified == NULL
  ------------------
  |  Branch (511:9): [True: 2, False: 1]
  ------------------
  512|      3|        && r->headers_out.last_modified_time != -1)
  ------------------
  |  Branch (512:12): [True: 0, False: 2]
  ------------------
  513|      0|    {
  514|      0|        b->last = ngx_cpymem(b->last, "Last-Modified: ",
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  515|      0|                             sizeof("Last-Modified: ") - 1);
  516|      0|        b->last = ngx_http_time(b->last, r->headers_out.last_modified_time);
  517|       |
  518|      0|        *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
                      *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  519|      0|    }
  520|       |
  521|      3|    if (host.data) {
  ------------------
  |  Branch (521:9): [True: 0, False: 3]
  ------------------
  522|       |
  523|      0|        p = b->last + sizeof("Location: ") - 1;
  524|       |
  525|      0|        b->last = ngx_cpymem(b->last, "Location: http",
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  526|      0|                             sizeof("Location: http") - 1);
  527|       |
  528|       |#if (NGX_HTTP_SSL)
  529|       |        if (c->ssl) {
  530|       |            *b->last++ ='s';
  531|       |        }
  532|       |#endif
  533|       |
  534|      0|        *b->last++ = ':'; *b->last++ = '/'; *b->last++ = '/';
  535|      0|        b->last = ngx_copy(b->last, host.data, host.len);
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  536|       |
  537|      0|        if (port) {
  ------------------
  |  Branch (537:13): [True: 0, False: 0]
  ------------------
  538|      0|            b->last = ngx_sprintf(b->last, ":%ui", port);
  539|      0|        }
  540|       |
  541|      0|        b->last = ngx_copy(b->last, r->headers_out.location->value.data,
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  542|      0|                           r->headers_out.location->value.len);
  543|       |
  544|       |        /* update r->headers_out.location->value for possible logging */
  545|       |
  546|      0|        r->headers_out.location->value.len = b->last - p;
  547|      0|        r->headers_out.location->value.data = p;
  548|      0|        ngx_str_set(&r->headers_out.location->key, "Location");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
  549|       |
  550|      0|        *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
                      *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  551|      0|    }
  552|       |
  553|      3|    if (r->chunked) {
  ------------------
  |  Branch (553:9): [True: 0, False: 3]
  ------------------
  554|      0|        b->last = ngx_cpymem(b->last, "Transfer-Encoding: chunked" CRLF,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  555|      0|                             sizeof("Transfer-Encoding: chunked" CRLF) - 1);
  556|      0|    }
  557|       |
  558|      3|    if (r->headers_out.status == NGX_HTTP_SWITCHING_PROTOCOLS) {
  ------------------
  |  |   75|      3|#define NGX_HTTP_SWITCHING_PROTOCOLS       101
  ------------------
  |  Branch (558:9): [True: 0, False: 3]
  ------------------
  559|      0|        b->last = ngx_cpymem(b->last, "Connection: upgrade" CRLF,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  560|      0|                             sizeof("Connection: upgrade" CRLF) - 1);
  561|       |
  562|      3|    } else if (r->keepalive) {
  ------------------
  |  Branch (562:16): [True: 0, False: 3]
  ------------------
  563|      0|        b->last = ngx_cpymem(b->last, "Connection: keep-alive" CRLF,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  564|      0|                             sizeof("Connection: keep-alive" CRLF) - 1);
  565|       |
  566|      0|        if (clcf->keepalive_header) {
  ------------------
  |  Branch (566:13): [True: 0, False: 0]
  ------------------
  567|      0|            b->last = ngx_sprintf(b->last, "Keep-Alive: timeout=%T" CRLF,
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  568|      0|                                  clcf->keepalive_header);
  569|      0|        }
  570|       |
  571|      3|    } else {
  572|      3|        b->last = ngx_cpymem(b->last, "Connection: close" CRLF,
  ------------------
  |  |  107|      3|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  573|      3|                             sizeof("Connection: close" CRLF) - 1);
  574|      3|    }
  575|       |
  576|      3|#if (NGX_HTTP_GZIP)
  577|      3|    if (r->gzip_vary) {
  ------------------
  |  Branch (577:9): [True: 0, False: 3]
  ------------------
  578|      0|        b->last = ngx_cpymem(b->last, "Vary: Accept-Encoding" CRLF,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  579|      0|                             sizeof("Vary: Accept-Encoding" CRLF) - 1);
  580|      0|    }
  581|      3|#endif
  582|       |
  583|      3|    part = &r->headers_out.headers.part;
  584|      3|    header = part->elts;
  585|       |
  586|      7|    for (i = 0; /* void */; i++) {
  587|       |
  588|      7|        if (i >= part->nelts) {
  ------------------
  |  Branch (588:13): [True: 3, False: 4]
  ------------------
  589|      3|            if (part->next == NULL) {
  ------------------
  |  Branch (589:17): [True: 3, False: 0]
  ------------------
  590|      3|                break;
  591|      3|            }
  592|       |
  593|      0|            part = part->next;
  594|      0|            header = part->elts;
  595|      0|            i = 0;
  596|      0|        }
  597|       |
  598|      4|        if (header[i].hash == 0) {
  ------------------
  |  Branch (598:13): [True: 0, False: 4]
  ------------------
  599|      0|            continue;
  600|      0|        }
  601|       |
  602|      4|        b->last = ngx_copy(b->last, header[i].key.data, header[i].key.len);
  ------------------
  |  |  138|      4|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      4|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  603|      4|        *b->last++ = ':'; *b->last++ = ' ';
  604|       |
  605|      4|        b->last = ngx_copy(b->last, header[i].value.data, header[i].value.len);
  ------------------
  |  |  138|      4|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      4|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  606|      4|        *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  104|      4|#define CR     (u_char) '\r'
  ------------------
                      *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  103|      4|#define LF     (u_char) '\n'
  ------------------
  607|      4|    }
  608|       |
  609|      3|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
  610|      3|                   "%*s", (size_t) (b->last - b->pos), b->pos);
  611|       |
  612|       |    /* the end of HTTP header */
  613|      3|    *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  104|      3|#define CR     (u_char) '\r'
  ------------------
                  *b->last++ = CR; *b->last++ = LF;
  ------------------
  |  |  103|      3|#define LF     (u_char) '\n'
  ------------------
  614|       |
  615|      3|    r->header_size = b->last - b->pos;
  616|       |
  617|      3|    if (r->header_only) {
  ------------------
  |  Branch (617:9): [True: 0, False: 3]
  ------------------
  618|      0|        b->last_buf = 1;
  619|      0|    }
  620|       |
  621|      3|    out.buf = b;
  622|      3|    out.next = NULL;
  623|       |
  624|      3|    return ngx_http_write_filter(r, &out);
  625|      3|}

ngx_http_parse_request_line:
  105|    111|{
  106|    111|    u_char  c, ch, *p, *m;
  107|    111|    enum {
  108|    111|        sw_start = 0,
  109|    111|        sw_method,
  110|    111|        sw_spaces_before_uri,
  111|    111|        sw_schema,
  112|    111|        sw_schema_slash,
  113|    111|        sw_schema_slash_slash,
  114|    111|        sw_host_start,
  115|    111|        sw_host,
  116|    111|        sw_host_end,
  117|    111|        sw_host_ip_literal,
  118|    111|        sw_port,
  119|    111|        sw_after_slash_in_uri,
  120|    111|        sw_check_uri,
  121|    111|        sw_uri,
  122|    111|        sw_http_09,
  123|    111|        sw_http_H,
  124|    111|        sw_http_HT,
  125|    111|        sw_http_HTT,
  126|    111|        sw_http_HTTP,
  127|    111|        sw_first_major_digit,
  128|    111|        sw_major_digit,
  129|    111|        sw_first_minor_digit,
  130|    111|        sw_minor_digit,
  131|    111|        sw_spaces_after_digit,
  132|    111|        sw_almost_done
  133|    111|    } state;
  134|       |
  135|    111|    state = r->state;
  136|       |
  137|  99.6k|    for (p = b->pos; p < b->last; p++) {
  ------------------
  |  Branch (137:22): [True: 99.5k, False: 98]
  ------------------
  138|  99.5k|        ch = *p;
  139|       |
  140|  99.5k|        switch (state) {
  ------------------
  |  Branch (140:17): [True: 0, False: 99.5k]
  ------------------
  141|       |
  142|       |        /* HTTP methods: GET, HEAD, POST */
  143|  95.4k|        case sw_start:
  ------------------
  |  Branch (143:9): [True: 95.4k, False: 4.16k]
  ------------------
  144|  95.4k|            r->request_start = p;
  145|       |
  146|  95.4k|            if (ch == CR || ch == LF) {
  ------------------
  |  |  104|   190k|#define CR     (u_char) '\r'
  ------------------
                          if (ch == CR || ch == LF) {
  ------------------
  |  |  103|    110|#define LF     (u_char) '\n'
  ------------------
  |  Branch (146:17): [True: 95.2k, False: 110]
  |  Branch (146:29): [True: 95, False: 15]
  ------------------
  147|  95.3k|                break;
  148|  95.3k|            }
  149|       |
  150|     15|            if ((ch < 'A' || ch > 'Z') && ch != '_' && ch != '-') {
  ------------------
  |  Branch (150:18): [True: 0, False: 15]
  |  Branch (150:30): [True: 0, False: 15]
  |  Branch (150:43): [True: 0, False: 0]
  |  Branch (150:56): [True: 0, False: 0]
  ------------------
  151|      0|                return NGX_HTTP_PARSE_INVALID_METHOD;
  ------------------
  |  |   57|      0|#define NGX_HTTP_PARSE_INVALID_METHOD      10
  ------------------
  152|      0|            }
  153|       |
  154|     15|            state = sw_method;
  155|     15|            break;
  156|       |
  157|     74|        case sw_method:
  ------------------
  |  Branch (157:9): [True: 74, False: 99.4k]
  ------------------
  158|     74|            if (ch == ' ') {
  ------------------
  |  Branch (158:17): [True: 14, False: 60]
  ------------------
  159|     14|                r->method_end = p - 1;
  160|     14|                m = r->request_start;
  161|       |
  162|     14|                switch (p - m) {
  ------------------
  |  Branch (162:25): [True: 5, False: 9]
  ------------------
  163|       |
  164|      5|                case 3:
  ------------------
  |  Branch (164:17): [True: 5, False: 9]
  ------------------
  165|      5|                    if (ngx_str3_cmp(m, 'G', 'E', 'T', ' ')) {
  ------------------
  |  |   39|      5|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
  |  |  ------------------
  |  |  |  Branch (39:5): [True: 5, False: 0]
  |  |  ------------------
  ------------------
  166|      5|                        r->method = NGX_HTTP_GET;
  ------------------
  |  |   30|      5|#define NGX_HTTP_GET                       0x00000002
  ------------------
  167|      5|                        break;
  168|      5|                    }
  169|       |
  170|      0|                    if (ngx_str3_cmp(m, 'P', 'U', 'T', ' ')) {
  ------------------
  |  |   39|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
  |  |  ------------------
  |  |  |  Branch (39:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  171|      0|                        r->method = NGX_HTTP_PUT;
  ------------------
  |  |   33|      0|#define NGX_HTTP_PUT                       0x00000010
  ------------------
  172|      0|                        break;
  173|      0|                    }
  174|       |
  175|      0|                    break;
  176|       |
  177|      0|                case 4:
  ------------------
  |  Branch (177:17): [True: 0, False: 14]
  ------------------
  178|      0|                    if (m[1] == 'O') {
  ------------------
  |  Branch (178:25): [True: 0, False: 0]
  ------------------
  179|       |
  180|      0|                        if (ngx_str3Ocmp(m, 'P', 'O', 'S', 'T')) {
  ------------------
  |  |   42|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
  |  |  ------------------
  |  |  |  Branch (42:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  181|      0|                            r->method = NGX_HTTP_POST;
  ------------------
  |  |   32|      0|#define NGX_HTTP_POST                      0x00000008
  ------------------
  182|      0|                            break;
  183|      0|                        }
  184|       |
  185|      0|                        if (ngx_str3Ocmp(m, 'C', 'O', 'P', 'Y')) {
  ------------------
  |  |   42|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
  |  |  ------------------
  |  |  |  Branch (42:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  186|      0|                            r->method = NGX_HTTP_COPY;
  ------------------
  |  |   36|      0|#define NGX_HTTP_COPY                      0x00000080
  ------------------
  187|      0|                            break;
  188|      0|                        }
  189|       |
  190|      0|                        if (ngx_str3Ocmp(m, 'M', 'O', 'V', 'E')) {
  ------------------
  |  |   42|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
  |  |  ------------------
  |  |  |  Branch (42:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  191|      0|                            r->method = NGX_HTTP_MOVE;
  ------------------
  |  |   37|      0|#define NGX_HTTP_MOVE                      0x00000100
  ------------------
  192|      0|                            break;
  193|      0|                        }
  194|       |
  195|      0|                        if (ngx_str3Ocmp(m, 'L', 'O', 'C', 'K')) {
  ------------------
  |  |   42|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
  |  |  ------------------
  |  |  |  Branch (42:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  196|      0|                            r->method = NGX_HTTP_LOCK;
  ------------------
  |  |   41|      0|#define NGX_HTTP_LOCK                      0x00001000
  ------------------
  197|      0|                            break;
  198|      0|                        }
  199|       |
  200|      0|                    } else {
  201|       |
  202|      0|                        if (ngx_str4cmp(m, 'H', 'E', 'A', 'D')) {
  ------------------
  |  |   45|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
  |  |  ------------------
  |  |  |  Branch (45:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  203|      0|                            r->method = NGX_HTTP_HEAD;
  ------------------
  |  |   31|      0|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
  204|      0|                            break;
  205|      0|                        }
  206|      0|                    }
  207|       |
  208|      0|                    break;
  209|       |
  210|      1|                case 5:
  ------------------
  |  Branch (210:17): [True: 1, False: 13]
  ------------------
  211|      1|                    if (ngx_str5cmp(m, 'M', 'K', 'C', 'O', 'L')) {
  ------------------
  |  |   48|      1|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)             \
  |  |  ------------------
  |  |  |  Branch (48:5): [True: 0, False: 1]
  |  |  ------------------
  |  |   49|      1|        && m[4] == c4
  |  |  ------------------
  |  |  |  Branch (49:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  212|      0|                        r->method = NGX_HTTP_MKCOL;
  ------------------
  |  |   35|      0|#define NGX_HTTP_MKCOL                     0x00000040
  ------------------
  213|      0|                        break;
  214|      0|                    }
  215|       |
  216|      1|                    if (ngx_str5cmp(m, 'P', 'A', 'T', 'C', 'H')) {
  ------------------
  |  |   48|      1|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)             \
  |  |  ------------------
  |  |  |  Branch (48:5): [True: 0, False: 1]
  |  |  ------------------
  |  |   49|      1|        && m[4] == c4
  |  |  ------------------
  |  |  |  Branch (49:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  217|      0|                        r->method = NGX_HTTP_PATCH;
  ------------------
  |  |   43|      0|#define NGX_HTTP_PATCH                     0x00004000
  ------------------
  218|      0|                        break;
  219|      0|                    }
  220|       |
  221|      1|                    if (ngx_str5cmp(m, 'T', 'R', 'A', 'C', 'E')) {
  ------------------
  |  |   48|      1|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)             \
  |  |  ------------------
  |  |  |  Branch (48:5): [True: 1, False: 0]
  |  |  ------------------
  |  |   49|      1|        && m[4] == c4
  |  |  ------------------
  |  |  |  Branch (49:12): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  222|      1|                        r->method = NGX_HTTP_TRACE;
  ------------------
  |  |   44|      1|#define NGX_HTTP_TRACE                     0x00008000
  ------------------
  223|      1|                        break;
  224|      1|                    }
  225|       |
  226|      0|                    break;
  227|       |
  228|      3|                case 6:
  ------------------
  |  Branch (228:17): [True: 3, False: 11]
  ------------------
  229|      3|                    if (ngx_str6cmp(m, 'D', 'E', 'L', 'E', 'T', 'E')) {
  ------------------
  |  |   52|      3|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)             \
  |  |  ------------------
  |  |  |  Branch (52:5): [True: 0, False: 3]
  |  |  ------------------
  |  |   53|      3|        && (((uint32_t *) m)[1] & 0xffff) == ((c5 << 8) | c4)
  |  |  ------------------
  |  |  |  Branch (53:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  230|      0|                        r->method = NGX_HTTP_DELETE;
  ------------------
  |  |   34|      0|#define NGX_HTTP_DELETE                    0x00000020
  ------------------
  231|      0|                        break;
  232|      0|                    }
  233|       |
  234|      3|                    if (ngx_str6cmp(m, 'U', 'N', 'L', 'O', 'C', 'K')) {
  ------------------
  |  |   52|      3|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)             \
  |  |  ------------------
  |  |  |  Branch (52:5): [True: 0, False: 3]
  |  |  ------------------
  |  |   53|      3|        && (((uint32_t *) m)[1] & 0xffff) == ((c5 << 8) | c4)
  |  |  ------------------
  |  |  |  Branch (53:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  235|      0|                        r->method = NGX_HTTP_UNLOCK;
  ------------------
  |  |   42|      0|#define NGX_HTTP_UNLOCK                    0x00002000
  ------------------
  236|      0|                        break;
  237|      0|                    }
  238|       |
  239|      3|                    break;
  240|       |
  241|      3|                case 7:
  ------------------
  |  Branch (241:17): [True: 0, False: 14]
  ------------------
  242|      0|                    if (ngx_str7_cmp(m, 'O', 'P', 'T', 'I', 'O', 'N', 'S', ' '))
  ------------------
  |  |   56|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)             \
  |  |  ------------------
  |  |  |  Branch (56:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   57|      0|        && ((uint32_t *) m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4)
  |  |  ------------------
  |  |  |  Branch (57:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  243|      0|                    {
  244|      0|                        r->method = NGX_HTTP_OPTIONS;
  ------------------
  |  |   38|      0|#define NGX_HTTP_OPTIONS                   0x00000200
  ------------------
  245|      0|                    }
  246|       |
  247|      0|                    if (ngx_str7_cmp(m, 'C', 'O', 'N', 'N', 'E', 'C', 'T', ' '))
  ------------------
  |  |   56|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)             \
  |  |  ------------------
  |  |  |  Branch (56:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   57|      0|        && ((uint32_t *) m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4)
  |  |  ------------------
  |  |  |  Branch (57:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  248|      0|                    {
  249|      0|                        r->method = NGX_HTTP_CONNECT;
  ------------------
  |  |   45|      0|#define NGX_HTTP_CONNECT                   0x00010000
  ------------------
  250|      0|                    }
  251|       |
  252|      0|                    break;
  253|       |
  254|      0|                case 8:
  ------------------
  |  Branch (254:17): [True: 0, False: 14]
  ------------------
  255|      0|                    if (ngx_str8cmp(m, 'P', 'R', 'O', 'P', 'F', 'I', 'N', 'D'))
  ------------------
  |  |   60|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)             \
  |  |  ------------------
  |  |  |  Branch (60:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   61|      0|        && ((uint32_t *) m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4)
  |  |  ------------------
  |  |  |  Branch (61:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  256|      0|                    {
  257|      0|                        r->method = NGX_HTTP_PROPFIND;
  ------------------
  |  |   39|      0|#define NGX_HTTP_PROPFIND                  0x00000400
  ------------------
  258|      0|                    }
  259|       |
  260|      0|                    break;
  261|       |
  262|      0|                case 9:
  ------------------
  |  Branch (262:17): [True: 0, False: 14]
  ------------------
  263|      0|                    if (ngx_str9cmp(m,
  ------------------
  |  |   64|      0|    *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)             \
  |  |  ------------------
  |  |  |  Branch (64:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   65|      0|        && ((uint32_t *) m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4)  \
  |  |  ------------------
  |  |  |  Branch (65:12): [True: 0, False: 0]
  |  |  ------------------
  |  |   66|      0|        && m[8] == c8
  |  |  ------------------
  |  |  |  Branch (66:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  264|      0|                            'P', 'R', 'O', 'P', 'P', 'A', 'T', 'C', 'H'))
  265|      0|                    {
  266|      0|                        r->method = NGX_HTTP_PROPPATCH;
  ------------------
  |  |   40|      0|#define NGX_HTTP_PROPPATCH                 0x00000800
  ------------------
  267|      0|                    }
  268|       |
  269|      0|                    break;
  270|     14|                }
  271|       |
  272|     14|                state = sw_spaces_before_uri;
  273|     14|                break;
  274|     14|            }
  275|       |
  276|     60|            if ((ch < 'A' || ch > 'Z') && ch != '_' && ch != '-') {
  ------------------
  |  Branch (276:18): [True: 1, False: 59]
  |  Branch (276:30): [True: 0, False: 59]
  |  Branch (276:43): [True: 1, False: 0]
  |  Branch (276:56): [True: 1, False: 0]
  ------------------
  277|      1|                return NGX_HTTP_PARSE_INVALID_METHOD;
  ------------------
  |  |   57|      1|#define NGX_HTTP_PARSE_INVALID_METHOD      10
  ------------------
  278|      1|            }
  279|       |
  280|     59|            break;
  281|       |
  282|       |        /* space* before URI */
  283|     59|        case sw_spaces_before_uri:
  ------------------
  |  Branch (283:9): [True: 14, False: 99.5k]
  ------------------
  284|       |
  285|     14|            if (ch == '/') {
  ------------------
  |  Branch (285:17): [True: 12, False: 2]
  ------------------
  286|     12|                r->uri_start = p;
  287|     12|                state = sw_after_slash_in_uri;
  288|     12|                break;
  289|     12|            }
  290|       |
  291|      2|            c = (u_char) (ch | 0x20);
  292|      2|            if (c >= 'a' && c <= 'z') {
  ------------------
  |  Branch (292:17): [True: 2, False: 0]
  |  Branch (292:29): [True: 2, False: 0]
  ------------------
  293|      2|                r->schema_start = p;
  294|      2|                state = sw_schema;
  295|      2|                break;
  296|      2|            }
  297|       |
  298|      0|            switch (ch) {
  299|      0|            case ' ':
  ------------------
  |  Branch (299:13): [True: 0, False: 0]
  ------------------
  300|      0|                break;
  301|      0|            default:
  ------------------
  |  Branch (301:13): [True: 0, False: 0]
  ------------------
  302|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  303|      0|            }
  304|      0|            break;
  305|       |
  306|      2|        case sw_schema:
  ------------------
  |  Branch (306:9): [True: 2, False: 99.5k]
  ------------------
  307|       |
  308|      2|            c = (u_char) (ch | 0x20);
  309|      2|            if (c >= 'a' && c <= 'z') {
  ------------------
  |  Branch (309:17): [True: 0, False: 2]
  |  Branch (309:29): [True: 0, False: 0]
  ------------------
  310|      0|                break;
  311|      0|            }
  312|       |
  313|      2|            if ((ch >= '0' && ch <= '9') || ch == '+' || ch == '-' || ch == '.')
  ------------------
  |  Branch (313:18): [True: 2, False: 0]
  |  Branch (313:31): [True: 0, False: 2]
  |  Branch (313:45): [True: 0, False: 2]
  |  Branch (313:58): [True: 0, False: 2]
  |  Branch (313:71): [True: 0, False: 2]
  ------------------
  314|      0|            {
  315|      0|                break;
  316|      0|            }
  317|       |
  318|      2|            switch (ch) {
  319|      2|            case ':':
  ------------------
  |  Branch (319:13): [True: 2, False: 0]
  ------------------
  320|      2|                r->schema_end = p;
  321|      2|                state = sw_schema_slash;
  322|      2|                break;
  323|      0|            default:
  ------------------
  |  Branch (323:13): [True: 0, False: 2]
  ------------------
  324|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  325|      2|            }
  326|      2|            break;
  327|       |
  328|      2|        case sw_schema_slash:
  ------------------
  |  Branch (328:9): [True: 2, False: 99.5k]
  ------------------
  329|      2|            switch (ch) {
  330|      2|            case '/':
  ------------------
  |  Branch (330:13): [True: 2, False: 0]
  ------------------
  331|      2|                state = sw_schema_slash_slash;
  332|      2|                break;
  333|      0|            default:
  ------------------
  |  Branch (333:13): [True: 0, False: 2]
  ------------------
  334|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  335|      2|            }
  336|      2|            break;
  337|       |
  338|      2|        case sw_schema_slash_slash:
  ------------------
  |  Branch (338:9): [True: 2, False: 99.5k]
  ------------------
  339|      2|            switch (ch) {
  340|      2|            case '/':
  ------------------
  |  Branch (340:13): [True: 2, False: 0]
  ------------------
  341|      2|                state = sw_host_start;
  342|      2|                break;
  343|      0|            default:
  ------------------
  |  Branch (343:13): [True: 0, False: 2]
  ------------------
  344|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  345|      2|            }
  346|      2|            break;
  347|       |
  348|      2|        case sw_host_start:
  ------------------
  |  Branch (348:9): [True: 2, False: 99.5k]
  ------------------
  349|       |
  350|      2|            r->host_start = p;
  351|       |
  352|      2|            if (ch == '[') {
  ------------------
  |  Branch (352:17): [True: 0, False: 2]
  ------------------
  353|      0|                state = sw_host_ip_literal;
  354|      0|                break;
  355|      0|            }
  356|       |
  357|      2|            state = sw_host;
  358|       |
  359|       |            /* fall through */
  360|       |
  361|     22|        case sw_host:
  ------------------
  |  Branch (361:9): [True: 20, False: 99.5k]
  ------------------
  362|       |
  363|     22|            c = (u_char) (ch | 0x20);
  364|     22|            if (c >= 'a' && c <= 'z') {
  ------------------
  |  Branch (364:17): [True: 18, False: 4]
  |  Branch (364:29): [True: 18, False: 0]
  ------------------
  365|     18|                break;
  366|     18|            }
  367|       |
  368|      4|            if ((ch >= '0' && ch <= '9') || ch == '.' || ch == '-') {
  ------------------
  |  Branch (368:18): [True: 0, False: 4]
  |  Branch (368:31): [True: 0, False: 0]
  |  Branch (368:45): [True: 0, False: 4]
  |  Branch (368:58): [True: 2, False: 2]
  ------------------
  369|      2|                break;
  370|      2|            }
  371|       |
  372|       |            /* fall through */
  373|       |
  374|      2|        case sw_host_end:
  ------------------
  |  Branch (374:9): [True: 0, False: 99.5k]
  ------------------
  375|       |
  376|      2|            r->host_end = p;
  377|       |
  378|      2|            switch (ch) {
  379|      0|            case ':':
  ------------------
  |  Branch (379:13): [True: 0, False: 2]
  ------------------
  380|      0|                state = sw_port;
  381|      0|                break;
  382|      0|            case '/':
  ------------------
  |  Branch (382:13): [True: 0, False: 2]
  ------------------
  383|      0|                r->uri_start = p;
  384|      0|                state = sw_after_slash_in_uri;
  385|      0|                break;
  386|      0|            case '?':
  ------------------
  |  Branch (386:13): [True: 0, False: 2]
  ------------------
  387|      0|                r->uri_start = p;
  388|      0|                r->args_start = p + 1;
  389|      0|                r->empty_path_in_uri = 1;
  390|      0|                state = sw_uri;
  391|      0|                break;
  392|      2|            case ' ':
  ------------------
  |  Branch (392:13): [True: 2, False: 0]
  ------------------
  393|       |                /*
  394|       |                 * use single "/" from request line to preserve pointers,
  395|       |                 * if request line will be copied to large client buffer
  396|       |                 */
  397|      2|                r->uri_start = r->schema_end + 1;
  398|      2|                r->uri_end = r->schema_end + 2;
  399|      2|                state = sw_http_09;
  400|      2|                break;
  401|      0|            default:
  ------------------
  |  Branch (401:13): [True: 0, False: 2]
  ------------------
  402|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  403|      2|            }
  404|      2|            break;
  405|       |
  406|      2|        case sw_host_ip_literal:
  ------------------
  |  Branch (406:9): [True: 0, False: 99.5k]
  ------------------
  407|       |
  408|      0|            if (ch >= '0' && ch <= '9') {
  ------------------
  |  Branch (408:17): [True: 0, False: 0]
  |  Branch (408:30): [True: 0, False: 0]
  ------------------
  409|      0|                break;
  410|      0|            }
  411|       |
  412|      0|            c = (u_char) (ch | 0x20);
  413|      0|            if (c >= 'a' && c <= 'z') {
  ------------------
  |  Branch (413:17): [True: 0, False: 0]
  |  Branch (413:29): [True: 0, False: 0]
  ------------------
  414|      0|                break;
  415|      0|            }
  416|       |
  417|      0|            switch (ch) {
  418|      0|            case ':':
  ------------------
  |  Branch (418:13): [True: 0, False: 0]
  ------------------
  419|      0|                break;
  420|      0|            case ']':
  ------------------
  |  Branch (420:13): [True: 0, False: 0]
  ------------------
  421|      0|                state = sw_host_end;
  422|      0|                break;
  423|      0|            case '-':
  ------------------
  |  Branch (423:13): [True: 0, False: 0]
  ------------------
  424|      0|            case '.':
  ------------------
  |  Branch (424:13): [True: 0, False: 0]
  ------------------
  425|      0|            case '_':
  ------------------
  |  Branch (425:13): [True: 0, False: 0]
  ------------------
  426|      0|            case '~':
  ------------------
  |  Branch (426:13): [True: 0, False: 0]
  ------------------
  427|       |                /* unreserved */
  428|      0|                break;
  429|      0|            case '!':
  ------------------
  |  Branch (429:13): [True: 0, False: 0]
  ------------------
  430|      0|            case '$':
  ------------------
  |  Branch (430:13): [True: 0, False: 0]
  ------------------
  431|      0|            case '&':
  ------------------
  |  Branch (431:13): [True: 0, False: 0]
  ------------------
  432|      0|            case '\'':
  ------------------
  |  Branch (432:13): [True: 0, False: 0]
  ------------------
  433|      0|            case '(':
  ------------------
  |  Branch (433:13): [True: 0, False: 0]
  ------------------
  434|      0|            case ')':
  ------------------
  |  Branch (434:13): [True: 0, False: 0]
  ------------------
  435|      0|            case '*':
  ------------------
  |  Branch (435:13): [True: 0, False: 0]
  ------------------
  436|      0|            case '+':
  ------------------
  |  Branch (436:13): [True: 0, False: 0]
  ------------------
  437|      0|            case ',':
  ------------------
  |  Branch (437:13): [True: 0, False: 0]
  ------------------
  438|      0|            case ';':
  ------------------
  |  Branch (438:13): [True: 0, False: 0]
  ------------------
  439|      0|            case '=':
  ------------------
  |  Branch (439:13): [True: 0, False: 0]
  ------------------
  440|       |                /* sub-delims */
  441|      0|                break;
  442|      0|            default:
  ------------------
  |  Branch (442:13): [True: 0, False: 0]
  ------------------
  443|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  444|      0|            }
  445|      0|            break;
  446|       |
  447|      0|        case sw_port:
  ------------------
  |  Branch (447:9): [True: 0, False: 99.5k]
  ------------------
  448|      0|            if (ch >= '0' && ch <= '9') {
  ------------------
  |  Branch (448:17): [True: 0, False: 0]
  |  Branch (448:30): [True: 0, False: 0]
  ------------------
  449|      0|                break;
  450|      0|            }
  451|       |
  452|      0|            switch (ch) {
  453|      0|            case '/':
  ------------------
  |  Branch (453:13): [True: 0, False: 0]
  ------------------
  454|      0|                r->port_end = p;
  455|      0|                r->uri_start = p;
  456|      0|                state = sw_after_slash_in_uri;
  457|      0|                break;
  458|      0|            case '?':
  ------------------
  |  Branch (458:13): [True: 0, False: 0]
  ------------------
  459|      0|                r->port_end = p;
  460|      0|                r->uri_start = p;
  461|      0|                r->args_start = p + 1;
  462|      0|                r->empty_path_in_uri = 1;
  463|      0|                state = sw_uri;
  464|      0|                break;
  465|      0|            case ' ':
  ------------------
  |  Branch (465:13): [True: 0, False: 0]
  ------------------
  466|      0|                r->port_end = p;
  467|       |                /*
  468|       |                 * use single "/" from request line to preserve pointers,
  469|       |                 * if request line will be copied to large client buffer
  470|       |                 */
  471|      0|                r->uri_start = r->schema_end + 1;
  472|      0|                r->uri_end = r->schema_end + 2;
  473|      0|                state = sw_http_09;
  474|      0|                break;
  475|      0|            default:
  ------------------
  |  Branch (475:13): [True: 0, False: 0]
  ------------------
  476|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  477|      0|            }
  478|      0|            break;
  479|       |
  480|       |        /* check "/.", "//", "%", and "\" (Win32) in URI */
  481|     12|        case sw_after_slash_in_uri:
  ------------------
  |  Branch (481:9): [True: 12, False: 99.5k]
  ------------------
  482|       |
  483|     12|            if (usual[ch >> 5] & (1U << (ch & 0x1f))) {
  ------------------
  |  Branch (483:17): [True: 2, False: 10]
  ------------------
  484|      2|                state = sw_check_uri;
  485|      2|                break;
  486|      2|            }
  487|       |
  488|     10|            switch (ch) {
  489|      2|            case ' ':
  ------------------
  |  Branch (489:13): [True: 2, False: 8]
  ------------------
  490|      2|                r->uri_end = p;
  491|      2|                state = sw_http_09;
  492|      2|                break;
  493|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (493:13): [True: 0, False: 10]
  ------------------
  494|      0|                r->uri_end = p;
  495|      0|                r->http_minor = 9;
  496|      0|                state = sw_almost_done;
  497|      0|                break;
  498|      4|            case LF:
  ------------------
  |  |  103|      4|#define LF     (u_char) '\n'
  ------------------
  |  Branch (498:13): [True: 4, False: 6]
  ------------------
  499|      4|                r->uri_end = p;
  500|      4|                r->http_minor = 9;
  501|      4|                goto done;
  502|      0|            case '.':
  ------------------
  |  Branch (502:13): [True: 0, False: 10]
  ------------------
  503|      0|                r->complex_uri = 1;
  504|      0|                state = sw_uri;
  505|      0|                break;
  506|      0|            case '%':
  ------------------
  |  Branch (506:13): [True: 0, False: 10]
  ------------------
  507|      0|                r->quoted_uri = 1;
  508|      0|                state = sw_uri;
  509|      0|                break;
  510|      4|            case '/':
  ------------------
  |  Branch (510:13): [True: 4, False: 6]
  ------------------
  511|      4|                r->complex_uri = 1;
  512|      4|                state = sw_uri;
  513|      4|                break;
  514|       |#if (NGX_WIN32)
  515|       |            case '\\':
  516|       |                r->complex_uri = 1;
  517|       |                state = sw_uri;
  518|       |                break;
  519|       |#endif
  520|      0|            case '?':
  ------------------
  |  Branch (520:13): [True: 0, False: 10]
  ------------------
  521|      0|                r->args_start = p + 1;
  522|      0|                state = sw_uri;
  523|      0|                break;
  524|      0|            case '#':
  ------------------
  |  Branch (524:13): [True: 0, False: 10]
  ------------------
  525|      0|                r->complex_uri = 1;
  526|      0|                state = sw_uri;
  527|      0|                break;
  528|      0|            case '+':
  ------------------
  |  Branch (528:13): [True: 0, False: 10]
  ------------------
  529|      0|                r->plus_in_uri = 1;
  530|      0|                break;
  531|      0|            default:
  ------------------
  |  Branch (531:13): [True: 0, False: 10]
  ------------------
  532|      0|                if (ch < 0x20 || ch == 0x7f) {
  ------------------
  |  Branch (532:21): [True: 0, False: 0]
  |  Branch (532:34): [True: 0, False: 0]
  ------------------
  533|      0|                    return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  534|      0|                }
  535|      0|                state = sw_check_uri;
  536|      0|                break;
  537|     10|            }
  538|      6|            break;
  539|       |
  540|       |        /* check "/", "%" and "\" (Win32) in URI */
  541|  1.29k|        case sw_check_uri:
  ------------------
  |  Branch (541:9): [True: 1.29k, False: 98.2k]
  ------------------
  542|       |
  543|  1.29k|            if (usual[ch >> 5] & (1U << (ch & 0x1f))) {
  ------------------
  |  Branch (543:17): [True: 1.29k, False: 2]
  ------------------
  544|  1.29k|                break;
  545|  1.29k|            }
  546|       |
  547|      2|            switch (ch) {
  548|      0|            case '/':
  ------------------
  |  Branch (548:13): [True: 0, False: 2]
  ------------------
  549|       |#if (NGX_WIN32)
  550|       |                if (r->uri_ext == p) {
  551|       |                    r->complex_uri = 1;
  552|       |                    state = sw_uri;
  553|       |                    break;
  554|       |                }
  555|       |#endif
  556|      0|                r->uri_ext = NULL;
  557|      0|                state = sw_after_slash_in_uri;
  558|      0|                break;
  559|      0|            case '.':
  ------------------
  |  Branch (559:13): [True: 0, False: 2]
  ------------------
  560|      0|                r->uri_ext = p + 1;
  561|      0|                break;
  562|      0|            case ' ':
  ------------------
  |  Branch (562:13): [True: 0, False: 2]
  ------------------
  563|      0|                r->uri_end = p;
  564|      0|                state = sw_http_09;
  565|      0|                break;
  566|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (566:13): [True: 0, False: 2]
  ------------------
  567|      0|                r->uri_end = p;
  568|      0|                r->http_minor = 9;
  569|      0|                state = sw_almost_done;
  570|      0|                break;
  571|      0|            case LF:
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (571:13): [True: 0, False: 2]
  ------------------
  572|      0|                r->uri_end = p;
  573|      0|                r->http_minor = 9;
  574|      0|                goto done;
  575|       |#if (NGX_WIN32)
  576|       |            case '\\':
  577|       |                r->complex_uri = 1;
  578|       |                state = sw_after_slash_in_uri;
  579|       |                break;
  580|       |#endif
  581|      2|            case '%':
  ------------------
  |  Branch (581:13): [True: 2, False: 0]
  ------------------
  582|      2|                r->quoted_uri = 1;
  583|      2|                state = sw_uri;
  584|      2|                break;
  585|      0|            case '?':
  ------------------
  |  Branch (585:13): [True: 0, False: 2]
  ------------------
  586|      0|                r->args_start = p + 1;
  587|      0|                state = sw_uri;
  588|      0|                break;
  589|      0|            case '#':
  ------------------
  |  Branch (589:13): [True: 0, False: 2]
  ------------------
  590|      0|                r->complex_uri = 1;
  591|      0|                state = sw_uri;
  592|      0|                break;
  593|      0|            case '+':
  ------------------
  |  Branch (593:13): [True: 0, False: 2]
  ------------------
  594|      0|                r->plus_in_uri = 1;
  595|      0|                break;
  596|      0|            default:
  ------------------
  |  Branch (596:13): [True: 0, False: 2]
  ------------------
  597|      0|                if (ch < 0x20 || ch == 0x7f) {
  ------------------
  |  Branch (597:21): [True: 0, False: 0]
  |  Branch (597:34): [True: 0, False: 0]
  ------------------
  598|      0|                    return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  599|      0|                }
  600|      0|                break;
  601|      2|            }
  602|      2|            break;
  603|       |
  604|       |        /* URI */
  605|  2.63k|        case sw_uri:
  ------------------
  |  Branch (605:9): [True: 2.63k, False: 96.9k]
  ------------------
  606|       |
  607|  2.63k|            if (usual[ch >> 5] & (1U << (ch & 0x1f))) {
  ------------------
  |  Branch (607:17): [True: 2.62k, False: 16]
  ------------------
  608|  2.62k|                break;
  609|  2.62k|            }
  610|       |
  611|     16|            switch (ch) {
  612|      4|            case ' ':
  ------------------
  |  Branch (612:13): [True: 4, False: 12]
  ------------------
  613|      4|                r->uri_end = p;
  614|      4|                state = sw_http_09;
  615|      4|                break;
  616|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (616:13): [True: 0, False: 16]
  ------------------
  617|      0|                r->uri_end = p;
  618|      0|                r->http_minor = 9;
  619|      0|                state = sw_almost_done;
  620|      0|                break;
  621|      0|            case LF:
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (621:13): [True: 0, False: 16]
  ------------------
  622|      0|                r->uri_end = p;
  623|      0|                r->http_minor = 9;
  624|      0|                goto done;
  625|      0|            case '#':
  ------------------
  |  Branch (625:13): [True: 0, False: 16]
  ------------------
  626|      0|                r->complex_uri = 1;
  627|      0|                break;
  628|     12|            default:
  ------------------
  |  Branch (628:13): [True: 12, False: 4]
  ------------------
  629|     12|                if (ch < 0x20 || ch == 0x7f) {
  ------------------
  |  Branch (629:21): [True: 0, False: 12]
  |  Branch (629:34): [True: 0, False: 12]
  ------------------
  630|      0|                    return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  631|      0|                }
  632|     12|                break;
  633|     16|            }
  634|     16|            break;
  635|       |
  636|       |        /* space+ after URI */
  637|     16|        case sw_http_09:
  ------------------
  |  Branch (637:9): [True: 14, False: 99.5k]
  ------------------
  638|     14|            switch (ch) {
  639|      6|            case ' ':
  ------------------
  |  Branch (639:13): [True: 6, False: 8]
  ------------------
  640|      6|                break;
  641|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (641:13): [True: 0, False: 14]
  ------------------
  642|      0|                r->http_minor = 9;
  643|      0|                state = sw_almost_done;
  644|      0|                break;
  645|      0|            case LF:
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (645:13): [True: 0, False: 14]
  ------------------
  646|      0|                r->http_minor = 9;
  647|      0|                goto done;
  648|      8|            case 'H':
  ------------------
  |  Branch (648:13): [True: 8, False: 6]
  ------------------
  649|      8|                r->http_protocol.data = p;
  650|      8|                state = sw_http_H;
  651|      8|                break;
  652|      0|            default:
  ------------------
  |  Branch (652:13): [True: 0, False: 14]
  ------------------
  653|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  654|     14|            }
  655|     14|            break;
  656|       |
  657|     14|        case sw_http_H:
  ------------------
  |  Branch (657:9): [True: 8, False: 99.5k]
  ------------------
  658|      8|            switch (ch) {
  659|      8|            case 'T':
  ------------------
  |  Branch (659:13): [True: 8, False: 0]
  ------------------
  660|      8|                state = sw_http_HT;
  661|      8|                break;
  662|      0|            default:
  ------------------
  |  Branch (662:13): [True: 0, False: 8]
  ------------------
  663|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  664|      8|            }
  665|      8|            break;
  666|       |
  667|      8|        case sw_http_HT:
  ------------------
  |  Branch (667:9): [True: 8, False: 99.5k]
  ------------------
  668|      8|            switch (ch) {
  669|      8|            case 'T':
  ------------------
  |  Branch (669:13): [True: 8, False: 0]
  ------------------
  670|      8|                state = sw_http_HTT;
  671|      8|                break;
  672|      0|            default:
  ------------------
  |  Branch (672:13): [True: 0, False: 8]
  ------------------
  673|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  674|      8|            }
  675|      8|            break;
  676|       |
  677|      8|        case sw_http_HTT:
  ------------------
  |  Branch (677:9): [True: 8, False: 99.5k]
  ------------------
  678|      8|            switch (ch) {
  679|      8|            case 'P':
  ------------------
  |  Branch (679:13): [True: 8, False: 0]
  ------------------
  680|      8|                state = sw_http_HTTP;
  681|      8|                break;
  682|      0|            default:
  ------------------
  |  Branch (682:13): [True: 0, False: 8]
  ------------------
  683|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  684|      8|            }
  685|      8|            break;
  686|       |
  687|      8|        case sw_http_HTTP:
  ------------------
  |  Branch (687:9): [True: 8, False: 99.5k]
  ------------------
  688|      8|            switch (ch) {
  689|      8|            case '/':
  ------------------
  |  Branch (689:13): [True: 8, False: 0]
  ------------------
  690|      8|                state = sw_first_major_digit;
  691|      8|                break;
  692|      0|            default:
  ------------------
  |  Branch (692:13): [True: 0, False: 8]
  ------------------
  693|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  694|      8|            }
  695|      8|            break;
  696|       |
  697|       |        /* first digit of major HTTP version */
  698|      8|        case sw_first_major_digit:
  ------------------
  |  Branch (698:9): [True: 8, False: 99.5k]
  ------------------
  699|      8|            if (ch < '1' || ch > '9') {
  ------------------
  |  Branch (699:17): [True: 0, False: 8]
  |  Branch (699:29): [True: 0, False: 8]
  ------------------
  700|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  701|      0|            }
  702|       |
  703|      8|            r->http_major = ch - '0';
  704|       |
  705|      8|            if (r->http_major > 1) {
  ------------------
  |  Branch (705:17): [True: 0, False: 8]
  ------------------
  706|      0|                return NGX_HTTP_PARSE_INVALID_VERSION;
  ------------------
  |  |   59|      0|#define NGX_HTTP_PARSE_INVALID_VERSION     12
  ------------------
  707|      0|            }
  708|       |
  709|      8|            state = sw_major_digit;
  710|      8|            break;
  711|       |
  712|       |        /* major HTTP version or dot */
  713|      8|        case sw_major_digit:
  ------------------
  |  Branch (713:9): [True: 8, False: 99.5k]
  ------------------
  714|      8|            if (ch == '.') {
  ------------------
  |  Branch (714:17): [True: 8, False: 0]
  ------------------
  715|      8|                state = sw_first_minor_digit;
  716|      8|                break;
  717|      8|            }
  718|       |
  719|      0|            if (ch < '0' || ch > '9') {
  ------------------
  |  Branch (719:17): [True: 0, False: 0]
  |  Branch (719:29): [True: 0, False: 0]
  ------------------
  720|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  721|      0|            }
  722|       |
  723|      0|            r->http_major = r->http_major * 10 + (ch - '0');
  724|       |
  725|      0|            if (r->http_major > 1) {
  ------------------
  |  Branch (725:17): [True: 0, False: 0]
  ------------------
  726|      0|                return NGX_HTTP_PARSE_INVALID_VERSION;
  ------------------
  |  |   59|      0|#define NGX_HTTP_PARSE_INVALID_VERSION     12
  ------------------
  727|      0|            }
  728|       |
  729|      0|            break;
  730|       |
  731|       |        /* first digit of minor HTTP version */
  732|      8|        case sw_first_minor_digit:
  ------------------
  |  Branch (732:9): [True: 8, False: 99.5k]
  ------------------
  733|      8|            if (ch < '0' || ch > '9') {
  ------------------
  |  Branch (733:17): [True: 0, False: 8]
  |  Branch (733:29): [True: 0, False: 8]
  ------------------
  734|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  735|      0|            }
  736|       |
  737|      8|            r->http_minor = ch - '0';
  738|      8|            state = sw_minor_digit;
  739|      8|            break;
  740|       |
  741|       |        /* minor HTTP version or end of request line */
  742|      8|        case sw_minor_digit:
  ------------------
  |  Branch (742:9): [True: 8, False: 99.5k]
  ------------------
  743|      8|            if (ch == CR) {
  ------------------
  |  |  104|      8|#define CR     (u_char) '\r'
  ------------------
  |  Branch (743:17): [True: 0, False: 8]
  ------------------
  744|      0|                state = sw_almost_done;
  745|      0|                break;
  746|      0|            }
  747|       |
  748|      8|            if (ch == LF) {
  ------------------
  |  |  103|      8|#define LF     (u_char) '\n'
  ------------------
  |  Branch (748:17): [True: 2, False: 6]
  ------------------
  749|      2|                goto done;
  750|      2|            }
  751|       |
  752|      6|            if (ch == ' ') {
  ------------------
  |  Branch (752:17): [True: 6, False: 0]
  ------------------
  753|      6|                state = sw_spaces_after_digit;
  754|      6|                break;
  755|      6|            }
  756|       |
  757|      0|            if (ch < '0' || ch > '9') {
  ------------------
  |  Branch (757:17): [True: 0, False: 0]
  |  Branch (757:29): [True: 0, False: 0]
  ------------------
  758|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  759|      0|            }
  760|       |
  761|      0|            if (r->http_minor > 99) {
  ------------------
  |  Branch (761:17): [True: 0, False: 0]
  ------------------
  762|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  763|      0|            }
  764|       |
  765|      0|            r->http_minor = r->http_minor * 10 + (ch - '0');
  766|      0|            break;
  767|       |
  768|     18|        case sw_spaces_after_digit:
  ------------------
  |  Branch (768:9): [True: 18, False: 99.5k]
  ------------------
  769|     18|            switch (ch) {
  770|     12|            case ' ':
  ------------------
  |  Branch (770:13): [True: 12, False: 6]
  ------------------
  771|     12|                break;
  772|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (772:13): [True: 0, False: 18]
  ------------------
  773|      0|                state = sw_almost_done;
  774|      0|                break;
  775|      6|            case LF:
  ------------------
  |  |  103|      6|#define LF     (u_char) '\n'
  ------------------
  |  Branch (775:13): [True: 6, False: 12]
  ------------------
  776|      6|                goto done;
  777|      0|            default:
  ------------------
  |  Branch (777:13): [True: 0, False: 18]
  ------------------
  778|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  779|     18|            }
  780|     12|            break;
  781|       |
  782|       |        /* end of request line */
  783|     12|        case sw_almost_done:
  ------------------
  |  Branch (783:9): [True: 0, False: 99.5k]
  ------------------
  784|      0|            r->request_end = p - 1;
  785|      0|            switch (ch) {
  786|      0|            case LF:
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (786:13): [True: 0, False: 0]
  ------------------
  787|      0|                goto done;
  788|      0|            default:
  ------------------
  |  Branch (788:13): [True: 0, False: 0]
  ------------------
  789|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
  790|      0|            }
  791|  99.5k|        }
  792|  99.5k|    }
  793|       |
  794|     98|    b->pos = p;
  795|     98|    r->state = state;
  796|       |
  797|     98|    return NGX_AGAIN;
  ------------------
  |  |   40|     98|#define  NGX_AGAIN      -2
  ------------------
  798|       |
  799|     12|done:
  800|       |
  801|     12|    b->pos = p + 1;
  802|       |
  803|     12|    if (r->request_end == NULL) {
  ------------------
  |  Branch (803:9): [True: 12, False: 0]
  ------------------
  804|     12|        r->request_end = p;
  805|     12|    }
  806|       |
  807|     12|    r->http_version = r->http_major * 1000 + r->http_minor;
  808|     12|    r->state = sw_start;
  809|       |
  810|     12|    if (r->http_version == 9 && r->method != NGX_HTTP_GET) {
  ------------------
  |  |   30|      4|#define NGX_HTTP_GET                       0x00000002
  ------------------
  |  Branch (810:9): [True: 4, False: 8]
  |  Branch (810:33): [True: 0, False: 4]
  ------------------
  811|      0|        return NGX_HTTP_PARSE_INVALID_09_METHOD;
  ------------------
  |  |   60|      0|#define NGX_HTTP_PARSE_INVALID_09_METHOD   13
  ------------------
  812|      0|    }
  813|       |
  814|     12|    return NGX_OK;
  ------------------
  |  |   38|     12|#define  NGX_OK          0
  ------------------
  815|     12|}
ngx_http_parse_header_line:
  821|     38|{
  822|     38|    u_char      c, ch, *p;
  823|     38|    ngx_uint_t  hash, i;
  824|     38|    enum {
  825|     38|        sw_start = 0,
  826|     38|        sw_name,
  827|     38|        sw_space_before_value,
  828|     38|        sw_value,
  829|     38|        sw_space_after_value,
  830|     38|        sw_ignore_line,
  831|     38|        sw_almost_done,
  832|     38|        sw_header_almost_done
  833|     38|    } state;
  834|       |
  835|       |    /* the last '\0' is not needed because string is zero terminated */
  836|       |
  837|     38|    static u_char  lowcase[] =
  838|     38|        "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
  839|     38|        "\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0" "0123456789\0\0\0\0\0\0"
  840|     38|        "\0abcdefghijklmnopqrstuvwxyz\0\0\0\0\0"
  841|     38|        "\0abcdefghijklmnopqrstuvwxyz\0\0\0\0\0"
  842|     38|        "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
  843|     38|        "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
  844|     38|        "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
  845|     38|        "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
  846|       |
  847|     38|    state = r->state;
  848|     38|    hash = r->header_hash;
  849|     38|    i = r->lowcase_index;
  850|       |
  851|  38.9k|    for (p = b->pos; p < b->last; p++) {
  ------------------
  |  Branch (851:22): [True: 38.9k, False: 0]
  ------------------
  852|  38.9k|        ch = *p;
  853|       |
  854|  38.9k|        switch (state) {
  ------------------
  |  Branch (854:17): [True: 0, False: 38.9k]
  ------------------
  855|       |
  856|       |        /* first char */
  857|     38|        case sw_start:
  ------------------
  |  Branch (857:9): [True: 38, False: 38.8k]
  ------------------
  858|     38|            r->header_name_start = p;
  859|     38|            r->invalid_header = 0;
  860|       |
  861|     38|            switch (ch) {
  862|      2|            case CR:
  ------------------
  |  |  104|      2|#define CR     (u_char) '\r'
  ------------------
  |  Branch (862:13): [True: 2, False: 36]
  ------------------
  863|      2|                r->header_end = p;
  864|      2|                state = sw_header_almost_done;
  865|      2|                break;
  866|     10|            case LF:
  ------------------
  |  |  103|     10|#define LF     (u_char) '\n'
  ------------------
  |  Branch (866:13): [True: 10, False: 28]
  ------------------
  867|     10|                r->header_end = p;
  868|     10|                goto header_done;
  869|     26|            default:
  ------------------
  |  Branch (869:13): [True: 26, False: 12]
  ------------------
  870|     26|                state = sw_name;
  871|       |
  872|     26|                c = lowcase[ch];
  873|       |
  874|     26|                if (c) {
  ------------------
  |  Branch (874:21): [True: 25, False: 1]
  ------------------
  875|     25|                    hash = ngx_hash(0, c);
  ------------------
  |  |  114|     25|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
  876|     25|                    r->lowcase_header[0] = c;
  877|     25|                    i = 1;
  878|     25|                    break;
  879|     25|                }
  880|       |
  881|      1|                if (ch == '_') {
  ------------------
  |  Branch (881:21): [True: 0, False: 1]
  ------------------
  882|      0|                    if (allow_underscores) {
  ------------------
  |  Branch (882:25): [True: 0, False: 0]
  ------------------
  883|      0|                        hash = ngx_hash(0, ch);
  ------------------
  |  |  114|      0|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
  884|      0|                        r->lowcase_header[0] = ch;
  885|      0|                        i = 1;
  886|       |
  887|      0|                    } else {
  888|      0|                        hash = 0;
  889|      0|                        i = 0;
  890|      0|                        r->invalid_header = 1;
  891|      0|                    }
  892|       |
  893|      0|                    break;
  894|      0|                }
  895|       |
  896|      1|                if (ch <= 0x20 || ch == 0x7f || ch == ':') {
  ------------------
  |  Branch (896:21): [True: 0, False: 1]
  |  Branch (896:35): [True: 0, False: 1]
  |  Branch (896:49): [True: 0, False: 1]
  ------------------
  897|      0|                    r->header_end = p;
  898|      0|                    return NGX_HTTP_PARSE_INVALID_HEADER;
  ------------------
  |  |   62|      0|#define NGX_HTTP_PARSE_INVALID_HEADER      14
  ------------------
  899|      0|                }
  900|       |
  901|      1|                hash = 0;
  902|      1|                i = 0;
  903|      1|                r->invalid_header = 1;
  904|       |
  905|      1|                break;
  906|       |
  907|     38|            }
  908|     28|            break;
  909|       |
  910|       |        /* header name */
  911|  7.81k|        case sw_name:
  ------------------
  |  Branch (911:9): [True: 7.81k, False: 31.0k]
  ------------------
  912|  7.81k|            c = lowcase[ch];
  913|       |
  914|  7.81k|            if (c) {
  ------------------
  |  Branch (914:17): [True: 7.73k, False: 82]
  ------------------
  915|  7.73k|                hash = ngx_hash(hash, c);
  ------------------
  |  |  114|  7.73k|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
  916|  7.73k|                r->lowcase_header[i++] = c;
  917|  7.73k|                i &= (NGX_HTTP_LC_HEADER_LEN - 1);
  ------------------
  |  |   16|  7.73k|#define NGX_HTTP_LC_HEADER_LEN             32
  ------------------
  918|  7.73k|                break;
  919|  7.73k|            }
  920|       |
  921|     82|            if (ch == '_') {
  ------------------
  |  Branch (921:17): [True: 28, False: 54]
  ------------------
  922|     28|                if (allow_underscores) {
  ------------------
  |  Branch (922:21): [True: 28, False: 0]
  ------------------
  923|     28|                    hash = ngx_hash(hash, ch);
  ------------------
  |  |  114|     28|#define ngx_hash(key, c)   ((ngx_uint_t) key * 31 + c)
  ------------------
  924|     28|                    r->lowcase_header[i++] = ch;
  925|     28|                    i &= (NGX_HTTP_LC_HEADER_LEN - 1);
  ------------------
  |  |   16|     28|#define NGX_HTTP_LC_HEADER_LEN             32
  ------------------
  926|       |
  927|     28|                } else {
  928|      0|                    r->invalid_header = 1;
  929|      0|                }
  930|       |
  931|     28|                break;
  932|     28|            }
  933|       |
  934|     54|            if (ch == ':') {
  ------------------
  |  Branch (934:17): [True: 24, False: 30]
  ------------------
  935|     24|                r->header_name_end = p;
  936|     24|                state = sw_space_before_value;
  937|     24|                break;
  938|     24|            }
  939|       |
  940|     30|            if (ch == CR) {
  ------------------
  |  |  104|     30|#define CR     (u_char) '\r'
  ------------------
  |  Branch (940:17): [True: 0, False: 30]
  ------------------
  941|      0|                r->header_name_end = p;
  942|      0|                r->header_start = p;
  943|      0|                r->header_end = p;
  944|      0|                state = sw_almost_done;
  945|      0|                break;
  946|      0|            }
  947|       |
  948|     30|            if (ch == LF) {
  ------------------
  |  |  103|     30|#define LF     (u_char) '\n'
  ------------------
  |  Branch (948:17): [True: 2, False: 28]
  ------------------
  949|      2|                r->header_name_end = p;
  950|      2|                r->header_start = p;
  951|      2|                r->header_end = p;
  952|      2|                goto done;
  953|      2|            }
  954|       |
  955|       |            /* IIS may send the duplicate "HTTP/1.1 ..." lines */
  956|     28|            if (ch == '/'
  ------------------
  |  Branch (956:17): [True: 4, False: 24]
  ------------------
  957|     28|                && r->upstream
  ------------------
  |  Branch (957:20): [True: 4, False: 0]
  ------------------
  958|     28|                && p - r->header_name_start == 4
  ------------------
  |  Branch (958:20): [True: 0, False: 4]
  ------------------
  959|     28|                && ngx_strncmp(r->header_name_start, "HTTP", 4) == 0)
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (959:20): [True: 0, False: 0]
  ------------------
  960|      0|            {
  961|      0|                state = sw_ignore_line;
  962|      0|                break;
  963|      0|            }
  964|       |
  965|     28|            if (ch <= 0x20 || ch == 0x7f) {
  ------------------
  |  Branch (965:17): [True: 0, False: 28]
  |  Branch (965:31): [True: 0, False: 28]
  ------------------
  966|      0|                r->header_end = p;
  967|      0|                return NGX_HTTP_PARSE_INVALID_HEADER;
  ------------------
  |  |   62|      0|#define NGX_HTTP_PARSE_INVALID_HEADER      14
  ------------------
  968|      0|            }
  969|       |
  970|     28|            r->invalid_header = 1;
  971|       |
  972|     28|            break;
  973|       |
  974|       |        /* space* before header value */
  975|     26|        case sw_space_before_value:
  ------------------
  |  Branch (975:9): [True: 26, False: 38.8k]
  ------------------
  976|     26|            switch (ch) {
  977|      2|            case ' ':
  ------------------
  |  Branch (977:13): [True: 2, False: 24]
  ------------------
  978|      2|                break;
  979|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (979:13): [True: 0, False: 26]
  ------------------
  980|      0|                r->header_start = p;
  981|      0|                r->header_end = p;
  982|      0|                state = sw_almost_done;
  983|      0|                break;
  984|      0|            case LF:
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (984:13): [True: 0, False: 26]
  ------------------
  985|      0|                r->header_start = p;
  986|      0|                r->header_end = p;
  987|      0|                goto done;
  988|      0|            case '\0':
  ------------------
  |  Branch (988:13): [True: 0, False: 26]
  ------------------
  989|      0|                r->header_end = p;
  990|      0|                return NGX_HTTP_PARSE_INVALID_HEADER;
  ------------------
  |  |   62|      0|#define NGX_HTTP_PARSE_INVALID_HEADER      14
  ------------------
  991|     24|            default:
  ------------------
  |  Branch (991:13): [True: 24, False: 2]
  ------------------
  992|     24|                r->header_start = p;
  993|     24|                state = sw_value;
  994|     24|                break;
  995|     26|            }
  996|     26|            break;
  997|       |
  998|       |        /* header value */
  999|  31.0k|        case sw_value:
  ------------------
  |  Branch (999:9): [True: 31.0k, False: 7.90k]
  ------------------
 1000|  31.0k|            switch (ch) {
  ------------------
  |  Branch (1000:21): [True: 30.9k, False: 33]
  ------------------
 1001|     15|            case ' ':
  ------------------
  |  Branch (1001:13): [True: 15, False: 30.9k]
  ------------------
 1002|     15|                r->header_end = p;
 1003|     15|                state = sw_space_after_value;
 1004|     15|                break;
 1005|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (1005:13): [True: 0, False: 31.0k]
  ------------------
 1006|      0|                r->header_end = p;
 1007|      0|                state = sw_almost_done;
 1008|      0|                break;
 1009|     18|            case LF:
  ------------------
  |  |  103|     18|#define LF     (u_char) '\n'
  ------------------
  |  Branch (1009:13): [True: 18, False: 30.9k]
  ------------------
 1010|     18|                r->header_end = p;
 1011|     18|                goto done;
 1012|      0|            case '\0':
  ------------------
  |  Branch (1012:13): [True: 0, False: 31.0k]
  ------------------
 1013|      0|                r->header_end = p;
 1014|      0|                return NGX_HTTP_PARSE_INVALID_HEADER;
  ------------------
  |  |   62|      0|#define NGX_HTTP_PARSE_INVALID_HEADER      14
  ------------------
 1015|  31.0k|            }
 1016|  30.9k|            break;
 1017|       |
 1018|       |        /* space* before end of header line */
 1019|  30.9k|        case sw_space_after_value:
  ------------------
  |  Branch (1019:9): [True: 25, False: 38.8k]
  ------------------
 1020|     25|            switch (ch) {
 1021|     10|            case ' ':
  ------------------
  |  Branch (1021:13): [True: 10, False: 15]
  ------------------
 1022|     10|                break;
 1023|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (1023:13): [True: 0, False: 25]
  ------------------
 1024|      0|                state = sw_almost_done;
 1025|      0|                break;
 1026|      6|            case LF:
  ------------------
  |  |  103|      6|#define LF     (u_char) '\n'
  ------------------
  |  Branch (1026:13): [True: 6, False: 19]
  ------------------
 1027|      6|                goto done;
 1028|      0|            case '\0':
  ------------------
  |  Branch (1028:13): [True: 0, False: 25]
  ------------------
 1029|      0|                r->header_end = p;
 1030|      0|                return NGX_HTTP_PARSE_INVALID_HEADER;
  ------------------
  |  |   62|      0|#define NGX_HTTP_PARSE_INVALID_HEADER      14
  ------------------
 1031|      9|            default:
  ------------------
  |  Branch (1031:13): [True: 9, False: 16]
  ------------------
 1032|      9|                state = sw_value;
 1033|      9|                break;
 1034|     25|            }
 1035|     19|            break;
 1036|       |
 1037|       |        /* ignore header line */
 1038|     19|        case sw_ignore_line:
  ------------------
  |  Branch (1038:9): [True: 0, False: 38.9k]
  ------------------
 1039|      0|            switch (ch) {
 1040|      0|            case LF:
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (1040:13): [True: 0, False: 0]
  ------------------
 1041|      0|                state = sw_start;
 1042|      0|                break;
 1043|      0|            default:
  ------------------
  |  Branch (1043:13): [True: 0, False: 0]
  ------------------
 1044|      0|                break;
 1045|      0|            }
 1046|      0|            break;
 1047|       |
 1048|       |        /* end of header line */
 1049|      0|        case sw_almost_done:
  ------------------
  |  Branch (1049:9): [True: 0, False: 38.9k]
  ------------------
 1050|      0|            switch (ch) {
 1051|      0|            case LF:
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (1051:13): [True: 0, False: 0]
  ------------------
 1052|      0|                goto done;
 1053|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (1053:13): [True: 0, False: 0]
  ------------------
 1054|      0|                break;
 1055|      0|            default:
  ------------------
  |  Branch (1055:13): [True: 0, False: 0]
  ------------------
 1056|      0|                return NGX_HTTP_PARSE_INVALID_HEADER;
  ------------------
  |  |   62|      0|#define NGX_HTTP_PARSE_INVALID_HEADER      14
  ------------------
 1057|      0|            }
 1058|      0|            break;
 1059|       |
 1060|       |        /* end of header */
 1061|      2|        case sw_header_almost_done:
  ------------------
  |  Branch (1061:9): [True: 2, False: 38.9k]
  ------------------
 1062|      2|            switch (ch) {
 1063|      2|            case LF:
  ------------------
  |  |  103|      2|#define LF     (u_char) '\n'
  ------------------
  |  Branch (1063:13): [True: 2, False: 0]
  ------------------
 1064|      2|                goto header_done;
 1065|      0|            default:
  ------------------
  |  Branch (1065:13): [True: 0, False: 2]
  ------------------
 1066|      0|                return NGX_HTTP_PARSE_INVALID_HEADER;
  ------------------
  |  |   62|      0|#define NGX_HTTP_PARSE_INVALID_HEADER      14
  ------------------
 1067|      2|            }
 1068|  38.9k|        }
 1069|  38.9k|    }
 1070|       |
 1071|      0|    b->pos = p;
 1072|      0|    r->state = state;
 1073|      0|    r->header_hash = hash;
 1074|      0|    r->lowcase_index = i;
 1075|       |
 1076|      0|    return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1077|       |
 1078|     26|done:
 1079|       |
 1080|     26|    b->pos = p + 1;
 1081|     26|    r->state = sw_start;
 1082|     26|    r->header_hash = hash;
 1083|     26|    r->lowcase_index = i;
 1084|       |
 1085|     26|    return NGX_OK;
  ------------------
  |  |   38|     26|#define  NGX_OK          0
  ------------------
 1086|       |
 1087|     12|header_done:
 1088|       |
 1089|     12|    b->pos = p + 1;
 1090|     12|    r->state = sw_start;
 1091|       |
 1092|     12|    return NGX_HTTP_PARSE_HEADER_DONE;
  ------------------
  |  |   54|     12|#define NGX_HTTP_PARSE_HEADER_DONE         1
  ------------------
 1093|     38|}
ngx_http_parse_complex_uri:
 1249|      4|{
 1250|      4|    u_char  c, ch, decoded, *p, *u;
 1251|      4|    enum {
 1252|      4|        sw_usual = 0,
 1253|      4|        sw_slash,
 1254|      4|        sw_dot,
 1255|      4|        sw_dot_dot,
 1256|      4|        sw_quoted,
 1257|      4|        sw_quoted_second
 1258|      4|    } state, quoted_state;
 1259|       |
 1260|      4|#if (NGX_SUPPRESS_WARN)
 1261|      4|    decoded = '\0';
 1262|      4|    quoted_state = sw_usual;
 1263|      4|#endif
 1264|       |
 1265|      4|    state = sw_usual;
 1266|      4|    p = r->uri_start;
 1267|      4|    u = r->uri.data;
 1268|      4|    r->uri_ext = NULL;
 1269|      4|    r->args_start = NULL;
 1270|       |
 1271|      4|    if (r->empty_path_in_uri) {
  ------------------
  |  Branch (1271:9): [True: 0, False: 4]
  ------------------
 1272|      0|        *u++ = '/';
 1273|      0|    }
 1274|       |
 1275|      4|    ch = *p++;
 1276|       |
 1277|  1.93k|    while (p <= r->uri_end) {
  ------------------
  |  Branch (1277:12): [True: 1.93k, False: 4]
  ------------------
 1278|       |
 1279|       |        /*
 1280|       |         * we use "ch = *p++" inside the cycle, but this operation is safe,
 1281|       |         * because after the URI there is always at least one character:
 1282|       |         * the line feed
 1283|       |         */
 1284|       |
 1285|  1.93k|        ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1286|  1.93k|                       "s:%d in:'%Xd:%c'", state, ch, ch);
 1287|       |
 1288|  1.93k|        switch (state) {
  ------------------
  |  Branch (1288:17): [True: 0, False: 1.93k]
  ------------------
 1289|       |
 1290|  1.92k|        case sw_usual:
  ------------------
  |  Branch (1290:9): [True: 1.92k, False: 15]
  ------------------
 1291|       |
 1292|  1.92k|            if (usual[ch >> 5] & (1U << (ch & 0x1f))) {
  ------------------
  |  Branch (1292:17): [True: 1.91k, False: 10]
  ------------------
 1293|  1.91k|                *u++ = ch;
 1294|  1.91k|                ch = *p++;
 1295|  1.91k|                break;
 1296|  1.91k|            }
 1297|       |
 1298|     10|            switch (ch) {
 1299|       |#if (NGX_WIN32)
 1300|       |            case '\\':
 1301|       |                if (u - 2 >= r->uri.data
 1302|       |                    && *(u - 1) == '.' && *(u - 2) != '.')
 1303|       |                {
 1304|       |                    u--;
 1305|       |                }
 1306|       |
 1307|       |                r->uri_ext = NULL;
 1308|       |
 1309|       |                if (p == r->uri_start + r->uri.len) {
 1310|       |
 1311|       |                    /*
 1312|       |                     * we omit the last "\" to cause redirect because
 1313|       |                     * the browsers do not treat "\" as "/" in relative URL path
 1314|       |                     */
 1315|       |
 1316|       |                    break;
 1317|       |                }
 1318|       |
 1319|       |                state = sw_slash;
 1320|       |                *u++ = '/';
 1321|       |                break;
 1322|       |#endif
 1323|      7|            case '/':
  ------------------
  |  Branch (1323:13): [True: 7, False: 3]
  ------------------
 1324|       |#if (NGX_WIN32)
 1325|       |                if (u - 2 >= r->uri.data
 1326|       |                    && *(u - 1) == '.' && *(u - 2) != '.')
 1327|       |                {
 1328|       |                    u--;
 1329|       |                }
 1330|       |#endif
 1331|      7|                r->uri_ext = NULL;
 1332|      7|                state = sw_slash;
 1333|      7|                *u++ = ch;
 1334|      7|                break;
 1335|      0|            case '%':
  ------------------
  |  Branch (1335:13): [True: 0, False: 10]
  ------------------
 1336|      0|                quoted_state = state;
 1337|      0|                state = sw_quoted;
 1338|      0|                break;
 1339|      0|            case '?':
  ------------------
  |  Branch (1339:13): [True: 0, False: 10]
  ------------------
 1340|      0|                r->args_start = p;
 1341|      0|                goto args;
 1342|      0|            case '#':
  ------------------
  |  Branch (1342:13): [True: 0, False: 10]
  ------------------
 1343|      0|                goto done;
 1344|      2|            case '.':
  ------------------
  |  Branch (1344:13): [True: 2, False: 8]
  ------------------
 1345|      2|                r->uri_ext = u + 1;
 1346|      2|                *u++ = ch;
 1347|      2|                break;
 1348|      1|            case '+':
  ------------------
  |  Branch (1348:13): [True: 1, False: 9]
  ------------------
 1349|      1|                r->plus_in_uri = 1;
 1350|       |                /* fall through */
 1351|      1|            default:
  ------------------
  |  Branch (1351:13): [True: 0, False: 10]
  ------------------
 1352|      1|                *u++ = ch;
 1353|      1|                break;
 1354|     10|            }
 1355|       |
 1356|     10|            ch = *p++;
 1357|     10|            break;
 1358|       |
 1359|     15|        case sw_slash:
  ------------------
  |  Branch (1359:9): [True: 15, False: 1.92k]
  ------------------
 1360|       |
 1361|     15|            if (usual[ch >> 5] & (1U << (ch & 0x1f))) {
  ------------------
  |  Branch (1361:17): [True: 5, False: 10]
  ------------------
 1362|      5|                state = sw_usual;
 1363|      5|                *u++ = ch;
 1364|      5|                ch = *p++;
 1365|      5|                break;
 1366|      5|            }
 1367|       |
 1368|     10|            switch (ch) {
 1369|       |#if (NGX_WIN32)
 1370|       |            case '\\':
 1371|       |                break;
 1372|       |#endif
 1373|     10|            case '/':
  ------------------
  |  Branch (1373:13): [True: 10, False: 0]
  ------------------
 1374|     10|                if (!merge_slashes) {
  ------------------
  |  Branch (1374:21): [True: 0, False: 10]
  ------------------
 1375|      0|                    *u++ = ch;
 1376|      0|                }
 1377|     10|                break;
 1378|      0|            case '.':
  ------------------
  |  Branch (1378:13): [True: 0, False: 10]
  ------------------
 1379|      0|                state = sw_dot;
 1380|      0|                *u++ = ch;
 1381|      0|                break;
 1382|      0|            case '%':
  ------------------
  |  Branch (1382:13): [True: 0, False: 10]
  ------------------
 1383|      0|                quoted_state = state;
 1384|      0|                state = sw_quoted;
 1385|      0|                break;
 1386|      0|            case '?':
  ------------------
  |  Branch (1386:13): [True: 0, False: 10]
  ------------------
 1387|      0|                r->args_start = p;
 1388|      0|                goto args;
 1389|      0|            case '#':
  ------------------
  |  Branch (1389:13): [True: 0, False: 10]
  ------------------
 1390|      0|                goto done;
 1391|      0|            case '+':
  ------------------
  |  Branch (1391:13): [True: 0, False: 10]
  ------------------
 1392|      0|                r->plus_in_uri = 1;
 1393|       |                /* fall through */
 1394|      0|            default:
  ------------------
  |  Branch (1394:13): [True: 0, False: 10]
  ------------------
 1395|      0|                state = sw_usual;
 1396|      0|                *u++ = ch;
 1397|      0|                break;
 1398|     10|            }
 1399|       |
 1400|     10|            ch = *p++;
 1401|     10|            break;
 1402|       |
 1403|      0|        case sw_dot:
  ------------------
  |  Branch (1403:9): [True: 0, False: 1.93k]
  ------------------
 1404|       |
 1405|      0|            if (usual[ch >> 5] & (1U << (ch & 0x1f))) {
  ------------------
  |  Branch (1405:17): [True: 0, False: 0]
  ------------------
 1406|      0|                state = sw_usual;
 1407|      0|                *u++ = ch;
 1408|      0|                ch = *p++;
 1409|      0|                break;
 1410|      0|            }
 1411|       |
 1412|      0|            switch (ch) {
 1413|       |#if (NGX_WIN32)
 1414|       |            case '\\':
 1415|       |#endif
 1416|      0|            case '/':
  ------------------
  |  Branch (1416:13): [True: 0, False: 0]
  ------------------
 1417|      0|                state = sw_slash;
 1418|      0|                u--;
 1419|      0|                break;
 1420|      0|            case '.':
  ------------------
  |  Branch (1420:13): [True: 0, False: 0]
  ------------------
 1421|      0|                state = sw_dot_dot;
 1422|      0|                *u++ = ch;
 1423|      0|                break;
 1424|      0|            case '%':
  ------------------
  |  Branch (1424:13): [True: 0, False: 0]
  ------------------
 1425|      0|                quoted_state = state;
 1426|      0|                state = sw_quoted;
 1427|      0|                break;
 1428|      0|            case '?':
  ------------------
  |  Branch (1428:13): [True: 0, False: 0]
  ------------------
 1429|      0|                u--;
 1430|      0|                r->args_start = p;
 1431|      0|                goto args;
 1432|      0|            case '#':
  ------------------
  |  Branch (1432:13): [True: 0, False: 0]
  ------------------
 1433|      0|                u--;
 1434|      0|                goto done;
 1435|      0|            case '+':
  ------------------
  |  Branch (1435:13): [True: 0, False: 0]
  ------------------
 1436|      0|                r->plus_in_uri = 1;
 1437|       |                /* fall through */
 1438|      0|            default:
  ------------------
  |  Branch (1438:13): [True: 0, False: 0]
  ------------------
 1439|      0|                state = sw_usual;
 1440|      0|                *u++ = ch;
 1441|      0|                break;
 1442|      0|            }
 1443|       |
 1444|      0|            ch = *p++;
 1445|      0|            break;
 1446|       |
 1447|      0|        case sw_dot_dot:
  ------------------
  |  Branch (1447:9): [True: 0, False: 1.93k]
  ------------------
 1448|       |
 1449|      0|            if (usual[ch >> 5] & (1U << (ch & 0x1f))) {
  ------------------
  |  Branch (1449:17): [True: 0, False: 0]
  ------------------
 1450|      0|                state = sw_usual;
 1451|      0|                *u++ = ch;
 1452|      0|                ch = *p++;
 1453|      0|                break;
 1454|      0|            }
 1455|       |
 1456|      0|            switch (ch) {
 1457|       |#if (NGX_WIN32)
 1458|       |            case '\\':
 1459|       |#endif
 1460|      0|            case '/':
  ------------------
  |  Branch (1460:13): [True: 0, False: 0]
  ------------------
 1461|      0|            case '?':
  ------------------
  |  Branch (1461:13): [True: 0, False: 0]
  ------------------
 1462|      0|            case '#':
  ------------------
  |  Branch (1462:13): [True: 0, False: 0]
  ------------------
 1463|      0|                u -= 4;
 1464|      0|                for ( ;; ) {
 1465|      0|                    if (u < r->uri.data) {
  ------------------
  |  Branch (1465:25): [True: 0, False: 0]
  ------------------
 1466|      0|                        return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
 1467|      0|                    }
 1468|      0|                    if (*u == '/') {
  ------------------
  |  Branch (1468:25): [True: 0, False: 0]
  ------------------
 1469|      0|                        u++;
 1470|      0|                        break;
 1471|      0|                    }
 1472|      0|                    u--;
 1473|      0|                }
 1474|      0|                if (ch == '?') {
  ------------------
  |  Branch (1474:21): [True: 0, False: 0]
  ------------------
 1475|      0|                    r->args_start = p;
 1476|      0|                    goto args;
 1477|      0|                }
 1478|      0|                if (ch == '#') {
  ------------------
  |  Branch (1478:21): [True: 0, False: 0]
  ------------------
 1479|      0|                    goto done;
 1480|      0|                }
 1481|      0|                state = sw_slash;
 1482|      0|                break;
 1483|      0|            case '%':
  ------------------
  |  Branch (1483:13): [True: 0, False: 0]
  ------------------
 1484|      0|                quoted_state = state;
 1485|      0|                state = sw_quoted;
 1486|      0|                break;
 1487|      0|            case '+':
  ------------------
  |  Branch (1487:13): [True: 0, False: 0]
  ------------------
 1488|      0|                r->plus_in_uri = 1;
 1489|       |                /* fall through */
 1490|      0|            default:
  ------------------
  |  Branch (1490:13): [True: 0, False: 0]
  ------------------
 1491|      0|                state = sw_usual;
 1492|      0|                *u++ = ch;
 1493|      0|                break;
 1494|      0|            }
 1495|       |
 1496|      0|            ch = *p++;
 1497|      0|            break;
 1498|       |
 1499|      0|        case sw_quoted:
  ------------------
  |  Branch (1499:9): [True: 0, False: 1.93k]
  ------------------
 1500|      0|            r->quoted_uri = 1;
 1501|       |
 1502|      0|            if (ch >= '0' && ch <= '9') {
  ------------------
  |  Branch (1502:17): [True: 0, False: 0]
  |  Branch (1502:30): [True: 0, False: 0]
  ------------------
 1503|      0|                decoded = (u_char) (ch - '0');
 1504|      0|                state = sw_quoted_second;
 1505|      0|                ch = *p++;
 1506|      0|                break;
 1507|      0|            }
 1508|       |
 1509|      0|            c = (u_char) (ch | 0x20);
 1510|      0|            if (c >= 'a' && c <= 'f') {
  ------------------
  |  Branch (1510:17): [True: 0, False: 0]
  |  Branch (1510:29): [True: 0, False: 0]
  ------------------
 1511|      0|                decoded = (u_char) (c - 'a' + 10);
 1512|      0|                state = sw_quoted_second;
 1513|      0|                ch = *p++;
 1514|      0|                break;
 1515|      0|            }
 1516|       |
 1517|      0|            return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
 1518|       |
 1519|      0|        case sw_quoted_second:
  ------------------
  |  Branch (1519:9): [True: 0, False: 1.93k]
  ------------------
 1520|      0|            if (ch >= '0' && ch <= '9') {
  ------------------
  |  Branch (1520:17): [True: 0, False: 0]
  |  Branch (1520:30): [True: 0, False: 0]
  ------------------
 1521|      0|                ch = (u_char) ((decoded << 4) + (ch - '0'));
 1522|       |
 1523|      0|                if (ch == '%' || ch == '#') {
  ------------------
  |  Branch (1523:21): [True: 0, False: 0]
  |  Branch (1523:34): [True: 0, False: 0]
  ------------------
 1524|      0|                    state = sw_usual;
 1525|      0|                    *u++ = ch;
 1526|      0|                    ch = *p++;
 1527|      0|                    break;
 1528|       |
 1529|      0|                } else if (ch == '\0') {
  ------------------
  |  Branch (1529:28): [True: 0, False: 0]
  ------------------
 1530|      0|                    return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
 1531|      0|                }
 1532|       |
 1533|      0|                state = quoted_state;
 1534|      0|                break;
 1535|      0|            }
 1536|       |
 1537|      0|            c = (u_char) (ch | 0x20);
 1538|      0|            if (c >= 'a' && c <= 'f') {
  ------------------
  |  Branch (1538:17): [True: 0, False: 0]
  |  Branch (1538:29): [True: 0, False: 0]
  ------------------
 1539|      0|                ch = (u_char) ((decoded << 4) + (c - 'a') + 10);
 1540|       |
 1541|      0|                if (ch == '?') {
  ------------------
  |  Branch (1541:21): [True: 0, False: 0]
  ------------------
 1542|      0|                    state = sw_usual;
 1543|      0|                    *u++ = ch;
 1544|      0|                    ch = *p++;
 1545|      0|                    break;
 1546|       |
 1547|      0|                } else if (ch == '+') {
  ------------------
  |  Branch (1547:28): [True: 0, False: 0]
  ------------------
 1548|      0|                    r->plus_in_uri = 1;
 1549|      0|                }
 1550|       |
 1551|      0|                state = quoted_state;
 1552|      0|                break;
 1553|      0|            }
 1554|       |
 1555|      0|            return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
 1556|  1.93k|        }
 1557|  1.93k|    }
 1558|       |
 1559|      4|    if (state == sw_quoted || state == sw_quoted_second) {
  ------------------
  |  Branch (1559:9): [True: 0, False: 4]
  |  Branch (1559:31): [True: 0, False: 4]
  ------------------
 1560|      0|        return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
 1561|      0|    }
 1562|       |
 1563|      4|    if (state == sw_dot) {
  ------------------
  |  Branch (1563:9): [True: 0, False: 4]
  ------------------
 1564|      0|        u--;
 1565|       |
 1566|      4|    } else if (state == sw_dot_dot) {
  ------------------
  |  Branch (1566:16): [True: 0, False: 4]
  ------------------
 1567|      0|        u -= 4;
 1568|       |
 1569|      0|        for ( ;; ) {
 1570|      0|            if (u < r->uri.data) {
  ------------------
  |  Branch (1570:17): [True: 0, False: 0]
  ------------------
 1571|      0|                return NGX_HTTP_PARSE_INVALID_REQUEST;
  ------------------
  |  |   58|      0|#define NGX_HTTP_PARSE_INVALID_REQUEST     11
  ------------------
 1572|      0|            }
 1573|       |
 1574|      0|            if (*u == '/') {
  ------------------
  |  Branch (1574:17): [True: 0, False: 0]
  ------------------
 1575|      0|                u++;
 1576|      0|                break;
 1577|      0|            }
 1578|       |
 1579|      0|            u--;
 1580|      0|        }
 1581|      0|    }
 1582|       |
 1583|      4|done:
 1584|       |
 1585|      4|    r->uri.len = u - r->uri.data;
 1586|       |
 1587|      4|    if (r->uri_ext) {
  ------------------
  |  Branch (1587:9): [True: 2, False: 2]
  ------------------
 1588|      2|        r->exten.len = u - r->uri_ext;
 1589|      2|        r->exten.data = r->uri_ext;
 1590|      2|    }
 1591|       |
 1592|      4|    r->uri_ext = NULL;
 1593|       |
 1594|      4|    return NGX_OK;
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
 1595|       |
 1596|      0|args:
 1597|       |
 1598|      0|    while (p < r->uri_end) {
  ------------------
  |  Branch (1598:12): [True: 0, False: 0]
  ------------------
 1599|      0|        if (*p++ != '#') {
  ------------------
  |  Branch (1599:13): [True: 0, False: 0]
  ------------------
 1600|      0|            continue;
 1601|      0|        }
 1602|       |
 1603|      0|        r->args.len = p - 1 - r->args_start;
 1604|      0|        r->args.data = r->args_start;
 1605|      0|        r->args_start = NULL;
 1606|       |
 1607|      0|        break;
 1608|      0|    }
 1609|       |
 1610|      0|    r->uri.len = u - r->uri.data;
 1611|       |
 1612|      0|    if (r->uri_ext) {
  ------------------
  |  Branch (1612:9): [True: 0, False: 0]
  ------------------
 1613|      0|        r->exten.len = u - r->uri_ext;
 1614|      0|        r->exten.data = r->uri_ext;
 1615|      0|    }
 1616|       |
 1617|      0|    r->uri_ext = NULL;
 1618|       |
 1619|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1620|      4|}
ngx_http_parse_status_line:
 1626|      5|{
 1627|      5|    u_char   ch;
 1628|      5|    u_char  *p;
 1629|      5|    enum {
 1630|      5|        sw_start = 0,
 1631|      5|        sw_H,
 1632|      5|        sw_HT,
 1633|      5|        sw_HTT,
 1634|      5|        sw_HTTP,
 1635|      5|        sw_first_major_digit,
 1636|      5|        sw_major_digit,
 1637|      5|        sw_first_minor_digit,
 1638|      5|        sw_minor_digit,
 1639|      5|        sw_status,
 1640|      5|        sw_space_after_status,
 1641|      5|        sw_status_text,
 1642|      5|        sw_almost_done
 1643|      5|    } state;
 1644|       |
 1645|      5|    state = r->state;
 1646|       |
 1647|  1.79k|    for (p = b->pos; p < b->last; p++) {
  ------------------
  |  Branch (1647:22): [True: 1.79k, False: 0]
  ------------------
 1648|  1.79k|        ch = *p;
 1649|       |
 1650|  1.79k|        switch (state) {
  ------------------
  |  Branch (1650:17): [True: 0, False: 1.79k]
  ------------------
 1651|       |
 1652|       |        /* "HTTP/" */
 1653|      5|        case sw_start:
  ------------------
  |  Branch (1653:9): [True: 5, False: 1.79k]
  ------------------
 1654|      5|            switch (ch) {
 1655|      4|            case 'H':
  ------------------
  |  Branch (1655:13): [True: 4, False: 1]
  ------------------
 1656|      4|                state = sw_H;
 1657|      4|                break;
 1658|      1|            default:
  ------------------
  |  Branch (1658:13): [True: 1, False: 4]
  ------------------
 1659|      1|                return NGX_ERROR;
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
 1660|      5|            }
 1661|      4|            break;
 1662|       |
 1663|      4|        case sw_H:
  ------------------
  |  Branch (1663:9): [True: 4, False: 1.79k]
  ------------------
 1664|      4|            switch (ch) {
 1665|      4|            case 'T':
  ------------------
  |  Branch (1665:13): [True: 4, False: 0]
  ------------------
 1666|      4|                state = sw_HT;
 1667|      4|                break;
 1668|      0|            default:
  ------------------
  |  Branch (1668:13): [True: 0, False: 4]
  ------------------
 1669|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1670|      4|            }
 1671|      4|            break;
 1672|       |
 1673|      4|        case sw_HT:
  ------------------
  |  Branch (1673:9): [True: 4, False: 1.79k]
  ------------------
 1674|      4|            switch (ch) {
 1675|      4|            case 'T':
  ------------------
  |  Branch (1675:13): [True: 4, False: 0]
  ------------------
 1676|      4|                state = sw_HTT;
 1677|      4|                break;
 1678|      0|            default:
  ------------------
  |  Branch (1678:13): [True: 0, False: 4]
  ------------------
 1679|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1680|      4|            }
 1681|      4|            break;
 1682|       |
 1683|      4|        case sw_HTT:
  ------------------
  |  Branch (1683:9): [True: 4, False: 1.79k]
  ------------------
 1684|      4|            switch (ch) {
 1685|      4|            case 'P':
  ------------------
  |  Branch (1685:13): [True: 4, False: 0]
  ------------------
 1686|      4|                state = sw_HTTP;
 1687|      4|                break;
 1688|      0|            default:
  ------------------
  |  Branch (1688:13): [True: 0, False: 4]
  ------------------
 1689|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1690|      4|            }
 1691|      4|            break;
 1692|       |
 1693|      4|        case sw_HTTP:
  ------------------
  |  Branch (1693:9): [True: 4, False: 1.79k]
  ------------------
 1694|      4|            switch (ch) {
 1695|      4|            case '/':
  ------------------
  |  Branch (1695:13): [True: 4, False: 0]
  ------------------
 1696|      4|                state = sw_first_major_digit;
 1697|      4|                break;
 1698|      0|            default:
  ------------------
  |  Branch (1698:13): [True: 0, False: 4]
  ------------------
 1699|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1700|      4|            }
 1701|      4|            break;
 1702|       |
 1703|       |        /* the first digit of major HTTP version */
 1704|      4|        case sw_first_major_digit:
  ------------------
  |  Branch (1704:9): [True: 4, False: 1.79k]
  ------------------
 1705|      4|            if (ch < '1' || ch > '9') {
  ------------------
  |  Branch (1705:17): [True: 0, False: 4]
  |  Branch (1705:29): [True: 0, False: 4]
  ------------------
 1706|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1707|      0|            }
 1708|       |
 1709|      4|            r->http_major = ch - '0';
 1710|      4|            state = sw_major_digit;
 1711|      4|            break;
 1712|       |
 1713|       |        /* the major HTTP version or dot */
 1714|      4|        case sw_major_digit:
  ------------------
  |  Branch (1714:9): [True: 4, False: 1.79k]
  ------------------
 1715|      4|            if (ch == '.') {
  ------------------
  |  Branch (1715:17): [True: 4, False: 0]
  ------------------
 1716|      4|                state = sw_first_minor_digit;
 1717|      4|                break;
 1718|      4|            }
 1719|       |
 1720|      0|            if (ch < '0' || ch > '9') {
  ------------------
  |  Branch (1720:17): [True: 0, False: 0]
  |  Branch (1720:29): [True: 0, False: 0]
  ------------------
 1721|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1722|      0|            }
 1723|       |
 1724|      0|            if (r->http_major > 99) {
  ------------------
  |  Branch (1724:17): [True: 0, False: 0]
  ------------------
 1725|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1726|      0|            }
 1727|       |
 1728|      0|            r->http_major = r->http_major * 10 + (ch - '0');
 1729|      0|            break;
 1730|       |
 1731|       |        /* the first digit of minor HTTP version */
 1732|      4|        case sw_first_minor_digit:
  ------------------
  |  Branch (1732:9): [True: 4, False: 1.79k]
  ------------------
 1733|      4|            if (ch < '0' || ch > '9') {
  ------------------
  |  Branch (1733:17): [True: 0, False: 4]
  |  Branch (1733:29): [True: 0, False: 4]
  ------------------
 1734|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1735|      0|            }
 1736|       |
 1737|      4|            r->http_minor = ch - '0';
 1738|      4|            state = sw_minor_digit;
 1739|      4|            break;
 1740|       |
 1741|       |        /* the minor HTTP version or the end of the request line */
 1742|      6|        case sw_minor_digit:
  ------------------
  |  Branch (1742:9): [True: 6, False: 1.79k]
  ------------------
 1743|      6|            if (ch == ' ') {
  ------------------
  |  Branch (1743:17): [True: 4, False: 2]
  ------------------
 1744|      4|                state = sw_status;
 1745|      4|                break;
 1746|      4|            }
 1747|       |
 1748|      2|            if (ch < '0' || ch > '9') {
  ------------------
  |  Branch (1748:17): [True: 0, False: 2]
  |  Branch (1748:29): [True: 0, False: 2]
  ------------------
 1749|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1750|      0|            }
 1751|       |
 1752|      2|            if (r->http_minor > 99) {
  ------------------
  |  Branch (1752:17): [True: 0, False: 2]
  ------------------
 1753|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1754|      0|            }
 1755|       |
 1756|      2|            r->http_minor = r->http_minor * 10 + (ch - '0');
 1757|      2|            break;
 1758|       |
 1759|       |        /* HTTP status code */
 1760|     12|        case sw_status:
  ------------------
  |  Branch (1760:9): [True: 12, False: 1.78k]
  ------------------
 1761|     12|            if (ch == ' ') {
  ------------------
  |  Branch (1761:17): [True: 0, False: 12]
  ------------------
 1762|      0|                break;
 1763|      0|            }
 1764|       |
 1765|     12|            if (ch < '0' || ch > '9') {
  ------------------
  |  Branch (1765:17): [True: 0, False: 12]
  |  Branch (1765:29): [True: 0, False: 12]
  ------------------
 1766|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1767|      0|            }
 1768|       |
 1769|     12|            status->code = status->code * 10 + (ch - '0');
 1770|       |
 1771|     12|            if (++status->count == 3) {
  ------------------
  |  Branch (1771:17): [True: 4, False: 8]
  ------------------
 1772|      4|                state = sw_space_after_status;
 1773|      4|                status->start = p - 2;
 1774|      4|            }
 1775|       |
 1776|     12|            break;
 1777|       |
 1778|       |        /* space or end of line */
 1779|      4|        case sw_space_after_status:
  ------------------
  |  Branch (1779:9): [True: 4, False: 1.79k]
  ------------------
 1780|      4|            switch (ch) {
 1781|      0|            case ' ':
  ------------------
  |  Branch (1781:13): [True: 0, False: 4]
  ------------------
 1782|      0|                state = sw_status_text;
 1783|      0|                break;
 1784|      2|            case '.':                    /* IIS may send 403.1, 403.2, etc */
  ------------------
  |  Branch (1784:13): [True: 2, False: 2]
  ------------------
 1785|      2|                state = sw_status_text;
 1786|      2|                break;
 1787|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (1787:13): [True: 0, False: 4]
  ------------------
 1788|      0|                state = sw_almost_done;
 1789|      0|                break;
 1790|      2|            case LF:
  ------------------
  |  |  103|      2|#define LF     (u_char) '\n'
  ------------------
  |  Branch (1790:13): [True: 2, False: 2]
  ------------------
 1791|      2|                goto done;
 1792|      0|            default:
  ------------------
  |  Branch (1792:13): [True: 0, False: 4]
  ------------------
 1793|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1794|      4|            }
 1795|      2|            break;
 1796|       |
 1797|       |        /* any text until end of line */
 1798|  1.74k|        case sw_status_text:
  ------------------
  |  Branch (1798:9): [True: 1.74k, False: 55]
  ------------------
 1799|  1.74k|            switch (ch) {
  ------------------
  |  Branch (1799:21): [True: 1.74k, False: 2]
  ------------------
 1800|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (1800:13): [True: 0, False: 1.74k]
  ------------------
 1801|      0|                state = sw_almost_done;
 1802|       |
 1803|      0|                break;
 1804|      2|            case LF:
  ------------------
  |  |  103|      2|#define LF     (u_char) '\n'
  ------------------
  |  Branch (1804:13): [True: 2, False: 1.74k]
  ------------------
 1805|      2|                goto done;
 1806|  1.74k|            }
 1807|  1.74k|            break;
 1808|       |
 1809|       |        /* end of status line */
 1810|  1.74k|        case sw_almost_done:
  ------------------
  |  Branch (1810:9): [True: 0, False: 1.79k]
  ------------------
 1811|      0|            status->end = p - 1;
 1812|      0|            switch (ch) {
 1813|      0|            case LF:
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (1813:13): [True: 0, False: 0]
  ------------------
 1814|      0|                goto done;
 1815|      0|            default:
  ------------------
  |  Branch (1815:13): [True: 0, False: 0]
  ------------------
 1816|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1817|      0|            }
 1818|  1.79k|        }
 1819|  1.79k|    }
 1820|       |
 1821|      0|    b->pos = p;
 1822|      0|    r->state = state;
 1823|       |
 1824|      0|    return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1825|       |
 1826|      4|done:
 1827|       |
 1828|      4|    b->pos = p + 1;
 1829|       |
 1830|      4|    if (status->end == NULL) {
  ------------------
  |  Branch (1830:9): [True: 4, False: 0]
  ------------------
 1831|      4|        status->end = p;
 1832|      4|    }
 1833|       |
 1834|      4|    status->http_version = r->http_major * 1000 + r->http_minor;
 1835|      4|    r->state = sw_start;
 1836|       |
 1837|      4|    return NGX_OK;
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
 1838|      5|}
ngx_http_parse_chunked:
 2147|    118|{
 2148|    118|    u_char     *pos, ch, c;
 2149|    118|    ngx_int_t   rc;
 2150|    118|    enum {
 2151|    118|        sw_chunk_start = 0,
 2152|    118|        sw_chunk_size,
 2153|    118|        sw_chunk_extension,
 2154|    118|        sw_chunk_extension_almost_done,
 2155|    118|        sw_chunk_data,
 2156|    118|        sw_after_data,
 2157|    118|        sw_after_data_almost_done,
 2158|    118|        sw_last_chunk_extension,
 2159|    118|        sw_last_chunk_extension_almost_done,
 2160|    118|        sw_trailer,
 2161|    118|        sw_trailer_almost_done,
 2162|    118|        sw_trailer_header,
 2163|    118|        sw_trailer_header_almost_done
 2164|    118|    } state;
 2165|       |
 2166|    118|    state = ctx->state;
 2167|       |
 2168|    118|    if (state == sw_chunk_data && ctx->size == 0) {
  ------------------
  |  Branch (2168:9): [True: 83, False: 35]
  |  Branch (2168:35): [True: 45, False: 38]
  ------------------
 2169|     45|        state = sw_after_data;
 2170|     45|    }
 2171|       |
 2172|    118|    rc = NGX_AGAIN;
  ------------------
  |  |   40|    118|#define  NGX_AGAIN      -2
  ------------------
 2173|       |
 2174|   410k|    for (pos = b->pos; pos < b->last; pos++) {
  ------------------
  |  Branch (2174:24): [True: 410k, False: 53]
  ------------------
 2175|       |
 2176|   410k|        ch = *pos;
 2177|       |
 2178|   410k|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2179|   410k|                       "http chunked byte: %02Xd s:%d", ch, state);
 2180|       |
 2181|   410k|        switch (state) {
  ------------------
  |  Branch (2181:17): [True: 0, False: 410k]
  ------------------
 2182|       |
 2183|     52|        case sw_chunk_start:
  ------------------
  |  Branch (2183:9): [True: 52, False: 410k]
  ------------------
 2184|     52|            if (ch >= '0' && ch <= '9') {
  ------------------
  |  Branch (2184:17): [True: 52, False: 0]
  |  Branch (2184:30): [True: 49, False: 3]
  ------------------
 2185|     49|                state = sw_chunk_size;
 2186|     49|                ctx->size = ch - '0';
 2187|     49|                break;
 2188|     49|            }
 2189|       |
 2190|      3|            c = (u_char) (ch | 0x20);
 2191|       |
 2192|      3|            if (c >= 'a' && c <= 'f') {
  ------------------
  |  Branch (2192:17): [True: 3, False: 0]
  |  Branch (2192:29): [True: 3, False: 0]
  ------------------
 2193|      3|                state = sw_chunk_size;
 2194|      3|                ctx->size = c - 'a' + 10;
 2195|      3|                break;
 2196|      3|            }
 2197|       |
 2198|      0|            goto invalid;
 2199|       |
 2200|    114|        case sw_chunk_size:
  ------------------
  |  Branch (2200:9): [True: 114, False: 410k]
  ------------------
 2201|    114|            if (ctx->size > NGX_MAX_OFF_T_VALUE / 16) {
  ------------------
  |  |  197|    114|#define NGX_MAX_OFF_T_VALUE  9223372036854775807LL
  ------------------
  |  Branch (2201:17): [True: 0, False: 114]
  ------------------
 2202|      0|                goto invalid;
 2203|      0|            }
 2204|       |
 2205|    114|            if (ch >= '0' && ch <= '9') {
  ------------------
  |  Branch (2205:17): [True: 62, False: 52]
  |  Branch (2205:30): [True: 58, False: 4]
  ------------------
 2206|     58|                ctx->size = ctx->size * 16 + (ch - '0');
 2207|     58|                break;
 2208|     58|            }
 2209|       |
 2210|     56|            c = (u_char) (ch | 0x20);
 2211|       |
 2212|     56|            if (c >= 'a' && c <= 'f') {
  ------------------
  |  Branch (2212:17): [True: 4, False: 52]
  |  Branch (2212:29): [True: 4, False: 0]
  ------------------
 2213|      4|                ctx->size = ctx->size * 16 + (c - 'a' + 10);
 2214|      4|                break;
 2215|      4|            }
 2216|       |
 2217|     52|            if (ctx->size == 0) {
  ------------------
  |  Branch (2217:17): [True: 2, False: 50]
  ------------------
 2218|       |
 2219|      2|                switch (ch) {
 2220|      0|                case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (2220:17): [True: 0, False: 2]
  ------------------
 2221|      0|                    state = sw_last_chunk_extension_almost_done;
 2222|      0|                    break;
 2223|      1|                case LF:
  ------------------
  |  |  103|      1|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2223:17): [True: 1, False: 1]
  ------------------
 2224|      1|                    state = sw_trailer;
 2225|      1|                    break;
 2226|      0|                case ';':
  ------------------
  |  Branch (2226:17): [True: 0, False: 2]
  ------------------
 2227|      1|                case ' ':
  ------------------
  |  Branch (2227:17): [True: 1, False: 1]
  ------------------
 2228|      1|                case '\t':
  ------------------
  |  Branch (2228:17): [True: 0, False: 2]
  ------------------
 2229|      1|                    state = sw_last_chunk_extension;
 2230|      1|                    break;
 2231|      0|                default:
  ------------------
  |  Branch (2231:17): [True: 0, False: 2]
  ------------------
 2232|      0|                    goto invalid;
 2233|      2|                }
 2234|       |
 2235|      2|                break;
 2236|      2|            }
 2237|       |
 2238|     50|            switch (ch) {
 2239|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (2239:13): [True: 0, False: 50]
  ------------------
 2240|      0|                state = sw_chunk_extension_almost_done;
 2241|      0|                break;
 2242|      4|            case LF:
  ------------------
  |  |  103|      4|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2242:13): [True: 4, False: 46]
  ------------------
 2243|      4|                state = sw_chunk_data;
 2244|      4|                break;
 2245|      0|            case ';':
  ------------------
  |  Branch (2245:13): [True: 0, False: 50]
  ------------------
 2246|     44|            case ' ':
  ------------------
  |  Branch (2246:13): [True: 44, False: 6]
  ------------------
 2247|     46|            case '\t':
  ------------------
  |  Branch (2247:13): [True: 2, False: 48]
  ------------------
 2248|     46|                state = sw_chunk_extension;
 2249|     46|                break;
 2250|      0|            default:
  ------------------
  |  Branch (2250:13): [True: 0, False: 50]
  ------------------
 2251|      0|                goto invalid;
 2252|     50|            }
 2253|       |
 2254|     50|            break;
 2255|       |
 2256|   238k|        case sw_chunk_extension:
  ------------------
  |  Branch (2256:9): [True: 238k, False: 172k]
  ------------------
 2257|   238k|            switch (ch) {
  ------------------
  |  Branch (2257:21): [True: 238k, False: 43]
  ------------------
 2258|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (2258:13): [True: 0, False: 238k]
  ------------------
 2259|      0|                state = sw_chunk_extension_almost_done;
 2260|      0|                break;
 2261|     43|            case LF:
  ------------------
  |  |  103|     43|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2261:13): [True: 43, False: 238k]
  ------------------
 2262|     43|                state = sw_chunk_data;
 2263|   238k|            }
 2264|   238k|            break;
 2265|       |
 2266|   238k|        case sw_chunk_extension_almost_done:
  ------------------
  |  Branch (2266:9): [True: 0, False: 410k]
  ------------------
 2267|      0|            if (ch == LF) {
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2267:17): [True: 0, False: 0]
  ------------------
 2268|      0|                state = sw_chunk_data;
 2269|      0|                break;
 2270|      0|            }
 2271|      0|            goto invalid;
 2272|       |
 2273|     65|        case sw_chunk_data:
  ------------------
  |  Branch (2273:9): [True: 65, False: 410k]
  ------------------
 2274|     65|            rc = NGX_OK;
  ------------------
  |  |   38|     65|#define  NGX_OK          0
  ------------------
 2275|     65|            goto data;
 2276|       |
 2277|     45|        case sw_after_data:
  ------------------
  |  Branch (2277:9): [True: 45, False: 410k]
  ------------------
 2278|     45|            switch (ch) {
 2279|      3|            case CR:
  ------------------
  |  |  104|      3|#define CR     (u_char) '\r'
  ------------------
  |  Branch (2279:13): [True: 3, False: 42]
  ------------------
 2280|      3|                state = sw_after_data_almost_done;
 2281|      3|                break;
 2282|     42|            case LF:
  ------------------
  |  |  103|     42|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2282:13): [True: 42, False: 3]
  ------------------
 2283|     42|                state = sw_chunk_start;
 2284|     42|                break;
 2285|      0|            default:
  ------------------
  |  Branch (2285:13): [True: 0, False: 45]
  ------------------
 2286|      0|                goto invalid;
 2287|     45|            }
 2288|     45|            break;
 2289|       |
 2290|     45|        case sw_after_data_almost_done:
  ------------------
  |  Branch (2290:9): [True: 3, False: 410k]
  ------------------
 2291|      3|            if (ch == LF) {
  ------------------
  |  |  103|      3|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2291:17): [True: 3, False: 0]
  ------------------
 2292|      3|                state = sw_chunk_start;
 2293|      3|                break;
 2294|      3|            }
 2295|      0|            goto invalid;
 2296|       |
 2297|     69|        case sw_last_chunk_extension:
  ------------------
  |  Branch (2297:9): [True: 69, False: 410k]
  ------------------
 2298|     69|            switch (ch) {
  ------------------
  |  Branch (2298:21): [True: 68, False: 1]
  ------------------
 2299|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (2299:13): [True: 0, False: 69]
  ------------------
 2300|      0|                state = sw_last_chunk_extension_almost_done;
 2301|      0|                break;
 2302|      1|            case LF:
  ------------------
  |  |  103|      1|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2302:13): [True: 1, False: 68]
  ------------------
 2303|      1|                state = sw_trailer;
 2304|     69|            }
 2305|     69|            break;
 2306|       |
 2307|     69|        case sw_last_chunk_extension_almost_done:
  ------------------
  |  Branch (2307:9): [True: 0, False: 410k]
  ------------------
 2308|      0|            if (ch == LF) {
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2308:17): [True: 0, False: 0]
  ------------------
 2309|      0|                state = sw_trailer;
 2310|      0|                break;
 2311|      0|            }
 2312|      0|            goto invalid;
 2313|       |
 2314|      4|        case sw_trailer:
  ------------------
  |  Branch (2314:9): [True: 4, False: 410k]
  ------------------
 2315|      4|            switch (ch) {
 2316|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (2316:13): [True: 0, False: 4]
  ------------------
 2317|      0|                state = sw_trailer_almost_done;
 2318|      0|                break;
 2319|      0|            case LF:
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2319:13): [True: 0, False: 4]
  ------------------
 2320|      0|                goto done;
 2321|      4|            default:
  ------------------
  |  Branch (2321:13): [True: 4, False: 0]
  ------------------
 2322|      4|                state = sw_trailer_header;
 2323|      4|            }
 2324|      4|            break;
 2325|       |
 2326|      4|        case sw_trailer_almost_done:
  ------------------
  |  Branch (2326:9): [True: 0, False: 410k]
  ------------------
 2327|      0|            if (ch == LF) {
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2327:17): [True: 0, False: 0]
  ------------------
 2328|      0|                goto done;
 2329|      0|            }
 2330|      0|            goto invalid;
 2331|       |
 2332|   172k|        case sw_trailer_header:
  ------------------
  |  Branch (2332:9): [True: 172k, False: 238k]
  ------------------
 2333|   172k|            switch (ch) {
  ------------------
  |  Branch (2333:21): [True: 172k, False: 3]
  ------------------
 2334|      0|            case CR:
  ------------------
  |  |  104|      0|#define CR     (u_char) '\r'
  ------------------
  |  Branch (2334:13): [True: 0, False: 172k]
  ------------------
 2335|      0|                state = sw_trailer_header_almost_done;
 2336|      0|                break;
 2337|      3|            case LF:
  ------------------
  |  |  103|      3|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2337:13): [True: 3, False: 172k]
  ------------------
 2338|      3|                state = sw_trailer;
 2339|   172k|            }
 2340|   172k|            break;
 2341|       |
 2342|   172k|        case sw_trailer_header_almost_done:
  ------------------
  |  Branch (2342:9): [True: 0, False: 410k]
  ------------------
 2343|      0|            if (ch == LF) {
  ------------------
  |  |  103|      0|#define LF     (u_char) '\n'
  ------------------
  |  Branch (2343:17): [True: 0, False: 0]
  ------------------
 2344|      0|                state = sw_trailer;
 2345|      0|                break;
 2346|      0|            }
 2347|      0|            goto invalid;
 2348|       |
 2349|   410k|        }
 2350|   410k|    }
 2351|       |
 2352|    118|data:
 2353|       |
 2354|    118|    ctx->state = state;
 2355|    118|    b->pos = pos;
 2356|       |
 2357|    118|    if (ctx->size > NGX_MAX_OFF_T_VALUE - 5) {
  ------------------
  |  |  197|    118|#define NGX_MAX_OFF_T_VALUE  9223372036854775807LL
  ------------------
  |  Branch (2357:9): [True: 0, False: 118]
  ------------------
 2358|      0|        goto invalid;
 2359|      0|    }
 2360|       |
 2361|    118|    switch (state) {
  ------------------
  |  Branch (2361:13): [True: 0, False: 118]
  ------------------
 2362|       |
 2363|      0|    case sw_chunk_start:
  ------------------
  |  Branch (2363:5): [True: 0, False: 118]
  ------------------
 2364|      0|        ctx->length = 3 /* "0" LF LF */;
 2365|      0|        break;
 2366|      0|    case sw_chunk_size:
  ------------------
  |  Branch (2366:5): [True: 0, False: 118]
  ------------------
 2367|      0|        ctx->length = 1 /* LF */
 2368|      0|                      + (ctx->size ? ctx->size + 4 /* LF "0" LF LF */
  ------------------
  |  Branch (2368:26): [True: 0, False: 0]
  ------------------
 2369|      0|                                   : 1 /* LF */);
 2370|      0|        break;
 2371|     24|    case sw_chunk_extension:
  ------------------
  |  Branch (2371:5): [True: 24, False: 94]
  ------------------
 2372|     24|    case sw_chunk_extension_almost_done:
  ------------------
  |  Branch (2372:5): [True: 0, False: 118]
  ------------------
 2373|     24|        ctx->length = 1 /* LF */ + ctx->size + 4 /* LF "0" LF LF */;
 2374|     24|        break;
 2375|     85|    case sw_chunk_data:
  ------------------
  |  Branch (2375:5): [True: 85, False: 33]
  ------------------
 2376|     85|        ctx->length = ctx->size + 4 /* LF "0" LF LF */;
 2377|     85|        break;
 2378|      0|    case sw_after_data:
  ------------------
  |  Branch (2378:5): [True: 0, False: 118]
  ------------------
 2379|      0|    case sw_after_data_almost_done:
  ------------------
  |  Branch (2379:5): [True: 0, False: 118]
  ------------------
 2380|      0|        ctx->length = 4 /* LF "0" LF LF */;
 2381|      0|        break;
 2382|      0|    case sw_last_chunk_extension:
  ------------------
  |  Branch (2382:5): [True: 0, False: 118]
  ------------------
 2383|      0|    case sw_last_chunk_extension_almost_done:
  ------------------
  |  Branch (2383:5): [True: 0, False: 118]
  ------------------
 2384|      0|        ctx->length = 2 /* LF LF */;
 2385|      0|        break;
 2386|      1|    case sw_trailer:
  ------------------
  |  Branch (2386:5): [True: 1, False: 117]
  ------------------
 2387|      1|    case sw_trailer_almost_done:
  ------------------
  |  Branch (2387:5): [True: 0, False: 118]
  ------------------
 2388|      1|        ctx->length = 1 /* LF */;
 2389|      1|        break;
 2390|      8|    case sw_trailer_header:
  ------------------
  |  Branch (2390:5): [True: 8, False: 110]
  ------------------
 2391|      8|    case sw_trailer_header_almost_done:
  ------------------
  |  Branch (2391:5): [True: 0, False: 118]
  ------------------
 2392|      8|        ctx->length = 2 /* LF LF */;
 2393|      8|        break;
 2394|       |
 2395|    118|    }
 2396|       |
 2397|    118|    return rc;
 2398|       |
 2399|      0|done:
 2400|       |
 2401|      0|    ctx->state = 0;
 2402|      0|    b->pos = pos + 1;
 2403|       |
 2404|      0|    return NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
 2405|       |
 2406|      0|invalid:
 2407|       |
 2408|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2409|    118|}

ngx_http_postpone_filter_module.c:ngx_http_postpone_filter_init:
  254|      1|{
  255|      1|    ngx_http_next_body_filter = ngx_http_top_body_filter;
  256|      1|    ngx_http_top_body_filter = ngx_http_postpone_filter;
  257|       |
  258|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  259|      1|}
ngx_http_postpone_filter_module.c:ngx_http_postpone_filter:
   56|     13|{
   57|     13|    ngx_connection_t              *c;
   58|     13|    ngx_http_postponed_request_t  *pr;
   59|       |
   60|     13|    c = r->connection;
   61|       |
   62|     13|    ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
   63|     13|                   "http postpone filter \"%V?%V\" %p", &r->uri, &r->args, in);
   64|       |
   65|     13|    if (r->subrequest_in_memory) {
  ------------------
  |  Branch (65:9): [True: 0, False: 13]
  ------------------
   66|      0|        return ngx_http_postpone_filter_in_memory(r, in);
   67|      0|    }
   68|       |
   69|     13|    if (r != c->data) {
  ------------------
  |  Branch (69:9): [True: 0, False: 13]
  ------------------
   70|       |
   71|      0|        if (in) {
  ------------------
  |  Branch (71:13): [True: 0, False: 0]
  ------------------
   72|      0|            if (ngx_http_postpone_filter_add(r, in) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (72:17): [True: 0, False: 0]
  ------------------
   73|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   74|      0|            }
   75|       |
   76|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
   77|      0|        }
   78|       |
   79|       |#if 0
   80|       |        /* TODO: SSI may pass NULL */
   81|       |        ngx_log_error(NGX_LOG_ALERT, c->log, 0,
   82|       |                      "http postpone filter NULL inactive request");
   83|       |#endif
   84|       |
   85|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
   86|      0|    }
   87|       |
   88|     13|    if (r->postponed == NULL) {
  ------------------
  |  Branch (88:9): [True: 13, False: 0]
  ------------------
   89|       |
   90|     13|        if (in || c->buffered) {
  ------------------
  |  Branch (90:13): [True: 4, False: 9]
  |  Branch (90:19): [True: 9, False: 0]
  ------------------
   91|     13|            return ngx_http_next_body_filter(r->main, in);
   92|     13|        }
   93|       |
   94|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
   95|     13|    }
   96|       |
   97|      0|    if (in) {
  ------------------
  |  Branch (97:9): [True: 0, False: 0]
  ------------------
   98|      0|        if (ngx_http_postpone_filter_add(r, in) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (98:13): [True: 0, False: 0]
  ------------------
   99|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  100|      0|        }
  101|      0|    }
  102|       |
  103|      0|    do {
  104|      0|        pr = r->postponed;
  105|       |
  106|      0|        if (pr->request) {
  ------------------
  |  Branch (106:13): [True: 0, False: 0]
  ------------------
  107|       |
  108|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
  109|      0|                           "http postpone filter wake \"%V?%V\"",
  110|      0|                           &pr->request->uri, &pr->request->args);
  111|       |
  112|      0|            r->postponed = pr->next;
  113|       |
  114|      0|            c->data = pr->request;
  115|       |
  116|      0|            return ngx_http_post_request(pr->request, NULL);
  117|      0|        }
  118|       |
  119|      0|        if (pr->out == NULL) {
  ------------------
  |  Branch (119:13): [True: 0, False: 0]
  ------------------
  120|      0|            ngx_log_error(NGX_LOG_ALERT, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  121|      0|                          "http postpone filter NULL output");
  122|       |
  123|      0|        } else {
  124|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
  125|      0|                           "http postpone filter output \"%V?%V\"",
  126|      0|                           &r->uri, &r->args);
  127|       |
  128|      0|            if (ngx_http_next_body_filter(r->main, pr->out) == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (128:17): [True: 0, False: 0]
  ------------------
  129|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  130|      0|            }
  131|      0|        }
  132|       |
  133|      0|        r->postponed = pr->next;
  134|       |
  135|      0|    } while (r->postponed);
  ------------------
  |  Branch (135:14): [True: 0, False: 0]
  ------------------
  136|       |
  137|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  138|      0|}

ngx_http_init_connection:
  201|     16|{
  202|     16|    ngx_uint_t                 i;
  203|     16|    ngx_event_t               *rev;
  204|     16|    struct sockaddr_in        *sin;
  205|     16|    ngx_http_port_t           *port;
  206|     16|    ngx_http_in_addr_t        *addr;
  207|     16|    ngx_http_log_ctx_t        *ctx;
  208|     16|    ngx_http_connection_t     *hc;
  209|     16|    ngx_http_core_srv_conf_t  *cscf;
  210|     16|#if (NGX_HAVE_INET6)
  211|     16|    struct sockaddr_in6       *sin6;
  212|     16|    ngx_http_in6_addr_t       *addr6;
  213|     16|#endif
  214|       |
  215|     16|    hc = ngx_pcalloc(c->pool, sizeof(ngx_http_connection_t));
  216|     16|    if (hc == NULL) {
  ------------------
  |  Branch (216:9): [True: 0, False: 16]
  ------------------
  217|      0|        ngx_http_close_connection(c);
  218|      0|        return;
  219|      0|    }
  220|       |
  221|     16|    c->data = hc;
  222|       |
  223|       |    /* find the server configuration for the address:port */
  224|       |
  225|     16|    port = c->listening->servers;
  226|       |
  227|     16|    if (port->naddrs > 1) {
  ------------------
  |  Branch (227:9): [True: 0, False: 16]
  ------------------
  228|       |
  229|       |        /*
  230|       |         * there are several addresses on this port and one of them
  231|       |         * is an "*:port" wildcard so getsockname() in ngx_http_server_addr()
  232|       |         * is required to determine a server address
  233|       |         */
  234|       |
  235|      0|        if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (235:13): [True: 0, False: 0]
  ------------------
  236|      0|            ngx_http_close_connection(c);
  237|      0|            return;
  238|      0|        }
  239|       |
  240|      0|        switch (c->local_sockaddr->sa_family) {
  241|       |
  242|      0|#if (NGX_HAVE_INET6)
  243|      0|        case AF_INET6:
  ------------------
  |  Branch (243:9): [True: 0, False: 0]
  ------------------
  244|      0|            sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
  245|       |
  246|      0|            addr6 = port->addrs;
  247|       |
  248|       |            /* the last address is "*" */
  249|       |
  250|      0|            for (i = 0; i < port->naddrs - 1; i++) {
  ------------------
  |  Branch (250:25): [True: 0, False: 0]
  ------------------
  251|      0|                if (ngx_memcmp(&addr6[i].addr6, &sin6->sin6_addr, 16) == 0) {
  ------------------
  |  |  148|      0|#define ngx_memcmp(s1, s2, n)     memcmp(s1, s2, n)
  ------------------
  |  Branch (251:21): [True: 0, False: 0]
  ------------------
  252|      0|                    break;
  253|      0|                }
  254|      0|            }
  255|       |
  256|      0|            hc->addr_conf = &addr6[i].conf;
  257|       |
  258|      0|            break;
  259|      0|#endif
  260|       |
  261|      0|        default: /* AF_INET */
  ------------------
  |  Branch (261:9): [True: 0, False: 0]
  ------------------
  262|      0|            sin = (struct sockaddr_in *) c->local_sockaddr;
  263|       |
  264|      0|            addr = port->addrs;
  265|       |
  266|       |            /* the last address is "*" */
  267|       |
  268|      0|            for (i = 0; i < port->naddrs - 1; i++) {
  ------------------
  |  Branch (268:25): [True: 0, False: 0]
  ------------------
  269|      0|                if (addr[i].addr == sin->sin_addr.s_addr) {
  ------------------
  |  Branch (269:21): [True: 0, False: 0]
  ------------------
  270|      0|                    break;
  271|      0|                }
  272|      0|            }
  273|       |
  274|      0|            hc->addr_conf = &addr[i].conf;
  275|       |
  276|      0|            break;
  277|      0|        }
  278|       |
  279|     16|    } else {
  280|       |
  281|     16|        switch (c->local_sockaddr->sa_family) {
  282|       |
  283|      0|#if (NGX_HAVE_INET6)
  284|      0|        case AF_INET6:
  ------------------
  |  Branch (284:9): [True: 0, False: 16]
  ------------------
  285|      0|            addr6 = port->addrs;
  286|      0|            hc->addr_conf = &addr6[0].conf;
  287|      0|            break;
  288|      0|#endif
  289|       |
  290|     16|        default: /* AF_INET */
  ------------------
  |  Branch (290:9): [True: 16, False: 0]
  ------------------
  291|     16|            addr = port->addrs;
  292|     16|            hc->addr_conf = &addr[0].conf;
  293|     16|            break;
  294|     16|        }
  295|     16|    }
  296|       |
  297|       |    /* the default server configuration for the address:port */
  298|     16|    hc->conf_ctx = hc->addr_conf->default_server->ctx;
  299|       |
  300|     16|    ctx = ngx_palloc(c->pool, sizeof(ngx_http_log_ctx_t));
  301|     16|    if (ctx == NULL) {
  ------------------
  |  Branch (301:9): [True: 0, False: 16]
  ------------------
  302|      0|        ngx_http_close_connection(c);
  303|      0|        return;
  304|      0|    }
  305|       |
  306|     16|    ctx->connection = c;
  307|     16|    ctx->request = NULL;
  308|     16|    ctx->current_request = NULL;
  309|       |
  310|     16|    c->log->connection = c->number;
  311|     16|    c->log->handler = ngx_http_log_error;
  312|     16|    c->log->data = ctx;
  313|     16|    c->log->action = "waiting for request";
  314|       |
  315|     16|    c->log_error = NGX_ERROR_INFO;
  316|       |
  317|     16|    rev = c->read;
  318|     16|    rev->handler = ngx_http_wait_request_handler;
  319|     16|    c->write->handler = ngx_http_empty_handler;
  320|       |
  321|     16|#if (NGX_HTTP_V2)
  322|     16|    if (hc->addr_conf->http2) {
  ------------------
  |  Branch (322:9): [True: 0, False: 16]
  ------------------
  323|      0|        rev->handler = ngx_http_v2_init;
  324|      0|    }
  325|     16|#endif
  326|       |
  327|       |#if (NGX_HTTP_V3)
  328|       |    if (hc->addr_conf->quic) {
  329|       |        ngx_http_v3_init_stream(c);
  330|       |        return;
  331|       |    }
  332|       |#endif
  333|       |
  334|       |#if (NGX_HTTP_SSL)
  335|       |    {
  336|       |    ngx_http_ssl_srv_conf_t  *sscf;
  337|       |
  338|       |    sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
  339|       |
  340|       |    if (sscf->enable || hc->addr_conf->ssl) {
  341|       |        hc->ssl = 1;
  342|       |        c->log->action = "SSL handshaking";
  343|       |        rev->handler = ngx_http_ssl_handshake;
  344|       |    }
  345|       |    }
  346|       |#endif
  347|       |
  348|     16|    if (hc->addr_conf->proxy_protocol) {
  ------------------
  |  Branch (348:9): [True: 0, False: 16]
  ------------------
  349|      0|        hc->proxy_protocol = 1;
  350|      0|        c->log->action = "reading PROXY protocol";
  351|      0|    }
  352|       |
  353|     16|    if (rev->ready) {
  ------------------
  |  Branch (353:9): [True: 16, False: 0]
  ------------------
  354|       |        /* the deferred accept(), iocp */
  355|       |
  356|     16|        if (ngx_use_accept_mutex) {
  ------------------
  |  Branch (356:13): [True: 0, False: 16]
  ------------------
  357|      0|            ngx_post_event(rev, &ngx_posted_events);
  ------------------
  |  |   19|      0|    if (!(ev)->posted) {                                                      \
  |  |  ------------------
  |  |  |  Branch (19:9): [True: 0, False: 0]
  |  |  ------------------
  |  |   20|      0|        (ev)->posted = 1;                                                     \
  |  |   21|      0|        ngx_queue_insert_tail(q, &(ev)->queue);                               \
  |  |  ------------------
  |  |  |  |   44|      0|    (x)->prev = (h)->prev;                                                    \
  |  |  |  |   45|      0|    (x)->prev->next = x;                                                      \
  |  |  |  |   46|      0|    (x)->next = h;                                                            \
  |  |  |  |   47|      0|    (h)->prev = x
  |  |  ------------------
  |  |   22|      0|                                                                              \
  |  |   23|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, "post event %p", ev);\
  |  |   24|      0|                                                                              \
  |  |   25|      0|    } else  {                                                                 \
  |  |   26|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                      \
  |  |   27|      0|                       "update posted event %p", ev);                         \
  |  |   28|      0|    }
  ------------------
  358|      0|            return;
  359|      0|        }
  360|       |
  361|     16|        rev->handler(rev);
  362|     16|        return;
  363|     16|    }
  364|       |
  365|      0|    cscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_core_module);
  ------------------
  |  |   57|      0|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
  366|       |
  367|      0|    ngx_add_timer(rev, cscf->client_header_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
  368|      0|    ngx_reusable_connection(c, 1);
  369|       |
  370|      0|    if (ngx_handle_read_event(rev, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (370:9): [True: 0, False: 0]
  ------------------
  371|      0|        ngx_http_close_connection(c);
  372|      0|        return;
  373|      0|    }
  374|      0|}
ngx_http_create_request:
  509|     16|{
  510|     16|    ngx_http_request_t        *r;
  511|     16|    ngx_http_log_ctx_t        *ctx;
  512|     16|    ngx_http_core_loc_conf_t  *clcf;
  513|       |
  514|     16|    r = ngx_http_alloc_request(c);
  515|     16|    if (r == NULL) {
  ------------------
  |  Branch (515:9): [True: 0, False: 16]
  ------------------
  516|      0|        return NULL;
  517|      0|    }
  518|       |
  519|     16|    c->requests++;
  520|       |
  521|     16|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|     16|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  522|       |
  523|     16|    ngx_set_connection_log(c, clcf->error_log);
  ------------------
  |  |  207|     16|    c->log->file = l->file;                                                  \
  |  |  208|     16|    c->log->next = l->next;                                                  \
  |  |  209|     16|    c->log->writer = l->writer;                                              \
  |  |  210|     16|    c->log->wdata = l->wdata;                                                \
  |  |  211|     16|    if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {                   \
  |  |  ------------------
  |  |  |  |   41|     16|#define NGX_LOG_DEBUG_CONNECTION  0x80000000
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 16, False: 0]
  |  |  ------------------
  |  |  212|     16|        c->log->log_level = l->log_level;                                    \
  |  |  213|     16|    }
  ------------------
  524|       |
  525|     16|    ctx = c->log->data;
  526|     16|    ctx->request = r;
  527|     16|    ctx->current_request = r;
  528|       |
  529|       |#if (NGX_STAT_STUB)
  530|       |    (void) ngx_atomic_fetch_add(ngx_stat_reading, 1);
  531|       |    r->stat_reading = 1;
  532|       |    (void) ngx_atomic_fetch_add(ngx_stat_requests, 1);
  533|       |#endif
  534|       |
  535|     16|    return r;
  536|     16|}
ngx_http_process_request_uri:
 1224|     12|{
 1225|     12|    ngx_http_core_srv_conf_t  *cscf;
 1226|       |
 1227|     12|    if (r->args_start) {
  ------------------
  |  Branch (1227:9): [True: 0, False: 12]
  ------------------
 1228|      0|        r->uri.len = r->args_start - 1 - r->uri_start;
 1229|     12|    } else {
 1230|     12|        r->uri.len = r->uri_end - r->uri_start;
 1231|     12|    }
 1232|       |
 1233|     12|    if (r->complex_uri || r->quoted_uri || r->empty_path_in_uri) {
  ------------------
  |  Branch (1233:9): [True: 4, False: 8]
  |  Branch (1233:27): [True: 0, False: 8]
  |  Branch (1233:44): [True: 0, False: 8]
  ------------------
 1234|       |
 1235|      4|        if (r->empty_path_in_uri) {
  ------------------
  |  Branch (1235:13): [True: 0, False: 4]
  ------------------
 1236|      0|            r->uri.len++;
 1237|      0|        }
 1238|       |
 1239|      4|        r->uri.data = ngx_pnalloc(r->pool, r->uri.len);
 1240|      4|        if (r->uri.data == NULL) {
  ------------------
  |  Branch (1240:13): [True: 0, False: 4]
  ------------------
 1241|      0|            ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1242|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1243|      0|        }
 1244|       |
 1245|      4|        cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|      4|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
 1246|       |
 1247|      4|        if (ngx_http_parse_complex_uri(r, cscf->merge_slashes) != NGX_OK) {
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
  |  Branch (1247:13): [True: 0, False: 4]
  ------------------
 1248|      0|            r->uri.len = 0;
 1249|       |
 1250|      0|            ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1251|      0|                          "client sent invalid request");
 1252|      0|            ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1253|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1254|      0|        }
 1255|       |
 1256|      8|    } else {
 1257|      8|        r->uri.data = r->uri_start;
 1258|      8|    }
 1259|       |
 1260|     12|    r->unparsed_uri.len = r->uri_end - r->uri_start;
 1261|     12|    r->unparsed_uri.data = r->uri_start;
 1262|       |
 1263|     12|    r->valid_unparsed_uri = r->empty_path_in_uri ? 0 : 1;
  ------------------
  |  Branch (1263:29): [True: 0, False: 12]
  ------------------
 1264|       |
 1265|     12|    if (r->uri_ext) {
  ------------------
  |  Branch (1265:9): [True: 0, False: 12]
  ------------------
 1266|      0|        if (r->args_start) {
  ------------------
  |  Branch (1266:13): [True: 0, False: 0]
  ------------------
 1267|      0|            r->exten.len = r->args_start - 1 - r->uri_ext;
 1268|      0|        } else {
 1269|      0|            r->exten.len = r->uri_end - r->uri_ext;
 1270|      0|        }
 1271|       |
 1272|      0|        r->exten.data = r->uri_ext;
 1273|      0|    }
 1274|       |
 1275|     12|    if (r->args_start && r->uri_end > r->args_start) {
  ------------------
  |  Branch (1275:9): [True: 0, False: 12]
  |  Branch (1275:26): [True: 0, False: 0]
  ------------------
 1276|      0|        r->args.len = r->uri_end - r->args_start;
 1277|      0|        r->args.data = r->args_start;
 1278|      0|    }
 1279|       |
 1280|       |#if (NGX_WIN32)
 1281|       |    {
 1282|       |    u_char  *p, *last;
 1283|       |
 1284|       |    p = r->uri.data;
 1285|       |    last = r->uri.data + r->uri.len;
 1286|       |
 1287|       |    while (p < last) {
 1288|       |
 1289|       |        if (*p++ == ':') {
 1290|       |
 1291|       |            /*
 1292|       |             * this check covers "::$data", "::$index_allocation" and
 1293|       |             * ":$i30:$index_allocation"
 1294|       |             */
 1295|       |
 1296|       |            if (p < last && *p == '$') {
 1297|       |                ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
 1298|       |                              "client sent unsafe win32 URI");
 1299|       |                ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
 1300|       |                return NGX_ERROR;
 1301|       |            }
 1302|       |        }
 1303|       |    }
 1304|       |
 1305|       |    p = r->uri.data + r->uri.len - 1;
 1306|       |
 1307|       |    while (p > r->uri.data) {
 1308|       |
 1309|       |        if (*p == ' ') {
 1310|       |            p--;
 1311|       |            continue;
 1312|       |        }
 1313|       |
 1314|       |        if (*p == '.') {
 1315|       |            p--;
 1316|       |            continue;
 1317|       |        }
 1318|       |
 1319|       |        break;
 1320|       |    }
 1321|       |
 1322|       |    if (p != r->uri.data + r->uri.len - 1) {
 1323|       |        r->uri.len = p + 1 - r->uri.data;
 1324|       |        ngx_http_set_exten(r);
 1325|       |    }
 1326|       |
 1327|       |    }
 1328|       |#endif
 1329|       |
 1330|     12|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1331|     12|                   "http uri: \"%V\"", &r->uri);
 1332|       |
 1333|     12|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1334|     12|                   "http args: \"%V\"", &r->args);
 1335|       |
 1336|     12|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1337|     12|                   "http exten: \"%V\"", &r->exten);
 1338|       |
 1339|     12|    return NGX_OK;
  ------------------
  |  |   38|     12|#define  NGX_OK          0
  ------------------
 1340|     12|}
ngx_http_process_request_header:
 1929|      8|{
 1930|      8|    if (r->headers_in.server.len == 0
  ------------------
  |  Branch (1930:9): [True: 5, False: 3]
  ------------------
 1931|      8|        && ngx_http_set_virtual_server(r, &r->headers_in.server)
  ------------------
  |  Branch (1931:12): [True: 0, False: 5]
  ------------------
 1932|      5|           == NGX_ERROR)
  ------------------
  |  |   39|      5|#define  NGX_ERROR      -1
  ------------------
 1933|      0|    {
 1934|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1935|      0|    }
 1936|       |
 1937|      8|    if (r->headers_in.host == NULL && r->http_version > NGX_HTTP_VERSION_10) {
  ------------------
  |  |   24|      5|#define NGX_HTTP_VERSION_10                1000
  ------------------
  |  Branch (1937:9): [True: 5, False: 3]
  |  Branch (1937:39): [True: 0, False: 5]
  ------------------
 1938|      0|        ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1939|      0|                   "client sent HTTP/1.1 request without \"Host\" header");
 1940|      0|        ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1941|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1942|      0|    }
 1943|       |
 1944|      8|    if (r->headers_in.content_length) {
  ------------------
  |  Branch (1944:9): [True: 4, False: 4]
  ------------------
 1945|      4|        r->headers_in.content_length_n =
 1946|      4|                            ngx_atoof(r->headers_in.content_length->value.data,
 1947|      4|                                      r->headers_in.content_length->value.len);
 1948|       |
 1949|      4|        if (r->headers_in.content_length_n == NGX_ERROR) {
  ------------------
  |  |   39|      4|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1949:13): [True: 0, False: 4]
  ------------------
 1950|      0|            ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1951|      0|                          "client sent invalid \"Content-Length\" header");
 1952|      0|            ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1953|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1954|      0|        }
 1955|      4|    }
 1956|       |
 1957|      8|    if (r->headers_in.transfer_encoding) {
  ------------------
  |  Branch (1957:9): [True: 3, False: 5]
  ------------------
 1958|      3|        if (r->http_version < NGX_HTTP_VERSION_11) {
  ------------------
  |  |   25|      3|#define NGX_HTTP_VERSION_11                1001
  ------------------
  |  Branch (1958:13): [True: 0, False: 3]
  ------------------
 1959|      0|            ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1960|      0|                          "client sent HTTP/1.0 request with "
 1961|      0|                          "\"Transfer-Encoding\" header");
 1962|      0|            ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1963|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1964|      0|        }
 1965|       |
 1966|      3|        if (r->headers_in.transfer_encoding->value.len == 7
  ------------------
  |  Branch (1966:13): [True: 3, False: 0]
  ------------------
 1967|      3|            && ngx_strncasecmp(r->headers_in.transfer_encoding->value.data,
  ------------------
  |  Branch (1967:16): [True: 3, False: 0]
  ------------------
 1968|      3|                               (u_char *) "chunked", 7) == 0)
 1969|      3|        {
 1970|      3|            if (r->headers_in.content_length) {
  ------------------
  |  Branch (1970:17): [True: 0, False: 3]
  ------------------
 1971|      0|                ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1972|      0|                              "client sent \"Content-Length\" and "
 1973|      0|                              "\"Transfer-Encoding\" headers "
 1974|      0|                              "at the same time");
 1975|      0|                ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1976|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1977|      0|            }
 1978|       |
 1979|      3|            r->headers_in.chunked = 1;
 1980|       |
 1981|      3|        } else {
 1982|      0|            ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1983|      0|                          "client sent unknown \"Transfer-Encoding\": \"%V\"",
 1984|      0|                          &r->headers_in.transfer_encoding->value);
 1985|      0|            ngx_http_finalize_request(r, NGX_HTTP_NOT_IMPLEMENTED);
  ------------------
  |  |  139|      0|#define NGX_HTTP_NOT_IMPLEMENTED           501
  ------------------
 1986|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1987|      0|        }
 1988|      3|    }
 1989|       |
 1990|      8|    if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) {
  ------------------
  |  |   48|      8|#define NGX_HTTP_CONNECTION_KEEP_ALIVE     2
  ------------------
  |  Branch (1990:9): [True: 0, False: 8]
  ------------------
 1991|      0|        if (r->headers_in.keep_alive) {
  ------------------
  |  Branch (1991:13): [True: 0, False: 0]
  ------------------
 1992|      0|            r->headers_in.keep_alive_n =
 1993|      0|                            ngx_atotm(r->headers_in.keep_alive->value.data,
 1994|      0|                                      r->headers_in.keep_alive->value.len);
 1995|      0|        }
 1996|      0|    }
 1997|       |
 1998|      8|    if (r->method == NGX_HTTP_CONNECT) {
  ------------------
  |  |   45|      8|#define NGX_HTTP_CONNECT                   0x00010000
  ------------------
  |  Branch (1998:9): [True: 0, False: 8]
  ------------------
 1999|      0|        ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2000|      0|                      "client sent CONNECT method");
 2001|      0|        ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
  ------------------
  |  |   96|      0|#define NGX_HTTP_NOT_ALLOWED               405
  ------------------
 2002|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2003|      0|    }
 2004|       |
 2005|      8|    if (r->method == NGX_HTTP_TRACE) {
  ------------------
  |  |   44|      8|#define NGX_HTTP_TRACE                     0x00008000
  ------------------
  |  Branch (2005:9): [True: 1, False: 7]
  ------------------
 2006|      1|        ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      1|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2007|      1|                      "client sent TRACE method");
 2008|      1|        ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
  ------------------
  |  |   96|      1|#define NGX_HTTP_NOT_ALLOWED               405
  ------------------
 2009|      1|        return NGX_ERROR;
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
 2010|      1|    }
 2011|       |
 2012|      7|    return NGX_OK;
  ------------------
  |  |   38|      7|#define  NGX_OK          0
  ------------------
 2013|      8|}
ngx_http_process_request:
 2018|     11|{
 2019|     11|    ngx_connection_t  *c;
 2020|       |
 2021|     11|    c = r->connection;
 2022|       |
 2023|       |#if (NGX_HTTP_SSL)
 2024|       |
 2025|       |    if (r->http_connection->ssl) {
 2026|       |        long                      rc;
 2027|       |        X509                     *cert;
 2028|       |        const char               *s;
 2029|       |        ngx_http_ssl_srv_conf_t  *sscf;
 2030|       |
 2031|       |        if (c->ssl == NULL) {
 2032|       |            ngx_log_error(NGX_LOG_INFO, c->log, 0,
 2033|       |                          "client sent plain HTTP request to HTTPS port");
 2034|       |            ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
 2035|       |            return;
 2036|       |        }
 2037|       |
 2038|       |        sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
 2039|       |
 2040|       |        if (sscf->verify) {
 2041|       |            rc = SSL_get_verify_result(c->ssl->connection);
 2042|       |
 2043|       |            if (rc != X509_V_OK
 2044|       |                && (sscf->verify != 3 || !ngx_ssl_verify_error_optional(rc)))
 2045|       |            {
 2046|       |                ngx_log_error(NGX_LOG_INFO, c->log, 0,
 2047|       |                              "client SSL certificate verify error: (%l:%s)",
 2048|       |                              rc, X509_verify_cert_error_string(rc));
 2049|       |
 2050|       |                ngx_ssl_remove_cached_session(c->ssl->session_ctx,
 2051|       |                                       (SSL_get0_session(c->ssl->connection)));
 2052|       |
 2053|       |                ngx_http_finalize_request(r, NGX_HTTPS_CERT_ERROR);
 2054|       |                return;
 2055|       |            }
 2056|       |
 2057|       |            if (sscf->verify == 1) {
 2058|       |                cert = SSL_get_peer_certificate(c->ssl->connection);
 2059|       |
 2060|       |                if (cert == NULL) {
 2061|       |                    ngx_log_error(NGX_LOG_INFO, c->log, 0,
 2062|       |                                  "client sent no required SSL certificate");
 2063|       |
 2064|       |                    ngx_ssl_remove_cached_session(c->ssl->session_ctx,
 2065|       |                                       (SSL_get0_session(c->ssl->connection)));
 2066|       |
 2067|       |                    ngx_http_finalize_request(r, NGX_HTTPS_NO_CERT);
 2068|       |                    return;
 2069|       |                }
 2070|       |
 2071|       |                X509_free(cert);
 2072|       |            }
 2073|       |
 2074|       |            if (ngx_ssl_ocsp_get_status(c, &s) != NGX_OK) {
 2075|       |                ngx_log_error(NGX_LOG_INFO, c->log, 0,
 2076|       |                              "client SSL certificate verify error: %s", s);
 2077|       |
 2078|       |                ngx_ssl_remove_cached_session(c->ssl->session_ctx,
 2079|       |                                       (SSL_get0_session(c->ssl->connection)));
 2080|       |
 2081|       |                ngx_http_finalize_request(r, NGX_HTTPS_CERT_ERROR);
 2082|       |                return;
 2083|       |            }
 2084|       |        }
 2085|       |    }
 2086|       |
 2087|       |#endif
 2088|       |
 2089|     11|    if (c->read->timer_set) {
  ------------------
  |  Branch (2089:9): [True: 0, False: 11]
  ------------------
 2090|      0|        ngx_del_timer(c->read);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 2091|      0|    }
 2092|       |
 2093|       |#if (NGX_STAT_STUB)
 2094|       |    (void) ngx_atomic_fetch_add(ngx_stat_reading, -1);
 2095|       |    r->stat_reading = 0;
 2096|       |    (void) ngx_atomic_fetch_add(ngx_stat_writing, 1);
 2097|       |    r->stat_writing = 1;
 2098|       |#endif
 2099|       |
 2100|     11|    c->read->handler = ngx_http_request_handler;
 2101|     11|    c->write->handler = ngx_http_request_handler;
 2102|     11|    r->read_event_handler = ngx_http_block_reading;
 2103|       |
 2104|     11|    ngx_http_handler(r);
 2105|     11|}
ngx_http_validate_host:
 2110|      5|{
 2111|      5|    u_char  *h, ch;
 2112|      5|    size_t   i, dot_pos, host_len;
 2113|       |
 2114|      5|    enum {
 2115|      5|        sw_usual = 0,
 2116|      5|        sw_literal,
 2117|      5|        sw_rest
 2118|      5|    } state;
 2119|       |
 2120|      5|    dot_pos = host->len;
 2121|      5|    host_len = host->len;
 2122|       |
 2123|      5|    h = host->data;
 2124|       |
 2125|      5|    state = sw_usual;
 2126|       |
 2127|     84|    for (i = 0; i < host->len; i++) {
  ------------------
  |  Branch (2127:17): [True: 79, False: 5]
  ------------------
 2128|     79|        ch = h[i];
 2129|       |
 2130|     79|        switch (ch) {
 2131|       |
 2132|      0|        case '.':
  ------------------
  |  Branch (2132:9): [True: 0, False: 79]
  ------------------
 2133|      0|            if (dot_pos == i - 1) {
  ------------------
  |  Branch (2133:17): [True: 0, False: 0]
  ------------------
 2134|      0|                return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 2135|      0|            }
 2136|      0|            dot_pos = i;
 2137|      0|            break;
 2138|       |
 2139|      2|        case ':':
  ------------------
  |  Branch (2139:9): [True: 2, False: 77]
  ------------------
 2140|      2|            if (state == sw_usual) {
  ------------------
  |  Branch (2140:17): [True: 1, False: 1]
  ------------------
 2141|      1|                host_len = i;
 2142|      1|                state = sw_rest;
 2143|      1|            }
 2144|      2|            break;
 2145|       |
 2146|      0|        case '[':
  ------------------
  |  Branch (2146:9): [True: 0, False: 79]
  ------------------
 2147|      0|            if (i == 0) {
  ------------------
  |  Branch (2147:17): [True: 0, False: 0]
  ------------------
 2148|      0|                state = sw_literal;
 2149|      0|            }
 2150|      0|            break;
 2151|       |
 2152|      0|        case ']':
  ------------------
  |  Branch (2152:9): [True: 0, False: 79]
  ------------------
 2153|      0|            if (state == sw_literal) {
  ------------------
  |  Branch (2153:17): [True: 0, False: 0]
  ------------------
 2154|      0|                host_len = i + 1;
 2155|      0|                state = sw_rest;
 2156|      0|            }
 2157|      0|            break;
 2158|       |
 2159|     77|        default:
  ------------------
  |  Branch (2159:9): [True: 77, False: 2]
  ------------------
 2160|       |
 2161|     77|            if (ngx_path_separator(ch)) {
  ------------------
  |  |  204|     77|#define ngx_path_separator(c)    ((c) == '/')
  |  |  ------------------
  |  |  |  Branch (204:34): [True: 0, False: 77]
  |  |  ------------------
  ------------------
 2162|      0|                return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 2163|      0|            }
 2164|       |
 2165|     77|            if (ch <= 0x20 || ch == 0x7f) {
  ------------------
  |  Branch (2165:17): [True: 0, False: 77]
  |  Branch (2165:31): [True: 0, False: 77]
  ------------------
 2166|      0|                return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 2167|      0|            }
 2168|       |
 2169|     77|            if (ch >= 'A' && ch <= 'Z') {
  ------------------
  |  Branch (2169:17): [True: 68, False: 9]
  |  Branch (2169:30): [True: 15, False: 53]
  ------------------
 2170|     15|                alloc = 1;
 2171|     15|            }
 2172|       |
 2173|     77|            break;
 2174|     79|        }
 2175|     79|    }
 2176|       |
 2177|      5|    if (dot_pos == host_len - 1) {
  ------------------
  |  Branch (2177:9): [True: 0, False: 5]
  ------------------
 2178|      0|        host_len--;
 2179|      0|    }
 2180|       |
 2181|      5|    if (host_len == 0) {
  ------------------
  |  Branch (2181:9): [True: 0, False: 5]
  ------------------
 2182|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 2183|      0|    }
 2184|       |
 2185|      5|    if (alloc) {
  ------------------
  |  Branch (2185:9): [True: 5, False: 0]
  ------------------
 2186|      5|        host->data = ngx_pnalloc(pool, host_len);
 2187|      5|        if (host->data == NULL) {
  ------------------
  |  Branch (2187:13): [True: 0, False: 5]
  ------------------
 2188|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2189|      0|        }
 2190|       |
 2191|      5|        ngx_strlow(host->data, h, host_len);
 2192|      5|    }
 2193|       |
 2194|      5|    host->len = host_len;
 2195|       |
 2196|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 2197|      5|}
ngx_http_set_virtual_server:
 2202|     12|{
 2203|     12|    ngx_int_t                  rc;
 2204|     12|    ngx_http_connection_t     *hc;
 2205|     12|    ngx_http_core_loc_conf_t  *clcf;
 2206|     12|    ngx_http_core_srv_conf_t  *cscf;
 2207|       |
 2208|     12|#if (NGX_SUPPRESS_WARN)
 2209|     12|    cscf = NULL;
 2210|     12|#endif
 2211|       |
 2212|     12|    hc = r->http_connection;
 2213|       |
 2214|       |#if (NGX_HTTP_SSL && defined SSL_CTRL_SET_TLSEXT_HOSTNAME)
 2215|       |
 2216|       |    if (hc->ssl_servername) {
 2217|       |        if (hc->ssl_servername->len == host->len
 2218|       |            && ngx_strncmp(hc->ssl_servername->data,
 2219|       |                           host->data, host->len) == 0)
 2220|       |        {
 2221|       |#if (NGX_PCRE)
 2222|       |            if (hc->ssl_servername_regex
 2223|       |                && ngx_http_regex_exec(r, hc->ssl_servername_regex,
 2224|       |                                          hc->ssl_servername) != NGX_OK)
 2225|       |            {
 2226|       |                ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
 2227|       |                return NGX_ERROR;
 2228|       |            }
 2229|       |#endif
 2230|       |            return NGX_OK;
 2231|       |        }
 2232|       |    }
 2233|       |
 2234|       |#endif
 2235|       |
 2236|     12|    rc = ngx_http_find_virtual_server(r->connection,
 2237|     12|                                      hc->addr_conf->virtual_names,
 2238|     12|                                      host, r, &cscf);
 2239|       |
 2240|     12|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|     12|#define  NGX_ERROR      -1
  ------------------
  |  Branch (2240:9): [True: 0, False: 12]
  ------------------
 2241|      0|        ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2242|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2243|      0|    }
 2244|       |
 2245|       |#if (NGX_HTTP_SSL && defined SSL_CTRL_SET_TLSEXT_HOSTNAME)
 2246|       |
 2247|       |    if (hc->ssl_servername) {
 2248|       |        ngx_http_ssl_srv_conf_t  *sscf;
 2249|       |
 2250|       |        if (rc == NGX_DECLINED) {
 2251|       |            cscf = hc->addr_conf->default_server;
 2252|       |            rc = NGX_OK;
 2253|       |        }
 2254|       |
 2255|       |        sscf = ngx_http_get_module_srv_conf(cscf->ctx, ngx_http_ssl_module);
 2256|       |
 2257|       |        if (sscf->verify) {
 2258|       |            ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
 2259|       |                          "client attempted to request the server name "
 2260|       |                          "different from the one that was negotiated");
 2261|       |            ngx_http_finalize_request(r, NGX_HTTP_MISDIRECTED_REQUEST);
 2262|       |            return NGX_ERROR;
 2263|       |        }
 2264|       |    }
 2265|       |
 2266|       |#endif
 2267|       |
 2268|     12|    if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|     12|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (2268:9): [True: 12, False: 0]
  ------------------
 2269|     12|        return NGX_OK;
  ------------------
  |  |   38|     12|#define  NGX_OK          0
  ------------------
 2270|     12|    }
 2271|       |
 2272|      0|    r->srv_conf = cscf->ctx->srv_conf;
 2273|      0|    r->loc_conf = cscf->ctx->loc_conf;
 2274|       |
 2275|      0|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 2276|       |
 2277|      0|    ngx_set_connection_log(r->connection, clcf->error_log);
  ------------------
  |  |  207|      0|    c->log->file = l->file;                                                  \
  |  |  208|      0|    c->log->next = l->next;                                                  \
  |  |  209|      0|    c->log->writer = l->writer;                                              \
  |  |  210|      0|    c->log->wdata = l->wdata;                                                \
  |  |  211|      0|    if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {                   \
  |  |  ------------------
  |  |  |  |   41|      0|#define NGX_LOG_DEBUG_CONNECTION  0x80000000
  |  |  ------------------
  |  |  |  Branch (211:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  212|      0|        c->log->log_level = l->log_level;                                    \
  |  |  213|      0|    }
  ------------------
 2278|       |
 2279|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2280|     12|}
ngx_http_run_posted_requests:
 2408|     24|{
 2409|     24|    ngx_http_request_t         *r;
 2410|     24|    ngx_http_posted_request_t  *pr;
 2411|       |
 2412|     30|    for ( ;; ) {
 2413|       |
 2414|     30|        if (c->destroyed) {
  ------------------
  |  Branch (2414:13): [True: 15, False: 15]
  ------------------
 2415|     15|            return;
 2416|     15|        }
 2417|       |
 2418|     15|        r = c->data;
 2419|     15|        pr = r->main->posted_requests;
 2420|       |
 2421|     15|        if (pr == NULL) {
  ------------------
  |  Branch (2421:13): [True: 9, False: 6]
  ------------------
 2422|      9|            return;
 2423|      9|        }
 2424|       |
 2425|      6|        r->main->posted_requests = pr->next;
 2426|       |
 2427|      6|        r = pr->request;
 2428|       |
 2429|      6|        ngx_http_set_log_request(c->log, r);
  ------------------
  |  |  625|      6|    ((ngx_http_log_ctx_t *) log->data)->current_request = r
  ------------------
 2430|       |
 2431|      6|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
 2432|      6|                       "http posted request: \"%V?%V\"", &r->uri, &r->args);
 2433|       |
 2434|      6|        r->write_event_handler(r);
 2435|      6|    }
 2436|     24|}
ngx_http_post_request:
 2441|      6|{
 2442|      6|    ngx_http_posted_request_t  **p;
 2443|       |
 2444|      6|    if (pr == NULL) {
  ------------------
  |  Branch (2444:9): [True: 0, False: 6]
  ------------------
 2445|      0|        pr = ngx_palloc(r->pool, sizeof(ngx_http_posted_request_t));
 2446|      0|        if (pr == NULL) {
  ------------------
  |  Branch (2446:13): [True: 0, False: 0]
  ------------------
 2447|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2448|      0|        }
 2449|      0|    }
 2450|       |
 2451|      6|    pr->request = r;
 2452|      6|    pr->next = NULL;
 2453|       |
 2454|      6|    for (p = &r->main->posted_requests; *p; p = &(*p)->next) { /* void */ }
  ------------------
  |  Branch (2454:41): [True: 0, False: 6]
  ------------------
 2455|       |
 2456|      6|    *p = pr;
 2457|       |
 2458|      6|    return NGX_OK;
  ------------------
  |  |   38|      6|#define  NGX_OK          0
  ------------------
 2459|      6|}
ngx_http_finalize_request:
 2464|     25|{
 2465|     25|    ngx_connection_t          *c;
 2466|     25|    ngx_http_request_t        *pr;
 2467|     25|    ngx_http_core_loc_conf_t  *clcf;
 2468|       |
 2469|     25|    c = r->connection;
 2470|       |
 2471|     25|    ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0,
 2472|     25|                   "http finalize request: %i, \"%V?%V\" a:%d, c:%d",
 2473|     25|                   rc, &r->uri, &r->args, r == c->data, r->main->count);
 2474|       |
 2475|     25|    if (rc == NGX_DONE) {
  ------------------
  |  |   42|     25|#define  NGX_DONE       -4
  ------------------
  |  Branch (2475:9): [True: 12, False: 13]
  ------------------
 2476|     12|        ngx_http_finalize_connection(r);
 2477|     12|        return;
 2478|     12|    }
 2479|       |
 2480|     13|    if (rc == NGX_OK && r->filter_finalize) {
  ------------------
  |  |   38|     26|#define  NGX_OK          0
  ------------------
  |  Branch (2480:9): [True: 0, False: 13]
  |  Branch (2480:25): [True: 0, False: 0]
  ------------------
 2481|      0|        c->error = 1;
 2482|      0|    }
 2483|       |
 2484|     13|    if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|     13|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (2484:9): [True: 0, False: 13]
  ------------------
 2485|      0|        r->content_handler = NULL;
 2486|      0|        r->write_event_handler = ngx_http_core_run_phases;
 2487|      0|        ngx_http_core_run_phases(r);
 2488|      0|        return;
 2489|      0|    }
 2490|       |
 2491|     13|    if (r != r->main && r->post_subrequest) {
  ------------------
  |  Branch (2491:9): [True: 0, False: 13]
  |  Branch (2491:25): [True: 0, False: 0]
  ------------------
 2492|      0|        rc = r->post_subrequest->handler(r, r->post_subrequest->data, rc);
 2493|      0|    }
 2494|       |
 2495|     13|    if (rc == NGX_ERROR
  ------------------
  |  |   39|     26|#define  NGX_ERROR      -1
  ------------------
  |  Branch (2495:9): [True: 0, False: 13]
  ------------------
 2496|     13|        || rc == NGX_HTTP_REQUEST_TIME_OUT
  ------------------
  |  |   97|     26|#define NGX_HTTP_REQUEST_TIME_OUT          408
  ------------------
  |  Branch (2496:12): [True: 0, False: 13]
  ------------------
 2497|     13|        || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST
  ------------------
  |  |  135|     26|#define NGX_HTTP_CLIENT_CLOSED_REQUEST     499
  ------------------
  |  Branch (2497:12): [True: 0, False: 13]
  ------------------
 2498|     13|        || c->error)
  ------------------
  |  Branch (2498:12): [True: 9, False: 4]
  ------------------
 2499|      9|    {
 2500|      9|        if (ngx_http_post_action(r) == NGX_OK) {
  ------------------
  |  |   38|      9|#define  NGX_OK          0
  ------------------
  |  Branch (2500:13): [True: 0, False: 9]
  ------------------
 2501|      0|            return;
 2502|      0|        }
 2503|       |
 2504|      9|        ngx_http_terminate_request(r, rc);
 2505|      9|        return;
 2506|      9|    }
 2507|       |
 2508|      4|    if (rc >= NGX_HTTP_SPECIAL_RESPONSE
  ------------------
  |  |   84|      8|#define NGX_HTTP_SPECIAL_RESPONSE          300
  ------------------
  |  Branch (2508:9): [True: 2, False: 2]
  ------------------
 2509|      4|        || rc == NGX_HTTP_CREATED
  ------------------
  |  |   79|      6|#define NGX_HTTP_CREATED                   201
  ------------------
  |  Branch (2509:12): [True: 0, False: 2]
  ------------------
 2510|      4|        || rc == NGX_HTTP_NO_CONTENT)
  ------------------
  |  |   81|      2|#define NGX_HTTP_NO_CONTENT                204
  ------------------
  |  Branch (2510:12): [True: 0, False: 2]
  ------------------
 2511|      2|    {
 2512|      2|        if (rc == NGX_HTTP_CLOSE) {
  ------------------
  |  |  112|      2|#define NGX_HTTP_CLOSE                     444
  ------------------
  |  Branch (2512:13): [True: 0, False: 2]
  ------------------
 2513|      0|            c->timedout = 1;
 2514|      0|            ngx_http_terminate_request(r, rc);
 2515|      0|            return;
 2516|      0|        }
 2517|       |
 2518|      2|        if (r == r->main) {
  ------------------
  |  Branch (2518:13): [True: 2, False: 0]
  ------------------
 2519|      2|            if (c->read->timer_set) {
  ------------------
  |  Branch (2519:17): [True: 0, False: 2]
  ------------------
 2520|      0|                ngx_del_timer(c->read);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 2521|      0|            }
 2522|       |
 2523|      2|            if (c->write->timer_set) {
  ------------------
  |  Branch (2523:17): [True: 0, False: 2]
  ------------------
 2524|      0|                ngx_del_timer(c->write);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 2525|      0|            }
 2526|      2|        }
 2527|       |
 2528|      2|        c->read->handler = ngx_http_request_handler;
 2529|      2|        c->write->handler = ngx_http_request_handler;
 2530|       |
 2531|      2|        ngx_http_finalize_request(r, ngx_http_special_response_handler(r, rc));
 2532|      2|        return;
 2533|      2|    }
 2534|       |
 2535|      2|    if (r != r->main) {
  ------------------
  |  Branch (2535:9): [True: 0, False: 2]
  ------------------
 2536|       |
 2537|      0|        if (r->buffered || r->postponed) {
  ------------------
  |  Branch (2537:13): [True: 0, False: 0]
  |  Branch (2537:28): [True: 0, False: 0]
  ------------------
 2538|       |
 2539|      0|            if (ngx_http_set_write_handler(r) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2539:17): [True: 0, False: 0]
  ------------------
 2540|      0|                ngx_http_terminate_request(r, 0);
 2541|      0|            }
 2542|       |
 2543|      0|            return;
 2544|      0|        }
 2545|       |
 2546|      0|        pr = r->parent;
 2547|       |
 2548|      0|        if (r == c->data || r->background) {
  ------------------
  |  Branch (2548:13): [True: 0, False: 0]
  |  Branch (2548:29): [True: 0, False: 0]
  ------------------
 2549|       |
 2550|      0|            if (!r->logged) {
  ------------------
  |  Branch (2550:17): [True: 0, False: 0]
  ------------------
 2551|       |
 2552|      0|                clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 2553|       |
 2554|      0|                if (clcf->log_subrequest) {
  ------------------
  |  Branch (2554:21): [True: 0, False: 0]
  ------------------
 2555|      0|                    ngx_http_log_request(r);
 2556|      0|                }
 2557|       |
 2558|      0|                r->logged = 1;
 2559|       |
 2560|      0|            } else {
 2561|      0|                ngx_log_error(NGX_LOG_ALERT, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2562|      0|                              "subrequest: \"%V?%V\" logged again",
 2563|      0|                              &r->uri, &r->args);
 2564|      0|            }
 2565|       |
 2566|      0|            r->done = 1;
 2567|       |
 2568|      0|            if (r->background) {
  ------------------
  |  Branch (2568:17): [True: 0, False: 0]
  ------------------
 2569|      0|                ngx_http_finalize_connection(r);
 2570|      0|                return;
 2571|      0|            }
 2572|       |
 2573|      0|            r->main->count--;
 2574|       |
 2575|      0|            if (pr->postponed && pr->postponed->request == r) {
  ------------------
  |  Branch (2575:17): [True: 0, False: 0]
  |  Branch (2575:34): [True: 0, False: 0]
  ------------------
 2576|      0|                pr->postponed = pr->postponed->next;
 2577|      0|            }
 2578|       |
 2579|      0|            c->data = pr;
 2580|       |
 2581|      0|        } else {
 2582|       |
 2583|      0|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
 2584|      0|                           "http finalize non-active request: \"%V?%V\"",
 2585|      0|                           &r->uri, &r->args);
 2586|       |
 2587|      0|            r->write_event_handler = ngx_http_request_finalizer;
 2588|       |
 2589|      0|            if (r->waited) {
  ------------------
  |  Branch (2589:17): [True: 0, False: 0]
  ------------------
 2590|      0|                r->done = 1;
 2591|      0|            }
 2592|      0|        }
 2593|       |
 2594|      0|        if (ngx_http_post_request(pr, NULL) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2594:13): [True: 0, False: 0]
  ------------------
 2595|      0|            r->main->count++;
 2596|      0|            ngx_http_terminate_request(r, 0);
 2597|      0|            return;
 2598|      0|        }
 2599|       |
 2600|      0|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
 2601|      0|                       "http wake parent request: \"%V?%V\"",
 2602|      0|                       &pr->uri, &pr->args);
 2603|       |
 2604|      0|        return;
 2605|      0|    }
 2606|       |
 2607|      2|    if (r->buffered || c->buffered || r->postponed) {
  ------------------
  |  Branch (2607:9): [True: 0, False: 2]
  |  Branch (2607:24): [True: 2, False: 0]
  |  Branch (2607:39): [True: 0, False: 0]
  ------------------
 2608|       |
 2609|      2|        if (ngx_http_set_write_handler(r) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (2609:13): [True: 0, False: 2]
  ------------------
 2610|      0|            ngx_http_terminate_request(r, 0);
 2611|      0|        }
 2612|       |
 2613|      2|        return;
 2614|      2|    }
 2615|       |
 2616|      0|    if (r != c->data) {
  ------------------
  |  Branch (2616:9): [True: 0, False: 0]
  ------------------
 2617|      0|        ngx_log_error(NGX_LOG_ALERT, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2618|      0|                      "http finalize non-active request: \"%V?%V\"",
 2619|      0|                      &r->uri, &r->args);
 2620|      0|        return;
 2621|      0|    }
 2622|       |
 2623|      0|    r->done = 1;
 2624|       |
 2625|      0|    r->read_event_handler = ngx_http_block_reading;
 2626|      0|    r->write_event_handler = ngx_http_request_empty_handler;
 2627|       |
 2628|      0|    if (!r->post_action) {
  ------------------
  |  Branch (2628:9): [True: 0, False: 0]
  ------------------
 2629|      0|        r->request_complete = 1;
 2630|      0|    }
 2631|       |
 2632|      0|    if (ngx_http_post_action(r) == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2632:9): [True: 0, False: 0]
  ------------------
 2633|      0|        return;
 2634|      0|    }
 2635|       |
 2636|      0|    if (c->read->timer_set) {
  ------------------
  |  Branch (2636:9): [True: 0, False: 0]
  ------------------
 2637|      0|        ngx_del_timer(c->read);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 2638|      0|    }
 2639|       |
 2640|      0|    if (c->write->timer_set) {
  ------------------
  |  Branch (2640:9): [True: 0, False: 0]
  ------------------
 2641|      0|        c->write->delayed = 0;
 2642|      0|        ngx_del_timer(c->write);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 2643|      0|    }
 2644|       |
 2645|      0|    ngx_http_finalize_connection(r);
 2646|      0|}
ngx_http_send_special:
 3556|      1|{
 3557|      1|    ngx_buf_t    *b;
 3558|      1|    ngx_chain_t   out;
 3559|       |
 3560|      1|    b = ngx_calloc_buf(r->pool);
  ------------------
  |  |  145|      1|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
 3561|      1|    if (b == NULL) {
  ------------------
  |  Branch (3561:9): [True: 0, False: 1]
  ------------------
 3562|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3563|      0|    }
 3564|       |
 3565|      1|    if (flags & NGX_HTTP_LAST) {
  ------------------
  |  |  144|      1|#define NGX_HTTP_LAST   1
  ------------------
  |  Branch (3565:9): [True: 0, False: 1]
  ------------------
 3566|       |
 3567|      0|        if (r == r->main && !r->post_action) {
  ------------------
  |  Branch (3567:13): [True: 0, False: 0]
  |  Branch (3567:29): [True: 0, False: 0]
  ------------------
 3568|      0|            b->last_buf = 1;
 3569|       |
 3570|      0|        } else {
 3571|      0|            b->sync = 1;
 3572|      0|            b->last_in_chain = 1;
 3573|      0|        }
 3574|      0|    }
 3575|       |
 3576|      1|    if (flags & NGX_HTTP_FLUSH) {
  ------------------
  |  |  145|      1|#define NGX_HTTP_FLUSH  2
  ------------------
  |  Branch (3576:9): [True: 1, False: 0]
  ------------------
 3577|      1|        b->flush = 1;
 3578|      1|    }
 3579|       |
 3580|      1|    out.buf = b;
 3581|      1|    out.next = NULL;
 3582|       |
 3583|      1|    return ngx_http_output_filter(r, &out);
 3584|      1|}
ngx_http_close_request:
 3626|     21|{
 3627|     21|    ngx_connection_t  *c;
 3628|       |
 3629|     21|    r = r->main;
 3630|     21|    c = r->connection;
 3631|       |
 3632|     21|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
 3633|     21|                   "http request count:%d blk:%d", r->count, r->blocked);
 3634|       |
 3635|     21|    if (r->count == 0) {
  ------------------
  |  Branch (3635:9): [True: 0, False: 21]
  ------------------
 3636|      0|        ngx_log_error(NGX_LOG_ALERT, c->log, 0, "http request count is zero");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3637|      0|    }
 3638|       |
 3639|     21|    r->count--;
 3640|       |
 3641|     21|    if (r->count || r->blocked) {
  ------------------
  |  Branch (3641:9): [True: 5, False: 16]
  |  Branch (3641:21): [True: 0, False: 16]
  ------------------
 3642|      5|        return;
 3643|      5|    }
 3644|       |
 3645|     16|#if (NGX_HTTP_V2)
 3646|     16|    if (r->stream) {
  ------------------
  |  Branch (3646:9): [True: 0, False: 16]
  ------------------
 3647|      0|        ngx_http_v2_close_stream(r->stream, rc);
 3648|      0|        return;
 3649|      0|    }
 3650|     16|#endif
 3651|       |
 3652|     16|    ngx_http_free_request(r, rc);
 3653|     16|    ngx_http_close_connection(c);
 3654|     16|}
ngx_http_free_request:
 3659|     16|{
 3660|     16|    ngx_log_t                 *log;
 3661|     16|    ngx_pool_t                *pool;
 3662|     16|    struct linger              linger;
 3663|     16|    ngx_http_cleanup_t        *cln;
 3664|     16|    ngx_http_log_ctx_t        *ctx;
 3665|     16|    ngx_http_core_loc_conf_t  *clcf;
 3666|       |
 3667|     16|    log = r->connection->log;
 3668|       |
 3669|     16|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "http close request");
 3670|       |
 3671|     16|    if (r->pool == NULL) {
  ------------------
  |  Branch (3671:9): [True: 0, False: 16]
  ------------------
 3672|      0|        ngx_log_error(NGX_LOG_ALERT, log, 0, "http request already closed");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3673|      0|        return;
 3674|      0|    }
 3675|       |
 3676|     16|    cln = r->cleanup;
 3677|     16|    r->cleanup = NULL;
 3678|       |
 3679|     16|    while (cln) {
  ------------------
  |  Branch (3679:12): [True: 0, False: 16]
  ------------------
 3680|      0|        if (cln->handler) {
  ------------------
  |  Branch (3680:13): [True: 0, False: 0]
  ------------------
 3681|      0|            cln->handler(cln->data);
 3682|      0|        }
 3683|       |
 3684|      0|        cln = cln->next;
 3685|      0|    }
 3686|       |
 3687|       |#if (NGX_STAT_STUB)
 3688|       |
 3689|       |    if (r->stat_reading) {
 3690|       |        (void) ngx_atomic_fetch_add(ngx_stat_reading, -1);
 3691|       |    }
 3692|       |
 3693|       |    if (r->stat_writing) {
 3694|       |        (void) ngx_atomic_fetch_add(ngx_stat_writing, -1);
 3695|       |    }
 3696|       |
 3697|       |#endif
 3698|       |
 3699|     16|    if (rc > 0 && (r->headers_out.status == 0 || r->connection->sent == 0)) {
  ------------------
  |  Branch (3699:9): [True: 3, False: 13]
  |  Branch (3699:20): [True: 0, False: 3]
  |  Branch (3699:50): [True: 3, False: 0]
  ------------------
 3700|      3|        r->headers_out.status = rc;
 3701|      3|    }
 3702|       |
 3703|     16|    if (!r->logged) {
  ------------------
  |  Branch (3703:9): [True: 16, False: 0]
  ------------------
 3704|     16|        log->action = "logging request";
 3705|       |
 3706|     16|        ngx_http_log_request(r);
 3707|     16|    }
 3708|       |
 3709|     16|    log->action = "closing request";
 3710|       |
 3711|     16|    if (r->connection->timedout
  ------------------
  |  Branch (3711:9): [True: 0, False: 16]
  ------------------
 3712|       |#if (NGX_HTTP_V3)
 3713|       |        && r->connection->quic == NULL
 3714|       |#endif
 3715|     16|       )
 3716|      0|    {
 3717|      0|        clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 3718|       |
 3719|      0|        if (clcf->reset_timedout_connection) {
  ------------------
  |  Branch (3719:13): [True: 0, False: 0]
  ------------------
 3720|      0|            linger.l_onoff = 1;
 3721|      0|            linger.l_linger = 0;
 3722|       |
 3723|      0|            if (setsockopt(r->connection->fd, SOL_SOCKET, SO_LINGER,
  ------------------
  |  Branch (3723:17): [True: 0, False: 0]
  ------------------
 3724|      0|                           (const void *) &linger, sizeof(struct linger)) == -1)
 3725|      0|            {
 3726|      0|                ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3727|      0|                              "setsockopt(SO_LINGER) failed");
 3728|      0|            }
 3729|      0|        }
 3730|      0|    }
 3731|       |
 3732|       |    /* the various request strings were allocated from r->pool */
 3733|     16|    ctx = log->data;
 3734|     16|    ctx->request = NULL;
 3735|       |
 3736|     16|    r->request_line.len = 0;
 3737|       |
 3738|     16|    r->connection->destroyed = 1;
 3739|       |
 3740|       |    /*
 3741|       |     * Setting r->pool to NULL will increase probability to catch double close
 3742|       |     * of request since the request object is allocated from its own pool.
 3743|       |     */
 3744|       |
 3745|     16|    pool = r->pool;
 3746|     16|    r->pool = NULL;
 3747|       |
 3748|     16|    ngx_destroy_pool(pool);
 3749|     16|}
ngx_http_close_connection:
 3772|     16|{
 3773|     16|    ngx_pool_t  *pool;
 3774|       |
 3775|     16|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
 3776|     16|                   "close http connection: %d", c->fd);
 3777|       |
 3778|       |#if (NGX_HTTP_SSL)
 3779|       |
 3780|       |    if (c->ssl) {
 3781|       |        if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
 3782|       |            c->ssl->handler = ngx_http_close_connection;
 3783|       |            return;
 3784|       |        }
 3785|       |    }
 3786|       |
 3787|       |#endif
 3788|       |
 3789|       |#if (NGX_HTTP_V3)
 3790|       |    if (c->quic) {
 3791|       |        ngx_http_v3_reset_stream(c);
 3792|       |    }
 3793|       |#endif
 3794|       |
 3795|       |#if (NGX_STAT_STUB)
 3796|       |    (void) ngx_atomic_fetch_add(ngx_stat_active, -1);
 3797|       |#endif
 3798|       |
 3799|     16|    c->destroyed = 1;
 3800|       |
 3801|     16|    pool = c->pool;
 3802|       |
 3803|     16|    ngx_close_connection(c);
 3804|       |
 3805|     16|    ngx_destroy_pool(pool);
 3806|     16|}
ngx_http_request.c:ngx_http_wait_request_handler:
  379|     16|{
  380|     16|    u_char                    *p;
  381|     16|    size_t                     size;
  382|     16|    ssize_t                    n;
  383|     16|    ngx_buf_t                 *b;
  384|     16|    ngx_connection_t          *c;
  385|     16|    ngx_http_connection_t     *hc;
  386|     16|    ngx_http_core_srv_conf_t  *cscf;
  387|       |
  388|     16|    c = rev->data;
  389|       |
  390|     16|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http wait request handler");
  391|       |
  392|     16|    if (rev->timedout) {
  ------------------
  |  Branch (392:9): [True: 0, False: 16]
  ------------------
  393|      0|        ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  394|      0|        ngx_http_close_connection(c);
  395|      0|        return;
  396|      0|    }
  397|       |
  398|     16|    if (c->close) {
  ------------------
  |  Branch (398:9): [True: 0, False: 16]
  ------------------
  399|      0|        ngx_http_close_connection(c);
  400|      0|        return;
  401|      0|    }
  402|       |
  403|     16|    hc = c->data;
  404|     16|    cscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_core_module);
  ------------------
  |  |   57|     16|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
  405|       |
  406|     16|    size = cscf->client_header_buffer_size;
  407|       |
  408|     16|    b = c->buffer;
  409|       |
  410|     16|    if (b == NULL) {
  ------------------
  |  Branch (410:9): [True: 16, False: 0]
  ------------------
  411|     16|        b = ngx_create_temp_buf(c->pool, size);
  412|     16|        if (b == NULL) {
  ------------------
  |  Branch (412:13): [True: 0, False: 16]
  ------------------
  413|      0|            ngx_http_close_connection(c);
  414|      0|            return;
  415|      0|        }
  416|       |
  417|     16|        c->buffer = b;
  418|       |
  419|     16|    } else if (b->start == NULL) {
  ------------------
  |  Branch (419:16): [True: 0, False: 0]
  ------------------
  420|       |
  421|      0|        b->start = ngx_palloc(c->pool, size);
  422|      0|        if (b->start == NULL) {
  ------------------
  |  Branch (422:13): [True: 0, False: 0]
  ------------------
  423|      0|            ngx_http_close_connection(c);
  424|      0|            return;
  425|      0|        }
  426|       |
  427|      0|        b->pos = b->start;
  428|      0|        b->last = b->start;
  429|      0|        b->end = b->last + size;
  430|      0|    }
  431|       |
  432|     16|    n = c->recv(c, b->last, size);
  433|       |
  434|     16|    if (n == NGX_AGAIN) {
  ------------------
  |  |   40|     16|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (434:9): [True: 0, False: 16]
  ------------------
  435|       |
  436|      0|        if (!rev->timer_set) {
  ------------------
  |  Branch (436:13): [True: 0, False: 0]
  ------------------
  437|      0|            ngx_add_timer(rev, cscf->client_header_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
  438|      0|            ngx_reusable_connection(c, 1);
  439|      0|        }
  440|       |
  441|      0|        if (ngx_handle_read_event(rev, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (441:13): [True: 0, False: 0]
  ------------------
  442|      0|            ngx_http_close_connection(c);
  443|      0|            return;
  444|      0|        }
  445|       |
  446|       |        /*
  447|       |         * We are trying to not hold c->buffer's memory for an idle connection.
  448|       |         */
  449|       |
  450|      0|        if (ngx_pfree(c->pool, b->start) == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (450:13): [True: 0, False: 0]
  ------------------
  451|      0|            b->start = NULL;
  452|      0|        }
  453|       |
  454|      0|        return;
  455|      0|    }
  456|       |
  457|     16|    if (n == NGX_ERROR) {
  ------------------
  |  |   39|     16|#define  NGX_ERROR      -1
  ------------------
  |  Branch (457:9): [True: 0, False: 16]
  ------------------
  458|      0|        ngx_http_close_connection(c);
  459|      0|        return;
  460|      0|    }
  461|       |
  462|     16|    if (n == 0) {
  ------------------
  |  Branch (462:9): [True: 0, False: 16]
  ------------------
  463|      0|        ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  464|      0|                      "client closed connection");
  465|      0|        ngx_http_close_connection(c);
  466|      0|        return;
  467|      0|    }
  468|       |
  469|     16|    b->last += n;
  470|       |
  471|     16|    if (hc->proxy_protocol) {
  ------------------
  |  Branch (471:9): [True: 0, False: 16]
  ------------------
  472|      0|        hc->proxy_protocol = 0;
  473|       |
  474|      0|        p = ngx_proxy_protocol_read(c, b->pos, b->last);
  475|       |
  476|      0|        if (p == NULL) {
  ------------------
  |  Branch (476:13): [True: 0, False: 0]
  ------------------
  477|      0|            ngx_http_close_connection(c);
  478|      0|            return;
  479|      0|        }
  480|       |
  481|      0|        b->pos = p;
  482|       |
  483|      0|        if (b->pos == b->last) {
  ------------------
  |  Branch (483:13): [True: 0, False: 0]
  ------------------
  484|      0|            c->log->action = "waiting for request";
  485|      0|            b->pos = b->start;
  486|      0|            b->last = b->start;
  487|      0|            ngx_post_event(rev, &ngx_posted_events);
  ------------------
  |  |   19|      0|    if (!(ev)->posted) {                                                      \
  |  |  ------------------
  |  |  |  Branch (19:9): [True: 0, False: 0]
  |  |  ------------------
  |  |   20|      0|        (ev)->posted = 1;                                                     \
  |  |   21|      0|        ngx_queue_insert_tail(q, &(ev)->queue);                               \
  |  |  ------------------
  |  |  |  |   44|      0|    (x)->prev = (h)->prev;                                                    \
  |  |  |  |   45|      0|    (x)->prev->next = x;                                                      \
  |  |  |  |   46|      0|    (x)->next = h;                                                            \
  |  |  |  |   47|      0|    (h)->prev = x
  |  |  ------------------
  |  |   22|      0|                                                                              \
  |  |   23|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, "post event %p", ev);\
  |  |   24|      0|                                                                              \
  |  |   25|      0|    } else  {                                                                 \
  |  |   26|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                      \
  |  |   27|      0|                       "update posted event %p", ev);                         \
  |  |   28|      0|    }
  ------------------
  488|      0|            return;
  489|      0|        }
  490|      0|    }
  491|       |
  492|     16|    c->log->action = "reading client request line";
  493|       |
  494|     16|    ngx_reusable_connection(c, 0);
  495|       |
  496|     16|    c->data = ngx_http_create_request(c);
  497|     16|    if (c->data == NULL) {
  ------------------
  |  Branch (497:9): [True: 0, False: 16]
  ------------------
  498|      0|        ngx_http_close_connection(c);
  499|      0|        return;
  500|      0|    }
  501|       |
  502|     16|    rev->handler = ngx_http_process_request_line;
  503|     16|    ngx_http_process_request_line(rev);
  504|     16|}
ngx_http_request.c:ngx_http_process_request_line:
 1061|     16|{
 1062|     16|    ssize_t              n;
 1063|     16|    ngx_int_t            rc, rv;
 1064|     16|    ngx_str_t            host;
 1065|     16|    ngx_connection_t    *c;
 1066|     16|    ngx_http_request_t  *r;
 1067|       |
 1068|     16|    c = rev->data;
 1069|     16|    r = c->data;
 1070|       |
 1071|     16|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0,
 1072|     16|                   "http process request line");
 1073|       |
 1074|     16|    if (rev->timedout) {
  ------------------
  |  Branch (1074:9): [True: 0, False: 16]
  ------------------
 1075|      0|        ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1076|      0|        c->timedout = 1;
 1077|      0|        ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT);
  ------------------
  |  |   97|      0|#define NGX_HTTP_REQUEST_TIME_OUT          408
  ------------------
 1078|      0|        return;
 1079|      0|    }
 1080|       |
 1081|     16|    rc = NGX_AGAIN;
  ------------------
  |  |   40|     16|#define  NGX_AGAIN      -2
  ------------------
 1082|       |
 1083|    114|    for ( ;; ) {
 1084|       |
 1085|    114|        if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|    114|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (1085:13): [True: 114, False: 0]
  ------------------
 1086|    114|            n = ngx_http_read_request_header(r);
 1087|       |
 1088|    114|            if (n == NGX_AGAIN || n == NGX_ERROR) {
  ------------------
  |  |   40|    228|#define  NGX_AGAIN      -2
  ------------------
                          if (n == NGX_AGAIN || n == NGX_ERROR) {
  ------------------
  |  |   39|    114|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1088:17): [True: 0, False: 114]
  |  Branch (1088:35): [True: 3, False: 111]
  ------------------
 1089|      3|                break;
 1090|      3|            }
 1091|    114|        }
 1092|       |
 1093|    111|        rc = ngx_http_parse_request_line(r, r->header_in);
 1094|       |
 1095|    111|        if (rc == NGX_OK) {
  ------------------
  |  |   38|    111|#define  NGX_OK          0
  ------------------
  |  Branch (1095:13): [True: 12, False: 99]
  ------------------
 1096|       |
 1097|       |            /* the request line has been parsed successfully */
 1098|       |
 1099|     12|            r->request_line.len = r->request_end - r->request_start;
 1100|     12|            r->request_line.data = r->request_start;
 1101|     12|            r->request_length = r->header_in->pos - r->request_start;
 1102|       |
 1103|     12|            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
 1104|     12|                           "http request line: \"%V\"", &r->request_line);
 1105|       |
 1106|     12|            r->method_name.len = r->method_end - r->request_start + 1;
 1107|     12|            r->method_name.data = r->request_line.data;
 1108|       |
 1109|     12|            if (r->http_protocol.data) {
  ------------------
  |  Branch (1109:17): [True: 8, False: 4]
  ------------------
 1110|      8|                r->http_protocol.len = r->request_end - r->http_protocol.data;
 1111|      8|            }
 1112|       |
 1113|     12|            if (ngx_http_process_request_uri(r) != NGX_OK) {
  ------------------
  |  |   38|     12|#define  NGX_OK          0
  ------------------
  |  Branch (1113:17): [True: 0, False: 12]
  ------------------
 1114|      0|                break;
 1115|      0|            }
 1116|       |
 1117|     12|            if (r->schema_end) {
  ------------------
  |  Branch (1117:17): [True: 2, False: 10]
  ------------------
 1118|      2|                r->schema.len = r->schema_end - r->schema_start;
 1119|      2|                r->schema.data = r->schema_start;
 1120|      2|            }
 1121|       |
 1122|     12|            if (r->host_end) {
  ------------------
  |  Branch (1122:17): [True: 2, False: 10]
  ------------------
 1123|       |
 1124|      2|                host.len = r->host_end - r->host_start;
 1125|      2|                host.data = r->host_start;
 1126|       |
 1127|      2|                rc = ngx_http_validate_host(&host, r->pool, 0);
 1128|       |
 1129|      2|                if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|      2|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (1129:21): [True: 0, False: 2]
  ------------------
 1130|      0|                    ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1131|      0|                                  "client sent invalid host in request line");
 1132|      0|                    ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1133|      0|                    break;
 1134|      0|                }
 1135|       |
 1136|      2|                if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      2|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1136:21): [True: 0, False: 2]
  ------------------
 1137|      0|                    ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1138|      0|                    break;
 1139|      0|                }
 1140|       |
 1141|      2|                if (ngx_http_set_virtual_server(r, &host) == NGX_ERROR) {
  ------------------
  |  |   39|      2|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1141:21): [True: 0, False: 2]
  ------------------
 1142|      0|                    break;
 1143|      0|                }
 1144|       |
 1145|      2|                r->headers_in.server = host;
 1146|      2|            }
 1147|       |
 1148|     12|            if (r->http_version < NGX_HTTP_VERSION_10) {
  ------------------
  |  |   24|     12|#define NGX_HTTP_VERSION_10                1000
  ------------------
  |  Branch (1148:17): [True: 4, False: 8]
  ------------------
 1149|       |
 1150|      4|                if (r->headers_in.server.len == 0
  ------------------
  |  Branch (1150:21): [True: 4, False: 0]
  ------------------
 1151|      4|                    && ngx_http_set_virtual_server(r, &r->headers_in.server)
  ------------------
  |  Branch (1151:24): [True: 0, False: 4]
  ------------------
 1152|      4|                       == NGX_ERROR)
  ------------------
  |  |   39|      4|#define  NGX_ERROR      -1
  ------------------
 1153|      0|                {
 1154|      0|                    break;
 1155|      0|                }
 1156|       |
 1157|      4|                ngx_http_process_request(r);
 1158|      4|                break;
 1159|      4|            }
 1160|       |
 1161|       |
 1162|      8|            if (ngx_list_init(&r->headers_in.headers, r->pool, 20,
  ------------------
  |  Branch (1162:17): [True: 0, False: 8]
  ------------------
 1163|      8|                              sizeof(ngx_table_elt_t))
 1164|      8|                != NGX_OK)
  ------------------
  |  |   38|      8|#define  NGX_OK          0
  ------------------
 1165|      0|            {
 1166|      0|                ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1167|      0|                break;
 1168|      0|            }
 1169|       |
 1170|      8|            c->log->action = "reading client request headers";
 1171|       |
 1172|      8|            rev->handler = ngx_http_process_request_headers;
 1173|      8|            ngx_http_process_request_headers(rev);
 1174|       |
 1175|      8|            break;
 1176|      8|        }
 1177|       |
 1178|     99|        if (rc != NGX_AGAIN) {
  ------------------
  |  |   40|     99|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (1178:13): [True: 1, False: 98]
  ------------------
 1179|       |
 1180|       |            /* there was error while a request line parsing */
 1181|       |
 1182|      1|            ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      1|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1183|      1|                          ngx_http_client_errors[rc - NGX_HTTP_CLIENT_ERROR]);
 1184|       |
 1185|      1|            if (rc == NGX_HTTP_PARSE_INVALID_VERSION) {
  ------------------
  |  |   59|      1|#define NGX_HTTP_PARSE_INVALID_VERSION     12
  ------------------
  |  Branch (1185:17): [True: 0, False: 1]
  ------------------
 1186|      0|                ngx_http_finalize_request(r, NGX_HTTP_VERSION_NOT_SUPPORTED);
  ------------------
  |  |  143|      0|#define NGX_HTTP_VERSION_NOT_SUPPORTED     505
  ------------------
 1187|       |
 1188|      1|            } else {
 1189|      1|                ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      1|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1190|      1|            }
 1191|       |
 1192|      1|            break;
 1193|      1|        }
 1194|       |
 1195|       |        /* NGX_AGAIN: a request line parsing is still incomplete */
 1196|       |
 1197|     98|        if (r->header_in->pos == r->header_in->end) {
  ------------------
  |  Branch (1197:13): [True: 95, False: 3]
  ------------------
 1198|       |
 1199|     95|            rv = ngx_http_alloc_large_header_buffer(r, 1);
 1200|       |
 1201|     95|            if (rv == NGX_ERROR) {
  ------------------
  |  |   39|     95|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1201:17): [True: 0, False: 95]
  ------------------
 1202|      0|                ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1203|      0|                break;
 1204|      0|            }
 1205|       |
 1206|     95|            if (rv == NGX_DECLINED) {
  ------------------
  |  |   43|     95|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (1206:17): [True: 0, False: 95]
  ------------------
 1207|      0|                r->request_line.len = r->header_in->end - r->request_start;
 1208|      0|                r->request_line.data = r->request_start;
 1209|       |
 1210|      0|                ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1211|      0|                              "client sent too long URI");
 1212|      0|                ngx_http_finalize_request(r, NGX_HTTP_REQUEST_URI_TOO_LARGE);
  ------------------
  |  |  102|      0|#define NGX_HTTP_REQUEST_URI_TOO_LARGE     414
  ------------------
 1213|      0|                break;
 1214|      0|            }
 1215|     95|        }
 1216|     98|    }
 1217|       |
 1218|     16|    ngx_http_run_posted_requests(c);
 1219|     16|}
ngx_http_request.c:ngx_http_read_request_header:
 1535|    122|{
 1536|    122|    ssize_t                    n;
 1537|    122|    ngx_event_t               *rev;
 1538|    122|    ngx_connection_t          *c;
 1539|    122|    ngx_http_core_srv_conf_t  *cscf;
 1540|       |
 1541|    122|    c = r->connection;
 1542|    122|    rev = c->read;
 1543|       |
 1544|    122|    n = r->header_in->last - r->header_in->pos;
 1545|       |
 1546|    122|    if (n > 0) {
  ------------------
  |  Branch (1546:9): [True: 24, False: 98]
  ------------------
 1547|     24|        return n;
 1548|     24|    }
 1549|       |
 1550|     98|    if (rev->ready) {
  ------------------
  |  Branch (1550:9): [True: 98, False: 0]
  ------------------
 1551|     98|        n = c->recv(c, r->header_in->last,
 1552|     98|                    r->header_in->end - r->header_in->last);
 1553|     98|    } else {
 1554|      0|        n = NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1555|      0|    }
 1556|       |
 1557|     98|    if (n == NGX_AGAIN) {
  ------------------
  |  |   40|     98|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (1557:9): [True: 0, False: 98]
  ------------------
 1558|      0|        if (!rev->timer_set) {
  ------------------
  |  Branch (1558:13): [True: 0, False: 0]
  ------------------
 1559|      0|            cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|      0|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
 1560|      0|            ngx_add_timer(rev, cscf->client_header_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 1561|      0|        }
 1562|       |
 1563|      0|        if (ngx_handle_read_event(rev, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1563:13): [True: 0, False: 0]
  ------------------
 1564|      0|            ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1565|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1566|      0|        }
 1567|       |
 1568|      0|        return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 1569|      0|    }
 1570|       |
 1571|     98|    if (n == 0) {
  ------------------
  |  Branch (1571:9): [True: 3, False: 95]
  ------------------
 1572|      3|        ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      3|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 3]
  |  |  ------------------
  ------------------
 1573|      3|                      "client prematurely closed connection");
 1574|      3|    }
 1575|       |
 1576|     98|    if (n == 0 || n == NGX_ERROR) {
  ------------------
  |  |   39|     95|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1576:9): [True: 3, False: 95]
  |  Branch (1576:19): [True: 0, False: 95]
  ------------------
 1577|      3|        c->error = 1;
 1578|      3|        c->log->action = "reading client request headers";
 1579|       |
 1580|      3|        ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      3|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1581|      3|        return NGX_ERROR;
  ------------------
  |  |   39|      3|#define  NGX_ERROR      -1
  ------------------
 1582|      3|    }
 1583|       |
 1584|     95|    r->header_in->last += n;
 1585|       |
 1586|     95|    return n;
 1587|     98|}
ngx_http_request.c:ngx_http_process_request_headers:
 1345|      8|{
 1346|      8|    u_char                     *p;
 1347|      8|    size_t                      len;
 1348|      8|    ssize_t                     n;
 1349|      8|    ngx_int_t                   rc, rv;
 1350|      8|    ngx_table_elt_t            *h;
 1351|      8|    ngx_connection_t           *c;
 1352|      8|    ngx_http_header_t          *hh;
 1353|      8|    ngx_http_request_t         *r;
 1354|      8|    ngx_http_core_srv_conf_t   *cscf;
 1355|      8|    ngx_http_core_main_conf_t  *cmcf;
 1356|       |
 1357|      8|    c = rev->data;
 1358|      8|    r = c->data;
 1359|       |
 1360|      8|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0,
 1361|      8|                   "http process request header line");
 1362|       |
 1363|      8|    if (rev->timedout) {
  ------------------
  |  Branch (1363:9): [True: 0, False: 8]
  ------------------
 1364|      0|        ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1365|      0|        c->timedout = 1;
 1366|      0|        ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT);
  ------------------
  |  |   97|      0|#define NGX_HTTP_REQUEST_TIME_OUT          408
  ------------------
 1367|      0|        return;
 1368|      0|    }
 1369|       |
 1370|      8|    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  ------------------
  |  |   56|      8|    (r)->main_conf[module.ctx_index]
  ------------------
 1371|       |
 1372|      8|    rc = NGX_AGAIN;
  ------------------
  |  |   40|      8|#define  NGX_AGAIN      -2
  ------------------
 1373|       |
 1374|     21|    for ( ;; ) {
 1375|       |
 1376|     21|        if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|     21|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (1376:13): [True: 8, False: 13]
  ------------------
 1377|       |
 1378|      8|            if (r->header_in->pos == r->header_in->end) {
  ------------------
  |  Branch (1378:17): [True: 0, False: 8]
  ------------------
 1379|       |
 1380|      0|                rv = ngx_http_alloc_large_header_buffer(r, 0);
 1381|       |
 1382|      0|                if (rv == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1382:21): [True: 0, False: 0]
  ------------------
 1383|      0|                    ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1384|      0|                    break;
 1385|      0|                }
 1386|       |
 1387|      0|                if (rv == NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (1387:21): [True: 0, False: 0]
  ------------------
 1388|      0|                    p = r->header_name_start;
 1389|       |
 1390|      0|                    r->lingering_close = 1;
 1391|       |
 1392|      0|                    if (p == NULL) {
  ------------------
  |  Branch (1392:25): [True: 0, False: 0]
  ------------------
 1393|      0|                        ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1394|      0|                                      "client sent too large request");
 1395|      0|                        ngx_http_finalize_request(r,
 1396|      0|                                            NGX_HTTP_REQUEST_HEADER_TOO_LARGE);
  ------------------
  |  |  116|      0|#define NGX_HTTP_REQUEST_HEADER_TOO_LARGE  494
  ------------------
 1397|      0|                        break;
 1398|      0|                    }
 1399|       |
 1400|      0|                    len = r->header_in->end - p;
 1401|       |
 1402|      0|                    if (len > NGX_MAX_ERROR_STR - 300) {
  ------------------
  |  |   76|      0|#define NGX_MAX_ERROR_STR   2048
  ------------------
  |  Branch (1402:25): [True: 0, False: 0]
  ------------------
 1403|      0|                        len = NGX_MAX_ERROR_STR - 300;
  ------------------
  |  |   76|      0|#define NGX_MAX_ERROR_STR   2048
  ------------------
 1404|      0|                    }
 1405|       |
 1406|      0|                    ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1407|      0|                                "client sent too long header line: \"%*s...\"",
 1408|      0|                                len, r->header_name_start);
 1409|       |
 1410|      0|                    ngx_http_finalize_request(r,
 1411|      0|                                            NGX_HTTP_REQUEST_HEADER_TOO_LARGE);
  ------------------
  |  |  116|      0|#define NGX_HTTP_REQUEST_HEADER_TOO_LARGE  494
  ------------------
 1412|      0|                    break;
 1413|      0|                }
 1414|      0|            }
 1415|       |
 1416|      8|            n = ngx_http_read_request_header(r);
 1417|       |
 1418|      8|            if (n == NGX_AGAIN || n == NGX_ERROR) {
  ------------------
  |  |   40|     16|#define  NGX_AGAIN      -2
  ------------------
                          if (n == NGX_AGAIN || n == NGX_ERROR) {
  ------------------
  |  |   39|      8|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1418:17): [True: 0, False: 8]
  |  Branch (1418:35): [True: 0, False: 8]
  ------------------
 1419|      0|                break;
 1420|      0|            }
 1421|      8|        }
 1422|       |
 1423|       |        /* the host header could change the server configuration context */
 1424|     21|        cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|     21|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
 1425|       |
 1426|     21|        rc = ngx_http_parse_header_line(r, r->header_in,
 1427|     21|                                        cscf->underscores_in_headers);
 1428|       |
 1429|     21|        if (rc == NGX_OK) {
  ------------------
  |  |   38|     21|#define  NGX_OK          0
  ------------------
  |  Branch (1429:13): [True: 13, False: 8]
  ------------------
 1430|       |
 1431|     13|            r->request_length += r->header_in->pos - r->header_name_start;
 1432|       |
 1433|     13|            if (r->invalid_header && cscf->ignore_invalid_headers) {
  ------------------
  |  Branch (1433:17): [True: 1, False: 12]
  |  Branch (1433:38): [True: 1, False: 0]
  ------------------
 1434|       |
 1435|       |                /* there was error while a header line parsing */
 1436|       |
 1437|      1|                ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      1|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1438|      1|                              "client sent invalid header line: \"%*s\"",
 1439|      1|                              r->header_end - r->header_name_start,
 1440|      1|                              r->header_name_start);
 1441|      1|                continue;
 1442|      1|            }
 1443|       |
 1444|       |            /* a header line has been parsed successfully */
 1445|       |
 1446|     12|            h = ngx_list_push(&r->headers_in.headers);
 1447|     12|            if (h == NULL) {
  ------------------
  |  Branch (1447:17): [True: 0, False: 12]
  ------------------
 1448|      0|                ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1449|      0|                break;
 1450|      0|            }
 1451|       |
 1452|     12|            h->hash = r->header_hash;
 1453|       |
 1454|     12|            h->key.len = r->header_name_end - r->header_name_start;
 1455|     12|            h->key.data = r->header_name_start;
 1456|     12|            h->key.data[h->key.len] = '\0';
 1457|       |
 1458|     12|            h->value.len = r->header_end - r->header_start;
 1459|     12|            h->value.data = r->header_start;
 1460|     12|            h->value.data[h->value.len] = '\0';
 1461|       |
 1462|     12|            h->lowcase_key = ngx_pnalloc(r->pool, h->key.len);
 1463|     12|            if (h->lowcase_key == NULL) {
  ------------------
  |  Branch (1463:17): [True: 0, False: 12]
  ------------------
 1464|      0|                ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1465|      0|                break;
 1466|      0|            }
 1467|       |
 1468|     12|            if (h->key.len == r->lowcase_index) {
  ------------------
  |  Branch (1468:17): [True: 12, False: 0]
  ------------------
 1469|     12|                ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
  ------------------
  |  |  106|     12|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1470|       |
 1471|     12|            } else {
 1472|      0|                ngx_strlow(h->lowcase_key, h->key.data, h->key.len);
 1473|      0|            }
 1474|       |
 1475|     12|            hh = ngx_hash_find(&cmcf->headers_in_hash, h->hash,
 1476|     12|                               h->lowcase_key, h->key.len);
 1477|       |
 1478|     12|            if (hh && hh->handler(r, h, hh->offset) != NGX_OK) {
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  |  Branch (1478:17): [True: 11, False: 1]
  |  Branch (1478:23): [True: 0, False: 11]
  ------------------
 1479|      0|                break;
 1480|      0|            }
 1481|       |
 1482|     12|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1483|     12|                           "http header: \"%V: %V\"",
 1484|     12|                           &h->key, &h->value);
 1485|       |
 1486|     12|            continue;
 1487|     12|        }
 1488|       |
 1489|      8|        if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
  ------------------
  |  |   54|      8|#define NGX_HTTP_PARSE_HEADER_DONE         1
  ------------------
  |  Branch (1489:13): [True: 8, False: 0]
  ------------------
 1490|       |
 1491|       |            /* a whole header has been parsed successfully */
 1492|       |
 1493|      8|            ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1494|      8|                           "http header done");
 1495|       |
 1496|      8|            r->request_length += r->header_in->pos - r->header_name_start;
 1497|       |
 1498|      8|            r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE;
 1499|       |
 1500|      8|            rc = ngx_http_process_request_header(r);
 1501|       |
 1502|      8|            if (rc != NGX_OK) {
  ------------------
  |  |   38|      8|#define  NGX_OK          0
  ------------------
  |  Branch (1502:17): [True: 1, False: 7]
  ------------------
 1503|      1|                break;
 1504|      1|            }
 1505|       |
 1506|      7|            ngx_http_process_request(r);
 1507|       |
 1508|      7|            break;
 1509|      8|        }
 1510|       |
 1511|      0|        if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (1511:13): [True: 0, False: 0]
  ------------------
 1512|       |
 1513|       |            /* a header line parsing is still not complete */
 1514|       |
 1515|      0|            continue;
 1516|      0|        }
 1517|       |
 1518|       |        /* rc == NGX_HTTP_PARSE_INVALID_HEADER */
 1519|       |
 1520|      0|        ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1521|      0|                      "client sent invalid header line: \"%*s\\x%02xd...\"",
 1522|      0|                      r->header_end - r->header_name_start,
 1523|      0|                      r->header_name_start, *r->header_end);
 1524|       |
 1525|      0|        ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1526|      0|        break;
 1527|      0|    }
 1528|       |
 1529|      8|    ngx_http_run_posted_requests(c);
 1530|      8|}
ngx_http_request.c:ngx_http_alloc_large_header_buffer:
 1593|     95|{
 1594|     95|    u_char                    *old, *new;
 1595|     95|    ngx_buf_t                 *b;
 1596|     95|    ngx_chain_t               *cl;
 1597|     95|    ngx_http_connection_t     *hc;
 1598|     95|    ngx_http_core_srv_conf_t  *cscf;
 1599|       |
 1600|     95|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1601|     95|                   "http alloc large header buffer");
 1602|       |
 1603|     95|    if (request_line && r->state == 0) {
  ------------------
  |  Branch (1603:9): [True: 95, False: 0]
  |  Branch (1603:25): [True: 93, False: 2]
  ------------------
 1604|       |
 1605|       |        /* the client fills up the buffer with "\r\n" */
 1606|       |
 1607|     93|        r->header_in->pos = r->header_in->start;
 1608|     93|        r->header_in->last = r->header_in->start;
 1609|       |
 1610|     93|        return NGX_OK;
  ------------------
  |  |   38|     93|#define  NGX_OK          0
  ------------------
 1611|     93|    }
 1612|       |
 1613|      2|    old = request_line ? r->request_start : r->header_name_start;
  ------------------
  |  Branch (1613:11): [True: 2, False: 0]
  ------------------
 1614|       |
 1615|      2|    cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|      2|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
 1616|       |
 1617|      2|    if (r->state != 0
  ------------------
  |  Branch (1617:9): [True: 2, False: 0]
  ------------------
 1618|      2|        && (size_t) (r->header_in->pos - old)
  ------------------
  |  Branch (1618:12): [True: 0, False: 2]
  ------------------
 1619|      2|                                     >= cscf->large_client_header_buffers.size)
 1620|      0|    {
 1621|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 1622|      0|    }
 1623|       |
 1624|      2|    hc = r->http_connection;
 1625|       |
 1626|      2|    if (hc->free) {
  ------------------
  |  Branch (1626:9): [True: 0, False: 2]
  ------------------
 1627|      0|        cl = hc->free;
 1628|      0|        hc->free = cl->next;
 1629|       |
 1630|      0|        b = cl->buf;
 1631|       |
 1632|      0|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1633|      0|                       "http large header free: %p %uz",
 1634|      0|                       b->pos, b->end - b->last);
 1635|       |
 1636|      2|    } else if (hc->nbusy < cscf->large_client_header_buffers.num) {
  ------------------
  |  Branch (1636:16): [True: 2, False: 0]
  ------------------
 1637|       |
 1638|      2|        b = ngx_create_temp_buf(r->connection->pool,
 1639|      2|                                cscf->large_client_header_buffers.size);
 1640|      2|        if (b == NULL) {
  ------------------
  |  Branch (1640:13): [True: 0, False: 2]
  ------------------
 1641|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1642|      0|        }
 1643|       |
 1644|      2|        cl = ngx_alloc_chain_link(r->connection->pool);
 1645|      2|        if (cl == NULL) {
  ------------------
  |  Branch (1645:13): [True: 0, False: 2]
  ------------------
 1646|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1647|      0|        }
 1648|       |
 1649|      2|        cl->buf = b;
 1650|       |
 1651|      2|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1652|      2|                       "http large header alloc: %p %uz",
 1653|      2|                       b->pos, b->end - b->last);
 1654|       |
 1655|      2|    } else {
 1656|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 1657|      0|    }
 1658|       |
 1659|      2|    cl->next = hc->busy;
 1660|      2|    hc->busy = cl;
 1661|      2|    hc->nbusy++;
 1662|       |
 1663|      2|    if (r->state == 0) {
  ------------------
  |  Branch (1663:9): [True: 0, False: 2]
  ------------------
 1664|       |        /*
 1665|       |         * r->state == 0 means that a header line was parsed successfully
 1666|       |         * and we do not need to copy incomplete header line and
 1667|       |         * to relocate the parser header pointers
 1668|       |         */
 1669|       |
 1670|      0|        r->header_in = b;
 1671|       |
 1672|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1673|      0|    }
 1674|       |
 1675|      2|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1676|      2|                   "http large header copy: %uz", r->header_in->pos - old);
 1677|       |
 1678|      2|    if (r->header_in->pos - old > b->end - b->start) {
  ------------------
  |  Branch (1678:9): [True: 0, False: 2]
  ------------------
 1679|      0|        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1680|      0|                      "too large header to copy");
 1681|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1682|      0|    }
 1683|       |
 1684|      2|    new = b->start;
 1685|       |
 1686|      2|    ngx_memcpy(new, old, r->header_in->pos - old);
  ------------------
  |  |  106|      2|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
 1687|       |
 1688|      2|    b->pos = new + (r->header_in->pos - old);
 1689|      2|    b->last = new + (r->header_in->pos - old);
 1690|       |
 1691|      2|    if (request_line) {
  ------------------
  |  Branch (1691:9): [True: 2, False: 0]
  ------------------
 1692|      2|        r->request_start = new;
 1693|       |
 1694|      2|        if (r->request_end) {
  ------------------
  |  Branch (1694:13): [True: 0, False: 2]
  ------------------
 1695|      0|            r->request_end = new + (r->request_end - old);
 1696|      0|        }
 1697|       |
 1698|      2|        r->method_end = new + (r->method_end - old);
 1699|       |
 1700|      2|        r->uri_start = new + (r->uri_start - old);
 1701|      2|        r->uri_end = new + (r->uri_end - old);
 1702|       |
 1703|      2|        if (r->schema_start) {
  ------------------
  |  Branch (1703:13): [True: 0, False: 2]
  ------------------
 1704|      0|            r->schema_start = new + (r->schema_start - old);
 1705|      0|            r->schema_end = new + (r->schema_end - old);
 1706|      0|        }
 1707|       |
 1708|      2|        if (r->host_start) {
  ------------------
  |  Branch (1708:13): [True: 0, False: 2]
  ------------------
 1709|      0|            r->host_start = new + (r->host_start - old);
 1710|      0|            if (r->host_end) {
  ------------------
  |  Branch (1710:17): [True: 0, False: 0]
  ------------------
 1711|      0|                r->host_end = new + (r->host_end - old);
 1712|      0|            }
 1713|      0|        }
 1714|       |
 1715|      2|        if (r->port_start) {
  ------------------
  |  Branch (1715:13): [True: 0, False: 2]
  ------------------
 1716|      0|            r->port_start = new + (r->port_start - old);
 1717|      0|            r->port_end = new + (r->port_end - old);
 1718|      0|        }
 1719|       |
 1720|      2|        if (r->uri_ext) {
  ------------------
  |  Branch (1720:13): [True: 0, False: 2]
  ------------------
 1721|      0|            r->uri_ext = new + (r->uri_ext - old);
 1722|      0|        }
 1723|       |
 1724|      2|        if (r->args_start) {
  ------------------
  |  Branch (1724:13): [True: 0, False: 2]
  ------------------
 1725|      0|            r->args_start = new + (r->args_start - old);
 1726|      0|        }
 1727|       |
 1728|      2|        if (r->http_protocol.data) {
  ------------------
  |  Branch (1728:13): [True: 0, False: 2]
  ------------------
 1729|      0|            r->http_protocol.data = new + (r->http_protocol.data - old);
 1730|      0|        }
 1731|       |
 1732|      2|    } else {
 1733|      0|        r->header_name_start = new;
 1734|      0|        r->header_name_end = new + (r->header_name_end - old);
 1735|      0|        r->header_start = new + (r->header_start - old);
 1736|      0|        r->header_end = new + (r->header_end - old);
 1737|      0|    }
 1738|       |
 1739|      2|    r->header_in = b;
 1740|       |
 1741|      2|    return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 1742|      2|}
ngx_http_request.c:ngx_http_alloc_request:
  541|     16|{
  542|     16|    ngx_pool_t                 *pool;
  543|     16|    ngx_time_t                 *tp;
  544|     16|    ngx_http_request_t         *r;
  545|     16|    ngx_http_connection_t      *hc;
  546|     16|    ngx_http_core_srv_conf_t   *cscf;
  547|     16|    ngx_http_core_main_conf_t  *cmcf;
  548|       |
  549|     16|    hc = c->data;
  550|       |
  551|     16|    cscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_core_module);
  ------------------
  |  |   57|     16|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
  552|       |
  553|     16|    pool = ngx_create_pool(cscf->request_pool_size, c->log);
  554|     16|    if (pool == NULL) {
  ------------------
  |  Branch (554:9): [True: 0, False: 16]
  ------------------
  555|      0|        return NULL;
  556|      0|    }
  557|       |
  558|     16|    r = ngx_pcalloc(pool, sizeof(ngx_http_request_t));
  559|     16|    if (r == NULL) {
  ------------------
  |  Branch (559:9): [True: 0, False: 16]
  ------------------
  560|      0|        ngx_destroy_pool(pool);
  561|      0|        return NULL;
  562|      0|    }
  563|       |
  564|     16|    r->pool = pool;
  565|       |
  566|     16|    r->http_connection = hc;
  567|     16|    r->signature = NGX_HTTP_MODULE;
  ------------------
  |  |   39|     16|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  568|     16|    r->connection = c;
  569|       |
  570|     16|    r->main_conf = hc->conf_ctx->main_conf;
  571|     16|    r->srv_conf = hc->conf_ctx->srv_conf;
  572|     16|    r->loc_conf = hc->conf_ctx->loc_conf;
  573|       |
  574|     16|    r->read_event_handler = ngx_http_block_reading;
  575|       |
  576|     16|    r->header_in = hc->busy ? hc->busy->buf : c->buffer;
  ------------------
  |  Branch (576:20): [True: 0, False: 16]
  ------------------
  577|       |
  578|     16|    if (ngx_list_init(&r->headers_out.headers, r->pool, 20,
  ------------------
  |  Branch (578:9): [True: 0, False: 16]
  ------------------
  579|     16|                      sizeof(ngx_table_elt_t))
  580|     16|        != NGX_OK)
  ------------------
  |  |   38|     16|#define  NGX_OK          0
  ------------------
  581|      0|    {
  582|      0|        ngx_destroy_pool(r->pool);
  583|      0|        return NULL;
  584|      0|    }
  585|       |
  586|     16|    if (ngx_list_init(&r->headers_out.trailers, r->pool, 4,
  ------------------
  |  Branch (586:9): [True: 0, False: 16]
  ------------------
  587|     16|                      sizeof(ngx_table_elt_t))
  588|     16|        != NGX_OK)
  ------------------
  |  |   38|     16|#define  NGX_OK          0
  ------------------
  589|      0|    {
  590|      0|        ngx_destroy_pool(r->pool);
  591|      0|        return NULL;
  592|      0|    }
  593|       |
  594|     16|    r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
  595|     16|    if (r->ctx == NULL) {
  ------------------
  |  Branch (595:9): [True: 0, False: 16]
  ------------------
  596|      0|        ngx_destroy_pool(r->pool);
  597|      0|        return NULL;
  598|      0|    }
  599|       |
  600|     16|    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  ------------------
  |  |   56|     16|    (r)->main_conf[module.ctx_index]
  ------------------
  601|       |
  602|     16|    r->variables = ngx_pcalloc(r->pool, cmcf->variables.nelts
  603|     16|                                        * sizeof(ngx_http_variable_value_t));
  604|     16|    if (r->variables == NULL) {
  ------------------
  |  Branch (604:9): [True: 0, False: 16]
  ------------------
  605|      0|        ngx_destroy_pool(r->pool);
  606|      0|        return NULL;
  607|      0|    }
  608|       |
  609|       |#if (NGX_HTTP_SSL)
  610|       |    if (c->ssl && !c->ssl->sendfile) {
  611|       |        r->main_filter_need_in_memory = 1;
  612|       |    }
  613|       |#endif
  614|       |
  615|     16|    r->main = r;
  616|     16|    r->count = 1;
  617|       |
  618|     16|    tp = ngx_timeofday();
  ------------------
  |  |   37|     16|#define ngx_timeofday()      (ngx_time_t *) ngx_cached_time
  ------------------
  619|     16|    r->start_sec = tp->sec;
  620|     16|    r->start_msec = tp->msec;
  621|       |
  622|     16|    r->method = NGX_HTTP_UNKNOWN;
  ------------------
  |  |   29|     16|#define NGX_HTTP_UNKNOWN                   0x00000001
  ------------------
  623|     16|    r->http_version = NGX_HTTP_VERSION_10;
  ------------------
  |  |   24|     16|#define NGX_HTTP_VERSION_10                1000
  ------------------
  624|       |
  625|     16|    r->headers_in.content_length_n = -1;
  626|     16|    r->headers_in.keep_alive_n = -1;
  627|     16|    r->headers_out.content_length_n = -1;
  628|     16|    r->headers_out.last_modified_time = -1;
  629|       |
  630|     16|    r->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1;
  ------------------
  |  |   12|     16|#define NGX_HTTP_MAX_URI_CHANGES           10
  ------------------
  631|     16|    r->subrequests = NGX_HTTP_MAX_SUBREQUESTS + 1;
  ------------------
  |  |   13|     16|#define NGX_HTTP_MAX_SUBREQUESTS           50
  ------------------
  632|       |
  633|     16|    r->http_state = NGX_HTTP_READING_REQUEST_STATE;
  634|       |
  635|     16|    r->log_handler = ngx_http_log_error_handler;
  636|       |
  637|     16|    return r;
  638|     16|}
ngx_http_request.c:ngx_http_process_unique_header_line:
 1765|      8|{
 1766|      8|    ngx_table_elt_t  **ph;
 1767|       |
 1768|      8|    ph = (ngx_table_elt_t **) ((char *) &r->headers_in + offset);
 1769|       |
 1770|      8|    if (*ph == NULL) {
  ------------------
  |  Branch (1770:9): [True: 8, False: 0]
  ------------------
 1771|      8|        *ph = h;
 1772|      8|        h->next = NULL;
 1773|      8|        return NGX_OK;
  ------------------
  |  |   38|      8|#define  NGX_OK          0
  ------------------
 1774|      8|    }
 1775|       |
 1776|      0|    ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1777|      0|                  "client sent duplicate header line: \"%V: %V\", "
 1778|      0|                  "previous value: \"%V: %V\"",
 1779|      0|                  &h->key, &h->value, &(*ph)->key, &(*ph)->value);
 1780|       |
 1781|      0|    ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1782|       |
 1783|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1784|      8|}
ngx_http_request.c:ngx_http_process_host:
 1790|      3|{
 1791|      3|    ngx_int_t  rc;
 1792|      3|    ngx_str_t  host;
 1793|       |
 1794|      3|    if (r->headers_in.host) {
  ------------------
  |  Branch (1794:9): [True: 0, False: 3]
  ------------------
 1795|      0|        ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1796|      0|                      "client sent duplicate host header: \"%V: %V\", "
 1797|      0|                      "previous value: \"%V: %V\"",
 1798|      0|                      &h->key, &h->value, &r->headers_in.host->key,
 1799|      0|                      &r->headers_in.host->value);
 1800|      0|        ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1801|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1802|      0|    }
 1803|       |
 1804|      3|    r->headers_in.host = h;
 1805|      3|    h->next = NULL;
 1806|       |
 1807|      3|    host = h->value;
 1808|       |
 1809|      3|    rc = ngx_http_validate_host(&host, r->pool, 0);
 1810|       |
 1811|      3|    if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|      3|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (1811:9): [True: 0, False: 3]
  ------------------
 1812|      0|        ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1813|      0|                      "client sent invalid host header");
 1814|      0|        ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1815|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1816|      0|    }
 1817|       |
 1818|      3|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      3|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1818:9): [True: 0, False: 3]
  ------------------
 1819|      0|        ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1820|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1821|      0|    }
 1822|       |
 1823|      3|    if (r->headers_in.server.len) {
  ------------------
  |  Branch (1823:9): [True: 2, False: 1]
  ------------------
 1824|      2|        return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 1825|      2|    }
 1826|       |
 1827|      1|    if (ngx_http_set_virtual_server(r, &host) == NGX_ERROR) {
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1827:9): [True: 0, False: 1]
  ------------------
 1828|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1829|      0|    }
 1830|       |
 1831|      1|    r->headers_in.server = host;
 1832|       |
 1833|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 1834|      1|}
ngx_http_request.c:ngx_http_find_virtual_server:
 2287|     12|{
 2288|     12|    ngx_http_core_srv_conf_t  *cscf;
 2289|       |
 2290|     12|    if (virtual_names == NULL) {
  ------------------
  |  Branch (2290:9): [True: 0, False: 12]
  ------------------
 2291|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 2292|      0|    }
 2293|       |
 2294|     12|    cscf = ngx_hash_find_combined(&virtual_names->names,
 2295|     12|                                  ngx_hash_key(host->data, host->len),
 2296|     12|                                  host->data, host->len);
 2297|       |
 2298|     12|    if (cscf) {
  ------------------
  |  Branch (2298:9): [True: 0, False: 12]
  ------------------
 2299|      0|        *cscfp = cscf;
 2300|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2301|      0|    }
 2302|       |
 2303|     12|#if (NGX_PCRE)
 2304|       |
 2305|     12|    if (host->len && virtual_names->nregex) {
  ------------------
  |  Branch (2305:9): [True: 3, False: 9]
  |  Branch (2305:22): [True: 3, False: 0]
  ------------------
 2306|      3|        ngx_int_t                n;
 2307|      3|        ngx_uint_t               i;
 2308|      3|        ngx_http_server_name_t  *sn;
 2309|       |
 2310|      3|        sn = virtual_names->regex;
 2311|       |
 2312|       |#if (NGX_HTTP_SSL && defined SSL_CTRL_SET_TLSEXT_HOSTNAME)
 2313|       |
 2314|       |        if (r == NULL) {
 2315|       |            ngx_http_connection_t  *hc;
 2316|       |
 2317|       |            for (i = 0; i < virtual_names->nregex; i++) {
 2318|       |
 2319|       |                n = ngx_regex_exec(sn[i].regex->regex, host, NULL, 0);
 2320|       |
 2321|       |                if (n == NGX_REGEX_NO_MATCHED) {
 2322|       |                    continue;
 2323|       |                }
 2324|       |
 2325|       |                if (n >= 0) {
 2326|       |                    hc = c->data;
 2327|       |                    hc->ssl_servername_regex = sn[i].regex;
 2328|       |
 2329|       |                    *cscfp = sn[i].server;
 2330|       |                    return NGX_OK;
 2331|       |                }
 2332|       |
 2333|       |                ngx_log_error(NGX_LOG_ALERT, c->log, 0,
 2334|       |                              ngx_regex_exec_n " failed: %i "
 2335|       |                              "on \"%V\" using \"%V\"",
 2336|       |                              n, host, &sn[i].regex->name);
 2337|       |
 2338|       |                return NGX_ERROR;
 2339|       |            }
 2340|       |
 2341|       |            return NGX_DECLINED;
 2342|       |        }
 2343|       |
 2344|       |#endif /* NGX_HTTP_SSL && defined SSL_CTRL_SET_TLSEXT_HOSTNAME */
 2345|       |
 2346|      6|        for (i = 0; i < virtual_names->nregex; i++) {
  ------------------
  |  Branch (2346:21): [True: 3, False: 3]
  ------------------
 2347|       |
 2348|      3|            n = ngx_http_regex_exec(r, sn[i].regex, host);
 2349|       |
 2350|      3|            if (n == NGX_DECLINED) {
  ------------------
  |  |   43|      3|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (2350:17): [True: 3, False: 0]
  ------------------
 2351|      3|                continue;
 2352|      3|            }
 2353|       |
 2354|      0|            if (n == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2354:17): [True: 0, False: 0]
  ------------------
 2355|      0|                *cscfp = sn[i].server;
 2356|      0|                return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2357|      0|            }
 2358|       |
 2359|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2360|      0|        }
 2361|      3|    }
 2362|       |
 2363|     12|#endif /* NGX_PCRE */
 2364|       |
 2365|     12|    return NGX_DECLINED;
  ------------------
  |  |   43|     12|#define  NGX_DECLINED   -5
  ------------------
 2366|     12|}
ngx_http_request.c:ngx_http_terminate_request:
 2651|      9|{
 2652|      9|    ngx_http_cleanup_t    *cln;
 2653|      9|    ngx_http_request_t    *mr;
 2654|      9|    ngx_http_ephemeral_t  *e;
 2655|       |
 2656|      9|    mr = r->main;
 2657|       |
 2658|      9|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2659|      9|                   "http terminate request count:%d", mr->count);
 2660|       |
 2661|      9|    if (rc > 0 && (mr->headers_out.status == 0 || mr->connection->sent == 0)) {
  ------------------
  |  Branch (2661:9): [True: 9, False: 0]
  |  Branch (2661:20): [True: 9, False: 0]
  |  Branch (2661:51): [True: 0, False: 0]
  ------------------
 2662|      9|        mr->headers_out.status = rc;
 2663|      9|    }
 2664|       |
 2665|      9|    cln = mr->cleanup;
 2666|      9|    mr->cleanup = NULL;
 2667|       |
 2668|      9|    while (cln) {
  ------------------
  |  Branch (2668:12): [True: 0, False: 9]
  ------------------
 2669|      0|        if (cln->handler) {
  ------------------
  |  Branch (2669:13): [True: 0, False: 0]
  ------------------
 2670|      0|            cln->handler(cln->data);
 2671|      0|        }
 2672|       |
 2673|      0|        cln = cln->next;
 2674|      0|    }
 2675|       |
 2676|      9|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2677|      9|                   "http terminate cleanup count:%d blk:%d",
 2678|      9|                   mr->count, mr->blocked);
 2679|       |
 2680|      9|    if (mr->write_event_handler) {
  ------------------
  |  Branch (2680:9): [True: 6, False: 3]
  ------------------
 2681|       |
 2682|      6|        if (mr->blocked) {
  ------------------
  |  Branch (2682:13): [True: 0, False: 6]
  ------------------
 2683|      0|            r->connection->error = 1;
 2684|      0|            r->write_event_handler = ngx_http_request_finalizer;
 2685|      0|            return;
 2686|      0|        }
 2687|       |
 2688|      6|        e = ngx_http_ephemeral(mr);
  ------------------
  |  |  617|      6|#define ngx_http_ephemeral(r)  (void *) (&r->uri_start)
  ------------------
 2689|      6|        mr->posted_requests = NULL;
 2690|      6|        mr->write_event_handler = ngx_http_terminate_handler;
 2691|      6|        (void) ngx_http_post_request(mr, &e->terminal_posted_request);
 2692|      6|        return;
 2693|      6|    }
 2694|       |
 2695|      3|    ngx_http_close_request(mr, rc);
 2696|      3|}
ngx_http_request.c:ngx_http_terminate_handler:
 2701|      6|{
 2702|      6|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2703|      6|                   "http terminate handler count:%d", r->count);
 2704|       |
 2705|      6|    r->count = 1;
 2706|       |
 2707|      6|    ngx_http_close_request(r, 0);
 2708|      6|}
ngx_http_request.c:ngx_http_finalize_connection:
 2713|     12|{
 2714|     12|    ngx_http_core_loc_conf_t  *clcf;
 2715|       |
 2716|     12|#if (NGX_HTTP_V2)
 2717|     12|    if (r->stream) {
  ------------------
  |  Branch (2717:9): [True: 0, False: 12]
  ------------------
 2718|      0|        ngx_http_close_request(r, 0);
 2719|      0|        return;
 2720|      0|    }
 2721|     12|#endif
 2722|       |
 2723|       |#if (NGX_HTTP_V3)
 2724|       |    if (r->connection->quic) {
 2725|       |        ngx_http_close_request(r, 0);
 2726|       |        return;
 2727|       |    }
 2728|       |#endif
 2729|       |
 2730|     12|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|     12|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 2731|       |
 2732|     12|    if (r->main->count != 1) {
  ------------------
  |  Branch (2732:9): [True: 5, False: 7]
  ------------------
 2733|       |
 2734|      5|        if (r->discard_body) {
  ------------------
  |  Branch (2734:13): [True: 0, False: 5]
  ------------------
 2735|      0|            r->read_event_handler = ngx_http_discarded_request_body_handler;
 2736|      0|            ngx_add_timer(r->connection->read, clcf->lingering_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 2737|       |
 2738|      0|            if (r->lingering_time == 0) {
  ------------------
  |  Branch (2738:17): [True: 0, False: 0]
  ------------------
 2739|      0|                r->lingering_time = ngx_time()
  ------------------
  |  |   36|      0|#define ngx_time()           ngx_cached_time->sec
  ------------------
 2740|      0|                                      + (time_t) (clcf->lingering_time / 1000);
 2741|      0|            }
 2742|      0|        }
 2743|       |
 2744|      5|        ngx_http_close_request(r, 0);
 2745|      5|        return;
 2746|      5|    }
 2747|       |
 2748|      7|    r = r->main;
 2749|       |
 2750|      7|    if (r->connection->read->eof) {
  ------------------
  |  Branch (2750:9): [True: 0, False: 7]
  ------------------
 2751|      0|        ngx_http_close_request(r, 0);
 2752|      0|        return;
 2753|      0|    }
 2754|       |
 2755|      7|    if (r->reading_body) {
  ------------------
  |  Branch (2755:9): [True: 0, False: 7]
  ------------------
 2756|      0|        r->keepalive = 0;
 2757|      0|        r->lingering_close = 1;
 2758|      0|    }
 2759|       |
 2760|      7|    if (!ngx_terminate
  ------------------
  |  Branch (2760:9): [True: 7, False: 0]
  ------------------
 2761|      7|         && !ngx_exiting
  ------------------
  |  Branch (2761:13): [True: 7, False: 0]
  ------------------
 2762|      7|         && r->keepalive
  ------------------
  |  Branch (2762:13): [True: 0, False: 7]
  ------------------
 2763|      7|         && clcf->keepalive_timeout > 0)
  ------------------
  |  Branch (2763:13): [True: 0, False: 0]
  ------------------
 2764|      0|    {
 2765|      0|        ngx_http_set_keepalive(r);
 2766|      0|        return;
 2767|      0|    }
 2768|       |
 2769|      7|    if (clcf->lingering_close == NGX_HTTP_LINGERING_ALWAYS
  ------------------
  |  |   45|     14|#define NGX_HTTP_LINGERING_ALWAYS       2
  ------------------
  |  Branch (2769:9): [True: 0, False: 7]
  ------------------
 2770|      7|        || (clcf->lingering_close == NGX_HTTP_LINGERING_ON
  ------------------
  |  |   44|     14|#define NGX_HTTP_LINGERING_ON           1
  ------------------
  |  Branch (2770:13): [True: 7, False: 0]
  ------------------
 2771|      7|            && (r->lingering_close
  ------------------
  |  Branch (2771:17): [True: 0, False: 7]
  ------------------
 2772|      7|                || r->header_in->pos < r->header_in->last
  ------------------
  |  Branch (2772:20): [True: 1, False: 6]
  ------------------
 2773|      7|                || r->connection->read->ready
  ------------------
  |  Branch (2773:20): [True: 6, False: 0]
  ------------------
 2774|      7|                || r->connection->pipeline)))
  ------------------
  |  Branch (2774:20): [True: 0, False: 0]
  ------------------
 2775|      7|    {
 2776|      7|        ngx_http_set_lingering_close(r->connection);
 2777|      7|        return;
 2778|      7|    }
 2779|       |
 2780|      0|    ngx_http_close_request(r, 0);
 2781|      0|}
ngx_http_request.c:ngx_http_set_lingering_close:
 3406|      7|{
 3407|      7|    ngx_event_t               *rev, *wev;
 3408|      7|    ngx_http_request_t        *r;
 3409|      7|    ngx_http_core_loc_conf_t  *clcf;
 3410|       |
 3411|      7|    r = c->data;
 3412|       |
 3413|      7|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      7|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 3414|       |
 3415|      7|    if (r->lingering_time == 0) {
  ------------------
  |  Branch (3415:9): [True: 7, False: 0]
  ------------------
 3416|      7|        r->lingering_time = ngx_time() + (time_t) (clcf->lingering_time / 1000);
  ------------------
  |  |   36|      7|#define ngx_time()           ngx_cached_time->sec
  ------------------
 3417|      7|    }
 3418|       |
 3419|       |#if (NGX_HTTP_SSL)
 3420|       |    if (c->ssl) {
 3421|       |        ngx_int_t  rc;
 3422|       |
 3423|       |        c->ssl->shutdown_without_free = 1;
 3424|       |
 3425|       |        rc = ngx_ssl_shutdown(c);
 3426|       |
 3427|       |        if (rc == NGX_ERROR) {
 3428|       |            ngx_http_close_request(r, 0);
 3429|       |            return;
 3430|       |        }
 3431|       |
 3432|       |        if (rc == NGX_AGAIN) {
 3433|       |            c->ssl->handler = ngx_http_set_lingering_close;
 3434|       |            return;
 3435|       |        }
 3436|       |    }
 3437|       |#endif
 3438|       |
 3439|      7|    rev = c->read;
 3440|      7|    rev->handler = ngx_http_lingering_close_handler;
 3441|       |
 3442|      7|    if (ngx_handle_read_event(rev, 0) != NGX_OK) {
  ------------------
  |  |   38|      7|#define  NGX_OK          0
  ------------------
  |  Branch (3442:9): [True: 0, False: 7]
  ------------------
 3443|      0|        ngx_http_close_request(r, 0);
 3444|      0|        return;
 3445|      0|    }
 3446|       |
 3447|      7|    wev = c->write;
 3448|      7|    wev->handler = ngx_http_empty_handler;
 3449|       |
 3450|      7|    if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) {
  ------------------
  |  |  196|      0|#define NGX_USE_LEVEL_EVENT      0x00000001
  ------------------
  |  Branch (3450:9): [True: 0, False: 7]
  |  Branch (3450:24): [True: 0, False: 0]
  ------------------
 3451|      0|        if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) {
  ------------------
  |  |  404|      0|#define ngx_del_event        ngx_event_actions.del
  ------------------
                      if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) {
  ------------------
  |  |  350|      0|#define NGX_WRITE_EVENT    EPOLLOUT
  ------------------
                      if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3451:13): [True: 0, False: 0]
  ------------------
 3452|      0|            ngx_http_close_request(r, 0);
 3453|      0|            return;
 3454|      0|        }
 3455|      0|    }
 3456|       |
 3457|      7|    if (ngx_shutdown_socket(c->fd, NGX_WRITE_SHUTDOWN) == -1) {
  ------------------
  |  |   66|      7|#define ngx_shutdown_socket    shutdown
  ------------------
                  if (ngx_shutdown_socket(c->fd, NGX_WRITE_SHUTDOWN) == -1) {
  ------------------
  |  |   15|      7|#define NGX_WRITE_SHUTDOWN SHUT_WR
  ------------------
  |  Branch (3457:9): [True: 0, False: 7]
  ------------------
 3458|      0|        ngx_connection_error(c, ngx_socket_errno,
  ------------------
  |  |   70|      0|#define ngx_socket_errno           errno
  ------------------
 3459|      0|                             ngx_shutdown_socket_n " failed");
  ------------------
  |  |   67|      0|#define ngx_shutdown_socket_n  "shutdown()"
  ------------------
 3460|      0|        ngx_http_close_request(r, 0);
 3461|      0|        return;
 3462|      0|    }
 3463|       |
 3464|      7|    c->close = 0;
 3465|      7|    ngx_reusable_connection(c, 1);
 3466|       |
 3467|      7|    ngx_add_timer(rev, clcf->lingering_timeout);
  ------------------
  |  |  410|      7|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 3468|       |
 3469|      7|    if (rev->ready) {
  ------------------
  |  Branch (3469:9): [True: 7, False: 0]
  ------------------
 3470|      7|        ngx_http_lingering_close_handler(rev);
 3471|      7|    }
 3472|      7|}
ngx_http_request.c:ngx_http_lingering_close_handler:
 3477|      7|{
 3478|      7|    ssize_t                    n;
 3479|      7|    ngx_msec_t                 timer;
 3480|      7|    ngx_connection_t          *c;
 3481|      7|    ngx_http_request_t        *r;
 3482|      7|    ngx_http_core_loc_conf_t  *clcf;
 3483|      7|    u_char                     buffer[NGX_HTTP_LINGERING_BUFFER_SIZE];
 3484|       |
 3485|      7|    c = rev->data;
 3486|      7|    r = c->data;
 3487|       |
 3488|      7|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
 3489|      7|                   "http lingering close handler");
 3490|       |
 3491|      7|    if (rev->timedout || c->close) {
  ------------------
  |  Branch (3491:9): [True: 0, False: 7]
  |  Branch (3491:26): [True: 0, False: 7]
  ------------------
 3492|      0|        ngx_http_close_request(r, 0);
 3493|      0|        return;
 3494|      0|    }
 3495|       |
 3496|      7|    timer = (ngx_msec_t) r->lingering_time - (ngx_msec_t) ngx_time();
  ------------------
  |  |   36|      7|#define ngx_time()           ngx_cached_time->sec
  ------------------
 3497|      7|    if ((ngx_msec_int_t) timer <= 0) {
  ------------------
  |  Branch (3497:9): [True: 0, False: 7]
  ------------------
 3498|      0|        ngx_http_close_request(r, 0);
 3499|      0|        return;
 3500|      0|    }
 3501|       |
 3502|     23|    do {
 3503|     23|        n = c->recv(c, buffer, NGX_HTTP_LINGERING_BUFFER_SIZE);
  ------------------
  |  |   20|     23|#define NGX_HTTP_LINGERING_BUFFER_SIZE     4096
  ------------------
 3504|       |
 3505|     23|        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "lingering read: %z", n);
 3506|       |
 3507|     23|        if (n == NGX_AGAIN) {
  ------------------
  |  |   40|     23|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (3507:13): [True: 0, False: 23]
  ------------------
 3508|      0|            break;
 3509|      0|        }
 3510|       |
 3511|     23|        if (n == NGX_ERROR || n == 0) {
  ------------------
  |  |   39|     46|#define  NGX_ERROR      -1
  ------------------
  |  Branch (3511:13): [True: 0, False: 23]
  |  Branch (3511:31): [True: 7, False: 16]
  ------------------
 3512|      7|            ngx_http_close_request(r, 0);
 3513|      7|            return;
 3514|      7|        }
 3515|       |
 3516|     23|    } while (rev->ready);
  ------------------
  |  Branch (3516:14): [True: 16, False: 0]
  ------------------
 3517|       |
 3518|      0|    if (ngx_handle_read_event(rev, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3518:9): [True: 0, False: 0]
  ------------------
 3519|      0|        ngx_http_close_request(r, 0);
 3520|      0|        return;
 3521|      0|    }
 3522|       |
 3523|      0|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 3524|       |
 3525|      0|    timer *= 1000;
 3526|       |
 3527|      0|    if (timer > clcf->lingering_timeout) {
  ------------------
  |  Branch (3527:9): [True: 0, False: 0]
  ------------------
 3528|      0|        timer = clcf->lingering_timeout;
 3529|      0|    }
 3530|       |
 3531|      0|    ngx_add_timer(rev, timer);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 3532|      0|}
ngx_http_request.c:ngx_http_set_write_handler:
 2786|      2|{
 2787|      2|    ngx_event_t               *wev;
 2788|      2|    ngx_http_core_loc_conf_t  *clcf;
 2789|       |
 2790|      2|    r->http_state = NGX_HTTP_WRITING_REQUEST_STATE;
 2791|       |
 2792|      2|    r->read_event_handler = r->discard_body ?
  ------------------
  |  Branch (2792:29): [True: 0, False: 2]
  ------------------
 2793|      0|                                ngx_http_discarded_request_body_handler:
 2794|      2|                                ngx_http_test_reading;
 2795|      2|    r->write_event_handler = ngx_http_writer;
 2796|       |
 2797|      2|    wev = r->connection->write;
 2798|       |
 2799|      2|    if (wev->ready && wev->delayed) {
  ------------------
  |  Branch (2799:9): [True: 2, False: 0]
  |  Branch (2799:23): [True: 2, False: 0]
  ------------------
 2800|      2|        return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 2801|      2|    }
 2802|       |
 2803|      0|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 2804|      0|    if (!wev->delayed) {
  ------------------
  |  Branch (2804:9): [True: 0, False: 0]
  ------------------
 2805|      0|        ngx_add_timer(wev, clcf->send_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 2806|      0|    }
 2807|       |
 2808|      0|    if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2808:9): [True: 0, False: 0]
  ------------------
 2809|      0|        ngx_http_close_request(r, 0);
 2810|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2811|      0|    }
 2812|       |
 2813|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2814|      0|}
ngx_http_request.c:ngx_http_post_action:
 3589|      9|{
 3590|      9|    ngx_http_core_loc_conf_t  *clcf;
 3591|       |
 3592|      9|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      9|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 3593|       |
 3594|      9|    if (clcf->post_action.data == NULL) {
  ------------------
  |  Branch (3594:9): [True: 9, False: 0]
  ------------------
 3595|      9|        return NGX_DECLINED;
  ------------------
  |  |   43|      9|#define  NGX_DECLINED   -5
  ------------------
 3596|      9|    }
 3597|       |
 3598|      0|    if (r->post_action && r->uri_changes == 0) {
  ------------------
  |  Branch (3598:9): [True: 0, False: 0]
  |  Branch (3598:27): [True: 0, False: 0]
  ------------------
 3599|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 3600|      0|    }
 3601|       |
 3602|      0|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 3603|      0|                   "post action: \"%V\"", &clcf->post_action);
 3604|       |
 3605|      0|    r->main->count--;
 3606|       |
 3607|      0|    r->http_version = NGX_HTTP_VERSION_9;
  ------------------
  |  |   23|      0|#define NGX_HTTP_VERSION_9                 9
  ------------------
 3608|      0|    r->header_only = 1;
 3609|      0|    r->post_action = 1;
 3610|       |
 3611|      0|    r->read_event_handler = ngx_http_block_reading;
 3612|       |
 3613|      0|    if (clcf->post_action.data[0] == '/') {
  ------------------
  |  Branch (3613:9): [True: 0, False: 0]
  ------------------
 3614|      0|        ngx_http_internal_redirect(r, &clcf->post_action, NULL);
 3615|       |
 3616|      0|    } else {
 3617|      0|        ngx_http_named_location(r, &clcf->post_action);
 3618|      0|    }
 3619|       |
 3620|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 3621|      0|}
ngx_http_request.c:ngx_http_log_request:
 3754|     16|{
 3755|     16|    ngx_uint_t                  i, n;
 3756|     16|    ngx_http_handler_pt        *log_handler;
 3757|     16|    ngx_http_core_main_conf_t  *cmcf;
 3758|       |
 3759|     16|    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  ------------------
  |  |   56|     16|    (r)->main_conf[module.ctx_index]
  ------------------
 3760|       |
 3761|     16|    log_handler = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.elts;
 3762|     16|    n = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.nelts;
 3763|       |
 3764|     32|    for (i = 0; i < n; i++) {
  ------------------
  |  Branch (3764:17): [True: 16, False: 16]
  ------------------
 3765|     16|        log_handler[i](r);
 3766|     16|    }
 3767|     16|}

ngx_http_read_client_request_body:
   34|     11|{
   35|     11|    size_t                     preread;
   36|     11|    ssize_t                    size;
   37|     11|    ngx_int_t                  rc;
   38|     11|    ngx_buf_t                 *b;
   39|     11|    ngx_chain_t                out;
   40|     11|    ngx_http_request_body_t   *rb;
   41|     11|    ngx_http_core_loc_conf_t  *clcf;
   42|       |
   43|     11|    r->main->count++;
   44|       |
   45|     11|    if (r != r->main || r->request_body || r->discard_body) {
  ------------------
  |  Branch (45:9): [True: 0, False: 11]
  |  Branch (45:25): [True: 0, False: 11]
  |  Branch (45:44): [True: 0, False: 11]
  ------------------
   46|      0|        r->request_body_no_buffering = 0;
   47|      0|        post_handler(r);
   48|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
   49|      0|    }
   50|       |
   51|     11|    if (ngx_http_test_expect(r) != NGX_OK) {
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  |  Branch (51:9): [True: 0, False: 11]
  ------------------
   52|      0|        rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
   53|      0|        goto done;
   54|      0|    }
   55|       |
   56|     11|    rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t));
   57|     11|    if (rb == NULL) {
  ------------------
  |  Branch (57:9): [True: 0, False: 11]
  ------------------
   58|      0|        rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
   59|      0|        goto done;
   60|      0|    }
   61|       |
   62|       |    /*
   63|       |     * set by ngx_pcalloc():
   64|       |     *
   65|       |     *     rb->temp_file = NULL;
   66|       |     *     rb->bufs = NULL;
   67|       |     *     rb->buf = NULL;
   68|       |     *     rb->free = NULL;
   69|       |     *     rb->busy = NULL;
   70|       |     *     rb->chunked = NULL;
   71|       |     *     rb->received = 0;
   72|       |     *     rb->filter_need_buffering = 0;
   73|       |     *     rb->last_sent = 0;
   74|       |     *     rb->last_saved = 0;
   75|       |     */
   76|       |
   77|     11|    rb->rest = -1;
   78|     11|    rb->post_handler = post_handler;
   79|       |
   80|     11|    r->request_body = rb;
   81|       |
   82|     11|    if (r->headers_in.content_length_n < 0 && !r->headers_in.chunked) {
  ------------------
  |  Branch (82:9): [True: 7, False: 4]
  |  Branch (82:47): [True: 5, False: 2]
  ------------------
   83|      5|        r->request_body_no_buffering = 0;
   84|      5|        post_handler(r);
   85|      5|        return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
   86|      5|    }
   87|       |
   88|      6|#if (NGX_HTTP_V2)
   89|      6|    if (r->stream) {
  ------------------
  |  Branch (89:9): [True: 0, False: 6]
  ------------------
   90|      0|        rc = ngx_http_v2_read_request_body(r);
   91|      0|        goto done;
   92|      0|    }
   93|      6|#endif
   94|       |
   95|       |#if (NGX_HTTP_V3)
   96|       |    if (r->http_version == NGX_HTTP_VERSION_30) {
   97|       |        rc = ngx_http_v3_read_request_body(r);
   98|       |        goto done;
   99|       |    }
  100|       |#endif
  101|       |
  102|      6|    preread = r->header_in->last - r->header_in->pos;
  103|       |
  104|      6|    if (preread) {
  ------------------
  |  Branch (104:9): [True: 5, False: 1]
  ------------------
  105|       |
  106|       |        /* there is the pre-read part of the request body */
  107|       |
  108|      5|        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  109|      5|                       "http client request body preread %uz", preread);
  110|       |
  111|      5|        out.buf = r->header_in;
  112|      5|        out.next = NULL;
  113|       |
  114|      5|        rc = ngx_http_request_body_filter(r, &out);
  115|       |
  116|      5|        if (rc != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (116:13): [True: 0, False: 5]
  ------------------
  117|      0|            goto done;
  118|      0|        }
  119|       |
  120|      5|        r->request_length += preread - (r->header_in->last - r->header_in->pos);
  121|       |
  122|      5|        if (!r->headers_in.chunked
  ------------------
  |  Branch (122:13): [True: 3, False: 2]
  ------------------
  123|      5|            && rb->rest > 0
  ------------------
  |  Branch (123:16): [True: 3, False: 0]
  ------------------
  124|      5|            && rb->rest <= (off_t) (r->header_in->end - r->header_in->last))
  ------------------
  |  Branch (124:16): [True: 0, False: 3]
  ------------------
  125|      0|        {
  126|       |            /* the whole request body may be placed in r->header_in */
  127|       |
  128|      0|            b = ngx_calloc_buf(r->pool);
  ------------------
  |  |  145|      0|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
  129|      0|            if (b == NULL) {
  ------------------
  |  Branch (129:17): [True: 0, False: 0]
  ------------------
  130|      0|                rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  131|      0|                goto done;
  132|      0|            }
  133|       |
  134|      0|            b->temporary = 1;
  135|      0|            b->start = r->header_in->pos;
  136|      0|            b->pos = r->header_in->pos;
  137|      0|            b->last = r->header_in->last;
  138|      0|            b->end = r->header_in->end;
  139|       |
  140|      0|            rb->buf = b;
  141|       |
  142|      0|            r->read_event_handler = ngx_http_read_client_request_body_handler;
  143|      0|            r->write_event_handler = ngx_http_request_empty_handler;
  144|       |
  145|      0|            rc = ngx_http_do_read_client_request_body(r);
  146|      0|            goto done;
  147|      0|        }
  148|       |
  149|      5|    } else {
  150|       |        /* set rb->rest */
  151|       |
  152|      1|        rc = ngx_http_request_body_filter(r, NULL);
  153|       |
  154|      1|        if (rc != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (154:13): [True: 0, False: 1]
  ------------------
  155|      0|            goto done;
  156|      0|        }
  157|      1|    }
  158|       |
  159|      6|    if (rb->rest == 0 && rb->last_saved) {
  ------------------
  |  Branch (159:9): [True: 0, False: 6]
  |  Branch (159:26): [True: 0, False: 0]
  ------------------
  160|       |        /* the whole request body was pre-read */
  161|      0|        r->request_body_no_buffering = 0;
  162|      0|        post_handler(r);
  163|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  164|      0|    }
  165|       |
  166|      6|    if (rb->rest < 0) {
  ------------------
  |  Branch (166:9): [True: 0, False: 6]
  ------------------
  167|      0|        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  168|      0|                      "negative request body rest");
  169|      0|        rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  170|      0|        goto done;
  171|      0|    }
  172|       |
  173|      6|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      6|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  174|       |
  175|      6|    size = clcf->client_body_buffer_size;
  176|      6|    size += size >> 2;
  177|       |
  178|       |    /* TODO: honor r->request_body_in_single_buf */
  179|       |
  180|      6|    if (!r->headers_in.chunked && rb->rest < size) {
  ------------------
  |  Branch (180:9): [True: 4, False: 2]
  |  Branch (180:35): [True: 0, False: 4]
  ------------------
  181|      0|        size = (ssize_t) rb->rest;
  182|       |
  183|      0|        if (r->request_body_in_single_buf) {
  ------------------
  |  Branch (183:13): [True: 0, False: 0]
  ------------------
  184|      0|            size += preread;
  185|      0|        }
  186|       |
  187|      0|        if (size == 0) {
  ------------------
  |  Branch (187:13): [True: 0, False: 0]
  ------------------
  188|      0|            size++;
  189|      0|        }
  190|       |
  191|      6|    } else {
  192|      6|        size = clcf->client_body_buffer_size;
  193|      6|    }
  194|       |
  195|      6|    rb->buf = ngx_create_temp_buf(r->pool, size);
  196|      6|    if (rb->buf == NULL) {
  ------------------
  |  Branch (196:9): [True: 0, False: 6]
  ------------------
  197|      0|        rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  198|      0|        goto done;
  199|      0|    }
  200|       |
  201|      6|    r->read_event_handler = ngx_http_read_client_request_body_handler;
  202|      6|    r->write_event_handler = ngx_http_request_empty_handler;
  203|       |
  204|      6|    rc = ngx_http_do_read_client_request_body(r);
  205|       |
  206|      6|done:
  207|       |
  208|      6|    if (r->request_body_no_buffering
  ------------------
  |  Branch (208:9): [True: 0, False: 6]
  ------------------
  209|      6|        && (rc == NGX_OK || rc == NGX_AGAIN))
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
                      && (rc == NGX_OK || rc == NGX_AGAIN))
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (209:13): [True: 0, False: 0]
  |  Branch (209:29): [True: 0, False: 0]
  ------------------
  210|      0|    {
  211|      0|        if (rc == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (211:13): [True: 0, False: 0]
  ------------------
  212|      0|            r->request_body_no_buffering = 0;
  213|       |
  214|      0|        } else {
  215|       |            /* rc == NGX_AGAIN */
  216|      0|            r->reading_body = 1;
  217|      0|        }
  218|       |
  219|      0|        r->read_event_handler = ngx_http_block_reading;
  220|      0|        post_handler(r);
  221|      0|    }
  222|       |
  223|      6|    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
  ------------------
  |  |   84|      6|#define NGX_HTTP_SPECIAL_RESPONSE          300
  ------------------
  |  Branch (223:9): [True: 6, False: 0]
  ------------------
  224|      6|        r->main->count--;
  225|      6|    }
  226|       |
  227|      6|    return rc;
  228|      6|}
ngx_http_discard_request_body:
  631|      2|{
  632|      2|    ssize_t       size;
  633|      2|    ngx_int_t     rc;
  634|      2|    ngx_event_t  *rev;
  635|       |
  636|      2|    if (r != r->main || r->discard_body || r->request_body) {
  ------------------
  |  Branch (636:9): [True: 0, False: 2]
  |  Branch (636:25): [True: 0, False: 2]
  |  Branch (636:44): [True: 0, False: 2]
  ------------------
  637|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  638|      0|    }
  639|       |
  640|      2|#if (NGX_HTTP_V2)
  641|      2|    if (r->stream) {
  ------------------
  |  Branch (641:9): [True: 0, False: 2]
  ------------------
  642|      0|        r->stream->skip_data = 1;
  643|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  644|      0|    }
  645|      2|#endif
  646|       |
  647|       |#if (NGX_HTTP_V3)
  648|       |    if (r->http_version == NGX_HTTP_VERSION_30) {
  649|       |        return NGX_OK;
  650|       |    }
  651|       |#endif
  652|       |
  653|      2|    if (ngx_http_test_expect(r) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (653:9): [True: 0, False: 2]
  ------------------
  654|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  655|      0|    }
  656|       |
  657|      2|    rev = r->connection->read;
  658|       |
  659|      2|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http set discard body");
  660|       |
  661|      2|    if (rev->timer_set) {
  ------------------
  |  Branch (661:9): [True: 0, False: 2]
  ------------------
  662|      0|        ngx_del_timer(rev);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
  663|      0|    }
  664|       |
  665|      2|    if (r->headers_in.content_length_n <= 0 && !r->headers_in.chunked) {
  ------------------
  |  Branch (665:9): [True: 2, False: 0]
  |  Branch (665:48): [True: 1, False: 1]
  ------------------
  666|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  667|      1|    }
  668|       |
  669|      1|    size = r->header_in->last - r->header_in->pos;
  670|       |
  671|      1|    if (size || r->headers_in.chunked) {
  ------------------
  |  Branch (671:9): [True: 1, False: 0]
  |  Branch (671:17): [True: 0, False: 0]
  ------------------
  672|      1|        rc = ngx_http_discard_request_body_filter(r, r->header_in);
  673|       |
  674|      1|        if (rc != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (674:13): [True: 0, False: 1]
  ------------------
  675|      0|            return rc;
  676|      0|        }
  677|       |
  678|      1|        if (r->headers_in.content_length_n == 0) {
  ------------------
  |  Branch (678:13): [True: 0, False: 1]
  ------------------
  679|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  680|      0|        }
  681|      1|    }
  682|       |
  683|      1|    rc = ngx_http_read_discarded_request_body(r);
  684|       |
  685|      1|    if (rc == NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (685:9): [True: 1, False: 0]
  ------------------
  686|      1|        r->lingering_close = 0;
  687|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  688|      1|    }
  689|       |
  690|      0|    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
  ------------------
  |  |   84|      0|#define NGX_HTTP_SPECIAL_RESPONSE          300
  ------------------
  |  Branch (690:9): [True: 0, False: 0]
  ------------------
  691|      0|        return rc;
  692|      0|    }
  693|       |
  694|       |    /* rc == NGX_AGAIN */
  695|       |
  696|      0|    r->read_event_handler = ngx_http_discarded_request_body_handler;
  697|       |
  698|      0|    if (ngx_handle_read_event(rev, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (698:9): [True: 0, False: 0]
  ------------------
  699|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  700|      0|    }
  701|       |
  702|      0|    r->count++;
  703|      0|    r->discard_body = 1;
  704|       |
  705|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  706|      0|}
ngx_http_request_body_save_filter:
 1273|    122|{
 1274|    122|    ngx_buf_t                 *b;
 1275|    122|    ngx_chain_t               *cl, *tl, **ll;
 1276|    122|    ngx_http_request_body_t   *rb;
 1277|       |
 1278|    122|    rb = r->request_body;
 1279|       |
 1280|    122|    ll = &rb->bufs;
 1281|       |
 1282|    127|    for (cl = rb->bufs; cl; cl = cl->next) {
  ------------------
  |  Branch (1282:25): [True: 5, False: 122]
  ------------------
 1283|       |
 1284|       |#if 0
 1285|       |        ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
 1286|       |                       "http body old buf t:%d f:%d %p, pos %p, size: %z "
 1287|       |                       "file: %O, size: %O",
 1288|       |                       cl->buf->temporary, cl->buf->in_file,
 1289|       |                       cl->buf->start, cl->buf->pos,
 1290|       |                       cl->buf->last - cl->buf->pos,
 1291|       |                       cl->buf->file_pos,
 1292|       |                       cl->buf->file_last - cl->buf->file_pos);
 1293|       |#endif
 1294|       |
 1295|      5|        ll = &cl->next;
 1296|      5|    }
 1297|       |
 1298|    192|    for (cl = in; cl; cl = cl->next) {
  ------------------
  |  Branch (1298:19): [True: 70, False: 122]
  ------------------
 1299|       |
 1300|     70|        ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
 1301|     70|                       "http body new buf t:%d f:%d %p, pos %p, size: %z "
 1302|     70|                       "file: %O, size: %O",
 1303|     70|                       cl->buf->temporary, cl->buf->in_file,
 1304|     70|                       cl->buf->start, cl->buf->pos,
 1305|     70|                       cl->buf->last - cl->buf->pos,
 1306|     70|                       cl->buf->file_pos,
 1307|     70|                       cl->buf->file_last - cl->buf->file_pos);
 1308|       |
 1309|     70|        if (cl->buf->last_buf) {
  ------------------
  |  Branch (1309:13): [True: 0, False: 70]
  ------------------
 1310|       |
 1311|      0|            if (rb->last_saved) {
  ------------------
  |  Branch (1311:17): [True: 0, False: 0]
  ------------------
 1312|      0|                ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1313|      0|                              "duplicate last buf in save filter");
 1314|      0|                *ll = NULL;
 1315|      0|                return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1316|      0|            }
 1317|       |
 1318|      0|            rb->last_saved = 1;
 1319|      0|        }
 1320|       |
 1321|     70|        tl = ngx_alloc_chain_link(r->pool);
 1322|     70|        if (tl == NULL) {
  ------------------
  |  Branch (1322:13): [True: 0, False: 70]
  ------------------
 1323|      0|            *ll = NULL;
 1324|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1325|      0|        }
 1326|       |
 1327|     70|        tl->buf = cl->buf;
 1328|     70|        *ll = tl;
 1329|     70|        ll = &tl->next;
 1330|     70|    }
 1331|       |
 1332|    122|    *ll = NULL;
 1333|       |
 1334|    122|    if (r->request_body_no_buffering) {
  ------------------
  |  Branch (1334:9): [True: 0, False: 122]
  ------------------
 1335|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1336|      0|    }
 1337|       |
 1338|    122|    if (rb->rest > 0) {
  ------------------
  |  Branch (1338:9): [True: 122, False: 0]
  ------------------
 1339|       |
 1340|    122|        if (rb->bufs && rb->buf && rb->buf->last == rb->buf->end
  ------------------
  |  Branch (1340:13): [True: 56, False: 66]
  |  Branch (1340:25): [True: 52, False: 4]
  |  Branch (1340:36): [True: 47, False: 5]
  ------------------
 1341|    122|            && ngx_http_write_request_body(r) != NGX_OK)
  ------------------
  |  |   38|     47|#define  NGX_OK          0
  ------------------
  |  Branch (1341:16): [True: 0, False: 47]
  ------------------
 1342|      0|        {
 1343|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1344|      0|        }
 1345|       |
 1346|    122|        return NGX_OK;
  ------------------
  |  |   38|    122|#define  NGX_OK          0
  ------------------
 1347|    122|    }
 1348|       |
 1349|      0|    if (!rb->last_saved) {
  ------------------
  |  Branch (1349:9): [True: 0, False: 0]
  ------------------
 1350|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1351|      0|    }
 1352|       |
 1353|      0|    if (rb->temp_file || r->request_body_in_file_only) {
  ------------------
  |  Branch (1353:9): [True: 0, False: 0]
  |  Branch (1353:26): [True: 0, False: 0]
  ------------------
 1354|       |
 1355|      0|        if (rb->bufs && rb->bufs->buf->in_file) {
  ------------------
  |  Branch (1355:13): [True: 0, False: 0]
  |  Branch (1355:25): [True: 0, False: 0]
  ------------------
 1356|      0|            ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1357|      0|                          "body already in file");
 1358|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1359|      0|        }
 1360|       |
 1361|      0|        if (ngx_http_write_request_body(r) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1361:13): [True: 0, False: 0]
  ------------------
 1362|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1363|      0|        }
 1364|       |
 1365|      0|        if (rb->temp_file->file.offset != 0) {
  ------------------
  |  Branch (1365:13): [True: 0, False: 0]
  ------------------
 1366|       |
 1367|      0|            cl = ngx_chain_get_free_buf(r->pool, &rb->free);
 1368|      0|            if (cl == NULL) {
  ------------------
  |  Branch (1368:17): [True: 0, False: 0]
  ------------------
 1369|      0|                return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1370|      0|            }
 1371|       |
 1372|      0|            b = cl->buf;
 1373|       |
 1374|      0|            ngx_memzero(b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1375|       |
 1376|      0|            b->in_file = 1;
 1377|      0|            b->file_last = rb->temp_file->file.offset;
 1378|      0|            b->file = &rb->temp_file->file;
 1379|       |
 1380|      0|            rb->bufs = cl;
 1381|      0|        }
 1382|      0|    }
 1383|       |
 1384|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 1385|      0|}
ngx_http_request_body.c:ngx_http_do_read_client_request_body:
  296|      6|{
  297|      6|    off_t                      rest;
  298|      6|    size_t                     size;
  299|      6|    ssize_t                    n;
  300|      6|    ngx_int_t                  rc;
  301|      6|    ngx_uint_t                 flush;
  302|      6|    ngx_chain_t                out;
  303|      6|    ngx_connection_t          *c;
  304|      6|    ngx_http_request_body_t   *rb;
  305|      6|    ngx_http_core_loc_conf_t  *clcf;
  306|       |
  307|      6|    c = r->connection;
  308|      6|    rb = r->request_body;
  309|      6|    flush = 1;
  310|       |
  311|      6|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
  312|      6|                   "http read client request body");
  313|       |
  314|     12|    for ( ;; ) {
  315|     67|        for ( ;; ) {
  316|     67|            if (rb->rest == 0) {
  ------------------
  |  Branch (316:17): [True: 0, False: 67]
  ------------------
  317|      0|                break;
  318|      0|            }
  319|       |
  320|     67|            if (rb->buf->last == rb->buf->end) {
  ------------------
  |  Branch (320:17): [True: 55, False: 12]
  ------------------
  321|       |
  322|       |                /* update chains */
  323|       |
  324|     55|                rc = ngx_http_request_body_filter(r, NULL);
  325|       |
  326|     55|                if (rc != NGX_OK) {
  ------------------
  |  |   38|     55|#define  NGX_OK          0
  ------------------
  |  Branch (326:21): [True: 0, False: 55]
  ------------------
  327|      0|                    return rc;
  328|      0|                }
  329|       |
  330|     55|                if (rb->busy != NULL) {
  ------------------
  |  Branch (330:21): [True: 0, False: 55]
  ------------------
  331|      0|                    if (r->request_body_no_buffering) {
  ------------------
  |  Branch (331:25): [True: 0, False: 0]
  ------------------
  332|      0|                        if (c->read->timer_set) {
  ------------------
  |  Branch (332:29): [True: 0, False: 0]
  ------------------
  333|      0|                            ngx_del_timer(c->read);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
  334|      0|                        }
  335|       |
  336|      0|                        if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (336:29): [True: 0, False: 0]
  ------------------
  337|      0|                            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  338|      0|                        }
  339|       |
  340|      0|                        return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  341|      0|                    }
  342|       |
  343|      0|                    if (rb->filter_need_buffering) {
  ------------------
  |  Branch (343:25): [True: 0, False: 0]
  ------------------
  344|      0|                        clcf = ngx_http_get_module_loc_conf(r,
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  345|      0|                                                         ngx_http_core_module);
  346|      0|                        ngx_add_timer(c->read, clcf->client_body_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
  347|       |
  348|      0|                        if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (348:29): [True: 0, False: 0]
  ------------------
  349|      0|                            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  350|      0|                        }
  351|       |
  352|      0|                        return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  353|      0|                    }
  354|       |
  355|      0|                    ngx_log_error(NGX_LOG_ALERT, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  356|      0|                                  "busy buffers after request body flush");
  357|       |
  358|      0|                    return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  359|      0|                }
  360|       |
  361|     55|                flush = 0;
  362|     55|                rb->buf->pos = rb->buf->start;
  363|     55|                rb->buf->last = rb->buf->start;
  364|     55|            }
  365|       |
  366|     67|            size = rb->buf->end - rb->buf->last;
  367|     67|            rest = rb->rest - (rb->buf->last - rb->buf->pos);
  368|       |
  369|     67|            if ((off_t) size > rest) {
  ------------------
  |  Branch (369:17): [True: 0, False: 67]
  ------------------
  370|      0|                size = (size_t) rest;
  371|      0|            }
  372|       |
  373|     67|            if (size == 0) {
  ------------------
  |  Branch (373:17): [True: 0, False: 67]
  ------------------
  374|      0|                break;
  375|      0|            }
  376|       |
  377|     67|            n = c->recv(c, rb->buf->last, size);
  378|       |
  379|     67|            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
  380|     67|                           "http client request body recv %z", n);
  381|       |
  382|     67|            if (n == NGX_AGAIN) {
  ------------------
  |  |   40|     67|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (382:17): [True: 0, False: 67]
  ------------------
  383|      0|                break;
  384|      0|            }
  385|       |
  386|     67|            if (n == 0) {
  ------------------
  |  Branch (386:17): [True: 6, False: 61]
  ------------------
  387|      6|                ngx_log_error(NGX_LOG_INFO, c->log, 0,
  ------------------
  |  |   86|      6|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 6]
  |  |  ------------------
  ------------------
  388|      6|                              "client prematurely closed connection");
  389|      6|            }
  390|       |
  391|     67|            if (n == 0 || n == NGX_ERROR) {
  ------------------
  |  |   39|     61|#define  NGX_ERROR      -1
  ------------------
  |  Branch (391:17): [True: 6, False: 61]
  |  Branch (391:27): [True: 0, False: 61]
  ------------------
  392|      6|                c->error = 1;
  393|      6|                return NGX_HTTP_BAD_REQUEST;
  ------------------
  |  |   92|      6|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
  394|      6|            }
  395|       |
  396|     61|            rb->buf->last += n;
  397|     61|            r->request_length += n;
  398|       |
  399|       |            /* pass buffer to request body filter chain */
  400|       |
  401|     61|            flush = 0;
  402|     61|            out.buf = rb->buf;
  403|     61|            out.next = NULL;
  404|       |
  405|     61|            rc = ngx_http_request_body_filter(r, &out);
  406|       |
  407|     61|            if (rc != NGX_OK) {
  ------------------
  |  |   38|     61|#define  NGX_OK          0
  ------------------
  |  Branch (407:17): [True: 0, False: 61]
  ------------------
  408|      0|                return rc;
  409|      0|            }
  410|       |
  411|     61|            if (rb->rest == 0) {
  ------------------
  |  Branch (411:17): [True: 0, False: 61]
  ------------------
  412|      0|                break;
  413|      0|            }
  414|       |
  415|     61|            if (rb->buf->last < rb->buf->end) {
  ------------------
  |  Branch (415:17): [True: 6, False: 55]
  ------------------
  416|      6|                break;
  417|      6|            }
  418|     61|        }
  419|       |
  420|      6|        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
  421|      6|                       "http client request body rest %O", rb->rest);
  422|       |
  423|      6|        if (flush) {
  ------------------
  |  Branch (423:13): [True: 0, False: 6]
  ------------------
  424|      0|            rc = ngx_http_request_body_filter(r, NULL);
  425|       |
  426|      0|            if (rc != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (426:17): [True: 0, False: 0]
  ------------------
  427|      0|                return rc;
  428|      0|            }
  429|      0|        }
  430|       |
  431|      6|        if (rb->rest == 0 && rb->last_saved) {
  ------------------
  |  Branch (431:13): [True: 0, False: 6]
  |  Branch (431:30): [True: 0, False: 0]
  ------------------
  432|      0|            break;
  433|      0|        }
  434|       |
  435|      6|        if (!c->read->ready || rb->rest == 0) {
  ------------------
  |  Branch (435:13): [True: 0, False: 6]
  |  Branch (435:32): [True: 0, False: 6]
  ------------------
  436|       |
  437|      0|            clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  438|      0|            ngx_add_timer(c->read, clcf->client_body_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
  439|       |
  440|      0|            if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (440:17): [True: 0, False: 0]
  ------------------
  441|      0|                return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  442|      0|            }
  443|       |
  444|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  445|      0|        }
  446|      6|    }
  447|       |
  448|      0|    if (ngx_http_copy_pipelined_header(r, rb->buf) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (448:9): [True: 0, False: 0]
  ------------------
  449|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  450|      0|    }
  451|       |
  452|      0|    if (c->read->timer_set) {
  ------------------
  |  Branch (452:9): [True: 0, False: 0]
  ------------------
  453|      0|        ngx_del_timer(c->read);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
  454|      0|    }
  455|       |
  456|      0|    if (!r->request_body_no_buffering) {
  ------------------
  |  Branch (456:9): [True: 0, False: 0]
  ------------------
  457|      0|        r->read_event_handler = ngx_http_block_reading;
  458|      0|        rb->post_handler(r);
  459|      0|    }
  460|       |
  461|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  462|      0|}
ngx_http_request_body.c:ngx_http_read_discarded_request_body:
  783|      1|{
  784|      1|    size_t     size;
  785|      1|    ssize_t    n;
  786|      1|    ngx_int_t  rc;
  787|      1|    ngx_buf_t  b;
  788|      1|    u_char     buffer[NGX_HTTP_DISCARD_BUFFER_SIZE];
  789|       |
  790|      1|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  791|      1|                   "http read discarded body");
  792|       |
  793|      1|    ngx_memzero(&b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  794|       |
  795|      1|    b.temporary = 1;
  796|       |
  797|     17|    for ( ;; ) {
  798|     17|        if (r->headers_in.content_length_n == 0) {
  ------------------
  |  Branch (798:13): [True: 0, False: 17]
  ------------------
  799|      0|            break;
  800|      0|        }
  801|       |
  802|     17|        if (!r->connection->read->ready) {
  ------------------
  |  Branch (802:13): [True: 0, False: 17]
  ------------------
  803|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  804|      0|        }
  805|       |
  806|     17|        size = (size_t) ngx_min(r->headers_in.content_length_n,
  ------------------
  |  |  110|     17|#define ngx_min(val1, val2)  ((val1 > val2) ? (val2) : (val1))
  |  |  ------------------
  |  |  |  Branch (110:31): [True: 17, False: 0]
  |  |  ------------------
  ------------------
  807|     17|                                NGX_HTTP_DISCARD_BUFFER_SIZE);
  808|       |
  809|     17|        n = r->connection->recv(r->connection, buffer, size);
  810|       |
  811|     17|        if (n == NGX_ERROR) {
  ------------------
  |  |   39|     17|#define  NGX_ERROR      -1
  ------------------
  |  Branch (811:13): [True: 0, False: 17]
  ------------------
  812|      0|            r->connection->error = 1;
  813|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  814|      0|        }
  815|       |
  816|     17|        if (n == NGX_AGAIN) {
  ------------------
  |  |   40|     17|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (816:13): [True: 0, False: 17]
  ------------------
  817|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  818|      0|        }
  819|       |
  820|     17|        if (n == 0) {
  ------------------
  |  Branch (820:13): [True: 1, False: 16]
  ------------------
  821|      1|            return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  822|      1|        }
  823|       |
  824|     16|        b.pos = buffer;
  825|     16|        b.last = buffer + n;
  826|       |
  827|     16|        rc = ngx_http_discard_request_body_filter(r, &b);
  828|       |
  829|     16|        if (rc != NGX_OK) {
  ------------------
  |  |   38|     16|#define  NGX_OK          0
  ------------------
  |  Branch (829:13): [True: 0, False: 16]
  ------------------
  830|      0|            return rc;
  831|      0|        }
  832|     16|    }
  833|       |
  834|      0|    if (ngx_http_copy_pipelined_header(r, &b) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (834:9): [True: 0, False: 0]
  ------------------
  835|      0|        return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  836|      0|    }
  837|       |
  838|      0|    r->read_event_handler = ngx_http_block_reading;
  839|       |
  840|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  841|      0|}
ngx_http_request_body.c:ngx_http_discard_request_body_filter:
  846|     17|{
  847|     17|    size_t                     size;
  848|     17|    ngx_int_t                  rc;
  849|     17|    ngx_http_request_body_t   *rb;
  850|     17|    ngx_http_core_srv_conf_t  *cscf;
  851|       |
  852|     17|    if (r->headers_in.chunked) {
  ------------------
  |  Branch (852:9): [True: 17, False: 0]
  ------------------
  853|       |
  854|     17|        rb = r->request_body;
  855|       |
  856|     17|        if (rb == NULL) {
  ------------------
  |  Branch (856:13): [True: 1, False: 16]
  ------------------
  857|       |
  858|      1|            rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t));
  859|      1|            if (rb == NULL) {
  ------------------
  |  Branch (859:17): [True: 0, False: 1]
  ------------------
  860|      0|                return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  861|      0|            }
  862|       |
  863|      1|            rb->chunked = ngx_pcalloc(r->pool, sizeof(ngx_http_chunked_t));
  864|      1|            if (rb->chunked == NULL) {
  ------------------
  |  Branch (864:17): [True: 0, False: 1]
  ------------------
  865|      0|                return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  866|      0|            }
  867|       |
  868|      1|            r->request_body = rb;
  869|      1|        }
  870|       |
  871|     34|        for ( ;; ) {
  872|       |
  873|     34|            rc = ngx_http_parse_chunked(r, b, rb->chunked);
  874|       |
  875|     34|            if (rc == NGX_OK) {
  ------------------
  |  |   38|     34|#define  NGX_OK          0
  ------------------
  |  Branch (875:17): [True: 17, False: 17]
  ------------------
  876|       |
  877|       |                /* a chunk has been parsed successfully */
  878|       |
  879|     17|                size = b->last - b->pos;
  880|       |
  881|     17|                if ((off_t) size > rb->chunked->size) {
  ------------------
  |  Branch (881:21): [True: 0, False: 17]
  ------------------
  882|      0|                    b->pos += (size_t) rb->chunked->size;
  883|      0|                    rb->chunked->size = 0;
  884|       |
  885|     17|                } else {
  886|     17|                    rb->chunked->size -= size;
  887|     17|                    b->pos = b->last;
  888|     17|                }
  889|       |
  890|     17|                continue;
  891|     17|            }
  892|       |
  893|     17|            if (rc == NGX_DONE) {
  ------------------
  |  |   42|     17|#define  NGX_DONE       -4
  ------------------
  |  Branch (893:17): [True: 0, False: 17]
  ------------------
  894|       |
  895|       |                /* a whole response has been parsed successfully */
  896|       |
  897|      0|                r->headers_in.content_length_n = 0;
  898|      0|                break;
  899|      0|            }
  900|       |
  901|     17|            if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|     17|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (901:17): [True: 17, False: 0]
  ------------------
  902|       |
  903|       |                /* set amount of data we want to see next time */
  904|       |
  905|     17|                cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|     17|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
  906|       |
  907|     17|                r->headers_in.content_length_n = ngx_max(rb->chunked->length,
  ------------------
  |  |  109|     17|#define ngx_max(val1, val2)  ((val1 < val2) ? (val2) : (val1))
  |  |  ------------------
  |  |  |  Branch (109:31): [True: 0, False: 17]
  |  |  ------------------
  ------------------
  908|     17|                               (off_t) cscf->large_client_header_buffers.size);
  909|     17|                break;
  910|     17|            }
  911|       |
  912|       |            /* invalid */
  913|       |
  914|      0|            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  915|      0|                          "client sent invalid chunked body");
  916|       |
  917|      0|            return NGX_HTTP_BAD_REQUEST;
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
  918|     17|        }
  919|       |
  920|     17|    } else {
  921|      0|        size = b->last - b->pos;
  922|       |
  923|      0|        if ((off_t) size > r->headers_in.content_length_n) {
  ------------------
  |  Branch (923:13): [True: 0, False: 0]
  ------------------
  924|      0|            b->pos += (size_t) r->headers_in.content_length_n;
  925|      0|            r->headers_in.content_length_n = 0;
  926|       |
  927|      0|        } else {
  928|      0|            b->pos = b->last;
  929|      0|            r->headers_in.content_length_n -= size;
  930|      0|        }
  931|      0|    }
  932|       |
  933|     17|    return NGX_OK;
  ------------------
  |  |   38|     17|#define  NGX_OK          0
  ------------------
  934|     17|}
ngx_http_request_body.c:ngx_http_test_expect:
  939|     13|{
  940|     13|    ngx_int_t   n;
  941|     13|    ngx_str_t  *expect;
  942|       |
  943|     13|    if (r->expect_tested
  ------------------
  |  Branch (943:9): [True: 2, False: 11]
  ------------------
  944|     13|        || r->headers_in.expect == NULL
  ------------------
  |  Branch (944:12): [True: 10, False: 1]
  ------------------
  945|     13|        || r->http_version < NGX_HTTP_VERSION_11
  ------------------
  |  |   25|     14|#define NGX_HTTP_VERSION_11                1001
  ------------------
  |  Branch (945:12): [True: 0, False: 1]
  ------------------
  946|     13|#if (NGX_HTTP_V2)
  947|     13|        || r->stream != NULL
  ------------------
  |  Branch (947:12): [True: 0, False: 1]
  ------------------
  948|     13|#endif
  949|       |#if (NGX_HTTP_V3)
  950|       |        || r->connection->quic != NULL
  951|       |#endif
  952|     13|       )
  953|     12|    {
  954|     12|        return NGX_OK;
  ------------------
  |  |   38|     12|#define  NGX_OK          0
  ------------------
  955|     12|    }
  956|       |
  957|      1|    r->expect_tested = 1;
  958|       |
  959|      1|    expect = &r->headers_in.expect->value;
  960|       |
  961|      1|    if (expect->len != sizeof("100-continue") - 1
  ------------------
  |  Branch (961:9): [True: 1, False: 0]
  ------------------
  962|      1|        || ngx_strncasecmp(expect->data, (u_char *) "100-continue",
  ------------------
  |  Branch (962:12): [True: 0, False: 0]
  ------------------
  963|      0|                           sizeof("100-continue") - 1)
  964|      0|           != 0)
  965|      1|    {
  966|      1|        return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  967|      1|    }
  968|       |
  969|      0|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  970|      0|                   "send 100 Continue");
  971|       |
  972|      0|    n = r->connection->send(r->connection,
  973|      0|                            (u_char *) "HTTP/1.1 100 Continue" CRLF CRLF,
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  974|      0|                            sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1);
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  975|       |
  976|      0|    if (n == sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1) {
  ------------------
  |  |  105|      0|#define CRLF   "\r\n"
  ------------------
  |  Branch (976:9): [True: 0, False: 0]
  ------------------
  977|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  978|      0|    }
  979|       |
  980|       |    /* we assume that such small packet should be send successfully */
  981|       |
  982|      0|    r->connection->error = 1;
  983|       |
  984|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  985|      0|}
ngx_http_request_body.c:ngx_http_request_body_filter:
  990|    122|{
  991|    122|    if (r->headers_in.chunked) {
  ------------------
  |  Branch (991:9): [True: 36, False: 86]
  ------------------
  992|     36|        return ngx_http_request_body_chunked_filter(r, in);
  993|       |
  994|     86|    } else {
  995|     86|        return ngx_http_request_body_length_filter(r, in);
  996|     86|    }
  997|    122|}
ngx_http_request_body.c:ngx_http_request_body_chunked_filter:
 1089|     36|{
 1090|     36|    size_t                     size;
 1091|     36|    ngx_int_t                  rc;
 1092|     36|    ngx_buf_t                 *b;
 1093|     36|    ngx_chain_t               *cl, *out, *tl, **ll;
 1094|     36|    ngx_http_request_body_t   *rb;
 1095|     36|    ngx_http_core_loc_conf_t  *clcf;
 1096|     36|    ngx_http_core_srv_conf_t  *cscf;
 1097|       |
 1098|     36|    rb = r->request_body;
 1099|       |
 1100|     36|    out = NULL;
 1101|     36|    ll = &out;
 1102|       |
 1103|     36|    if (rb->rest == -1) {
  ------------------
  |  Branch (1103:9): [True: 2, False: 34]
  ------------------
 1104|       |
 1105|      2|        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1106|      2|                       "http request body chunked filter");
 1107|       |
 1108|      2|        rb->chunked = ngx_pcalloc(r->pool, sizeof(ngx_http_chunked_t));
 1109|      2|        if (rb->chunked == NULL) {
  ------------------
  |  Branch (1109:13): [True: 0, False: 2]
  ------------------
 1110|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1111|      0|        }
 1112|       |
 1113|      2|        cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|      2|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
 1114|       |
 1115|      2|        r->headers_in.content_length_n = 0;
 1116|      2|        rb->rest = cscf->large_client_header_buffers.size;
 1117|      2|    }
 1118|       |
 1119|     56|    for (cl = in; cl; cl = cl->next) {
  ------------------
  |  Branch (1119:19): [True: 20, False: 36]
  ------------------
 1120|       |
 1121|     20|        b = NULL;
 1122|       |
 1123|     68|        for ( ;; ) {
 1124|       |
 1125|     68|            ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
 1126|     68|                           "http body chunked buf "
 1127|     68|                           "t:%d f:%d %p, pos %p, size: %z file: %O, size: %O",
 1128|     68|                           cl->buf->temporary, cl->buf->in_file,
 1129|     68|                           cl->buf->start, cl->buf->pos,
 1130|     68|                           cl->buf->last - cl->buf->pos,
 1131|     68|                           cl->buf->file_pos,
 1132|     68|                           cl->buf->file_last - cl->buf->file_pos);
 1133|       |
 1134|     68|            rc = ngx_http_parse_chunked(r, cl->buf, rb->chunked);
 1135|       |
 1136|     68|            if (rc == NGX_OK) {
  ------------------
  |  |   38|     68|#define  NGX_OK          0
  ------------------
  |  Branch (1136:17): [True: 48, False: 20]
  ------------------
 1137|       |
 1138|       |                /* a chunk has been parsed successfully */
 1139|       |
 1140|     48|                clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|     48|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 1141|       |
 1142|     48|                if (clcf->client_max_body_size
  ------------------
  |  Branch (1142:21): [True: 48, False: 0]
  ------------------
 1143|     48|                    && clcf->client_max_body_size
  ------------------
  |  Branch (1143:24): [True: 0, False: 48]
  ------------------
 1144|     48|                       - r->headers_in.content_length_n < rb->chunked->size)
 1145|      0|                {
 1146|      0|                    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1147|      0|                                  "client intended to send too large chunked "
 1148|      0|                                  "body: %O+%O bytes",
 1149|      0|                                  r->headers_in.content_length_n,
 1150|      0|                                  rb->chunked->size);
 1151|       |
 1152|      0|                    r->lingering_close = 1;
 1153|       |
 1154|      0|                    return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE;
  ------------------
  |  |  101|      0|#define NGX_HTTP_REQUEST_ENTITY_TOO_LARGE  413
  ------------------
 1155|      0|                }
 1156|       |
 1157|     48|                if (b
  ------------------
  |  Branch (1157:21): [True: 38, False: 10]
  ------------------
 1158|     48|                    && rb->chunked->size <= 128
  ------------------
  |  Branch (1158:24): [True: 24, False: 14]
  ------------------
 1159|     48|                    && cl->buf->last - cl->buf->pos >= rb->chunked->size)
  ------------------
  |  Branch (1159:24): [True: 24, False: 0]
  ------------------
 1160|     24|                {
 1161|     24|                    r->headers_in.content_length_n += rb->chunked->size;
 1162|       |
 1163|     24|                    if (rb->chunked->size < 8) {
  ------------------
  |  Branch (1163:25): [True: 21, False: 3]
  ------------------
 1164|       |
 1165|     62|                        while (rb->chunked->size) {
  ------------------
  |  Branch (1165:32): [True: 41, False: 21]
  ------------------
 1166|     41|                            *b->last++ = *cl->buf->pos++;
 1167|     41|                            rb->chunked->size--;
 1168|     41|                        }
 1169|       |
 1170|     21|                    } else {
 1171|      3|                        ngx_memmove(b->last, cl->buf->pos, rb->chunked->size);
  ------------------
  |  |  143|      3|#define ngx_memmove(dst, src, n)  (void) memmove(dst, src, n)
  ------------------
 1172|      3|                        b->last += rb->chunked->size;
 1173|      3|                        cl->buf->pos += rb->chunked->size;
 1174|      3|                        rb->chunked->size = 0;
 1175|      3|                    }
 1176|       |
 1177|     24|                    continue;
 1178|     24|                }
 1179|       |
 1180|     24|                tl = ngx_chain_get_free_buf(r->pool, &rb->free);
 1181|     24|                if (tl == NULL) {
  ------------------
  |  Branch (1181:21): [True: 0, False: 24]
  ------------------
 1182|      0|                    return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1183|      0|                }
 1184|       |
 1185|     24|                b = tl->buf;
 1186|       |
 1187|     24|                ngx_memzero(b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|     24|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1188|       |
 1189|     24|                b->temporary = 1;
 1190|     24|                b->tag = (ngx_buf_tag_t) &ngx_http_read_client_request_body;
 1191|     24|                b->start = cl->buf->pos;
 1192|     24|                b->pos = cl->buf->pos;
 1193|     24|                b->last = cl->buf->last;
 1194|     24|                b->end = cl->buf->end;
 1195|     24|                b->flush = r->request_body_no_buffering;
 1196|       |
 1197|     24|                *ll = tl;
 1198|     24|                ll = &tl->next;
 1199|       |
 1200|     24|                size = cl->buf->last - cl->buf->pos;
 1201|       |
 1202|     24|                if ((off_t) size > rb->chunked->size) {
  ------------------
  |  Branch (1202:21): [True: 21, False: 3]
  ------------------
 1203|     21|                    cl->buf->pos += (size_t) rb->chunked->size;
 1204|     21|                    r->headers_in.content_length_n += rb->chunked->size;
 1205|     21|                    rb->chunked->size = 0;
 1206|       |
 1207|     21|                } else {
 1208|      3|                    rb->chunked->size -= size;
 1209|      3|                    r->headers_in.content_length_n += size;
 1210|      3|                    cl->buf->pos = cl->buf->last;
 1211|      3|                }
 1212|       |
 1213|     24|                b->last = cl->buf->pos;
 1214|       |
 1215|     24|                continue;
 1216|     24|            }
 1217|       |
 1218|     20|            if (rc == NGX_DONE) {
  ------------------
  |  |   42|     20|#define  NGX_DONE       -4
  ------------------
  |  Branch (1218:17): [True: 0, False: 20]
  ------------------
 1219|       |
 1220|       |                /* a whole response has been parsed successfully */
 1221|       |
 1222|      0|                rb->rest = 0;
 1223|       |
 1224|      0|                tl = ngx_chain_get_free_buf(r->pool, &rb->free);
 1225|      0|                if (tl == NULL) {
  ------------------
  |  Branch (1225:21): [True: 0, False: 0]
  ------------------
 1226|      0|                    return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1227|      0|                }
 1228|       |
 1229|      0|                b = tl->buf;
 1230|       |
 1231|      0|                ngx_memzero(b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1232|       |
 1233|      0|                b->last_buf = 1;
 1234|       |
 1235|      0|                *ll = tl;
 1236|      0|                ll = &tl->next;
 1237|       |
 1238|      0|                break;
 1239|      0|            }
 1240|       |
 1241|     20|            if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|     20|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (1241:17): [True: 20, False: 0]
  ------------------
 1242|       |
 1243|       |                /* set rb->rest, amount of data we want to see next time */
 1244|       |
 1245|     20|                cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|     20|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
 1246|       |
 1247|     20|                rb->rest = ngx_max(rb->chunked->length,
  ------------------
  |  |  109|     20|#define ngx_max(val1, val2)  ((val1 < val2) ? (val2) : (val1))
  |  |  ------------------
  |  |  |  Branch (109:31): [True: 20, False: 0]
  |  |  ------------------
  ------------------
 1248|     20|                               (off_t) cscf->large_client_header_buffers.size);
 1249|       |
 1250|     20|                break;
 1251|     20|            }
 1252|       |
 1253|       |            /* invalid */
 1254|       |
 1255|      0|            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1256|      0|                          "client sent invalid chunked body");
 1257|       |
 1258|      0|            return NGX_HTTP_BAD_REQUEST;
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
 1259|     20|        }
 1260|     20|    }
 1261|       |
 1262|     36|    rc = ngx_http_top_request_body_filter(r, out);
 1263|       |
 1264|     36|    ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
 1265|     36|                            (ngx_buf_tag_t) &ngx_http_read_client_request_body);
 1266|       |
 1267|     36|    return rc;
 1268|     36|}
ngx_http_request_body.c:ngx_http_request_body_length_filter:
 1002|     86|{
 1003|     86|    size_t                     size;
 1004|     86|    ngx_int_t                  rc;
 1005|     86|    ngx_buf_t                 *b;
 1006|     86|    ngx_chain_t               *cl, *tl, *out, **ll;
 1007|     86|    ngx_http_request_body_t   *rb;
 1008|       |
 1009|     86|    rb = r->request_body;
 1010|       |
 1011|     86|    out = NULL;
 1012|     86|    ll = &out;
 1013|       |
 1014|     86|    if (rb->rest == -1) {
  ------------------
  |  Branch (1014:9): [True: 4, False: 82]
  ------------------
 1015|      4|        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1016|      4|                       "http request body content length filter");
 1017|       |
 1018|      4|        rb->rest = r->headers_in.content_length_n;
 1019|       |
 1020|      4|        if (rb->rest == 0) {
  ------------------
  |  Branch (1020:13): [True: 0, False: 4]
  ------------------
 1021|       |
 1022|      0|            tl = ngx_chain_get_free_buf(r->pool, &rb->free);
 1023|      0|            if (tl == NULL) {
  ------------------
  |  Branch (1023:17): [True: 0, False: 0]
  ------------------
 1024|      0|                return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1025|      0|            }
 1026|       |
 1027|      0|            b = tl->buf;
 1028|       |
 1029|      0|            ngx_memzero(b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1030|       |
 1031|      0|            b->last_buf = 1;
 1032|       |
 1033|      0|            *ll = tl;
 1034|      0|            ll = &tl->next;
 1035|      0|        }
 1036|      4|    }
 1037|       |
 1038|    132|    for (cl = in; cl; cl = cl->next) {
  ------------------
  |  Branch (1038:19): [True: 46, False: 86]
  ------------------
 1039|       |
 1040|     46|        if (rb->rest == 0) {
  ------------------
  |  Branch (1040:13): [True: 0, False: 46]
  ------------------
 1041|      0|            break;
 1042|      0|        }
 1043|       |
 1044|     46|        tl = ngx_chain_get_free_buf(r->pool, &rb->free);
 1045|     46|        if (tl == NULL) {
  ------------------
  |  Branch (1045:13): [True: 0, False: 46]
  ------------------
 1046|      0|            return NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1047|      0|        }
 1048|       |
 1049|     46|        b = tl->buf;
 1050|       |
 1051|     46|        ngx_memzero(b, sizeof(ngx_buf_t));
  ------------------
  |  |   88|     46|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1052|       |
 1053|     46|        b->temporary = 1;
 1054|     46|        b->tag = (ngx_buf_tag_t) &ngx_http_read_client_request_body;
 1055|     46|        b->start = cl->buf->pos;
 1056|     46|        b->pos = cl->buf->pos;
 1057|     46|        b->last = cl->buf->last;
 1058|     46|        b->end = cl->buf->end;
 1059|     46|        b->flush = r->request_body_no_buffering;
 1060|       |
 1061|     46|        size = cl->buf->last - cl->buf->pos;
 1062|       |
 1063|     46|        if ((off_t) size < rb->rest) {
  ------------------
  |  Branch (1063:13): [True: 46, False: 0]
  ------------------
 1064|     46|            cl->buf->pos = cl->buf->last;
 1065|     46|            rb->rest -= size;
 1066|       |
 1067|     46|        } else {
 1068|      0|            cl->buf->pos += (size_t) rb->rest;
 1069|      0|            rb->rest = 0;
 1070|      0|            b->last = cl->buf->pos;
 1071|      0|            b->last_buf = 1;
 1072|      0|        }
 1073|       |
 1074|     46|        *ll = tl;
 1075|     46|        ll = &tl->next;
 1076|     46|    }
 1077|       |
 1078|     86|    rc = ngx_http_top_request_body_filter(r, out);
 1079|       |
 1080|     86|    ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
 1081|     86|                            (ngx_buf_tag_t) &ngx_http_read_client_request_body);
 1082|       |
 1083|     86|    return rc;
 1084|     86|}
ngx_http_request_body.c:ngx_http_write_request_body:
  549|     47|{
  550|     47|    ssize_t                    n;
  551|     47|    ngx_chain_t               *cl, *ln;
  552|     47|    ngx_temp_file_t           *tf;
  553|     47|    ngx_http_request_body_t   *rb;
  554|     47|    ngx_http_core_loc_conf_t  *clcf;
  555|       |
  556|     47|    rb = r->request_body;
  557|       |
  558|     47|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  559|     47|                   "http write client request body, bufs %p", rb->bufs);
  560|       |
  561|     47|    if (rb->temp_file == NULL) {
  ------------------
  |  Branch (561:9): [True: 5, False: 42]
  ------------------
  562|      5|        tf = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t));
  563|      5|        if (tf == NULL) {
  ------------------
  |  Branch (563:13): [True: 0, False: 5]
  ------------------
  564|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  565|      0|        }
  566|       |
  567|      5|        clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      5|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  568|       |
  569|      5|        tf->file.fd = NGX_INVALID_FILE;
  ------------------
  |  |   49|      5|#define NGX_INVALID_FILE         -1
  ------------------
  570|      5|        tf->file.log = r->connection->log;
  571|      5|        tf->path = clcf->client_body_temp_path;
  572|      5|        tf->pool = r->pool;
  573|      5|        tf->warn = "a client request body is buffered to a temporary file";
  574|      5|        tf->log_level = r->request_body_file_log_level;
  575|      5|        tf->persistent = r->request_body_in_persistent_file;
  576|      5|        tf->clean = r->request_body_in_clean_file;
  577|       |
  578|      5|        if (r->request_body_file_group_access) {
  ------------------
  |  Branch (578:13): [True: 0, False: 5]
  ------------------
  579|      0|            tf->access = 0660;
  580|      0|        }
  581|       |
  582|      5|        rb->temp_file = tf;
  583|       |
  584|      5|        if (rb->bufs == NULL) {
  ------------------
  |  Branch (584:13): [True: 0, False: 5]
  ------------------
  585|       |            /* empty body with r->request_body_in_file_only */
  586|       |
  587|      0|            if (ngx_create_temp_file(&tf->file, tf->path, tf->pool,
  ------------------
  |  Branch (587:17): [True: 0, False: 0]
  ------------------
  588|      0|                                     tf->persistent, tf->clean, tf->access)
  589|      0|                != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  590|      0|            {
  591|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  592|      0|            }
  593|       |
  594|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  595|      0|        }
  596|      5|    }
  597|       |
  598|     47|    if (rb->bufs == NULL) {
  ------------------
  |  Branch (598:9): [True: 0, False: 47]
  ------------------
  599|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  600|      0|    }
  601|       |
  602|     47|    n = ngx_write_chain_to_temp_file(rb->temp_file, rb->bufs);
  603|       |
  604|       |    /* TODO: n == 0 or not complete and level event */
  605|       |
  606|     47|    if (n == NGX_ERROR) {
  ------------------
  |  |   39|     47|#define  NGX_ERROR      -1
  ------------------
  |  Branch (606:9): [True: 0, False: 47]
  ------------------
  607|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  608|      0|    }
  609|       |
  610|     47|    rb->temp_file->offset += n;
  611|       |
  612|       |    /* mark all buffers as written */
  613|       |
  614|    112|    for (cl = rb->bufs; cl; /* void */) {
  ------------------
  |  Branch (614:25): [True: 65, False: 47]
  ------------------
  615|       |
  616|     65|        cl->buf->pos = cl->buf->last;
  617|       |
  618|     65|        ln = cl;
  619|     65|        cl = cl->next;
  620|     65|        ngx_free_chain(r->pool, ln);
  ------------------
  |  |  149|     65|    (cl)->next = (pool)->chain;                                              \
  |  |  150|     65|    (pool)->chain = (cl)
  ------------------
  621|     65|    }
  622|       |
  623|     47|    rb->bufs = NULL;
  624|       |
  625|     47|    return NGX_OK;
  ------------------
  |  |   38|     47|#define  NGX_OK          0
  ------------------
  626|     47|}

ngx_http_script_flush_complex_value:
   38|     11|{
   39|     11|    ngx_uint_t *index;
   40|       |
   41|     11|    index = val->flushes;
   42|       |
   43|     11|    if (index) {
  ------------------
  |  Branch (43:9): [True: 11, False: 0]
  ------------------
   44|     22|        while (*index != (ngx_uint_t) -1) {
  ------------------
  |  Branch (44:16): [True: 11, False: 11]
  ------------------
   45|       |
   46|     11|            if (r->variables[*index].no_cacheable) {
  ------------------
  |  Branch (46:17): [True: 0, False: 11]
  ------------------
   47|      0|                r->variables[*index].valid = 0;
   48|      0|                r->variables[*index].not_found = 0;
   49|      0|            }
   50|       |
   51|     11|            index++;
   52|     11|        }
   53|     11|    }
   54|     11|}
ngx_http_complex_value:
   60|     11|{
   61|     11|    size_t                        len;
   62|     11|    ngx_http_script_code_pt       code;
   63|     11|    ngx_http_script_len_code_pt   lcode;
   64|     11|    ngx_http_script_engine_t      e;
   65|       |
   66|     11|    if (val->lengths == NULL) {
  ------------------
  |  Branch (66:9): [True: 0, False: 11]
  ------------------
   67|      0|        *value = val->value;
   68|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
   69|      0|    }
   70|       |
   71|     11|    ngx_http_script_flush_complex_value(r, val);
   72|       |
   73|     11|    ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
  ------------------
  |  |   88|     11|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
   74|       |
   75|     11|    e.ip = val->lengths;
   76|     11|    e.request = r;
   77|     11|    e.flushed = 1;
   78|       |
   79|     11|    len = 0;
   80|       |
   81|     22|    while (*(uintptr_t *) e.ip) {
  ------------------
  |  Branch (81:12): [True: 11, False: 11]
  ------------------
   82|     11|        lcode = *(ngx_http_script_len_code_pt *) e.ip;
   83|     11|        len += lcode(&e);
   84|     11|    }
   85|       |
   86|     11|    value->len = len;
   87|     11|    value->data = ngx_pnalloc(r->pool, len);
   88|     11|    if (value->data == NULL) {
  ------------------
  |  Branch (88:9): [True: 0, False: 11]
  ------------------
   89|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   90|      0|    }
   91|       |
   92|     11|    e.ip = val->values;
   93|     11|    e.pos = value->data;
   94|     11|    e.buf = *value;
   95|       |
   96|     22|    while (*(uintptr_t *) e.ip) {
  ------------------
  |  Branch (96:12): [True: 11, False: 11]
  ------------------
   97|     11|        code = *(ngx_http_script_code_pt *) e.ip;
   98|     11|        code((ngx_http_script_engine_t *) &e);
   99|     11|    }
  100|       |
  101|     11|    *value = e.buf;
  102|       |
  103|     11|    return NGX_OK;
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  104|     11|}
ngx_http_compile_complex_value:
  140|      5|{
  141|      5|    ngx_str_t                  *v;
  142|      5|    ngx_uint_t                  i, n, nv, nc;
  143|      5|    ngx_array_t                 flushes, lengths, values, *pf, *pl, *pv;
  144|      5|    ngx_http_script_compile_t   sc;
  145|       |
  146|      5|    v = ccv->value;
  147|       |
  148|      5|    nv = 0;
  149|      5|    nc = 0;
  150|       |
  151|     54|    for (i = 0; i < v->len; i++) {
  ------------------
  |  Branch (151:17): [True: 49, False: 5]
  ------------------
  152|     49|        if (v->data[i] == '$') {
  ------------------
  |  Branch (152:13): [True: 2, False: 47]
  ------------------
  153|      2|            if (v->data[i + 1] >= '1' && v->data[i + 1] <= '9') {
  ------------------
  |  Branch (153:17): [True: 2, False: 0]
  |  Branch (153:42): [True: 0, False: 2]
  ------------------
  154|      0|                nc++;
  155|       |
  156|      2|            } else {
  157|      2|                nv++;
  158|      2|            }
  159|      2|        }
  160|     49|    }
  161|       |
  162|      5|    if ((v->len == 0 || v->data[0] != '$')
  ------------------
  |  Branch (162:10): [True: 0, False: 5]
  |  Branch (162:25): [True: 3, False: 2]
  ------------------
  163|      5|        && (ccv->conf_prefix || ccv->root_prefix))
  ------------------
  |  Branch (163:13): [True: 0, False: 3]
  |  Branch (163:33): [True: 0, False: 3]
  ------------------
  164|      0|    {
  165|      0|        if (ngx_conf_full_name(ccv->cf->cycle, v, ccv->conf_prefix) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (165:13): [True: 0, False: 0]
  ------------------
  166|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  167|      0|        }
  168|       |
  169|      0|        ccv->conf_prefix = 0;
  170|      0|        ccv->root_prefix = 0;
  171|      0|    }
  172|       |
  173|      5|    ccv->complex_value->value = *v;
  174|      5|    ccv->complex_value->flushes = NULL;
  175|      5|    ccv->complex_value->lengths = NULL;
  176|      5|    ccv->complex_value->values = NULL;
  177|       |
  178|      5|    if (nv == 0 && nc == 0) {
  ------------------
  |  Branch (178:9): [True: 3, False: 2]
  |  Branch (178:20): [True: 3, False: 0]
  ------------------
  179|      3|        return NGX_OK;
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
  180|      3|    }
  181|       |
  182|      2|    n = nv + 1;
  183|       |
  184|      2|    if (ngx_array_init(&flushes, ccv->cf->pool, n, sizeof(ngx_uint_t))
  ------------------
  |  Branch (184:9): [True: 0, False: 2]
  ------------------
  185|      2|        != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  186|      0|    {
  187|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  188|      0|    }
  189|       |
  190|      2|    n = nv * (2 * sizeof(ngx_http_script_copy_code_t)
  191|      2|                  + sizeof(ngx_http_script_var_code_t))
  192|      2|        + sizeof(uintptr_t);
  193|       |
  194|      2|    if (ngx_array_init(&lengths, ccv->cf->pool, n, 1) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (194:9): [True: 0, False: 2]
  ------------------
  195|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  196|      0|    }
  197|       |
  198|      2|    n = (nv * (2 * sizeof(ngx_http_script_copy_code_t)
  199|      2|                   + sizeof(ngx_http_script_var_code_t))
  200|      2|                + sizeof(uintptr_t)
  201|      2|                + v->len
  202|      2|                + sizeof(uintptr_t) - 1)
  203|      2|            & ~(sizeof(uintptr_t) - 1);
  204|       |
  205|      2|    if (ngx_array_init(&values, ccv->cf->pool, n, 1) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (205:9): [True: 0, False: 2]
  ------------------
  206|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  207|      0|    }
  208|       |
  209|      2|    pf = &flushes;
  210|      2|    pl = &lengths;
  211|      2|    pv = &values;
  212|       |
  213|      2|    ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
  ------------------
  |  |   88|      2|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  214|       |
  215|      2|    sc.cf = ccv->cf;
  216|      2|    sc.source = v;
  217|      2|    sc.flushes = &pf;
  218|      2|    sc.lengths = &pl;
  219|      2|    sc.values = &pv;
  220|      2|    sc.complete_lengths = 1;
  221|      2|    sc.complete_values = 1;
  222|      2|    sc.zero = ccv->zero;
  223|      2|    sc.conf_prefix = ccv->conf_prefix;
  224|      2|    sc.root_prefix = ccv->root_prefix;
  225|       |
  226|      2|    if (ngx_http_script_compile(&sc) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (226:9): [True: 0, False: 2]
  ------------------
  227|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  228|      0|    }
  229|       |
  230|      2|    if (flushes.nelts) {
  ------------------
  |  Branch (230:9): [True: 2, False: 0]
  ------------------
  231|      2|        ccv->complex_value->flushes = flushes.elts;
  232|      2|        ccv->complex_value->flushes[flushes.nelts] = (ngx_uint_t) -1;
  233|      2|    }
  234|       |
  235|      2|    ccv->complex_value->lengths = lengths.elts;
  236|      2|    ccv->complex_value->values = values.elts;
  237|       |
  238|      2|    return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  239|      2|}
ngx_http_script_variables_count:
  446|      1|{
  447|      1|    ngx_uint_t  i, n;
  448|       |
  449|     12|    for (n = 0, i = 0; i < value->len; i++) {
  ------------------
  |  Branch (449:24): [True: 11, False: 1]
  ------------------
  450|     11|        if (value->data[i] == '$') {
  ------------------
  |  Branch (450:13): [True: 1, False: 10]
  ------------------
  451|      1|            n++;
  452|      1|        }
  453|     11|    }
  454|       |
  455|      1|    return n;
  456|      1|}
ngx_http_script_compile:
  461|     16|{
  462|     16|    u_char       ch;
  463|     16|    ngx_str_t    name;
  464|     16|    ngx_uint_t   i, bracket;
  465|       |
  466|     16|    if (ngx_http_script_init_arrays(sc) != NGX_OK) {
  ------------------
  |  |   38|     16|#define  NGX_OK          0
  ------------------
  |  Branch (466:9): [True: 0, False: 16]
  ------------------
  467|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  468|      0|    }
  469|       |
  470|     33|    for (i = 0; i < sc->source->len; /* void */ ) {
  ------------------
  |  Branch (470:17): [True: 17, False: 16]
  ------------------
  471|       |
  472|     17|        name.len = 0;
  473|       |
  474|     17|        if (sc->source->data[i] == '$') {
  ------------------
  |  Branch (474:13): [True: 15, False: 2]
  ------------------
  475|       |
  476|     15|            if (++i == sc->source->len) {
  ------------------
  |  Branch (476:17): [True: 0, False: 15]
  ------------------
  477|      0|                goto invalid_variable;
  478|      0|            }
  479|       |
  480|     15|            if (sc->source->data[i] >= '1' && sc->source->data[i] <= '9') {
  ------------------
  |  Branch (480:17): [True: 15, False: 0]
  |  Branch (480:47): [True: 0, False: 15]
  ------------------
  481|      0|#if (NGX_PCRE)
  482|      0|                ngx_uint_t  n;
  483|       |
  484|      0|                n = sc->source->data[i] - '0';
  485|       |
  486|      0|                if (sc->captures_mask & ((ngx_uint_t) 1 << n)) {
  ------------------
  |  Branch (486:21): [True: 0, False: 0]
  ------------------
  487|      0|                    sc->dup_capture = 1;
  488|      0|                }
  489|       |
  490|      0|                sc->captures_mask |= (ngx_uint_t) 1 << n;
  491|       |
  492|      0|                if (ngx_http_script_add_capture_code(sc, n) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (492:21): [True: 0, False: 0]
  ------------------
  493|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  494|      0|                }
  495|       |
  496|      0|                i++;
  497|       |
  498|      0|                continue;
  499|       |#else
  500|       |                ngx_conf_log_error(NGX_LOG_EMERG, sc->cf, 0,
  501|       |                                   "using variable \"$%c\" requires "
  502|       |                                   "PCRE library", sc->source->data[i]);
  503|       |                return NGX_ERROR;
  504|       |#endif
  505|      0|            }
  506|       |
  507|     15|            if (sc->source->data[i] == '{') {
  ------------------
  |  Branch (507:17): [True: 0, False: 15]
  ------------------
  508|      0|                bracket = 1;
  509|       |
  510|      0|                if (++i == sc->source->len) {
  ------------------
  |  Branch (510:21): [True: 0, False: 0]
  ------------------
  511|      0|                    goto invalid_variable;
  512|      0|                }
  513|       |
  514|      0|                name.data = &sc->source->data[i];
  515|       |
  516|     15|            } else {
  517|     15|                bracket = 0;
  518|     15|                name.data = &sc->source->data[i];
  519|     15|            }
  520|       |
  521|    233|            for ( /* void */ ; i < sc->source->len; i++, name.len++) {
  ------------------
  |  Branch (521:32): [True: 218, False: 15]
  ------------------
  522|    218|                ch = sc->source->data[i];
  523|       |
  524|    218|                if (ch == '}' && bracket) {
  ------------------
  |  Branch (524:21): [True: 0, False: 218]
  |  Branch (524:34): [True: 0, False: 0]
  ------------------
  525|      0|                    i++;
  526|      0|                    bracket = 0;
  527|      0|                    break;
  528|      0|                }
  529|       |
  530|    218|                if ((ch >= 'A' && ch <= 'Z')
  ------------------
  |  Branch (530:22): [True: 218, False: 0]
  |  Branch (530:35): [True: 0, False: 218]
  ------------------
  531|    218|                    || (ch >= 'a' && ch <= 'z')
  ------------------
  |  Branch (531:25): [True: 198, False: 20]
  |  Branch (531:38): [True: 198, False: 0]
  ------------------
  532|    218|                    || (ch >= '0' && ch <= '9')
  ------------------
  |  Branch (532:25): [True: 20, False: 0]
  |  Branch (532:38): [True: 0, False: 20]
  ------------------
  533|    218|                    || ch == '_')
  ------------------
  |  Branch (533:24): [True: 20, False: 0]
  ------------------
  534|    218|                {
  535|    218|                    continue;
  536|    218|                }
  537|       |
  538|      0|                break;
  539|    218|            }
  540|       |
  541|     15|            if (bracket) {
  ------------------
  |  Branch (541:17): [True: 0, False: 15]
  ------------------
  542|      0|                ngx_conf_log_error(NGX_LOG_EMERG, sc->cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  543|      0|                                   "the closing bracket in \"%V\" "
  544|      0|                                   "variable is missing", &name);
  545|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  546|      0|            }
  547|       |
  548|     15|            if (name.len == 0) {
  ------------------
  |  Branch (548:17): [True: 0, False: 15]
  ------------------
  549|      0|                goto invalid_variable;
  550|      0|            }
  551|       |
  552|     15|            sc->variables++;
  553|       |
  554|     15|            if (ngx_http_script_add_var_code(sc, &name) != NGX_OK) {
  ------------------
  |  |   38|     15|#define  NGX_OK          0
  ------------------
  |  Branch (554:17): [True: 0, False: 15]
  ------------------
  555|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  556|      0|            }
  557|       |
  558|     15|            continue;
  559|     15|        }
  560|       |
  561|      2|        if (sc->source->data[i] == '?' && sc->compile_args) {
  ------------------
  |  Branch (561:13): [True: 0, False: 2]
  |  Branch (561:43): [True: 0, False: 0]
  ------------------
  562|      0|            sc->args = 1;
  563|      0|            sc->compile_args = 0;
  564|       |
  565|      0|            if (ngx_http_script_add_args_code(sc) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (565:17): [True: 0, False: 0]
  ------------------
  566|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  567|      0|            }
  568|       |
  569|      0|            i++;
  570|       |
  571|      0|            continue;
  572|      0|        }
  573|       |
  574|      2|        name.data = &sc->source->data[i];
  575|       |
  576|     14|        while (i < sc->source->len) {
  ------------------
  |  Branch (576:16): [True: 13, False: 1]
  ------------------
  577|       |
  578|     13|            if (sc->source->data[i] == '$') {
  ------------------
  |  Branch (578:17): [True: 1, False: 12]
  ------------------
  579|      1|                break;
  580|      1|            }
  581|       |
  582|     12|            if (sc->source->data[i] == '?') {
  ------------------
  |  Branch (582:17): [True: 0, False: 12]
  ------------------
  583|       |
  584|      0|                sc->args = 1;
  585|       |
  586|      0|                if (sc->compile_args) {
  ------------------
  |  Branch (586:21): [True: 0, False: 0]
  ------------------
  587|      0|                    break;
  588|      0|                }
  589|      0|            }
  590|       |
  591|     12|            i++;
  592|     12|            name.len++;
  593|     12|        }
  594|       |
  595|      2|        sc->size += name.len;
  596|       |
  597|      2|        if (ngx_http_script_add_copy_code(sc, &name, (i == sc->source->len))
  ------------------
  |  Branch (597:13): [True: 0, False: 2]
  ------------------
  598|      2|            != NGX_OK)
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  599|      0|        {
  600|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  601|      0|        }
  602|      2|    }
  603|       |
  604|     16|    return ngx_http_script_done(sc);
  605|       |
  606|      0|invalid_variable:
  607|       |
  608|      0|    ngx_conf_log_error(NGX_LOG_EMERG, sc->cf, 0, "invalid variable name");
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  609|       |
  610|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  611|     16|}
ngx_http_script_run:
  617|     11|{
  618|     11|    ngx_uint_t                    i;
  619|     11|    ngx_http_script_code_pt       code;
  620|     11|    ngx_http_script_len_code_pt   lcode;
  621|     11|    ngx_http_script_engine_t      e;
  622|     11|    ngx_http_core_main_conf_t    *cmcf;
  623|       |
  624|     11|    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  ------------------
  |  |   56|     11|    (r)->main_conf[module.ctx_index]
  ------------------
  625|       |
  626|    132|    for (i = 0; i < cmcf->variables.nelts; i++) {
  ------------------
  |  Branch (626:17): [True: 121, False: 11]
  ------------------
  627|    121|        if (r->variables[i].no_cacheable) {
  ------------------
  |  Branch (627:13): [True: 0, False: 121]
  ------------------
  628|      0|            r->variables[i].valid = 0;
  629|      0|            r->variables[i].not_found = 0;
  630|      0|        }
  631|    121|    }
  632|       |
  633|     11|    ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
  ------------------
  |  |   88|     11|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  634|       |
  635|     11|    e.ip = code_lengths;
  636|     11|    e.request = r;
  637|     11|    e.flushed = 1;
  638|       |
  639|     33|    while (*(uintptr_t *) e.ip) {
  ------------------
  |  Branch (639:12): [True: 22, False: 11]
  ------------------
  640|     22|        lcode = *(ngx_http_script_len_code_pt *) e.ip;
  641|     22|        len += lcode(&e);
  642|     22|    }
  643|       |
  644|       |
  645|     11|    value->len = len;
  646|     11|    value->data = ngx_pnalloc(r->pool, len);
  647|     11|    if (value->data == NULL) {
  ------------------
  |  Branch (647:9): [True: 0, False: 11]
  ------------------
  648|      0|        return NULL;
  649|      0|    }
  650|       |
  651|     11|    e.ip = code_values;
  652|     11|    e.pos = value->data;
  653|       |
  654|     33|    while (*(uintptr_t *) e.ip) {
  ------------------
  |  Branch (654:12): [True: 22, False: 11]
  ------------------
  655|     22|        code = *(ngx_http_script_code_pt *) e.ip;
  656|     22|        code((ngx_http_script_engine_t *) &e);
  657|     22|    }
  658|       |
  659|     11|    return e.pos;
  660|     11|}
ngx_http_script_flush_no_cacheable_variables:
  666|     10|{
  667|     10|    ngx_uint_t  n, *index;
  668|       |
  669|     10|    if (indices) {
  ------------------
  |  Branch (669:9): [True: 5, False: 5]
  ------------------
  670|      5|        index = indices->elts;
  671|     30|        for (n = 0; n < indices->nelts; n++) {
  ------------------
  |  Branch (671:21): [True: 25, False: 5]
  ------------------
  672|     25|            if (r->variables[index[n]].no_cacheable) {
  ------------------
  |  Branch (672:17): [True: 0, False: 25]
  ------------------
  673|      0|                r->variables[index[n]].valid = 0;
  674|      0|                r->variables[index[n]].not_found = 0;
  675|      0|            }
  676|     25|        }
  677|      5|    }
  678|     10|}
ngx_http_script_add_code:
  786|     40|{
  787|     40|    u_char  *elts, **p;
  788|     40|    void    *new;
  789|       |
  790|     40|    elts = codes->elts;
  791|       |
  792|     40|    new = ngx_array_push_n(codes, size);
  793|     40|    if (new == NULL) {
  ------------------
  |  Branch (793:9): [True: 0, False: 40]
  ------------------
  794|      0|        return NULL;
  795|      0|    }
  796|       |
  797|     40|    if (code) {
  ------------------
  |  Branch (797:9): [True: 20, False: 20]
  ------------------
  798|     20|        if (elts != codes->elts) {
  ------------------
  |  Branch (798:13): [True: 0, False: 20]
  ------------------
  799|      0|            p = code;
  800|      0|            *p += (u_char *) codes->elts - elts;
  801|      0|        }
  802|     20|    }
  803|       |
  804|     40|    return new;
  805|     40|}
ngx_http_script_copy_len_code:
  854|     61|{
  855|     61|    ngx_http_script_copy_code_t  *code;
  856|       |
  857|     61|    code = (ngx_http_script_copy_code_t *) e->ip;
  858|       |
  859|     61|    e->ip += sizeof(ngx_http_script_copy_code_t);
  860|       |
  861|     61|    return code->len;
  862|     61|}
ngx_http_script_copy_code:
  867|     36|{
  868|     36|    u_char                       *p;
  869|     36|    ngx_http_script_copy_code_t  *code;
  870|       |
  871|     36|    code = (ngx_http_script_copy_code_t *) e->ip;
  872|       |
  873|     36|    p = e->pos;
  874|       |
  875|     36|    if (!e->skip) {
  ------------------
  |  Branch (875:9): [True: 11, False: 25]
  ------------------
  876|     11|        e->pos = ngx_copy(p, e->ip + sizeof(ngx_http_script_copy_code_t),
  ------------------
  |  |  138|     11|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|     11|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  877|     11|                          code->len);
  878|     11|    }
  879|       |
  880|     36|    e->ip += sizeof(ngx_http_script_copy_code_t)
  881|     36|          + ((code->len + sizeof(uintptr_t) - 1) & ~(sizeof(uintptr_t) - 1));
  882|       |
  883|     36|    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
  884|     36|                   "http script copy: \"%*s\"", e->pos - p, p);
  885|     36|}
ngx_http_script_copy_var_len_code:
  935|     72|{
  936|     72|    ngx_http_variable_value_t   *value;
  937|     72|    ngx_http_script_var_code_t  *code;
  938|       |
  939|     72|    code = (ngx_http_script_var_code_t *) e->ip;
  940|       |
  941|     72|    e->ip += sizeof(ngx_http_script_var_code_t);
  942|       |
  943|     72|    if (e->flushed) {
  ------------------
  |  Branch (943:9): [True: 72, False: 0]
  ------------------
  944|     72|        value = ngx_http_get_indexed_variable(e->request, code->index);
  945|       |
  946|     72|    } else {
  947|      0|        value = ngx_http_get_flushed_variable(e->request, code->index);
  948|      0|    }
  949|       |
  950|     72|    if (value && !value->not_found) {
  ------------------
  |  Branch (950:9): [True: 72, False: 0]
  |  Branch (950:18): [True: 31, False: 41]
  ------------------
  951|     31|        return value->len;
  952|     31|    }
  953|       |
  954|     41|    return 0;
  955|     72|}
ngx_http_script_copy_var_code:
  960|     47|{
  961|     47|    u_char                      *p;
  962|     47|    ngx_http_variable_value_t   *value;
  963|     47|    ngx_http_script_var_code_t  *code;
  964|       |
  965|     47|    code = (ngx_http_script_var_code_t *) e->ip;
  966|       |
  967|     47|    e->ip += sizeof(ngx_http_script_var_code_t);
  968|       |
  969|     47|    if (!e->skip) {
  ------------------
  |  Branch (969:9): [True: 22, False: 25]
  ------------------
  970|       |
  971|     22|        if (e->flushed) {
  ------------------
  |  Branch (971:13): [True: 22, False: 0]
  ------------------
  972|     22|            value = ngx_http_get_indexed_variable(e->request, code->index);
  973|       |
  974|     22|        } else {
  975|      0|            value = ngx_http_get_flushed_variable(e->request, code->index);
  976|      0|        }
  977|       |
  978|     22|        if (value && !value->not_found) {
  ------------------
  |  Branch (978:13): [True: 22, False: 0]
  |  Branch (978:22): [True: 11, False: 11]
  ------------------
  979|     11|            p = e->pos;
  980|     11|            e->pos = ngx_copy(p, value->data, value->len);
  ------------------
  |  |  138|     11|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|     11|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  981|       |
  982|     11|            ngx_log_debug2(NGX_LOG_DEBUG_HTTP,
  983|     11|                           e->request->connection->log, 0,
  984|     11|                           "http script var: \"%*s\"", e->pos - p, p);
  985|     11|        }
  986|     22|    }
  987|     47|}
ngx_http_script.c:ngx_http_script_init_arrays:
  683|     16|{
  684|     16|    ngx_uint_t   n;
  685|       |
  686|     16|    if (sc->flushes && *sc->flushes == NULL) {
  ------------------
  |  Branch (686:9): [True: 15, False: 1]
  |  Branch (686:24): [True: 3, False: 12]
  ------------------
  687|      3|        n = sc->variables ? sc->variables : 1;
  ------------------
  |  Branch (687:13): [True: 0, False: 3]
  ------------------
  688|      3|        *sc->flushes = ngx_array_create(sc->cf->pool, n, sizeof(ngx_uint_t));
  689|      3|        if (*sc->flushes == NULL) {
  ------------------
  |  Branch (689:13): [True: 0, False: 3]
  ------------------
  690|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  691|      0|        }
  692|      3|    }
  693|       |
  694|     16|    if (*sc->lengths == NULL) {
  ------------------
  |  Branch (694:9): [True: 1, False: 15]
  ------------------
  695|      1|        n = sc->variables * (2 * sizeof(ngx_http_script_copy_code_t)
  696|      1|                             + sizeof(ngx_http_script_var_code_t))
  697|      1|            + sizeof(uintptr_t);
  698|       |
  699|      1|        *sc->lengths = ngx_array_create(sc->cf->pool, n, 1);
  700|      1|        if (*sc->lengths == NULL) {
  ------------------
  |  Branch (700:13): [True: 0, False: 1]
  ------------------
  701|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  702|      0|        }
  703|      1|    }
  704|       |
  705|     16|    if (*sc->values == NULL) {
  ------------------
  |  Branch (705:9): [True: 1, False: 15]
  ------------------
  706|      1|        n = (sc->variables * (2 * sizeof(ngx_http_script_copy_code_t)
  707|      1|                              + sizeof(ngx_http_script_var_code_t))
  708|      1|                + sizeof(uintptr_t)
  709|      1|                + sc->source->len
  710|      1|                + sizeof(uintptr_t) - 1)
  711|      1|            & ~(sizeof(uintptr_t) - 1);
  712|       |
  713|      1|        *sc->values = ngx_array_create(sc->cf->pool, n, 1);
  714|      1|        if (*sc->values == NULL) {
  ------------------
  |  Branch (714:13): [True: 0, False: 1]
  ------------------
  715|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  716|      0|        }
  717|      1|    }
  718|       |
  719|     16|    sc->variables = 0;
  720|       |
  721|     16|    return NGX_OK;
  ------------------
  |  |   38|     16|#define  NGX_OK          0
  ------------------
  722|     16|}
ngx_http_script.c:ngx_http_script_done:
  727|     16|{
  728|     16|    ngx_str_t    zero;
  729|     16|    uintptr_t   *code;
  730|       |
  731|     16|    if (sc->zero) {
  ------------------
  |  Branch (731:9): [True: 0, False: 16]
  ------------------
  732|       |
  733|      0|        zero.len = 1;
  734|      0|        zero.data = (u_char *) "\0";
  735|       |
  736|      0|        if (ngx_http_script_add_copy_code(sc, &zero, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (736:13): [True: 0, False: 0]
  ------------------
  737|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  738|      0|        }
  739|      0|    }
  740|       |
  741|     16|    if (sc->conf_prefix || sc->root_prefix) {
  ------------------
  |  Branch (741:9): [True: 0, False: 16]
  |  Branch (741:28): [True: 0, False: 16]
  ------------------
  742|      0|        if (ngx_http_script_add_full_name_code(sc) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (742:13): [True: 0, False: 0]
  ------------------
  743|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  744|      0|        }
  745|      0|    }
  746|       |
  747|     16|    if (sc->complete_lengths) {
  ------------------
  |  Branch (747:9): [True: 3, False: 13]
  ------------------
  748|      3|        code = ngx_http_script_add_code(*sc->lengths, sizeof(uintptr_t), NULL);
  749|      3|        if (code == NULL) {
  ------------------
  |  Branch (749:13): [True: 0, False: 3]
  ------------------
  750|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  751|      0|        }
  752|       |
  753|      3|        *code = (uintptr_t) NULL;
  754|      3|    }
  755|       |
  756|     16|    if (sc->complete_values) {
  ------------------
  |  Branch (756:9): [True: 3, False: 13]
  ------------------
  757|      3|        code = ngx_http_script_add_code(*sc->values, sizeof(uintptr_t),
  758|      3|                                        &sc->main);
  759|      3|        if (code == NULL) {
  ------------------
  |  Branch (759:13): [True: 0, False: 3]
  ------------------
  760|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  761|      0|        }
  762|       |
  763|      3|        *code = (uintptr_t) NULL;
  764|      3|    }
  765|       |
  766|     16|    return NGX_OK;
  ------------------
  |  |   38|     16|#define  NGX_OK          0
  ------------------
  767|     16|}
ngx_http_script.c:ngx_http_script_add_copy_code:
  811|      2|{
  812|      2|    u_char                       *p;
  813|      2|    size_t                        size, len, zero;
  814|      2|    ngx_http_script_copy_code_t  *code;
  815|       |
  816|      2|    zero = (sc->zero && last);
  ------------------
  |  Branch (816:13): [True: 0, False: 2]
  |  Branch (816:25): [True: 0, False: 0]
  ------------------
  817|      2|    len = value->len + zero;
  818|       |
  819|      2|    code = ngx_http_script_add_code(*sc->lengths,
  820|      2|                                    sizeof(ngx_http_script_copy_code_t), NULL);
  821|      2|    if (code == NULL) {
  ------------------
  |  Branch (821:9): [True: 0, False: 2]
  ------------------
  822|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  823|      0|    }
  824|       |
  825|      2|    code->code = (ngx_http_script_code_pt) (void *)
  826|      2|                                                 ngx_http_script_copy_len_code;
  827|      2|    code->len = len;
  828|       |
  829|      2|    size = (sizeof(ngx_http_script_copy_code_t) + len + sizeof(uintptr_t) - 1)
  830|      2|            & ~(sizeof(uintptr_t) - 1);
  831|       |
  832|      2|    code = ngx_http_script_add_code(*sc->values, size, &sc->main);
  833|      2|    if (code == NULL) {
  ------------------
  |  Branch (833:9): [True: 0, False: 2]
  ------------------
  834|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  835|      0|    }
  836|       |
  837|      2|    code->code = ngx_http_script_copy_code;
  838|      2|    code->len = len;
  839|       |
  840|      2|    p = ngx_cpymem((u_char *) code + sizeof(ngx_http_script_copy_code_t),
  ------------------
  |  |  107|      2|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  841|      2|                   value->data, value->len);
  842|       |
  843|      2|    if (zero) {
  ------------------
  |  Branch (843:9): [True: 0, False: 2]
  ------------------
  844|      0|        *p = '\0';
  845|      0|        sc->zero = 0;
  846|      0|    }
  847|       |
  848|      2|    return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  849|      2|}
ngx_http_script.c:ngx_http_script_add_var_code:
  890|     15|{
  891|     15|    ngx_int_t                    index, *p;
  892|     15|    ngx_http_script_var_code_t  *code;
  893|       |
  894|     15|    index = ngx_http_get_variable_index(sc->cf, name);
  895|       |
  896|     15|    if (index == NGX_ERROR) {
  ------------------
  |  |   39|     15|#define  NGX_ERROR      -1
  ------------------
  |  Branch (896:9): [True: 0, False: 15]
  ------------------
  897|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  898|      0|    }
  899|       |
  900|     15|    if (sc->flushes) {
  ------------------
  |  Branch (900:9): [True: 14, False: 1]
  ------------------
  901|     14|        p = ngx_array_push(*sc->flushes);
  902|     14|        if (p == NULL) {
  ------------------
  |  Branch (902:13): [True: 0, False: 14]
  ------------------
  903|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  904|      0|        }
  905|       |
  906|     14|        *p = index;
  907|     14|    }
  908|       |
  909|     15|    code = ngx_http_script_add_code(*sc->lengths,
  910|     15|                                    sizeof(ngx_http_script_var_code_t), NULL);
  911|     15|    if (code == NULL) {
  ------------------
  |  Branch (911:9): [True: 0, False: 15]
  ------------------
  912|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  913|      0|    }
  914|       |
  915|     15|    code->code = (ngx_http_script_code_pt) (void *)
  916|     15|                                             ngx_http_script_copy_var_len_code;
  917|     15|    code->index = (uintptr_t) index;
  918|       |
  919|     15|    code = ngx_http_script_add_code(*sc->values,
  920|     15|                                    sizeof(ngx_http_script_var_code_t),
  921|     15|                                    &sc->main);
  922|     15|    if (code == NULL) {
  ------------------
  |  Branch (922:9): [True: 0, False: 15]
  ------------------
  923|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  924|      0|    }
  925|       |
  926|     15|    code->code = ngx_http_script_copy_var_code;
  927|     15|    code->index = (uintptr_t) index;
  928|       |
  929|     15|    return NGX_OK;
  ------------------
  |  |   38|     15|#define  NGX_OK          0
  ------------------
  930|     15|}

ngx_http_special_response_handler:
  417|      2|{
  418|      2|    ngx_uint_t                 i, err;
  419|      2|    ngx_http_err_page_t       *err_page;
  420|      2|    ngx_http_core_loc_conf_t  *clcf;
  421|       |
  422|      2|    ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  423|      2|                   "http special response: %i, \"%V?%V\"",
  424|      2|                   error, &r->uri, &r->args);
  425|       |
  426|      2|    r->err_status = error;
  427|       |
  428|      2|    if (r->keepalive) {
  ------------------
  |  Branch (428:9): [True: 0, False: 2]
  ------------------
  429|      0|        switch (error) {
  ------------------
  |  Branch (429:17): [True: 0, False: 0]
  ------------------
  430|      0|            case NGX_HTTP_BAD_REQUEST:
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
  |  Branch (430:13): [True: 0, False: 0]
  ------------------
  431|      0|            case NGX_HTTP_REQUEST_ENTITY_TOO_LARGE:
  ------------------
  |  |  101|      0|#define NGX_HTTP_REQUEST_ENTITY_TOO_LARGE  413
  ------------------
  |  Branch (431:13): [True: 0, False: 0]
  ------------------
  432|      0|            case NGX_HTTP_REQUEST_URI_TOO_LARGE:
  ------------------
  |  |  102|      0|#define NGX_HTTP_REQUEST_URI_TOO_LARGE     414
  ------------------
  |  Branch (432:13): [True: 0, False: 0]
  ------------------
  433|      0|            case NGX_HTTP_TO_HTTPS:
  ------------------
  |  |  125|      0|#define NGX_HTTP_TO_HTTPS                  497
  ------------------
  |  Branch (433:13): [True: 0, False: 0]
  ------------------
  434|      0|            case NGX_HTTPS_CERT_ERROR:
  ------------------
  |  |  118|      0|#define NGX_HTTPS_CERT_ERROR               495
  ------------------
  |  Branch (434:13): [True: 0, False: 0]
  ------------------
  435|      0|            case NGX_HTTPS_NO_CERT:
  ------------------
  |  |  119|      0|#define NGX_HTTPS_NO_CERT                  496
  ------------------
  |  Branch (435:13): [True: 0, False: 0]
  ------------------
  436|      0|            case NGX_HTTP_INTERNAL_SERVER_ERROR:
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  |  Branch (436:13): [True: 0, False: 0]
  ------------------
  437|      0|            case NGX_HTTP_NOT_IMPLEMENTED:
  ------------------
  |  |  139|      0|#define NGX_HTTP_NOT_IMPLEMENTED           501
  ------------------
  |  Branch (437:13): [True: 0, False: 0]
  ------------------
  438|      0|                r->keepalive = 0;
  439|      0|        }
  440|      0|    }
  441|       |
  442|      2|    if (r->lingering_close) {
  ------------------
  |  Branch (442:9): [True: 0, False: 2]
  ------------------
  443|      0|        switch (error) {
  ------------------
  |  Branch (443:17): [True: 0, False: 0]
  ------------------
  444|      0|            case NGX_HTTP_BAD_REQUEST:
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
  |  Branch (444:13): [True: 0, False: 0]
  ------------------
  445|      0|            case NGX_HTTP_TO_HTTPS:
  ------------------
  |  |  125|      0|#define NGX_HTTP_TO_HTTPS                  497
  ------------------
  |  Branch (445:13): [True: 0, False: 0]
  ------------------
  446|      0|            case NGX_HTTPS_CERT_ERROR:
  ------------------
  |  |  118|      0|#define NGX_HTTPS_CERT_ERROR               495
  ------------------
  |  Branch (446:13): [True: 0, False: 0]
  ------------------
  447|      0|            case NGX_HTTPS_NO_CERT:
  ------------------
  |  |  119|      0|#define NGX_HTTPS_NO_CERT                  496
  ------------------
  |  Branch (447:13): [True: 0, False: 0]
  ------------------
  448|      0|                r->lingering_close = 0;
  449|      0|        }
  450|      0|    }
  451|       |
  452|      2|    r->headers_out.content_type.len = 0;
  453|       |
  454|      2|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      2|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  455|       |
  456|      2|    if (!r->error_page && clcf->error_pages && r->uri_changes != 0) {
  ------------------
  |  Branch (456:9): [True: 2, False: 0]
  |  Branch (456:27): [True: 0, False: 2]
  |  Branch (456:48): [True: 0, False: 0]
  ------------------
  457|       |
  458|      0|        if (clcf->recursive_error_pages == 0) {
  ------------------
  |  Branch (458:13): [True: 0, False: 0]
  ------------------
  459|      0|            r->error_page = 1;
  460|      0|        }
  461|       |
  462|      0|        err_page = clcf->error_pages->elts;
  463|       |
  464|      0|        for (i = 0; i < clcf->error_pages->nelts; i++) {
  ------------------
  |  Branch (464:21): [True: 0, False: 0]
  ------------------
  465|      0|            if (err_page[i].status == error) {
  ------------------
  |  Branch (465:17): [True: 0, False: 0]
  ------------------
  466|      0|                return ngx_http_send_error_page(r, &err_page[i]);
  467|      0|            }
  468|      0|        }
  469|      0|    }
  470|       |
  471|      2|    r->expect_tested = 1;
  472|       |
  473|      2|    if (ngx_http_discard_request_body(r) != NGX_OK) {
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  |  Branch (473:9): [True: 0, False: 2]
  ------------------
  474|      0|        r->keepalive = 0;
  475|      0|    }
  476|       |
  477|      2|    if (clcf->msie_refresh
  ------------------
  |  Branch (477:9): [True: 0, False: 2]
  ------------------
  478|      2|        && r->headers_in.msie
  ------------------
  |  Branch (478:12): [True: 0, False: 0]
  ------------------
  479|      2|        && (error == NGX_HTTP_MOVED_PERMANENTLY
  ------------------
  |  |   85|      0|#define NGX_HTTP_MOVED_PERMANENTLY         301
  ------------------
  |  Branch (479:13): [True: 0, False: 0]
  ------------------
  480|      0|            || error == NGX_HTTP_MOVED_TEMPORARILY))
  ------------------
  |  |   86|      0|#define NGX_HTTP_MOVED_TEMPORARILY         302
  ------------------
  |  Branch (480:16): [True: 0, False: 0]
  ------------------
  481|      0|    {
  482|      0|        return ngx_http_send_refresh(r);
  483|      0|    }
  484|       |
  485|      2|    if (error == NGX_HTTP_CREATED) {
  ------------------
  |  |   79|      2|#define NGX_HTTP_CREATED                   201
  ------------------
  |  Branch (485:9): [True: 0, False: 2]
  ------------------
  486|       |        /* 201 */
  487|      0|        err = 0;
  488|       |
  489|      2|    } else if (error == NGX_HTTP_NO_CONTENT) {
  ------------------
  |  |   81|      2|#define NGX_HTTP_NO_CONTENT                204
  ------------------
  |  Branch (489:16): [True: 0, False: 2]
  ------------------
  490|       |        /* 204 */
  491|      0|        err = 0;
  492|       |
  493|      2|    } else if (error >= NGX_HTTP_MOVED_PERMANENTLY
  ------------------
  |  |   85|      4|#define NGX_HTTP_MOVED_PERMANENTLY         301
  ------------------
  |  Branch (493:16): [True: 2, False: 0]
  ------------------
  494|      2|               && error < NGX_HTTP_LAST_3XX)
  ------------------
  |  |  357|      2|#define NGX_HTTP_LAST_3XX  309
  ------------------
  |  Branch (494:19): [True: 0, False: 2]
  ------------------
  495|      0|    {
  496|       |        /* 3XX */
  497|      0|        err = error - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_OFF_3XX;
  ------------------
  |  |   85|      0|#define NGX_HTTP_MOVED_PERMANENTLY         301
  ------------------
                      err = error - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_OFF_3XX;
  ------------------
  |  |  345|      0|#define NGX_HTTP_OFF_3XX   (NGX_HTTP_LAST_2XX - 201)
  |  |  ------------------
  |  |  |  |  344|      0|#define NGX_HTTP_LAST_2XX  202
  |  |  ------------------
  ------------------
  498|       |
  499|      2|    } else if (error >= NGX_HTTP_BAD_REQUEST
  ------------------
  |  |   92|      4|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
  |  Branch (499:16): [True: 2, False: 0]
  ------------------
  500|      2|               && error < NGX_HTTP_LAST_4XX)
  ------------------
  |  |  391|      2|#define NGX_HTTP_LAST_4XX  430
  ------------------
  |  Branch (500:19): [True: 2, False: 0]
  ------------------
  501|      2|    {
  502|       |        /* 4XX */
  503|      2|        err = error - NGX_HTTP_BAD_REQUEST + NGX_HTTP_OFF_4XX;
  ------------------
  |  |   92|      2|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
                      err = error - NGX_HTTP_BAD_REQUEST + NGX_HTTP_OFF_4XX;
  ------------------
  |  |  358|      2|#define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  ------------------
  |  |  |  |  357|      2|#define NGX_HTTP_LAST_3XX  309
  |  |  ------------------
  |  |               #define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  ------------------
  |  |  |  |  345|      2|#define NGX_HTTP_OFF_3XX   (NGX_HTTP_LAST_2XX - 201)
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      2|#define NGX_HTTP_LAST_2XX  202
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  504|       |
  505|      2|    } else if (error >= NGX_HTTP_NGINX_CODES
  ------------------
  |  |  114|      0|#define NGX_HTTP_NGINX_CODES               494
  ------------------
  |  Branch (505:16): [True: 0, False: 0]
  ------------------
  506|      0|               && error < NGX_HTTP_LAST_5XX)
  ------------------
  |  |  410|      0|#define NGX_HTTP_LAST_5XX  508
  ------------------
  |  Branch (506:19): [True: 0, False: 0]
  ------------------
  507|      0|    {
  508|       |        /* 49X, 5XX */
  509|      0|        err = error - NGX_HTTP_NGINX_CODES + NGX_HTTP_OFF_5XX;
  ------------------
  |  |  114|      0|#define NGX_HTTP_NGINX_CODES               494
  ------------------
                      err = error - NGX_HTTP_NGINX_CODES + NGX_HTTP_OFF_5XX;
  ------------------
  |  |  392|      0|#define NGX_HTTP_OFF_5XX   (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
  |  |  ------------------
  |  |  |  |  391|      0|#define NGX_HTTP_LAST_4XX  430
  |  |  ------------------
  |  |               #define NGX_HTTP_OFF_5XX   (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
  |  |  ------------------
  |  |  |  |  358|      0|#define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  |  |  ------------------
  |  |  |  |  |  |  357|      0|#define NGX_HTTP_LAST_3XX  309
  |  |  |  |  ------------------
  |  |  |  |               #define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|#define NGX_HTTP_OFF_3XX   (NGX_HTTP_LAST_2XX - 201)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  344|      0|#define NGX_HTTP_LAST_2XX  202
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  510|      0|        switch (error) {
  ------------------
  |  Branch (510:17): [True: 0, False: 0]
  ------------------
  511|      0|            case NGX_HTTP_TO_HTTPS:
  ------------------
  |  |  125|      0|#define NGX_HTTP_TO_HTTPS                  497
  ------------------
  |  Branch (511:13): [True: 0, False: 0]
  ------------------
  512|      0|            case NGX_HTTPS_CERT_ERROR:
  ------------------
  |  |  118|      0|#define NGX_HTTPS_CERT_ERROR               495
  ------------------
  |  Branch (512:13): [True: 0, False: 0]
  ------------------
  513|      0|            case NGX_HTTPS_NO_CERT:
  ------------------
  |  |  119|      0|#define NGX_HTTPS_NO_CERT                  496
  ------------------
  |  Branch (513:13): [True: 0, False: 0]
  ------------------
  514|      0|            case NGX_HTTP_REQUEST_HEADER_TOO_LARGE:
  ------------------
  |  |  116|      0|#define NGX_HTTP_REQUEST_HEADER_TOO_LARGE  494
  ------------------
  |  Branch (514:13): [True: 0, False: 0]
  ------------------
  515|      0|                r->err_status = NGX_HTTP_BAD_REQUEST;
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
  516|      0|        }
  517|       |
  518|      0|    } else {
  519|       |        /* unknown code, zero body */
  520|      0|        err = 0;
  521|      0|    }
  522|       |
  523|      2|    return ngx_http_send_special_response(r, clcf, err);
  524|      2|}
ngx_http_special_response.c:ngx_http_send_special_response:
  675|      2|{
  676|      2|    u_char       *tail;
  677|      2|    size_t        len;
  678|      2|    ngx_int_t     rc;
  679|      2|    ngx_buf_t    *b;
  680|      2|    ngx_uint_t    msie_padding;
  681|      2|    ngx_chain_t   out[3];
  682|       |
  683|      2|    if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
  ------------------
  |  |   59|      2|#define NGX_HTTP_SERVER_TOKENS_ON       1
  ------------------
  |  Branch (683:9): [True: 0, False: 2]
  ------------------
  684|      0|        len = sizeof(ngx_http_error_full_tail) - 1;
  685|      0|        tail = ngx_http_error_full_tail;
  686|       |
  687|      2|    } else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) {
  ------------------
  |  |   60|      2|#define NGX_HTTP_SERVER_TOKENS_BUILD    2
  ------------------
  |  Branch (687:16): [True: 0, False: 2]
  ------------------
  688|      0|        len = sizeof(ngx_http_error_build_tail) - 1;
  689|      0|        tail = ngx_http_error_build_tail;
  690|       |
  691|      2|    } else {
  692|      2|        len = sizeof(ngx_http_error_tail) - 1;
  693|      2|        tail = ngx_http_error_tail;
  694|      2|    }
  695|       |
  696|      2|    msie_padding = 0;
  697|       |
  698|      2|    if (ngx_http_error_pages[err].len) {
  ------------------
  |  Branch (698:9): [True: 2, False: 0]
  ------------------
  699|      2|        r->headers_out.content_length_n = ngx_http_error_pages[err].len + len;
  700|      2|        if (clcf->msie_padding
  ------------------
  |  Branch (700:13): [True: 2, False: 0]
  ------------------
  701|      2|            && (r->headers_in.msie || r->headers_in.chrome)
  ------------------
  |  Branch (701:17): [True: 0, False: 2]
  |  Branch (701:39): [True: 0, False: 2]
  ------------------
  702|      2|            && r->http_version >= NGX_HTTP_VERSION_10
  ------------------
  |  |   24|      2|#define NGX_HTTP_VERSION_10                1000
  ------------------
  |  Branch (702:16): [True: 0, False: 0]
  ------------------
  703|      2|            && err >= NGX_HTTP_OFF_4XX)
  ------------------
  |  |  358|      0|#define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  ------------------
  |  |  |  |  357|      0|#define NGX_HTTP_LAST_3XX  309
  |  |  ------------------
  |  |               #define NGX_HTTP_OFF_4XX   (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
  |  |  ------------------
  |  |  |  |  345|      0|#define NGX_HTTP_OFF_3XX   (NGX_HTTP_LAST_2XX - 201)
  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|#define NGX_HTTP_LAST_2XX  202
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (703:16): [True: 0, False: 0]
  ------------------
  704|      0|        {
  705|      0|            r->headers_out.content_length_n +=
  706|      0|                                         sizeof(ngx_http_msie_padding) - 1;
  707|      0|            msie_padding = 1;
  708|      0|        }
  709|       |
  710|      2|        r->headers_out.content_type_len = sizeof("text/html") - 1;
  711|      2|        ngx_str_set(&r->headers_out.content_type, "text/html");
  ------------------
  |  |   43|      2|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
  712|      2|        r->headers_out.content_type_lowcase = NULL;
  713|       |
  714|      2|    } else {
  715|      0|        r->headers_out.content_length_n = 0;
  716|      0|    }
  717|       |
  718|      2|    if (r->headers_out.content_length) {
  ------------------
  |  Branch (718:9): [True: 0, False: 2]
  ------------------
  719|      0|        r->headers_out.content_length->hash = 0;
  720|      0|        r->headers_out.content_length = NULL;
  721|      0|    }
  722|       |
  723|      2|    ngx_http_clear_accept_ranges(r);
  ------------------
  |  |  563|      2|    r->allow_ranges = 0;                                                      \
  |  |  564|      2|    if (r->headers_out.accept_ranges) {                                       \
  |  |  ------------------
  |  |  |  Branch (564:9): [True: 0, False: 2]
  |  |  ------------------
  |  |  565|      0|        r->headers_out.accept_ranges->hash = 0;                               \
  |  |  566|      0|        r->headers_out.accept_ranges = NULL;                                  \
  |  |  567|      0|    }
  ------------------
  724|      2|    ngx_http_clear_last_modified(r);
  ------------------
  |  |  571|      2|    r->headers_out.last_modified_time = -1;                                   \
  |  |  572|      2|    if (r->headers_out.last_modified) {                                       \
  |  |  ------------------
  |  |  |  Branch (572:9): [True: 0, False: 2]
  |  |  ------------------
  |  |  573|      0|        r->headers_out.last_modified->hash = 0;                               \
  |  |  574|      0|        r->headers_out.last_modified = NULL;                                  \
  |  |  575|      0|    }
  ------------------
  725|      2|    ngx_http_clear_etag(r);
  ------------------
  |  |  586|      2|    if (r->headers_out.etag) {                                                \
  |  |  ------------------
  |  |  |  Branch (586:9): [True: 0, False: 2]
  |  |  ------------------
  |  |  587|      0|        r->headers_out.etag->hash = 0;                                        \
  |  |  588|      0|        r->headers_out.etag = NULL;                                           \
  |  |  589|      0|    }
  ------------------
  726|       |
  727|      2|    rc = ngx_http_send_header(r);
  728|       |
  729|      2|    if (rc == NGX_ERROR || r->header_only) {
  ------------------
  |  |   39|      4|#define  NGX_ERROR      -1
  ------------------
  |  Branch (729:9): [True: 0, False: 2]
  |  Branch (729:28): [True: 0, False: 2]
  ------------------
  730|      0|        return rc;
  731|      0|    }
  732|       |
  733|      2|    if (ngx_http_error_pages[err].len == 0) {
  ------------------
  |  Branch (733:9): [True: 0, False: 2]
  ------------------
  734|      0|        return ngx_http_send_special(r, NGX_HTTP_LAST);
  ------------------
  |  |  144|      0|#define NGX_HTTP_LAST   1
  ------------------
  735|      0|    }
  736|       |
  737|      2|    b = ngx_calloc_buf(r->pool);
  ------------------
  |  |  145|      2|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
  738|      2|    if (b == NULL) {
  ------------------
  |  Branch (738:9): [True: 0, False: 2]
  ------------------
  739|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  740|      0|    }
  741|       |
  742|      2|    b->memory = 1;
  743|      2|    b->pos = ngx_http_error_pages[err].data;
  744|      2|    b->last = ngx_http_error_pages[err].data + ngx_http_error_pages[err].len;
  745|       |
  746|      2|    out[0].buf = b;
  747|      2|    out[0].next = &out[1];
  748|       |
  749|      2|    b = ngx_calloc_buf(r->pool);
  ------------------
  |  |  145|      2|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
  750|      2|    if (b == NULL) {
  ------------------
  |  Branch (750:9): [True: 0, False: 2]
  ------------------
  751|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  752|      0|    }
  753|       |
  754|      2|    b->memory = 1;
  755|       |
  756|      2|    b->pos = tail;
  757|      2|    b->last = tail + len;
  758|       |
  759|      2|    out[1].buf = b;
  760|      2|    out[1].next = NULL;
  761|       |
  762|      2|    if (msie_padding) {
  ------------------
  |  Branch (762:9): [True: 0, False: 2]
  ------------------
  763|      0|        b = ngx_calloc_buf(r->pool);
  ------------------
  |  |  145|      0|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
  764|      0|        if (b == NULL) {
  ------------------
  |  Branch (764:13): [True: 0, False: 0]
  ------------------
  765|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  766|      0|        }
  767|       |
  768|      0|        b->memory = 1;
  769|      0|        b->pos = ngx_http_msie_padding;
  770|      0|        b->last = ngx_http_msie_padding + sizeof(ngx_http_msie_padding) - 1;
  771|       |
  772|      0|        out[1].next = &out[2];
  773|      0|        out[2].buf = b;
  774|      0|        out[2].next = NULL;
  775|      0|    }
  776|       |
  777|      2|    if (r == r->main) {
  ------------------
  |  Branch (777:9): [True: 2, False: 0]
  ------------------
  778|      2|        b->last_buf = 1;
  779|      2|    }
  780|       |
  781|      2|    b->last_in_chain = 1;
  782|       |
  783|      2|    return ngx_http_output_filter(r, &out[0]);
  784|      2|}

ngx_http_upstream_create:
  476|     11|{
  477|     11|    ngx_http_upstream_t  *u;
  478|       |
  479|     11|    u = r->upstream;
  480|       |
  481|     11|    if (u && u->cleanup) {
  ------------------
  |  Branch (481:9): [True: 0, False: 11]
  |  Branch (481:14): [True: 0, False: 0]
  ------------------
  482|      0|        r->main->count++;
  483|      0|        ngx_http_upstream_cleanup(r);
  484|      0|    }
  485|       |
  486|     11|    u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t));
  487|     11|    if (u == NULL) {
  ------------------
  |  Branch (487:9): [True: 0, False: 11]
  ------------------
  488|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  489|      0|    }
  490|       |
  491|     11|    r->upstream = u;
  492|       |
  493|     11|    u->peer.log = r->connection->log;
  494|     11|    u->peer.log_error = NGX_ERROR_ERR;
  495|       |
  496|     11|#if (NGX_HTTP_CACHE)
  497|     11|    r->cache = NULL;
  498|     11|#endif
  499|       |
  500|     11|    u->headers_in.content_length_n = -1;
  501|     11|    u->headers_in.last_modified_time = -1;
  502|       |
  503|     11|    return NGX_OK;
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
  504|     11|}
ngx_http_upstream_init:
  509|      5|{
  510|      5|    ngx_connection_t     *c;
  511|       |
  512|      5|    c = r->connection;
  513|       |
  514|      5|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
  515|      5|                   "http init upstream, client timer: %d", c->read->timer_set);
  516|       |
  517|      5|#if (NGX_HTTP_V2)
  518|      5|    if (r->stream) {
  ------------------
  |  Branch (518:9): [True: 0, False: 5]
  ------------------
  519|      0|        ngx_http_upstream_init_request(r);
  520|      0|        return;
  521|      0|    }
  522|      5|#endif
  523|       |
  524|       |#if (NGX_HTTP_V3)
  525|       |    if (c->quic) {
  526|       |        ngx_http_upstream_init_request(r);
  527|       |        return;
  528|       |    }
  529|       |#endif
  530|       |
  531|      5|    if (c->read->timer_set) {
  ------------------
  |  Branch (531:9): [True: 0, False: 5]
  ------------------
  532|      0|        ngx_del_timer(c->read);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
  533|      0|    }
  534|       |
  535|      5|    if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
  ------------------
  |  |  208|      5|#define NGX_USE_CLEAR_EVENT      0x00000004
  ------------------
  |  Branch (535:9): [True: 0, False: 5]
  ------------------
  536|       |
  537|      0|        if (!c->write->active) {
  ------------------
  |  Branch (537:13): [True: 0, False: 0]
  ------------------
  538|      0|            if (ngx_add_event(c->write, NGX_WRITE_EVENT, NGX_CLEAR_EVENT)
  ------------------
  |  |  403|      0|#define ngx_add_event        ngx_event_actions.add
  ------------------
                          if (ngx_add_event(c->write, NGX_WRITE_EVENT, NGX_CLEAR_EVENT)
  ------------------
  |  |  350|      0|#define NGX_WRITE_EVENT    EPOLLOUT
  ------------------
                          if (ngx_add_event(c->write, NGX_WRITE_EVENT, NGX_CLEAR_EVENT)
  ------------------
  |  |  353|      0|#define NGX_CLEAR_EVENT    EPOLLET
  ------------------
  |  Branch (538:17): [True: 0, False: 0]
  ------------------
  539|      0|                == NGX_ERROR)
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  540|      0|            {
  541|      0|                ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  542|      0|                return;
  543|      0|            }
  544|      0|        }
  545|      0|    }
  546|       |
  547|      5|    ngx_http_upstream_init_request(r);
  548|      5|}
ngx_http_upstream_add:
 6306|      1|{
 6307|      1|    ngx_uint_t                      i;
 6308|      1|    ngx_http_upstream_server_t     *us;
 6309|      1|    ngx_http_upstream_srv_conf_t   *uscf, **uscfp;
 6310|      1|    ngx_http_upstream_main_conf_t  *umcf;
 6311|       |
 6312|      1|    if (!(flags & NGX_HTTP_UPSTREAM_CREATE)) {
  ------------------
  |  |  112|      1|#define NGX_HTTP_UPSTREAM_CREATE        0x0001
  ------------------
  |  Branch (6312:9): [True: 0, False: 1]
  ------------------
 6313|       |
 6314|      0|        if (ngx_parse_url(cf->pool, u) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (6314:13): [True: 0, False: 0]
  ------------------
 6315|      0|            if (u->err) {
  ------------------
  |  Branch (6315:17): [True: 0, False: 0]
  ------------------
 6316|      0|                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 6317|      0|                                   "%s in upstream \"%V\"", u->err, &u->url);
 6318|      0|            }
 6319|       |
 6320|      0|            return NULL;
 6321|      0|        }
 6322|      0|    }
 6323|       |
 6324|      1|    umcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_upstream_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 6325|       |
 6326|      1|    uscfp = umcf->upstreams.elts;
 6327|       |
 6328|      1|    for (i = 0; i < umcf->upstreams.nelts; i++) {
  ------------------
  |  Branch (6328:17): [True: 0, False: 1]
  ------------------
 6329|       |
 6330|      0|        if (uscfp[i]->host.len != u->host.len
  ------------------
  |  Branch (6330:13): [True: 0, False: 0]
  ------------------
 6331|      0|            || ngx_strncasecmp(uscfp[i]->host.data, u->host.data, u->host.len)
  ------------------
  |  Branch (6331:16): [True: 0, False: 0]
  ------------------
 6332|      0|               != 0)
 6333|      0|        {
 6334|      0|            continue;
 6335|      0|        }
 6336|       |
 6337|      0|        if ((flags & NGX_HTTP_UPSTREAM_CREATE)
  ------------------
  |  |  112|      0|#define NGX_HTTP_UPSTREAM_CREATE        0x0001
  ------------------
  |  Branch (6337:13): [True: 0, False: 0]
  ------------------
 6338|      0|             && (uscfp[i]->flags & NGX_HTTP_UPSTREAM_CREATE))
  ------------------
  |  |  112|      0|#define NGX_HTTP_UPSTREAM_CREATE        0x0001
  ------------------
  |  Branch (6338:17): [True: 0, False: 0]
  ------------------
 6339|      0|        {
 6340|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 6341|      0|                               "duplicate upstream \"%V\"", &u->host);
 6342|      0|            return NULL;
 6343|      0|        }
 6344|       |
 6345|      0|        if ((uscfp[i]->flags & NGX_HTTP_UPSTREAM_CREATE) && !u->no_port) {
  ------------------
  |  |  112|      0|#define NGX_HTTP_UPSTREAM_CREATE        0x0001
  ------------------
  |  Branch (6345:13): [True: 0, False: 0]
  |  Branch (6345:61): [True: 0, False: 0]
  ------------------
 6346|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 6347|      0|                               "upstream \"%V\" may not have port %d",
 6348|      0|                               &u->host, u->port);
 6349|      0|            return NULL;
 6350|      0|        }
 6351|       |
 6352|      0|        if ((flags & NGX_HTTP_UPSTREAM_CREATE) && !uscfp[i]->no_port) {
  ------------------
  |  |  112|      0|#define NGX_HTTP_UPSTREAM_CREATE        0x0001
  ------------------
  |  Branch (6352:13): [True: 0, False: 0]
  |  Branch (6352:51): [True: 0, False: 0]
  ------------------
 6353|      0|            ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6354|      0|                          "upstream \"%V\" may not have port %d in %s:%ui",
 6355|      0|                          &u->host, uscfp[i]->port,
 6356|      0|                          uscfp[i]->file_name, uscfp[i]->line);
 6357|      0|            return NULL;
 6358|      0|        }
 6359|       |
 6360|      0|        if (uscfp[i]->port && u->port
  ------------------
  |  Branch (6360:13): [True: 0, False: 0]
  |  Branch (6360:31): [True: 0, False: 0]
  ------------------
 6361|      0|            && uscfp[i]->port != u->port)
  ------------------
  |  Branch (6361:16): [True: 0, False: 0]
  ------------------
 6362|      0|        {
 6363|      0|            continue;
 6364|      0|        }
 6365|       |
 6366|      0|        if (flags & NGX_HTTP_UPSTREAM_CREATE) {
  ------------------
  |  |  112|      0|#define NGX_HTTP_UPSTREAM_CREATE        0x0001
  ------------------
  |  Branch (6366:13): [True: 0, False: 0]
  ------------------
 6367|      0|            uscfp[i]->flags = flags;
 6368|      0|            uscfp[i]->port = 0;
 6369|      0|        }
 6370|       |
 6371|      0|        return uscfp[i];
 6372|      0|    }
 6373|       |
 6374|      1|    uscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_srv_conf_t));
 6375|      1|    if (uscf == NULL) {
  ------------------
  |  Branch (6375:9): [True: 0, False: 1]
  ------------------
 6376|      0|        return NULL;
 6377|      0|    }
 6378|       |
 6379|      1|    uscf->flags = flags;
 6380|      1|    uscf->host = u->host;
 6381|      1|    uscf->file_name = cf->conf_file->file.name.data;
 6382|      1|    uscf->line = cf->conf_file->line;
 6383|      1|    uscf->port = u->port;
 6384|      1|    uscf->no_port = u->no_port;
 6385|       |
 6386|      1|    if (u->naddrs == 1 && (u->port || u->family == AF_UNIX)) {
  ------------------
  |  Branch (6386:9): [True: 0, False: 1]
  |  Branch (6386:28): [True: 0, False: 0]
  |  Branch (6386:39): [True: 0, False: 0]
  ------------------
 6387|      0|        uscf->servers = ngx_array_create(cf->pool, 1,
 6388|      0|                                         sizeof(ngx_http_upstream_server_t));
 6389|      0|        if (uscf->servers == NULL) {
  ------------------
  |  Branch (6389:13): [True: 0, False: 0]
  ------------------
 6390|      0|            return NULL;
 6391|      0|        }
 6392|       |
 6393|      0|        us = ngx_array_push(uscf->servers);
 6394|      0|        if (us == NULL) {
  ------------------
  |  Branch (6394:13): [True: 0, False: 0]
  ------------------
 6395|      0|            return NULL;
 6396|      0|        }
 6397|       |
 6398|      0|        ngx_memzero(us, sizeof(ngx_http_upstream_server_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 6399|       |
 6400|      0|        us->addrs = u->addrs;
 6401|      0|        us->naddrs = 1;
 6402|      0|    }
 6403|       |
 6404|      1|    uscfp = ngx_array_push(&umcf->upstreams);
 6405|      1|    if (uscfp == NULL) {
  ------------------
  |  Branch (6405:9): [True: 0, False: 1]
  ------------------
 6406|      0|        return NULL;
 6407|      0|    }
 6408|       |
 6409|      1|    *uscfp = uscf;
 6410|       |
 6411|      1|    return uscf;
 6412|      1|}
ngx_http_upstream_hide_headers_hash:
 6616|     10|{
 6617|     10|    ngx_str_t       *h;
 6618|     10|    ngx_uint_t       i, j;
 6619|     10|    ngx_array_t      hide_headers;
 6620|     10|    ngx_hash_key_t  *hk;
 6621|       |
 6622|     10|    if (conf->hide_headers == NGX_CONF_UNSET_PTR
  ------------------
  |  |   58|     20|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  |  Branch (6622:9): [True: 10, False: 0]
  ------------------
 6623|     10|        && conf->pass_headers == NGX_CONF_UNSET_PTR)
  ------------------
  |  |   58|     10|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  |  Branch (6623:12): [True: 10, False: 0]
  ------------------
 6624|     10|    {
 6625|     10|        conf->hide_headers = prev->hide_headers;
 6626|     10|        conf->pass_headers = prev->pass_headers;
 6627|       |
 6628|     10|        conf->hide_headers_hash = prev->hide_headers_hash;
 6629|       |
 6630|     10|        if (conf->hide_headers_hash.buckets) {
  ------------------
  |  Branch (6630:13): [True: 5, False: 5]
  ------------------
 6631|      5|            return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 6632|      5|        }
 6633|       |
 6634|     10|    } else {
 6635|      0|        if (conf->hide_headers == NGX_CONF_UNSET_PTR) {
  ------------------
  |  |   58|      0|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  |  Branch (6635:13): [True: 0, False: 0]
  ------------------
 6636|      0|            conf->hide_headers = prev->hide_headers;
 6637|      0|        }
 6638|       |
 6639|      0|        if (conf->pass_headers == NGX_CONF_UNSET_PTR) {
  ------------------
  |  |   58|      0|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  |  Branch (6639:13): [True: 0, False: 0]
  ------------------
 6640|      0|            conf->pass_headers = prev->pass_headers;
 6641|      0|        }
 6642|      0|    }
 6643|       |
 6644|      5|    if (ngx_array_init(&hide_headers, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
  ------------------
  |  Branch (6644:9): [True: 0, False: 5]
  ------------------
 6645|      5|        != NGX_OK)
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 6646|      0|    {
 6647|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 6648|      0|    }
 6649|       |
 6650|     37|    for (h = default_hide_headers; h->len; h++) {
  ------------------
  |  Branch (6650:36): [True: 32, False: 5]
  ------------------
 6651|     32|        hk = ngx_array_push(&hide_headers);
 6652|     32|        if (hk == NULL) {
  ------------------
  |  Branch (6652:13): [True: 0, False: 32]
  ------------------
 6653|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 6654|      0|        }
 6655|       |
 6656|     32|        hk->key = *h;
 6657|     32|        hk->key_hash = ngx_hash_key_lc(h->data, h->len);
 6658|     32|        hk->value = (void *) 1;
 6659|     32|    }
 6660|       |
 6661|      5|    if (conf->hide_headers != NGX_CONF_UNSET_PTR) {
  ------------------
  |  |   58|      5|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  |  Branch (6661:9): [True: 0, False: 5]
  ------------------
 6662|       |
 6663|      0|        h = conf->hide_headers->elts;
 6664|       |
 6665|      0|        for (i = 0; i < conf->hide_headers->nelts; i++) {
  ------------------
  |  Branch (6665:21): [True: 0, False: 0]
  ------------------
 6666|       |
 6667|      0|            hk = hide_headers.elts;
 6668|       |
 6669|      0|            for (j = 0; j < hide_headers.nelts; j++) {
  ------------------
  |  Branch (6669:25): [True: 0, False: 0]
  ------------------
 6670|      0|                if (ngx_strcasecmp(h[i].data, hk[j].key.data) == 0) {
  ------------------
  |  Branch (6670:21): [True: 0, False: 0]
  ------------------
 6671|      0|                    goto exist;
 6672|      0|                }
 6673|      0|            }
 6674|       |
 6675|      0|            hk = ngx_array_push(&hide_headers);
 6676|      0|            if (hk == NULL) {
  ------------------
  |  Branch (6676:17): [True: 0, False: 0]
  ------------------
 6677|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 6678|      0|            }
 6679|       |
 6680|      0|            hk->key = h[i];
 6681|      0|            hk->key_hash = ngx_hash_key_lc(h[i].data, h[i].len);
 6682|      0|            hk->value = (void *) 1;
 6683|       |
 6684|      0|        exist:
 6685|       |
 6686|      0|            continue;
 6687|      0|        }
 6688|      0|    }
 6689|       |
 6690|      5|    if (conf->pass_headers != NGX_CONF_UNSET_PTR) {
  ------------------
  |  |   58|      5|#define NGX_CONF_UNSET_PTR   (void *) -1
  ------------------
  |  Branch (6690:9): [True: 0, False: 5]
  ------------------
 6691|       |
 6692|      0|        h = conf->pass_headers->elts;
 6693|      0|        hk = hide_headers.elts;
 6694|       |
 6695|      0|        for (i = 0; i < conf->pass_headers->nelts; i++) {
  ------------------
  |  Branch (6695:21): [True: 0, False: 0]
  ------------------
 6696|      0|            for (j = 0; j < hide_headers.nelts; j++) {
  ------------------
  |  Branch (6696:25): [True: 0, False: 0]
  ------------------
 6697|       |
 6698|      0|                if (hk[j].key.data == NULL) {
  ------------------
  |  Branch (6698:21): [True: 0, False: 0]
  ------------------
 6699|      0|                    continue;
 6700|      0|                }
 6701|       |
 6702|      0|                if (ngx_strcasecmp(h[i].data, hk[j].key.data) == 0) {
  ------------------
  |  Branch (6702:21): [True: 0, False: 0]
  ------------------
 6703|      0|                    hk[j].key.data = NULL;
 6704|      0|                    break;
 6705|      0|                }
 6706|      0|            }
 6707|      0|        }
 6708|      0|    }
 6709|       |
 6710|      5|    hash->hash = &conf->hide_headers_hash;
 6711|      5|    hash->key = ngx_hash_key_lc;
 6712|      5|    hash->pool = cf->pool;
 6713|      5|    hash->temp_pool = NULL;
 6714|       |
 6715|      5|    if (ngx_hash_init(hash, hide_headers.elts, hide_headers.nelts) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (6715:9): [True: 0, False: 5]
  ------------------
 6716|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 6717|      0|    }
 6718|       |
 6719|       |    /*
 6720|       |     * special handling to preserve conf->hide_headers_hash
 6721|       |     * in the "http" section to inherit it to all servers
 6722|       |     */
 6723|       |
 6724|      5|    if (prev->hide_headers_hash.buckets == NULL
  ------------------
  |  Branch (6724:9): [True: 5, False: 0]
  ------------------
 6725|      5|        && conf->hide_headers == prev->hide_headers
  ------------------
  |  Branch (6725:12): [True: 5, False: 0]
  ------------------
 6726|      5|        && conf->pass_headers == prev->pass_headers)
  ------------------
  |  Branch (6726:12): [True: 5, False: 0]
  ------------------
 6727|      5|    {
 6728|      5|        prev->hide_headers_hash = conf->hide_headers_hash;
 6729|      5|    }
 6730|       |
 6731|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 6732|      5|}
ngx_http_upstream.c:ngx_http_upstream_add_variables:
 5587|      1|{
 5588|      1|    ngx_http_variable_t  *var, *v;
 5589|       |
 5590|     15|    for (v = ngx_http_upstream_vars; v->name.len; v++) {
  ------------------
  |  Branch (5590:38): [True: 14, False: 1]
  ------------------
 5591|     14|        var = ngx_http_add_variable(cf, &v->name, v->flags);
 5592|     14|        if (var == NULL) {
  ------------------
  |  Branch (5592:13): [True: 0, False: 14]
  ------------------
 5593|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 5594|      0|        }
 5595|       |
 5596|     14|        var->get_handler = v->get_handler;
 5597|     14|        var->data = v->data;
 5598|     14|    }
 5599|       |
 5600|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 5601|      1|}
ngx_http_upstream.c:ngx_http_upstream_create_main_conf:
 6737|      1|{
 6738|      1|    ngx_http_upstream_main_conf_t  *umcf;
 6739|       |
 6740|      1|    umcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_main_conf_t));
 6741|      1|    if (umcf == NULL) {
  ------------------
  |  Branch (6741:9): [True: 0, False: 1]
  ------------------
 6742|      0|        return NULL;
 6743|      0|    }
 6744|       |
 6745|      1|    if (ngx_array_init(&umcf->upstreams, cf->pool, 4,
  ------------------
  |  Branch (6745:9): [True: 0, False: 1]
  ------------------
 6746|      1|                       sizeof(ngx_http_upstream_srv_conf_t *))
 6747|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 6748|      0|    {
 6749|      0|        return NULL;
 6750|      0|    }
 6751|       |
 6752|      1|    return umcf;
 6753|      1|}
ngx_http_upstream.c:ngx_http_upstream_init_main_conf:
 6758|      1|{
 6759|      1|    ngx_http_upstream_main_conf_t  *umcf = conf;
 6760|       |
 6761|      1|    ngx_uint_t                      i;
 6762|      1|    ngx_array_t                     headers_in;
 6763|      1|    ngx_hash_key_t                 *hk;
 6764|      1|    ngx_hash_init_t                 hash;
 6765|      1|    ngx_http_upstream_init_pt       init;
 6766|      1|    ngx_http_upstream_header_t     *header;
 6767|      1|    ngx_http_upstream_srv_conf_t  **uscfp;
 6768|       |
 6769|      1|    uscfp = umcf->upstreams.elts;
 6770|       |
 6771|      2|    for (i = 0; i < umcf->upstreams.nelts; i++) {
  ------------------
  |  Branch (6771:17): [True: 1, False: 1]
  ------------------
 6772|       |
 6773|      1|        init = uscfp[i]->peer.init_upstream ? uscfp[i]->peer.init_upstream:
  ------------------
  |  Branch (6773:16): [True: 0, False: 1]
  ------------------
 6774|      1|                                            ngx_http_upstream_init_round_robin;
 6775|       |
 6776|      1|        if (init(cf, uscfp[i]) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (6776:13): [True: 0, False: 1]
  ------------------
 6777|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6778|      0|        }
 6779|      1|    }
 6780|       |
 6781|       |
 6782|       |    /* upstream_headers_in_hash */
 6783|       |
 6784|      1|    if (ngx_array_init(&headers_in, cf->temp_pool, 32, sizeof(ngx_hash_key_t))
  ------------------
  |  Branch (6784:9): [True: 0, False: 1]
  ------------------
 6785|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 6786|      0|    {
 6787|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6788|      0|    }
 6789|       |
 6790|     28|    for (header = ngx_http_upstream_headers_in; header->name.len; header++) {
  ------------------
  |  Branch (6790:49): [True: 27, False: 1]
  ------------------
 6791|     27|        hk = ngx_array_push(&headers_in);
 6792|     27|        if (hk == NULL) {
  ------------------
  |  Branch (6792:13): [True: 0, False: 27]
  ------------------
 6793|      0|            return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6794|      0|        }
 6795|       |
 6796|     27|        hk->key = header->name;
 6797|     27|        hk->key_hash = ngx_hash_key_lc(header->name.data, header->name.len);
 6798|     27|        hk->value = header;
 6799|     27|    }
 6800|       |
 6801|      1|    hash.hash = &umcf->headers_in_hash;
 6802|      1|    hash.key = ngx_hash_key_lc;
 6803|      1|    hash.max_size = 512;
 6804|      1|    hash.bucket_size = ngx_align(64, ngx_cacheline_size);
  ------------------
  |  |  100|      1|#define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  ------------------
 6805|      1|    hash.name = "upstream_headers_in_hash";
 6806|      1|    hash.pool = cf->pool;
 6807|      1|    hash.temp_pool = NULL;
 6808|       |
 6809|      1|    if (ngx_hash_init(&hash, headers_in.elts, headers_in.nelts) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (6809:9): [True: 0, False: 1]
  ------------------
 6810|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6811|      0|    }
 6812|       |
 6813|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
 6814|      1|}
ngx_http_upstream.c:ngx_http_upstream_copy_header_line:
 5300|      7|{
 5301|      7|    ngx_table_elt_t  *ho, **ph;
 5302|       |
 5303|      7|    ho = ngx_list_push(&r->headers_out.headers);
 5304|      7|    if (ho == NULL) {
  ------------------
  |  Branch (5304:9): [True: 0, False: 7]
  ------------------
 5305|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 5306|      0|    }
 5307|       |
 5308|      7|    *ho = *h;
 5309|       |
 5310|      7|    if (offset) {
  ------------------
  |  Branch (5310:9): [True: 0, False: 7]
  ------------------
 5311|      0|        ph = (ngx_table_elt_t **) ((char *) &r->headers_out + offset);
 5312|      0|        *ph = ho;
 5313|      0|        ho->next = NULL;
 5314|      0|    }
 5315|       |
 5316|      7|    return NGX_OK;
  ------------------
  |  |   38|      7|#define  NGX_OK          0
  ------------------
 5317|      7|}
ngx_http_upstream.c:ngx_http_upstream_ignore_header_line:
 4698|      4|{
 4699|      4|    return NGX_OK;
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
 4700|      4|}
ngx_http_upstream.c:ngx_http_upstream_process_last_modified:
 4746|      2|{
 4747|      2|    ngx_http_upstream_t  *u;
 4748|       |
 4749|      2|    u = r->upstream;
 4750|       |
 4751|      2|    if (u->headers_in.last_modified) {
  ------------------
  |  Branch (4751:9): [True: 0, False: 2]
  ------------------
 4752|      0|        ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4753|      0|                      "upstream sent duplicate header line: \"%V: %V\", "
 4754|      0|                      "previous value: \"%V: %V\", ignored",
 4755|      0|                      &h->key, &h->value,
 4756|      0|                      &u->headers_in.last_modified->key,
 4757|      0|                      &u->headers_in.last_modified->value);
 4758|      0|        h->hash = 0;
 4759|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 4760|      0|    }
 4761|       |
 4762|      2|    h->next = NULL;
 4763|      2|    u->headers_in.last_modified = h;
 4764|      2|    u->headers_in.last_modified_time = ngx_parse_http_time(h->value.data,
 4765|      2|                                                           h->value.len);
 4766|       |
 4767|      2|    return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 4768|      2|}
ngx_http_upstream.c:ngx_http_upstream_copy_last_modified:
 5399|      2|{
 5400|      2|    ngx_table_elt_t  *ho;
 5401|       |
 5402|      2|    ho = ngx_list_push(&r->headers_out.headers);
 5403|      2|    if (ho == NULL) {
  ------------------
  |  Branch (5403:9): [True: 0, False: 2]
  ------------------
 5404|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 5405|      0|    }
 5406|       |
 5407|      2|    *ho = *h;
 5408|      2|    ho->next = NULL;
 5409|       |
 5410|      2|    r->headers_out.last_modified = ho;
 5411|      2|    r->headers_out.last_modified_time =
 5412|      2|                                    r->upstream->headers_in.last_modified_time;
 5413|       |
 5414|      2|    return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
 5415|      2|}
ngx_http_upstream.c:ngx_http_upstream_process_transfer_encoding:
 5178|      4|{
 5179|      4|    ngx_http_upstream_t  *u;
 5180|       |
 5181|      4|    u = r->upstream;
 5182|       |
 5183|      4|    if (u->headers_in.transfer_encoding) {
  ------------------
  |  Branch (5183:9): [True: 0, False: 4]
  ------------------
 5184|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5185|      0|                      "upstream sent duplicate header line: \"%V: %V\", "
 5186|      0|                      "previous value: \"%V: %V\"",
 5187|      0|                      &h->key, &h->value,
 5188|      0|                      &u->headers_in.transfer_encoding->key,
 5189|      0|                      &u->headers_in.transfer_encoding->value);
 5190|      0|        return NGX_HTTP_UPSTREAM_INVALID_HEADER;
  ------------------
  |  |   45|      0|#define NGX_HTTP_UPSTREAM_INVALID_HEADER     40
  ------------------
 5191|      0|    }
 5192|       |
 5193|      4|    if (u->headers_in.content_length) {
  ------------------
  |  Branch (5193:9): [True: 0, False: 4]
  ------------------
 5194|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5195|      0|                      "upstream sent \"Content-Length\" and "
 5196|      0|                      "\"Transfer-Encoding\" headers at the same time");
 5197|      0|        return NGX_HTTP_UPSTREAM_INVALID_HEADER;
  ------------------
  |  |   45|      0|#define NGX_HTTP_UPSTREAM_INVALID_HEADER     40
  ------------------
 5198|      0|    }
 5199|       |
 5200|      4|    u->headers_in.transfer_encoding = h;
 5201|      4|    h->next = NULL;
 5202|       |
 5203|      4|    if (h->value.len == 7
  ------------------
  |  Branch (5203:9): [True: 4, False: 0]
  ------------------
 5204|      4|        && ngx_strncasecmp(h->value.data, (u_char *) "chunked", 7) == 0)
  ------------------
  |  Branch (5204:12): [True: 4, False: 0]
  ------------------
 5205|      4|    {
 5206|      4|        u->headers_in.chunked = 1;
 5207|       |
 5208|      4|    } else {
 5209|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5210|      0|                      "upstream sent unknown \"Transfer-Encoding\": \"%V\"",
 5211|      0|                      &h->value);
 5212|      0|        return NGX_HTTP_UPSTREAM_INVALID_HEADER;
  ------------------
  |  |   45|      0|#define NGX_HTTP_UPSTREAM_INVALID_HEADER     40
  ------------------
 5213|      0|    }
 5214|       |
 5215|      4|    return NGX_OK;
  ------------------
  |  |   38|      4|#define  NGX_OK          0
  ------------------
 5216|      4|}
ngx_http_upstream.c:ngx_http_upstream:
 6033|      1|{
 6034|      1|    char                          *rv;
 6035|      1|    void                          *mconf;
 6036|      1|    ngx_str_t                     *value;
 6037|      1|    ngx_url_t                      u;
 6038|      1|    ngx_uint_t                     m;
 6039|      1|    ngx_conf_t                     pcf;
 6040|      1|    ngx_http_module_t             *module;
 6041|      1|    ngx_http_conf_ctx_t           *ctx, *http_ctx;
 6042|      1|    ngx_http_upstream_srv_conf_t  *uscf;
 6043|       |
 6044|      1|    ngx_memzero(&u, sizeof(ngx_url_t));
  ------------------
  |  |   88|      1|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 6045|       |
 6046|      1|    value = cf->args->elts;
 6047|      1|    u.host = value[1];
 6048|      1|    u.no_resolve = 1;
 6049|      1|    u.no_port = 1;
 6050|       |
 6051|      1|    uscf = ngx_http_upstream_add(cf, &u, NGX_HTTP_UPSTREAM_CREATE
  ------------------
  |  |  112|      1|#define NGX_HTTP_UPSTREAM_CREATE        0x0001
  ------------------
 6052|      1|                                         |NGX_HTTP_UPSTREAM_WEIGHT
  ------------------
  |  |  113|      1|#define NGX_HTTP_UPSTREAM_WEIGHT        0x0002
  ------------------
 6053|      1|                                         |NGX_HTTP_UPSTREAM_MAX_CONNS
  ------------------
  |  |  118|      1|#define NGX_HTTP_UPSTREAM_MAX_CONNS     0x0100
  ------------------
 6054|      1|                                         |NGX_HTTP_UPSTREAM_MAX_FAILS
  ------------------
  |  |  114|      1|#define NGX_HTTP_UPSTREAM_MAX_FAILS     0x0004
  ------------------
 6055|      1|                                         |NGX_HTTP_UPSTREAM_FAIL_TIMEOUT
  ------------------
  |  |  115|      1|#define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT  0x0008
  ------------------
 6056|      1|                                         |NGX_HTTP_UPSTREAM_DOWN
  ------------------
  |  |  116|      1|#define NGX_HTTP_UPSTREAM_DOWN          0x0010
  ------------------
 6057|      1|                                         |NGX_HTTP_UPSTREAM_BACKUP);
  ------------------
  |  |  117|      1|#define NGX_HTTP_UPSTREAM_BACKUP        0x0020
  ------------------
 6058|      1|    if (uscf == NULL) {
  ------------------
  |  Branch (6058:9): [True: 0, False: 1]
  ------------------
 6059|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6060|      0|    }
 6061|       |
 6062|       |
 6063|      1|    ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
 6064|      1|    if (ctx == NULL) {
  ------------------
  |  Branch (6064:9): [True: 0, False: 1]
  ------------------
 6065|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6066|      0|    }
 6067|       |
 6068|      1|    http_ctx = cf->ctx;
 6069|      1|    ctx->main_conf = http_ctx->main_conf;
 6070|       |
 6071|       |    /* the upstream{}'s srv_conf */
 6072|       |
 6073|      1|    ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
 6074|      1|    if (ctx->srv_conf == NULL) {
  ------------------
  |  Branch (6074:9): [True: 0, False: 1]
  ------------------
 6075|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6076|      0|    }
 6077|       |
 6078|      1|    ctx->srv_conf[ngx_http_upstream_module.ctx_index] = uscf;
 6079|       |
 6080|      1|    uscf->srv_conf = ctx->srv_conf;
 6081|       |
 6082|       |
 6083|       |    /* the upstream{}'s loc_conf */
 6084|       |
 6085|      1|    ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
 6086|      1|    if (ctx->loc_conf == NULL) {
  ------------------
  |  Branch (6086:9): [True: 0, False: 1]
  ------------------
 6087|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6088|      0|    }
 6089|       |
 6090|     55|    for (m = 0; cf->cycle->modules[m]; m++) {
  ------------------
  |  Branch (6090:17): [True: 54, False: 1]
  ------------------
 6091|     54|        if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
  ------------------
  |  |   39|     54|#define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
  ------------------
  |  Branch (6091:13): [True: 8, False: 46]
  ------------------
 6092|      8|            continue;
 6093|      8|        }
 6094|       |
 6095|     46|        module = cf->cycle->modules[m]->ctx;
 6096|       |
 6097|     46|        if (module->create_srv_conf) {
  ------------------
  |  Branch (6097:13): [True: 5, False: 41]
  ------------------
 6098|      5|            mconf = module->create_srv_conf(cf);
 6099|      5|            if (mconf == NULL) {
  ------------------
  |  Branch (6099:17): [True: 0, False: 5]
  ------------------
 6100|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6101|      0|            }
 6102|       |
 6103|      5|            ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
 6104|      5|        }
 6105|       |
 6106|     46|        if (module->create_loc_conf) {
  ------------------
  |  Branch (6106:13): [True: 26, False: 20]
  ------------------
 6107|     26|            mconf = module->create_loc_conf(cf);
 6108|     26|            if (mconf == NULL) {
  ------------------
  |  Branch (6108:17): [True: 0, False: 26]
  ------------------
 6109|      0|                return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6110|      0|            }
 6111|       |
 6112|     26|            ctx->loc_conf[cf->cycle->modules[m]->ctx_index] = mconf;
 6113|     26|        }
 6114|     46|    }
 6115|       |
 6116|      1|    uscf->servers = ngx_array_create(cf->pool, 4,
 6117|      1|                                     sizeof(ngx_http_upstream_server_t));
 6118|      1|    if (uscf->servers == NULL) {
  ------------------
  |  Branch (6118:9): [True: 0, False: 1]
  ------------------
 6119|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6120|      0|    }
 6121|       |
 6122|       |
 6123|       |    /* parse inside upstream{} */
 6124|       |
 6125|      1|    pcf = *cf;
 6126|      1|    cf->ctx = ctx;
 6127|      1|    cf->cmd_type = NGX_HTTP_UPS_CONF;
  ------------------
  |  |   44|      1|#define NGX_HTTP_UPS_CONF         0x10000000
  ------------------
 6128|       |
 6129|      1|    rv = ngx_conf_parse(cf, NULL);
 6130|       |
 6131|      1|    *cf = pcf;
 6132|       |
 6133|      1|    if (rv != NGX_CONF_OK) {
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  |  Branch (6133:9): [True: 0, False: 1]
  ------------------
 6134|      0|        return rv;
 6135|      0|    }
 6136|       |
 6137|      1|    if (uscf->servers->nelts == 0) {
  ------------------
  |  Branch (6137:9): [True: 0, False: 1]
  ------------------
 6138|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 6139|      0|                           "no servers are inside upstream");
 6140|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6141|      0|    }
 6142|       |
 6143|      1|    return rv;
 6144|      1|}
ngx_http_upstream.c:ngx_http_upstream_server:
 6149|     10|{
 6150|     10|    ngx_http_upstream_srv_conf_t  *uscf = conf;
 6151|       |
 6152|     10|    time_t                       fail_timeout;
 6153|     10|    ngx_str_t                   *value, s;
 6154|     10|    ngx_url_t                    u;
 6155|     10|    ngx_int_t                    weight, max_conns, max_fails;
 6156|     10|    ngx_uint_t                   i;
 6157|     10|    ngx_http_upstream_server_t  *us;
 6158|       |
 6159|     10|    us = ngx_array_push(uscf->servers);
 6160|     10|    if (us == NULL) {
  ------------------
  |  Branch (6160:9): [True: 0, False: 10]
  ------------------
 6161|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6162|      0|    }
 6163|       |
 6164|     10|    ngx_memzero(us, sizeof(ngx_http_upstream_server_t));
  ------------------
  |  |   88|     10|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 6165|       |
 6166|     10|    value = cf->args->elts;
 6167|       |
 6168|     10|    weight = 1;
 6169|     10|    max_conns = 0;
 6170|     10|    max_fails = 1;
 6171|     10|    fail_timeout = 10;
 6172|       |
 6173|     20|    for (i = 2; i < cf->args->nelts; i++) {
  ------------------
  |  Branch (6173:17): [True: 10, False: 10]
  ------------------
 6174|       |
 6175|     10|        if (ngx_strncmp(value[i].data, "weight=", 7) == 0) {
  ------------------
  |  |   53|     10|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (6175:13): [True: 0, False: 10]
  ------------------
 6176|       |
 6177|      0|            if (!(uscf->flags & NGX_HTTP_UPSTREAM_WEIGHT)) {
  ------------------
  |  |  113|      0|#define NGX_HTTP_UPSTREAM_WEIGHT        0x0002
  ------------------
  |  Branch (6177:17): [True: 0, False: 0]
  ------------------
 6178|      0|                goto not_supported;
 6179|      0|            }
 6180|       |
 6181|      0|            weight = ngx_atoi(&value[i].data[7], value[i].len - 7);
 6182|       |
 6183|      0|            if (weight == NGX_ERROR || weight == 0) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (6183:17): [True: 0, False: 0]
  |  Branch (6183:40): [True: 0, False: 0]
  ------------------
 6184|      0|                goto invalid;
 6185|      0|            }
 6186|       |
 6187|      0|            continue;
 6188|      0|        }
 6189|       |
 6190|     10|        if (ngx_strncmp(value[i].data, "max_conns=", 10) == 0) {
  ------------------
  |  |   53|     10|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (6190:13): [True: 0, False: 10]
  ------------------
 6191|       |
 6192|      0|            if (!(uscf->flags & NGX_HTTP_UPSTREAM_MAX_CONNS)) {
  ------------------
  |  |  118|      0|#define NGX_HTTP_UPSTREAM_MAX_CONNS     0x0100
  ------------------
  |  Branch (6192:17): [True: 0, False: 0]
  ------------------
 6193|      0|                goto not_supported;
 6194|      0|            }
 6195|       |
 6196|      0|            max_conns = ngx_atoi(&value[i].data[10], value[i].len - 10);
 6197|       |
 6198|      0|            if (max_conns == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (6198:17): [True: 0, False: 0]
  ------------------
 6199|      0|                goto invalid;
 6200|      0|            }
 6201|       |
 6202|      0|            continue;
 6203|      0|        }
 6204|       |
 6205|     10|        if (ngx_strncmp(value[i].data, "max_fails=", 10) == 0) {
  ------------------
  |  |   53|     10|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (6205:13): [True: 10, False: 0]
  ------------------
 6206|       |
 6207|     10|            if (!(uscf->flags & NGX_HTTP_UPSTREAM_MAX_FAILS)) {
  ------------------
  |  |  114|     10|#define NGX_HTTP_UPSTREAM_MAX_FAILS     0x0004
  ------------------
  |  Branch (6207:17): [True: 0, False: 10]
  ------------------
 6208|      0|                goto not_supported;
 6209|      0|            }
 6210|       |
 6211|     10|            max_fails = ngx_atoi(&value[i].data[10], value[i].len - 10);
 6212|       |
 6213|     10|            if (max_fails == NGX_ERROR) {
  ------------------
  |  |   39|     10|#define  NGX_ERROR      -1
  ------------------
  |  Branch (6213:17): [True: 0, False: 10]
  ------------------
 6214|      0|                goto invalid;
 6215|      0|            }
 6216|       |
 6217|     10|            continue;
 6218|     10|        }
 6219|       |
 6220|      0|        if (ngx_strncmp(value[i].data, "fail_timeout=", 13) == 0) {
  ------------------
  |  |   53|      0|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (6220:13): [True: 0, False: 0]
  ------------------
 6221|       |
 6222|      0|            if (!(uscf->flags & NGX_HTTP_UPSTREAM_FAIL_TIMEOUT)) {
  ------------------
  |  |  115|      0|#define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT  0x0008
  ------------------
  |  Branch (6222:17): [True: 0, False: 0]
  ------------------
 6223|      0|                goto not_supported;
 6224|      0|            }
 6225|       |
 6226|      0|            s.len = value[i].len - 13;
 6227|      0|            s.data = &value[i].data[13];
 6228|       |
 6229|      0|            fail_timeout = ngx_parse_time(&s, 1);
 6230|       |
 6231|      0|            if (fail_timeout == (time_t) NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (6231:17): [True: 0, False: 0]
  ------------------
 6232|      0|                goto invalid;
 6233|      0|            }
 6234|       |
 6235|      0|            continue;
 6236|      0|        }
 6237|       |
 6238|      0|        if (ngx_strcmp(value[i].data, "backup") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (6238:13): [True: 0, False: 0]
  ------------------
 6239|       |
 6240|      0|            if (!(uscf->flags & NGX_HTTP_UPSTREAM_BACKUP)) {
  ------------------
  |  |  117|      0|#define NGX_HTTP_UPSTREAM_BACKUP        0x0020
  ------------------
  |  Branch (6240:17): [True: 0, False: 0]
  ------------------
 6241|      0|                goto not_supported;
 6242|      0|            }
 6243|       |
 6244|      0|            us->backup = 1;
 6245|       |
 6246|      0|            continue;
 6247|      0|        }
 6248|       |
 6249|      0|        if (ngx_strcmp(value[i].data, "down") == 0) {
  ------------------
  |  |   57|      0|#define ngx_strcmp(s1, s2)  strcmp((const char *) s1, (const char *) s2)
  ------------------
  |  Branch (6249:13): [True: 0, False: 0]
  ------------------
 6250|       |
 6251|      0|            if (!(uscf->flags & NGX_HTTP_UPSTREAM_DOWN)) {
  ------------------
  |  |  116|      0|#define NGX_HTTP_UPSTREAM_DOWN          0x0010
  ------------------
  |  Branch (6251:17): [True: 0, False: 0]
  ------------------
 6252|      0|                goto not_supported;
 6253|      0|            }
 6254|       |
 6255|      0|            us->down = 1;
 6256|       |
 6257|      0|            continue;
 6258|      0|        }
 6259|       |
 6260|      0|        goto invalid;
 6261|      0|    }
 6262|       |
 6263|     10|    ngx_memzero(&u, sizeof(ngx_url_t));
  ------------------
  |  |   88|     10|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 6264|       |
 6265|     10|    u.url = value[1];
 6266|     10|    u.default_port = 80;
 6267|       |
 6268|     10|    if (ngx_parse_url(cf->pool, &u) != NGX_OK) {
  ------------------
  |  |   38|     10|#define  NGX_OK          0
  ------------------
  |  Branch (6268:9): [True: 0, False: 10]
  ------------------
 6269|      0|        if (u.err) {
  ------------------
  |  Branch (6269:13): [True: 0, False: 0]
  ------------------
 6270|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 6271|      0|                               "%s in upstream \"%V\"", u.err, &u.url);
 6272|      0|        }
 6273|       |
 6274|      0|        return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6275|      0|    }
 6276|       |
 6277|     10|    us->name = u.url;
 6278|     10|    us->addrs = u.addrs;
 6279|     10|    us->naddrs = u.naddrs;
 6280|     10|    us->weight = weight;
 6281|     10|    us->max_conns = max_conns;
 6282|     10|    us->max_fails = max_fails;
 6283|     10|    us->fail_timeout = fail_timeout;
 6284|       |
 6285|     10|    return NGX_CONF_OK;
  ------------------
  |  |   63|     10|#define NGX_CONF_OK          NULL
  ------------------
 6286|       |
 6287|      0|invalid:
 6288|       |
 6289|      0|    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 6290|      0|                       "invalid parameter \"%V\"", &value[i]);
 6291|       |
 6292|      0|    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6293|       |
 6294|      0|not_supported:
 6295|       |
 6296|      0|    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 6297|      0|                       "balancing method does not support parameter \"%V\"",
 6298|      0|                       &value[i]);
 6299|       |
 6300|      0|    return NGX_CONF_ERROR;
  ------------------
  |  |   64|      0|#define NGX_CONF_ERROR       (void *) -1
  ------------------
 6301|     10|}
ngx_http_upstream.c:ngx_http_upstream_init_request:
  553|      5|{
  554|      5|    ngx_str_t                      *host;
  555|      5|    ngx_uint_t                      i;
  556|      5|    ngx_resolver_ctx_t             *ctx, temp;
  557|      5|    ngx_http_cleanup_t             *cln;
  558|      5|    ngx_http_upstream_t            *u;
  559|      5|    ngx_http_core_loc_conf_t       *clcf;
  560|      5|    ngx_http_upstream_srv_conf_t   *uscf, **uscfp;
  561|      5|    ngx_http_upstream_main_conf_t  *umcf;
  562|       |
  563|      5|    if (r->aio) {
  ------------------
  |  Branch (563:9): [True: 0, False: 5]
  ------------------
  564|      0|        return;
  565|      0|    }
  566|       |
  567|      5|    u = r->upstream;
  568|       |
  569|      5|#if (NGX_HTTP_CACHE)
  570|       |
  571|      5|    if (u->conf->cache) {
  ------------------
  |  Branch (571:9): [True: 0, False: 5]
  ------------------
  572|      0|        ngx_int_t  rc;
  573|       |
  574|      0|        rc = ngx_http_upstream_cache(r, u);
  575|       |
  576|      0|        if (rc == NGX_BUSY) {
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  |  Branch (576:13): [True: 0, False: 0]
  ------------------
  577|      0|            r->write_event_handler = ngx_http_upstream_init_request;
  578|      0|            return;
  579|      0|        }
  580|       |
  581|      0|        r->write_event_handler = ngx_http_request_empty_handler;
  582|       |
  583|      0|        if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (583:13): [True: 0, False: 0]
  ------------------
  584|      0|            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  585|      0|            return;
  586|      0|        }
  587|       |
  588|      0|        if (rc == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (588:13): [True: 0, False: 0]
  ------------------
  589|      0|            rc = ngx_http_upstream_cache_send(r, u);
  590|       |
  591|      0|            if (rc == NGX_DONE) {
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  |  Branch (591:17): [True: 0, False: 0]
  ------------------
  592|      0|                return;
  593|      0|            }
  594|       |
  595|      0|            if (rc == NGX_HTTP_UPSTREAM_INVALID_HEADER) {
  ------------------
  |  |   45|      0|#define NGX_HTTP_UPSTREAM_INVALID_HEADER     40
  ------------------
  |  Branch (595:17): [True: 0, False: 0]
  ------------------
  596|      0|                rc = NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  597|      0|                r->cached = 0;
  598|      0|                u->buffer.start = NULL;
  599|      0|                u->cache_status = NGX_HTTP_CACHE_MISS;
  ------------------
  |  |   17|      0|#define NGX_HTTP_CACHE_MISS          1
  ------------------
  600|      0|                u->request_sent = 1;
  601|      0|            }
  602|      0|        }
  603|       |
  604|      0|        if (rc != NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (604:13): [True: 0, False: 0]
  ------------------
  605|      0|            ngx_http_finalize_request(r, rc);
  606|      0|            return;
  607|      0|        }
  608|      0|    }
  609|       |
  610|      5|#endif
  611|       |
  612|      5|    u->store = u->conf->store;
  613|       |
  614|      5|    if (!u->store && !r->post_action && !u->conf->ignore_client_abort) {
  ------------------
  |  Branch (614:9): [True: 5, False: 0]
  |  Branch (614:22): [True: 5, False: 0]
  |  Branch (614:41): [True: 5, False: 0]
  ------------------
  615|       |
  616|      5|        if (r->connection->read->ready) {
  ------------------
  |  Branch (616:13): [True: 5, False: 0]
  ------------------
  617|      5|            ngx_post_event(r->connection->read, &ngx_posted_events);
  ------------------
  |  |   19|      5|    if (!(ev)->posted) {                                                      \
  |  |  ------------------
  |  |  |  Branch (19:9): [True: 5, False: 0]
  |  |  ------------------
  |  |   20|      5|        (ev)->posted = 1;                                                     \
  |  |   21|      5|        ngx_queue_insert_tail(q, &(ev)->queue);                               \
  |  |  ------------------
  |  |  |  |   44|      5|    (x)->prev = (h)->prev;                                                    \
  |  |  |  |   45|      5|    (x)->prev->next = x;                                                      \
  |  |  |  |   46|      5|    (x)->next = h;                                                            \
  |  |  |  |   47|      5|    (h)->prev = x
  |  |  ------------------
  |  |   22|      5|                                                                              \
  |  |   23|      5|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, "post event %p", ev);\
  |  |   24|      5|                                                                              \
  |  |   25|      5|    } else  {                                                                 \
  |  |   26|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                      \
  |  |   27|      0|                       "update posted event %p", ev);                         \
  |  |   28|      0|    }
  ------------------
  618|       |
  619|      5|        } else {
  620|      0|            if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (620:17): [True: 0, False: 0]
  ------------------
  621|      0|                ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  622|      0|                return;
  623|      0|            }
  624|      0|        }
  625|       |
  626|      5|        r->read_event_handler = ngx_http_upstream_rd_check_broken_connection;
  627|      5|        r->write_event_handler = ngx_http_upstream_wr_check_broken_connection;
  628|      5|    }
  629|       |
  630|      5|    if (r->request_body) {
  ------------------
  |  Branch (630:9): [True: 5, False: 0]
  ------------------
  631|      5|        u->request_bufs = r->request_body->bufs;
  632|      5|    }
  633|       |
  634|      5|    if (u->create_request(r) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (634:9): [True: 0, False: 5]
  ------------------
  635|      0|        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  636|      0|        return;
  637|      0|    }
  638|       |
  639|      5|    if (ngx_http_upstream_set_local(r, u, u->conf->local) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (639:9): [True: 0, False: 5]
  ------------------
  640|      0|        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  641|      0|        return;
  642|      0|    }
  643|       |
  644|      5|    if (u->conf->socket_keepalive) {
  ------------------
  |  Branch (644:9): [True: 0, False: 5]
  ------------------
  645|      0|        u->peer.so_keepalive = 1;
  646|      0|    }
  647|       |
  648|      5|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      5|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  649|       |
  650|      5|    u->output.alignment = clcf->directio_alignment;
  651|      5|    u->output.pool = r->pool;
  652|      5|    u->output.bufs.num = 1;
  653|      5|    u->output.bufs.size = clcf->client_body_buffer_size;
  654|       |
  655|      5|    if (u->output.output_filter == NULL) {
  ------------------
  |  Branch (655:9): [True: 5, False: 0]
  ------------------
  656|      5|        u->output.output_filter = ngx_chain_writer;
  657|      5|        u->output.filter_ctx = &u->writer;
  658|      5|    }
  659|       |
  660|      5|    u->writer.pool = r->pool;
  661|       |
  662|      5|    if (r->upstream_states == NULL) {
  ------------------
  |  Branch (662:9): [True: 5, False: 0]
  ------------------
  663|       |
  664|      5|        r->upstream_states = ngx_array_create(r->pool, 1,
  665|      5|                                            sizeof(ngx_http_upstream_state_t));
  666|      5|        if (r->upstream_states == NULL) {
  ------------------
  |  Branch (666:13): [True: 0, False: 5]
  ------------------
  667|      0|            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  668|      0|            return;
  669|      0|        }
  670|       |
  671|      5|    } else {
  672|       |
  673|      0|        u->state = ngx_array_push(r->upstream_states);
  674|      0|        if (u->state == NULL) {
  ------------------
  |  Branch (674:13): [True: 0, False: 0]
  ------------------
  675|      0|            ngx_http_upstream_finalize_request(r, u,
  676|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  677|      0|            return;
  678|      0|        }
  679|       |
  680|      0|        ngx_memzero(u->state, sizeof(ngx_http_upstream_state_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  681|      0|    }
  682|       |
  683|      5|    cln = ngx_http_cleanup_add(r, 0);
  684|      5|    if (cln == NULL) {
  ------------------
  |  Branch (684:9): [True: 0, False: 5]
  ------------------
  685|      0|        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  686|      0|        return;
  687|      0|    }
  688|       |
  689|      5|    cln->handler = ngx_http_upstream_cleanup;
  690|      5|    cln->data = r;
  691|      5|    u->cleanup = &cln->handler;
  692|       |
  693|      5|    if (u->resolved == NULL) {
  ------------------
  |  Branch (693:9): [True: 0, False: 5]
  ------------------
  694|       |
  695|      0|        uscf = u->conf->upstream;
  696|       |
  697|      5|    } else {
  698|       |
  699|       |#if (NGX_HTTP_SSL)
  700|       |        u->ssl_name = u->resolved->host;
  701|       |#endif
  702|       |
  703|      5|        host = &u->resolved->host;
  704|       |
  705|      5|        umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
  ------------------
  |  |   56|      5|    (r)->main_conf[module.ctx_index]
  ------------------
  706|       |
  707|      5|        uscfp = umcf->upstreams.elts;
  708|       |
  709|      5|        for (i = 0; i < umcf->upstreams.nelts; i++) {
  ------------------
  |  Branch (709:21): [True: 5, False: 0]
  ------------------
  710|       |
  711|      5|            uscf = uscfp[i];
  712|       |
  713|      5|            if (uscf->host.len == host->len
  ------------------
  |  Branch (713:17): [True: 5, False: 0]
  ------------------
  714|      5|                && ((uscf->port == 0 && u->resolved->no_port)
  ------------------
  |  Branch (714:22): [True: 5, False: 0]
  |  Branch (714:41): [True: 5, False: 0]
  ------------------
  715|      5|                     || uscf->port == u->resolved->port)
  ------------------
  |  Branch (715:25): [True: 0, False: 0]
  ------------------
  716|      5|                && ngx_strncasecmp(uscf->host.data, host->data, host->len) == 0)
  ------------------
  |  Branch (716:20): [True: 5, False: 0]
  ------------------
  717|      5|            {
  718|      5|                goto found;
  719|      5|            }
  720|      5|        }
  721|       |
  722|      0|        if (u->resolved->sockaddr) {
  ------------------
  |  Branch (722:13): [True: 0, False: 0]
  ------------------
  723|       |
  724|      0|            if (u->resolved->port == 0
  ------------------
  |  Branch (724:17): [True: 0, False: 0]
  ------------------
  725|      0|                && u->resolved->sockaddr->sa_family != AF_UNIX)
  ------------------
  |  Branch (725:20): [True: 0, False: 0]
  ------------------
  726|      0|            {
  727|      0|                ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  728|      0|                              "no port in upstream \"%V\"", host);
  729|      0|                ngx_http_upstream_finalize_request(r, u,
  730|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  731|      0|                return;
  732|      0|            }
  733|       |
  734|      0|            if (ngx_http_upstream_create_round_robin_peer(r, u->resolved)
  ------------------
  |  Branch (734:17): [True: 0, False: 0]
  ------------------
  735|      0|                != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  736|      0|            {
  737|      0|                ngx_http_upstream_finalize_request(r, u,
  738|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  739|      0|                return;
  740|      0|            }
  741|       |
  742|      0|            ngx_http_upstream_connect(r, u);
  743|       |
  744|      0|            return;
  745|      0|        }
  746|       |
  747|      0|        if (u->resolved->port == 0) {
  ------------------
  |  Branch (747:13): [True: 0, False: 0]
  ------------------
  748|      0|            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  749|      0|                          "no port in upstream \"%V\"", host);
  750|      0|            ngx_http_upstream_finalize_request(r, u,
  751|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  752|      0|            return;
  753|      0|        }
  754|       |
  755|      0|        temp.name = *host;
  756|       |
  757|      0|        ctx = ngx_resolve_start(clcf->resolver, &temp);
  758|      0|        if (ctx == NULL) {
  ------------------
  |  Branch (758:13): [True: 0, False: 0]
  ------------------
  759|      0|            ngx_http_upstream_finalize_request(r, u,
  760|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  761|      0|            return;
  762|      0|        }
  763|       |
  764|      0|        if (ctx == NGX_NO_RESOLVER) {
  ------------------
  |  |   35|      0|#define NGX_NO_RESOLVER       (void *) -1
  ------------------
  |  Branch (764:13): [True: 0, False: 0]
  ------------------
  765|      0|            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  766|      0|                          "no resolver defined to resolve %V", host);
  767|       |
  768|      0|            ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY);
  ------------------
  |  |  140|      0|#define NGX_HTTP_BAD_GATEWAY               502
  ------------------
  769|      0|            return;
  770|      0|        }
  771|       |
  772|      0|        ctx->name = *host;
  773|      0|        ctx->handler = ngx_http_upstream_resolve_handler;
  774|      0|        ctx->data = r;
  775|      0|        ctx->timeout = clcf->resolver_timeout;
  776|       |
  777|      0|        u->resolved->ctx = ctx;
  778|       |
  779|      0|        if (ngx_resolve_name(ctx) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (779:13): [True: 0, False: 0]
  ------------------
  780|      0|            u->resolved->ctx = NULL;
  781|      0|            ngx_http_upstream_finalize_request(r, u,
  782|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  783|      0|            return;
  784|      0|        }
  785|       |
  786|      0|        return;
  787|      0|    }
  788|       |
  789|      5|found:
  790|       |
  791|      5|    if (uscf == NULL) {
  ------------------
  |  Branch (791:9): [True: 0, False: 5]
  ------------------
  792|      0|        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  793|      0|                      "no upstream configuration");
  794|      0|        ngx_http_upstream_finalize_request(r, u,
  795|      0|                                           NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  796|      0|        return;
  797|      0|    }
  798|       |
  799|      5|    u->upstream = uscf;
  800|       |
  801|       |#if (NGX_HTTP_SSL)
  802|       |    u->ssl_name = uscf->host;
  803|       |#endif
  804|       |
  805|      5|    if (uscf->peer.init(r, uscf) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (805:9): [True: 0, False: 5]
  ------------------
  806|      0|        ngx_http_upstream_finalize_request(r, u,
  807|      0|                                           NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  808|      0|        return;
  809|      0|    }
  810|       |
  811|      5|    u->peer.start_time = ngx_current_msec;
  812|       |
  813|      5|    if (u->conf->next_upstream_tries
  ------------------
  |  Branch (813:9): [True: 0, False: 5]
  ------------------
  814|      5|        && u->peer.tries > u->conf->next_upstream_tries)
  ------------------
  |  Branch (814:12): [True: 0, False: 0]
  ------------------
  815|      0|    {
  816|      0|        u->peer.tries = u->conf->next_upstream_tries;
  817|      0|    }
  818|       |
  819|      5|    ngx_http_upstream_connect(r, u);
  820|      5|}
ngx_http_upstream.c:ngx_http_upstream_process_headers:
 2815|      5|{
 2816|      5|    ngx_str_t                       uri, args;
 2817|      5|    ngx_uint_t                      i, flags;
 2818|      5|    ngx_list_part_t                *part;
 2819|      5|    ngx_table_elt_t                *h;
 2820|      5|    ngx_http_upstream_header_t     *hh;
 2821|      5|    ngx_http_upstream_main_conf_t  *umcf;
 2822|       |
 2823|      5|    umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
  ------------------
  |  |   56|      5|    (r)->main_conf[module.ctx_index]
  ------------------
 2824|       |
 2825|      5|    if (u->headers_in.no_cache || u->headers_in.expired) {
  ------------------
  |  Branch (2825:9): [True: 0, False: 5]
  |  Branch (2825:35): [True: 0, False: 5]
  ------------------
 2826|      0|        u->cacheable = 0;
 2827|      0|    }
 2828|       |
 2829|      5|    if (u->headers_in.x_accel_redirect
  ------------------
  |  Branch (2829:9): [True: 0, False: 5]
  ------------------
 2830|      5|        && !(u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT))
  ------------------
  |  |   48|      0|#define NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT    0x00000002
  ------------------
  |  Branch (2830:12): [True: 0, False: 0]
  ------------------
 2831|      0|    {
 2832|      0|        ngx_http_upstream_finalize_request(r, u, NGX_DECLINED);
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 2833|       |
 2834|      0|        part = &u->headers_in.headers.part;
 2835|      0|        h = part->elts;
 2836|       |
 2837|      0|        for (i = 0; /* void */; i++) {
 2838|       |
 2839|      0|            if (i >= part->nelts) {
  ------------------
  |  Branch (2839:17): [True: 0, False: 0]
  ------------------
 2840|      0|                if (part->next == NULL) {
  ------------------
  |  Branch (2840:21): [True: 0, False: 0]
  ------------------
 2841|      0|                    break;
 2842|      0|                }
 2843|       |
 2844|      0|                part = part->next;
 2845|      0|                h = part->elts;
 2846|      0|                i = 0;
 2847|      0|            }
 2848|       |
 2849|      0|            if (h[i].hash == 0) {
  ------------------
  |  Branch (2849:17): [True: 0, False: 0]
  ------------------
 2850|      0|                continue;
 2851|      0|            }
 2852|       |
 2853|      0|            hh = ngx_hash_find(&umcf->headers_in_hash, h[i].hash,
 2854|      0|                               h[i].lowcase_key, h[i].key.len);
 2855|       |
 2856|      0|            if (hh && hh->redirect) {
  ------------------
  |  Branch (2856:17): [True: 0, False: 0]
  |  Branch (2856:23): [True: 0, False: 0]
  ------------------
 2857|      0|                if (hh->copy_handler(r, &h[i], hh->conf) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2857:21): [True: 0, False: 0]
  ------------------
 2858|      0|                    ngx_http_finalize_request(r,
 2859|      0|                                              NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2860|      0|                    return NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
 2861|      0|                }
 2862|      0|            }
 2863|      0|        }
 2864|       |
 2865|      0|        uri = u->headers_in.x_accel_redirect->value;
 2866|       |
 2867|      0|        if (uri.data[0] == '@') {
  ------------------
  |  Branch (2867:13): [True: 0, False: 0]
  ------------------
 2868|      0|            ngx_http_named_location(r, &uri);
 2869|       |
 2870|      0|        } else {
 2871|      0|            ngx_str_null(&args);
  ------------------
  |  |   44|      0|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
 2872|      0|            flags = NGX_HTTP_LOG_UNSAFE;
  ------------------
  |  |   71|      0|#define NGX_HTTP_LOG_UNSAFE                1
  ------------------
 2873|       |
 2874|      0|            if (ngx_http_parse_unsafe_uri(r, &uri, &args, &flags) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2874:17): [True: 0, False: 0]
  ------------------
 2875|      0|                ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND);
  ------------------
  |  |   95|      0|#define NGX_HTTP_NOT_FOUND                 404
  ------------------
 2876|      0|                return NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
 2877|      0|            }
 2878|       |
 2879|      0|            if (r->method != NGX_HTTP_HEAD) {
  ------------------
  |  |   31|      0|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
  |  Branch (2879:17): [True: 0, False: 0]
  ------------------
 2880|      0|                r->method = NGX_HTTP_GET;
  ------------------
  |  |   30|      0|#define NGX_HTTP_GET                       0x00000002
  ------------------
 2881|      0|                r->method_name = ngx_http_core_get_method;
 2882|      0|            }
 2883|       |
 2884|      0|            ngx_http_internal_redirect(r, &uri, &args);
 2885|      0|        }
 2886|       |
 2887|      0|        ngx_http_finalize_request(r, NGX_DONE);
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
 2888|      0|        return NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
 2889|      0|    }
 2890|       |
 2891|      5|    part = &u->headers_in.headers.part;
 2892|      5|    h = part->elts;
 2893|       |
 2894|     26|    for (i = 0; /* void */; i++) {
 2895|       |
 2896|     26|        if (i >= part->nelts) {
  ------------------
  |  Branch (2896:13): [True: 5, False: 21]
  ------------------
 2897|      5|            if (part->next == NULL) {
  ------------------
  |  Branch (2897:17): [True: 5, False: 0]
  ------------------
 2898|      5|                break;
 2899|      5|            }
 2900|       |
 2901|      0|            part = part->next;
 2902|      0|            h = part->elts;
 2903|      0|            i = 0;
 2904|      0|        }
 2905|       |
 2906|     21|        if (h[i].hash == 0) {
  ------------------
  |  Branch (2906:13): [True: 0, False: 21]
  ------------------
 2907|      0|            continue;
 2908|      0|        }
 2909|       |
 2910|     21|        if (ngx_hash_find(&u->conf->hide_headers_hash, h[i].hash,
  ------------------
  |  Branch (2910:13): [True: 8, False: 13]
  ------------------
 2911|     21|                          h[i].lowcase_key, h[i].key.len))
 2912|      8|        {
 2913|      8|            continue;
 2914|      8|        }
 2915|       |
 2916|     13|        hh = ngx_hash_find(&umcf->headers_in_hash, h[i].hash,
 2917|     13|                           h[i].lowcase_key, h[i].key.len);
 2918|       |
 2919|     13|        if (hh) {
  ------------------
  |  Branch (2919:13): [True: 6, False: 7]
  ------------------
 2920|      6|            if (hh->copy_handler(r, &h[i], hh->conf) != NGX_OK) {
  ------------------
  |  |   38|      6|#define  NGX_OK          0
  ------------------
  |  Branch (2920:17): [True: 0, False: 6]
  ------------------
 2921|      0|                ngx_http_upstream_finalize_request(r, u,
 2922|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2923|      0|                return NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
 2924|      0|            }
 2925|       |
 2926|      6|            continue;
 2927|      6|        }
 2928|       |
 2929|      7|        if (ngx_http_upstream_copy_header_line(r, &h[i], 0) != NGX_OK) {
  ------------------
  |  |   38|      7|#define  NGX_OK          0
  ------------------
  |  Branch (2929:13): [True: 0, False: 7]
  ------------------
 2930|      0|            ngx_http_upstream_finalize_request(r, u,
 2931|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2932|      0|            return NGX_DONE;
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
 2933|      0|        }
 2934|      7|    }
 2935|       |
 2936|      5|    if (r->headers_out.server && r->headers_out.server->value.data == NULL) {
  ------------------
  |  Branch (2936:9): [True: 0, False: 5]
  |  Branch (2936:34): [True: 0, False: 0]
  ------------------
 2937|      0|        r->headers_out.server->hash = 0;
 2938|      0|    }
 2939|       |
 2940|      5|    if (r->headers_out.date && r->headers_out.date->value.data == NULL) {
  ------------------
  |  Branch (2940:9): [True: 0, False: 5]
  |  Branch (2940:32): [True: 0, False: 0]
  ------------------
 2941|      0|        r->headers_out.date->hash = 0;
 2942|      0|    }
 2943|       |
 2944|      5|    r->headers_out.status = u->headers_in.status_n;
 2945|      5|    r->headers_out.status_line = u->headers_in.status_line;
 2946|       |
 2947|      5|    r->headers_out.content_length_n = u->headers_in.content_length_n;
 2948|       |
 2949|      5|    r->disable_not_modified = !u->cacheable;
 2950|       |
 2951|      5|    if (u->conf->force_ranges) {
  ------------------
  |  Branch (2951:9): [True: 0, False: 5]
  ------------------
 2952|      0|        r->allow_ranges = 1;
 2953|      0|        r->single_range = 1;
 2954|       |
 2955|      0|#if (NGX_HTTP_CACHE)
 2956|      0|        if (r->cached) {
  ------------------
  |  Branch (2956:13): [True: 0, False: 0]
  ------------------
 2957|      0|            r->single_range = 0;
 2958|      0|        }
 2959|      0|#endif
 2960|      0|    }
 2961|       |
 2962|      5|    u->length = -1;
 2963|       |
 2964|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 2965|      5|}
ngx_http_upstream.c:ngx_http_upstream_set_local:
 6518|      5|{
 6519|      5|    ngx_int_t    rc;
 6520|      5|    ngx_str_t    val;
 6521|      5|    ngx_addr_t  *addr;
 6522|       |
 6523|      5|    if (local == NULL) {
  ------------------
  |  Branch (6523:9): [True: 5, False: 0]
  ------------------
 6524|      5|        u->peer.local = NULL;
 6525|      5|        return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 6526|      5|    }
 6527|       |
 6528|       |#if (NGX_HAVE_TRANSPARENT_PROXY)
 6529|       |    u->peer.transparent = local->transparent;
 6530|       |#endif
 6531|       |
 6532|      0|    if (local->value == NULL) {
  ------------------
  |  Branch (6532:9): [True: 0, False: 0]
  ------------------
 6533|      0|        u->peer.local = local->addr;
 6534|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 6535|      0|    }
 6536|       |
 6537|      0|    if (ngx_http_complex_value(r, local->value, &val) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (6537:9): [True: 0, False: 0]
  ------------------
 6538|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 6539|      0|    }
 6540|       |
 6541|      0|    if (val.len == 0) {
  ------------------
  |  Branch (6541:9): [True: 0, False: 0]
  ------------------
 6542|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 6543|      0|    }
 6544|       |
 6545|      0|    addr = ngx_palloc(r->pool, sizeof(ngx_addr_t));
 6546|      0|    if (addr == NULL) {
  ------------------
  |  Branch (6546:9): [True: 0, False: 0]
  ------------------
 6547|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 6548|      0|    }
 6549|       |
 6550|      0|    rc = ngx_parse_addr_port(r->pool, addr, val.data, val.len);
 6551|      0|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (6551:9): [True: 0, False: 0]
  ------------------
 6552|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 6553|      0|    }
 6554|       |
 6555|      0|    if (rc != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (6555:9): [True: 0, False: 0]
  ------------------
 6556|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6557|      0|                      "invalid local address \"%V\"", &val);
 6558|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 6559|      0|    }
 6560|       |
 6561|      0|    addr->name = val;
 6562|      0|    u->peer.local = addr;
 6563|       |
 6564|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 6565|      0|}
ngx_http_upstream.c:ngx_http_upstream_connect:
 1529|      5|{
 1530|      5|    ngx_int_t                  rc;
 1531|      5|    ngx_connection_t          *c;
 1532|      5|    ngx_http_core_loc_conf_t  *clcf;
 1533|       |
 1534|      5|    r->connection->log->action = "connecting to upstream";
 1535|       |
 1536|      5|    if (u->state && u->state->response_time == (ngx_msec_t) -1) {
  ------------------
  |  Branch (1536:9): [True: 0, False: 5]
  |  Branch (1536:21): [True: 0, False: 0]
  ------------------
 1537|      0|        u->state->response_time = ngx_current_msec - u->start_time;
 1538|      0|    }
 1539|       |
 1540|      5|    u->state = ngx_array_push(r->upstream_states);
 1541|      5|    if (u->state == NULL) {
  ------------------
  |  Branch (1541:9): [True: 0, False: 5]
  ------------------
 1542|      0|        ngx_http_upstream_finalize_request(r, u,
 1543|      0|                                           NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1544|      0|        return;
 1545|      0|    }
 1546|       |
 1547|      5|    ngx_memzero(u->state, sizeof(ngx_http_upstream_state_t));
  ------------------
  |  |   88|      5|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
 1548|       |
 1549|      5|    u->start_time = ngx_current_msec;
 1550|       |
 1551|      5|    u->state->response_time = (ngx_msec_t) -1;
 1552|      5|    u->state->connect_time = (ngx_msec_t) -1;
 1553|      5|    u->state->header_time = (ngx_msec_t) -1;
 1554|       |
 1555|      5|    rc = ngx_event_connect_peer(&u->peer);
 1556|       |
 1557|      5|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 1558|      5|                   "http upstream connect: %i", rc);
 1559|       |
 1560|      5|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      5|#define  NGX_ERROR      -1
  ------------------
  |  Branch (1560:9): [True: 0, False: 5]
  ------------------
 1561|      0|        ngx_http_upstream_finalize_request(r, u,
 1562|      0|                                           NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1563|      0|        return;
 1564|      0|    }
 1565|       |
 1566|      5|    u->state->peer = u->peer.name;
 1567|       |
 1568|      5|    if (rc == NGX_BUSY) {
  ------------------
  |  |   41|      5|#define  NGX_BUSY       -3
  ------------------
  |  Branch (1568:9): [True: 0, False: 5]
  ------------------
 1569|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no live upstreams");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1570|      0|        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_NOLIVE);
  ------------------
  |  |   34|      0|#define NGX_HTTP_UPSTREAM_FT_NOLIVE          0x40000000
  ------------------
 1571|      0|        return;
 1572|      0|    }
 1573|       |
 1574|      5|    if (rc == NGX_DECLINED) {
  ------------------
  |  |   43|      5|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (1574:9): [True: 0, False: 5]
  ------------------
 1575|      0|        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
  ------------------
  |  |   20|      0|#define NGX_HTTP_UPSTREAM_FT_ERROR           0x00000002
  ------------------
 1576|      0|        return;
 1577|      0|    }
 1578|       |
 1579|       |    /* rc == NGX_OK || rc == NGX_AGAIN || rc == NGX_DONE */
 1580|       |
 1581|      5|    c = u->peer.connection;
 1582|       |
 1583|      5|    c->requests++;
 1584|       |
 1585|      5|    c->data = r;
 1586|       |
 1587|      5|    c->write->handler = ngx_http_upstream_handler;
 1588|      5|    c->read->handler = ngx_http_upstream_handler;
 1589|       |
 1590|      5|    u->write_event_handler = ngx_http_upstream_send_request_handler;
 1591|      5|    u->read_event_handler = ngx_http_upstream_process_header;
 1592|       |
 1593|      5|    c->sendfile &= r->connection->sendfile;
 1594|      5|    u->output.sendfile = c->sendfile;
 1595|       |
 1596|      5|    if (r->connection->tcp_nopush == NGX_TCP_NOPUSH_DISABLED) {
  ------------------
  |  Branch (1596:9): [True: 5, False: 0]
  ------------------
 1597|      5|        c->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
 1598|      5|    }
 1599|       |
 1600|      5|    if (c->pool == NULL) {
  ------------------
  |  Branch (1600:9): [True: 5, False: 0]
  ------------------
 1601|       |
 1602|       |        /* we need separate pool here to be able to cache SSL connections */
 1603|       |
 1604|      5|        c->pool = ngx_create_pool(128, r->connection->log);
 1605|      5|        if (c->pool == NULL) {
  ------------------
  |  Branch (1605:13): [True: 0, False: 5]
  ------------------
 1606|      0|            ngx_http_upstream_finalize_request(r, u,
 1607|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1608|      0|            return;
 1609|      0|        }
 1610|      5|    }
 1611|       |
 1612|      5|    c->log = r->connection->log;
 1613|      5|    c->pool->log = c->log;
 1614|      5|    c->read->log = c->log;
 1615|      5|    c->write->log = c->log;
 1616|       |
 1617|       |    /* init or reinit the ngx_output_chain() and ngx_chain_writer() contexts */
 1618|       |
 1619|      5|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      5|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 1620|       |
 1621|      5|    u->writer.out = NULL;
 1622|      5|    u->writer.last = &u->writer.out;
 1623|      5|    u->writer.connection = c;
 1624|      5|    u->writer.limit = clcf->sendfile_max_chunk;
 1625|       |
 1626|      5|    if (u->request_sent) {
  ------------------
  |  Branch (1626:9): [True: 0, False: 5]
  ------------------
 1627|      0|        if (ngx_http_upstream_reinit(r, u) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (1627:13): [True: 0, False: 0]
  ------------------
 1628|      0|            ngx_http_upstream_finalize_request(r, u,
 1629|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1630|      0|            return;
 1631|      0|        }
 1632|      0|    }
 1633|       |
 1634|      5|    if (r->request_body
  ------------------
  |  Branch (1634:9): [True: 5, False: 0]
  ------------------
 1635|      5|        && r->request_body->buf
  ------------------
  |  Branch (1635:12): [True: 0, False: 5]
  ------------------
 1636|      5|        && r->request_body->temp_file
  ------------------
  |  Branch (1636:12): [True: 0, False: 0]
  ------------------
 1637|      5|        && r == r->main)
  ------------------
  |  Branch (1637:12): [True: 0, False: 0]
  ------------------
 1638|      0|    {
 1639|       |        /*
 1640|       |         * the r->request_body->buf can be reused for one request only,
 1641|       |         * the subrequests should allocate their own temporary bufs
 1642|       |         */
 1643|       |
 1644|      0|        u->output.free = ngx_alloc_chain_link(r->pool);
 1645|      0|        if (u->output.free == NULL) {
  ------------------
  |  Branch (1645:13): [True: 0, False: 0]
  ------------------
 1646|      0|            ngx_http_upstream_finalize_request(r, u,
 1647|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 1648|      0|            return;
 1649|      0|        }
 1650|       |
 1651|      0|        u->output.free->buf = r->request_body->buf;
 1652|      0|        u->output.free->next = NULL;
 1653|      0|        u->output.allocated = 1;
 1654|       |
 1655|      0|        r->request_body->buf->pos = r->request_body->buf->start;
 1656|      0|        r->request_body->buf->last = r->request_body->buf->start;
 1657|      0|        r->request_body->buf->tag = u->output.tag;
 1658|      0|    }
 1659|       |
 1660|      5|    u->request_sent = 0;
 1661|      5|    u->request_body_sent = 0;
 1662|      5|    u->request_body_blocked = 0;
 1663|       |
 1664|      5|    if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      5|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (1664:9): [True: 0, False: 5]
  ------------------
 1665|      0|        ngx_add_timer(c->write, u->conf->connect_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 1666|      0|        return;
 1667|      0|    }
 1668|       |
 1669|       |#if (NGX_HTTP_SSL)
 1670|       |
 1671|       |    if (u->ssl && c->ssl == NULL) {
 1672|       |        ngx_http_upstream_ssl_init_connection(r, u, c);
 1673|       |        return;
 1674|       |    }
 1675|       |
 1676|       |#endif
 1677|       |
 1678|      5|    ngx_http_upstream_send_request(r, u, 1);
 1679|      5|}
ngx_http_upstream.c:ngx_http_upstream_process_header:
 2372|      5|{
 2373|      5|    ssize_t            n;
 2374|      5|    ngx_int_t          rc;
 2375|      5|    ngx_connection_t  *c;
 2376|       |
 2377|      5|    c = u->peer.connection;
 2378|       |
 2379|      5|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
 2380|      5|                   "http upstream process header");
 2381|       |
 2382|      5|    c->log->action = "reading response header from upstream";
 2383|       |
 2384|      5|    if (c->read->timedout) {
  ------------------
  |  Branch (2384:9): [True: 0, False: 5]
  ------------------
 2385|      0|        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_TIMEOUT);
  ------------------
  |  |   21|      0|#define NGX_HTTP_UPSTREAM_FT_TIMEOUT         0x00000004
  ------------------
 2386|      0|        return;
 2387|      0|    }
 2388|       |
 2389|      5|    if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2389:9): [True: 0, False: 5]
  |  Branch (2389:29): [True: 0, False: 0]
  ------------------
 2390|      0|        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
  ------------------
  |  |   20|      0|#define NGX_HTTP_UPSTREAM_FT_ERROR           0x00000002
  ------------------
 2391|      0|        return;
 2392|      0|    }
 2393|       |
 2394|      5|    if (u->buffer.start == NULL) {
  ------------------
  |  Branch (2394:9): [True: 5, False: 0]
  ------------------
 2395|      5|        u->buffer.start = ngx_palloc(r->pool, u->conf->buffer_size);
 2396|      5|        if (u->buffer.start == NULL) {
  ------------------
  |  Branch (2396:13): [True: 0, False: 5]
  ------------------
 2397|      0|            ngx_http_upstream_finalize_request(r, u,
 2398|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2399|      0|            return;
 2400|      0|        }
 2401|       |
 2402|      5|        u->buffer.pos = u->buffer.start;
 2403|      5|        u->buffer.last = u->buffer.start;
 2404|      5|        u->buffer.end = u->buffer.start + u->conf->buffer_size;
 2405|      5|        u->buffer.temporary = 1;
 2406|       |
 2407|      5|        u->buffer.tag = u->output.tag;
 2408|       |
 2409|      5|        if (ngx_list_init(&u->headers_in.headers, r->pool, 8,
  ------------------
  |  Branch (2409:13): [True: 0, False: 5]
  ------------------
 2410|      5|                          sizeof(ngx_table_elt_t))
 2411|      5|            != NGX_OK)
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 2412|      0|        {
 2413|      0|            ngx_http_upstream_finalize_request(r, u,
 2414|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2415|      0|            return;
 2416|      0|        }
 2417|       |
 2418|      5|        if (ngx_list_init(&u->headers_in.trailers, r->pool, 2,
  ------------------
  |  Branch (2418:13): [True: 0, False: 5]
  ------------------
 2419|      5|                          sizeof(ngx_table_elt_t))
 2420|      5|            != NGX_OK)
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 2421|      0|        {
 2422|      0|            ngx_http_upstream_finalize_request(r, u,
 2423|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2424|      0|            return;
 2425|      0|        }
 2426|       |
 2427|      5|#if (NGX_HTTP_CACHE)
 2428|       |
 2429|      5|        if (r->cache) {
  ------------------
  |  Branch (2429:13): [True: 0, False: 5]
  ------------------
 2430|      0|            u->buffer.pos += r->cache->header_start;
 2431|      0|            u->buffer.last = u->buffer.pos;
 2432|      0|        }
 2433|      5|#endif
 2434|      5|    }
 2435|       |
 2436|      5|    for ( ;; ) {
 2437|       |
 2438|      5|        n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last);
 2439|       |
 2440|      5|        if (n == NGX_AGAIN) {
  ------------------
  |  |   40|      5|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (2440:13): [True: 0, False: 5]
  ------------------
 2441|       |#if 0
 2442|       |            ngx_add_timer(rev, u->read_timeout);
 2443|       |#endif
 2444|       |
 2445|      0|            if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2445:17): [True: 0, False: 0]
  ------------------
 2446|      0|                ngx_http_upstream_finalize_request(r, u,
 2447|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2448|      0|                return;
 2449|      0|            }
 2450|       |
 2451|      0|            return;
 2452|      0|        }
 2453|       |
 2454|      5|        if (n == 0) {
  ------------------
  |  Branch (2454:13): [True: 0, False: 5]
  ------------------
 2455|      0|            ngx_log_error(NGX_LOG_ERR, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2456|      0|                          "upstream prematurely closed connection");
 2457|      0|        }
 2458|       |
 2459|      5|        if (n == NGX_ERROR || n == 0) {
  ------------------
  |  |   39|     10|#define  NGX_ERROR      -1
  ------------------
  |  Branch (2459:13): [True: 0, False: 5]
  |  Branch (2459:31): [True: 0, False: 5]
  ------------------
 2460|      0|            ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
  ------------------
  |  |   20|      0|#define NGX_HTTP_UPSTREAM_FT_ERROR           0x00000002
  ------------------
 2461|      0|            return;
 2462|      0|        }
 2463|       |
 2464|      5|        u->state->bytes_received += n;
 2465|       |
 2466|      5|        u->buffer.last += n;
 2467|       |
 2468|       |#if 0
 2469|       |        u->valid_header_in = 0;
 2470|       |
 2471|       |        u->peer.cached = 0;
 2472|       |#endif
 2473|       |
 2474|      5|        rc = u->process_header(r);
 2475|       |
 2476|      5|        if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      5|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (2476:13): [True: 0, False: 5]
  ------------------
 2477|       |
 2478|      0|            if (u->buffer.last == u->buffer.end) {
  ------------------
  |  Branch (2478:17): [True: 0, False: 0]
  ------------------
 2479|      0|                ngx_log_error(NGX_LOG_ERR, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2480|      0|                              "upstream sent too big header");
 2481|       |
 2482|      0|                ngx_http_upstream_next(r, u,
 2483|      0|                                       NGX_HTTP_UPSTREAM_FT_INVALID_HEADER);
  ------------------
  |  |   22|      0|#define NGX_HTTP_UPSTREAM_FT_INVALID_HEADER  0x00000008
  ------------------
 2484|      0|                return;
 2485|      0|            }
 2486|       |
 2487|      0|            continue;
 2488|      0|        }
 2489|       |
 2490|      5|        break;
 2491|      5|    }
 2492|       |
 2493|      5|    if (rc == NGX_HTTP_UPSTREAM_INVALID_HEADER) {
  ------------------
  |  |   45|      5|#define NGX_HTTP_UPSTREAM_INVALID_HEADER     40
  ------------------
  |  Branch (2493:9): [True: 0, False: 5]
  ------------------
 2494|      0|        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_INVALID_HEADER);
  ------------------
  |  |   22|      0|#define NGX_HTTP_UPSTREAM_FT_INVALID_HEADER  0x00000008
  ------------------
 2495|      0|        return;
 2496|      0|    }
 2497|       |
 2498|      5|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      5|#define  NGX_ERROR      -1
  ------------------
  |  Branch (2498:9): [True: 0, False: 5]
  ------------------
 2499|      0|        ngx_http_upstream_finalize_request(r, u,
 2500|      0|                                           NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2501|      0|        return;
 2502|      0|    }
 2503|       |
 2504|       |    /* rc == NGX_OK */
 2505|       |
 2506|      5|    u->state->header_time = ngx_current_msec - u->start_time;
 2507|       |
 2508|      5|    if (u->headers_in.status_n >= NGX_HTTP_SPECIAL_RESPONSE) {
  ------------------
  |  |   84|      5|#define NGX_HTTP_SPECIAL_RESPONSE          300
  ------------------
  |  Branch (2508:9): [True: 3, False: 2]
  ------------------
 2509|       |
 2510|      3|        if (ngx_http_upstream_test_next(r, u) == NGX_OK) {
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
  |  Branch (2510:13): [True: 0, False: 3]
  ------------------
 2511|      0|            return;
 2512|      0|        }
 2513|       |
 2514|      3|        if (ngx_http_upstream_intercept_errors(r, u) == NGX_OK) {
  ------------------
  |  |   38|      3|#define  NGX_OK          0
  ------------------
  |  Branch (2514:13): [True: 0, False: 3]
  ------------------
 2515|      0|            return;
 2516|      0|        }
 2517|      3|    }
 2518|       |
 2519|      5|    if (ngx_http_upstream_process_headers(r, u) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (2519:9): [True: 0, False: 5]
  ------------------
 2520|      0|        return;
 2521|      0|    }
 2522|       |
 2523|      5|    ngx_http_upstream_send_response(r, u);
 2524|      5|}
ngx_http_upstream.c:ngx_http_upstream_test_connect:
 2764|      5|{
 2765|      5|    int        err;
 2766|      5|    socklen_t  len;
 2767|       |
 2768|       |#if (NGX_HAVE_KQUEUE)
 2769|       |
 2770|       |    if (ngx_event_flags & NGX_USE_KQUEUE_EVENT)  {
 2771|       |        if (c->write->pending_eof || c->read->pending_eof) {
 2772|       |            if (c->write->pending_eof) {
 2773|       |                err = c->write->kq_errno;
 2774|       |
 2775|       |            } else {
 2776|       |                err = c->read->kq_errno;
 2777|       |            }
 2778|       |
 2779|       |            c->log->action = "connecting to upstream";
 2780|       |            (void) ngx_connection_error(c, err,
 2781|       |                                    "kevent() reported that connect() failed");
 2782|       |            return NGX_ERROR;
 2783|       |        }
 2784|       |
 2785|       |    } else
 2786|       |#endif
 2787|      5|    {
 2788|      5|        err = 0;
 2789|      5|        len = sizeof(int);
 2790|       |
 2791|       |        /*
 2792|       |         * BSDs and Linux return 0 and set a pending error in err
 2793|       |         * Solaris returns -1 and sets errno
 2794|       |         */
 2795|       |
 2796|      5|        if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void *) &err, &len)
  ------------------
  |  Branch (2796:13): [True: 0, False: 5]
  ------------------
 2797|      5|            == -1)
 2798|      0|        {
 2799|      0|            err = ngx_socket_errno;
  ------------------
  |  |   70|      0|#define ngx_socket_errno           errno
  ------------------
 2800|      0|        }
 2801|       |
 2802|      5|        if (err) {
  ------------------
  |  Branch (2802:13): [True: 0, False: 5]
  ------------------
 2803|      0|            c->log->action = "connecting to upstream";
 2804|      0|            (void) ngx_connection_error(c, err, "connect() failed");
 2805|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2806|      0|        }
 2807|      5|    }
 2808|       |
 2809|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 2810|      5|}
ngx_http_upstream.c:ngx_http_upstream_test_next:
 2529|      3|{
 2530|      3|    ngx_msec_t                 timeout;
 2531|      3|    ngx_uint_t                 status, mask;
 2532|      3|    ngx_http_upstream_next_t  *un;
 2533|       |
 2534|      3|    status = u->headers_in.status_n;
 2535|       |
 2536|     24|    for (un = ngx_http_upstream_next_errors; un->status; un++) {
  ------------------
  |  Branch (2536:46): [True: 21, False: 3]
  ------------------
 2537|       |
 2538|     21|        if (status != un->status) {
  ------------------
  |  Branch (2538:13): [True: 21, False: 0]
  ------------------
 2539|     21|            continue;
 2540|     21|        }
 2541|       |
 2542|      0|        timeout = u->conf->next_upstream_timeout;
 2543|       |
 2544|      0|        if (u->request_sent
  ------------------
  |  Branch (2544:13): [True: 0, False: 0]
  ------------------
 2545|      0|            && (r->method & (NGX_HTTP_POST|NGX_HTTP_LOCK|NGX_HTTP_PATCH)))
  ------------------
  |  |   32|      0|#define NGX_HTTP_POST                      0x00000008
  ------------------
                          && (r->method & (NGX_HTTP_POST|NGX_HTTP_LOCK|NGX_HTTP_PATCH)))
  ------------------
  |  |   41|      0|#define NGX_HTTP_LOCK                      0x00001000
  ------------------
                          && (r->method & (NGX_HTTP_POST|NGX_HTTP_LOCK|NGX_HTTP_PATCH)))
  ------------------
  |  |   43|      0|#define NGX_HTTP_PATCH                     0x00004000
  ------------------
  |  Branch (2545:16): [True: 0, False: 0]
  ------------------
 2546|      0|        {
 2547|      0|            mask = un->mask | NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT;
  ------------------
  |  |   33|      0|#define NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT  0x00004000
  ------------------
 2548|       |
 2549|      0|        } else {
 2550|      0|            mask = un->mask;
 2551|      0|        }
 2552|       |
 2553|      0|        if (u->peer.tries > 1
  ------------------
  |  Branch (2553:13): [True: 0, False: 0]
  ------------------
 2554|      0|            && ((u->conf->next_upstream & mask) == mask)
  ------------------
  |  Branch (2554:16): [True: 0, False: 0]
  ------------------
 2555|      0|            && !(u->request_sent && r->request_body_no_buffering)
  ------------------
  |  Branch (2555:18): [True: 0, False: 0]
  |  Branch (2555:37): [True: 0, False: 0]
  ------------------
 2556|      0|            && !(timeout && ngx_current_msec - u->peer.start_time >= timeout))
  ------------------
  |  Branch (2556:18): [True: 0, False: 0]
  |  Branch (2556:29): [True: 0, False: 0]
  ------------------
 2557|      0|        {
 2558|      0|            ngx_http_upstream_next(r, u, un->mask);
 2559|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2560|      0|        }
 2561|       |
 2562|      0|#if (NGX_HTTP_CACHE)
 2563|       |
 2564|      0|        if (u->cache_status == NGX_HTTP_CACHE_EXPIRED
  ------------------
  |  |   19|      0|#define NGX_HTTP_CACHE_EXPIRED       3
  ------------------
  |  Branch (2564:13): [True: 0, False: 0]
  ------------------
 2565|      0|            && (u->conf->cache_use_stale & un->mask))
  ------------------
  |  Branch (2565:16): [True: 0, False: 0]
  ------------------
 2566|      0|        {
 2567|      0|            ngx_int_t  rc;
 2568|       |
 2569|      0|            rc = u->reinit_request(r);
 2570|       |
 2571|      0|            if (rc != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2571:17): [True: 0, False: 0]
  ------------------
 2572|      0|                ngx_http_upstream_finalize_request(r, u, rc);
 2573|      0|                return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2574|      0|            }
 2575|       |
 2576|      0|            u->cache_status = NGX_HTTP_CACHE_STALE;
  ------------------
  |  |   20|      0|#define NGX_HTTP_CACHE_STALE         4
  ------------------
 2577|      0|            rc = ngx_http_upstream_cache_send(r, u);
 2578|       |
 2579|      0|            if (rc == NGX_DONE) {
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  |  Branch (2579:17): [True: 0, False: 0]
  ------------------
 2580|      0|                return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2581|      0|            }
 2582|       |
 2583|      0|            if (rc == NGX_HTTP_UPSTREAM_INVALID_HEADER) {
  ------------------
  |  |   45|      0|#define NGX_HTTP_UPSTREAM_INVALID_HEADER     40
  ------------------
  |  Branch (2583:17): [True: 0, False: 0]
  ------------------
 2584|      0|                rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2585|      0|            }
 2586|       |
 2587|      0|            ngx_http_upstream_finalize_request(r, u, rc);
 2588|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2589|      0|        }
 2590|       |
 2591|      0|#endif
 2592|       |
 2593|      0|        break;
 2594|      0|    }
 2595|       |
 2596|      3|#if (NGX_HTTP_CACHE)
 2597|       |
 2598|      3|    if (status == NGX_HTTP_NOT_MODIFIED
  ------------------
  |  |   88|      6|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
  |  Branch (2598:9): [True: 0, False: 3]
  ------------------
 2599|      3|        && u->cache_status == NGX_HTTP_CACHE_EXPIRED
  ------------------
  |  |   19|      3|#define NGX_HTTP_CACHE_EXPIRED       3
  ------------------
  |  Branch (2599:12): [True: 0, False: 0]
  ------------------
 2600|      3|        && u->conf->cache_revalidate)
  ------------------
  |  Branch (2600:12): [True: 0, False: 0]
  ------------------
 2601|      0|    {
 2602|      0|        time_t     now, valid, updating, error;
 2603|      0|        ngx_int_t  rc;
 2604|       |
 2605|      0|        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2606|      0|                       "http upstream not modified");
 2607|       |
 2608|      0|        now = ngx_time();
  ------------------
  |  |   36|      0|#define ngx_time()           ngx_cached_time->sec
  ------------------
 2609|       |
 2610|      0|        valid = r->cache->valid_sec;
 2611|      0|        updating = r->cache->updating_sec;
 2612|      0|        error = r->cache->error_sec;
 2613|       |
 2614|      0|        rc = u->reinit_request(r);
 2615|       |
 2616|      0|        if (rc != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2616:13): [True: 0, False: 0]
  ------------------
 2617|      0|            ngx_http_upstream_finalize_request(r, u, rc);
 2618|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2619|      0|        }
 2620|       |
 2621|      0|        u->cache_status = NGX_HTTP_CACHE_REVALIDATED;
  ------------------
  |  |   22|      0|#define NGX_HTTP_CACHE_REVALIDATED   6
  ------------------
 2622|      0|        rc = ngx_http_upstream_cache_send(r, u);
 2623|       |
 2624|      0|        if (rc == NGX_DONE) {
  ------------------
  |  |   42|      0|#define  NGX_DONE       -4
  ------------------
  |  Branch (2624:13): [True: 0, False: 0]
  ------------------
 2625|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2626|      0|        }
 2627|       |
 2628|      0|        if (rc == NGX_HTTP_UPSTREAM_INVALID_HEADER) {
  ------------------
  |  |   45|      0|#define NGX_HTTP_UPSTREAM_INVALID_HEADER     40
  ------------------
  |  Branch (2628:13): [True: 0, False: 0]
  ------------------
 2629|      0|            rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2630|      0|        }
 2631|       |
 2632|      0|        if (valid == 0) {
  ------------------
  |  Branch (2632:13): [True: 0, False: 0]
  ------------------
 2633|      0|            valid = r->cache->valid_sec;
 2634|      0|            updating = r->cache->updating_sec;
 2635|      0|            error = r->cache->error_sec;
 2636|      0|        }
 2637|       |
 2638|      0|        if (valid == 0) {
  ------------------
  |  Branch (2638:13): [True: 0, False: 0]
  ------------------
 2639|      0|            valid = ngx_http_file_cache_valid(u->conf->cache_valid,
 2640|      0|                                              u->headers_in.status_n);
 2641|      0|            if (valid) {
  ------------------
  |  Branch (2641:17): [True: 0, False: 0]
  ------------------
 2642|      0|                valid = now + valid;
 2643|      0|            }
 2644|      0|        }
 2645|       |
 2646|      0|        if (valid) {
  ------------------
  |  Branch (2646:13): [True: 0, False: 0]
  ------------------
 2647|      0|            r->cache->valid_sec = valid;
 2648|      0|            r->cache->updating_sec = updating;
 2649|      0|            r->cache->error_sec = error;
 2650|       |
 2651|      0|            r->cache->date = now;
 2652|       |
 2653|      0|            ngx_http_file_cache_update_header(r);
 2654|      0|        }
 2655|       |
 2656|      0|        ngx_http_upstream_finalize_request(r, u, rc);
 2657|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2658|      0|    }
 2659|       |
 2660|      3|#endif
 2661|       |
 2662|      3|    return NGX_DECLINED;
  ------------------
  |  |   43|      3|#define  NGX_DECLINED   -5
  ------------------
 2663|      3|}
ngx_http_upstream.c:ngx_http_upstream_intercept_errors:
 2669|      3|{
 2670|      3|    ngx_int_t                  status;
 2671|      3|    ngx_uint_t                 i;
 2672|      3|    ngx_table_elt_t           *h, *ho, **ph;
 2673|      3|    ngx_http_err_page_t       *err_page;
 2674|      3|    ngx_http_core_loc_conf_t  *clcf;
 2675|       |
 2676|      3|    status = u->headers_in.status_n;
 2677|       |
 2678|      3|    if (status == NGX_HTTP_NOT_FOUND && u->conf->intercept_404) {
  ------------------
  |  |   95|      6|#define NGX_HTTP_NOT_FOUND                 404
  ------------------
  |  Branch (2678:9): [True: 0, False: 3]
  |  Branch (2678:41): [True: 0, False: 0]
  ------------------
 2679|      0|        ngx_http_upstream_finalize_request(r, u, NGX_HTTP_NOT_FOUND);
  ------------------
  |  |   95|      0|#define NGX_HTTP_NOT_FOUND                 404
  ------------------
 2680|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2681|      0|    }
 2682|       |
 2683|      3|    if (!u->conf->intercept_errors) {
  ------------------
  |  Branch (2683:9): [True: 3, False: 0]
  ------------------
 2684|      3|        return NGX_DECLINED;
  ------------------
  |  |   43|      3|#define  NGX_DECLINED   -5
  ------------------
 2685|      3|    }
 2686|       |
 2687|      0|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 2688|       |
 2689|      0|    if (clcf->error_pages == NULL) {
  ------------------
  |  Branch (2689:9): [True: 0, False: 0]
  ------------------
 2690|      0|        return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 2691|      0|    }
 2692|       |
 2693|      0|    err_page = clcf->error_pages->elts;
 2694|      0|    for (i = 0; i < clcf->error_pages->nelts; i++) {
  ------------------
  |  Branch (2694:17): [True: 0, False: 0]
  ------------------
 2695|       |
 2696|      0|        if (err_page[i].status == status) {
  ------------------
  |  Branch (2696:13): [True: 0, False: 0]
  ------------------
 2697|       |
 2698|      0|            if (status == NGX_HTTP_UNAUTHORIZED
  ------------------
  |  |   93|      0|#define NGX_HTTP_UNAUTHORIZED              401
  ------------------
  |  Branch (2698:17): [True: 0, False: 0]
  ------------------
 2699|      0|                && u->headers_in.www_authenticate)
  ------------------
  |  Branch (2699:20): [True: 0, False: 0]
  ------------------
 2700|      0|            {
 2701|      0|                h = u->headers_in.www_authenticate;
 2702|      0|                ph = &r->headers_out.www_authenticate;
 2703|       |
 2704|      0|                while (h) {
  ------------------
  |  Branch (2704:24): [True: 0, False: 0]
  ------------------
 2705|      0|                    ho = ngx_list_push(&r->headers_out.headers);
 2706|       |
 2707|      0|                    if (ho == NULL) {
  ------------------
  |  Branch (2707:25): [True: 0, False: 0]
  ------------------
 2708|      0|                        ngx_http_upstream_finalize_request(r, u,
 2709|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2710|      0|                        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2711|      0|                    }
 2712|       |
 2713|      0|                    *ho = *h;
 2714|      0|                    ho->next = NULL;
 2715|       |
 2716|      0|                    *ph = ho;
 2717|      0|                    ph = &ho->next;
 2718|       |
 2719|      0|                    h = h->next;
 2720|      0|                }
 2721|      0|            }
 2722|       |
 2723|      0|#if (NGX_HTTP_CACHE)
 2724|       |
 2725|      0|            if (r->cache) {
  ------------------
  |  Branch (2725:17): [True: 0, False: 0]
  ------------------
 2726|       |
 2727|      0|                if (u->headers_in.no_cache || u->headers_in.expired) {
  ------------------
  |  Branch (2727:21): [True: 0, False: 0]
  |  Branch (2727:47): [True: 0, False: 0]
  ------------------
 2728|      0|                    u->cacheable = 0;
 2729|      0|                }
 2730|       |
 2731|      0|                if (u->cacheable) {
  ------------------
  |  Branch (2731:21): [True: 0, False: 0]
  ------------------
 2732|      0|                    time_t  valid;
 2733|       |
 2734|      0|                    valid = r->cache->valid_sec;
 2735|       |
 2736|      0|                    if (valid == 0) {
  ------------------
  |  Branch (2736:25): [True: 0, False: 0]
  ------------------
 2737|      0|                        valid = ngx_http_file_cache_valid(u->conf->cache_valid,
 2738|      0|                                                          status);
 2739|      0|                        if (valid) {
  ------------------
  |  Branch (2739:29): [True: 0, False: 0]
  ------------------
 2740|      0|                            r->cache->valid_sec = ngx_time() + valid;
  ------------------
  |  |   36|      0|#define ngx_time()           ngx_cached_time->sec
  ------------------
 2741|      0|                        }
 2742|      0|                    }
 2743|       |
 2744|      0|                    if (valid) {
  ------------------
  |  Branch (2744:25): [True: 0, False: 0]
  ------------------
 2745|      0|                        r->cache->error = status;
 2746|      0|                    }
 2747|      0|                }
 2748|       |
 2749|      0|                ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
 2750|      0|            }
 2751|      0|#endif
 2752|      0|            ngx_http_upstream_finalize_request(r, u, status);
 2753|       |
 2754|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2755|      0|        }
 2756|      0|    }
 2757|       |
 2758|      0|    return NGX_DECLINED;
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
 2759|      0|}
ngx_http_upstream.c:ngx_http_upstream_send_response:
 3015|      5|{
 3016|      5|    ssize_t                    n;
 3017|      5|    ngx_int_t                  rc;
 3018|      5|    ngx_event_pipe_t          *p;
 3019|      5|    ngx_connection_t          *c;
 3020|      5|    ngx_http_core_loc_conf_t  *clcf;
 3021|       |
 3022|      5|    rc = ngx_http_send_header(r);
 3023|       |
 3024|      5|    if (rc == NGX_ERROR || rc > NGX_OK || r->post_action) {
  ------------------
  |  |   39|     10|#define  NGX_ERROR      -1
  ------------------
                  if (rc == NGX_ERROR || rc > NGX_OK || r->post_action) {
  ------------------
  |  |   38|     10|#define  NGX_OK          0
  ------------------
  |  Branch (3024:9): [True: 0, False: 5]
  |  Branch (3024:28): [True: 0, False: 5]
  |  Branch (3024:43): [True: 0, False: 5]
  ------------------
 3025|      0|        ngx_http_upstream_finalize_request(r, u, rc);
 3026|      0|        return;
 3027|      0|    }
 3028|       |
 3029|      5|    u->header_sent = 1;
 3030|       |
 3031|      5|    if (u->upgrade) {
  ------------------
  |  Branch (3031:9): [True: 0, False: 5]
  ------------------
 3032|       |
 3033|      0|#if (NGX_HTTP_CACHE)
 3034|       |
 3035|      0|        if (r->cache) {
  ------------------
  |  Branch (3035:13): [True: 0, False: 0]
  ------------------
 3036|      0|            ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
 3037|      0|        }
 3038|       |
 3039|      0|#endif
 3040|       |
 3041|      0|        ngx_http_upstream_upgrade(r, u);
 3042|      0|        return;
 3043|      0|    }
 3044|       |
 3045|      5|    c = r->connection;
 3046|       |
 3047|      5|    if (r->header_only) {
  ------------------
  |  Branch (3047:9): [True: 0, False: 5]
  ------------------
 3048|       |
 3049|      0|        if (!u->buffering) {
  ------------------
  |  Branch (3049:13): [True: 0, False: 0]
  ------------------
 3050|      0|            ngx_http_upstream_finalize_request(r, u, rc);
 3051|      0|            return;
 3052|      0|        }
 3053|       |
 3054|      0|        if (!u->cacheable && !u->store) {
  ------------------
  |  Branch (3054:13): [True: 0, False: 0]
  |  Branch (3054:30): [True: 0, False: 0]
  ------------------
 3055|      0|            ngx_http_upstream_finalize_request(r, u, rc);
 3056|      0|            return;
 3057|      0|        }
 3058|       |
 3059|      0|        u->pipe->downstream_error = 1;
 3060|      0|    }
 3061|       |
 3062|      5|    if (r->request_body && r->request_body->temp_file
  ------------------
  |  Branch (3062:9): [True: 5, False: 0]
  |  Branch (3062:28): [True: 0, False: 5]
  ------------------
 3063|      5|        && r == r->main && !r->preserve_body
  ------------------
  |  Branch (3063:12): [True: 0, False: 0]
  |  Branch (3063:28): [True: 0, False: 0]
  ------------------
 3064|      5|        && !u->conf->preserve_output)
  ------------------
  |  Branch (3064:12): [True: 0, False: 0]
  ------------------
 3065|      0|    {
 3066|      0|        ngx_pool_run_cleanup_file(r->pool, r->request_body->temp_file->file.fd);
 3067|      0|        r->request_body->temp_file->file.fd = NGX_INVALID_FILE;
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
 3068|      0|    }
 3069|       |
 3070|      5|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      5|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 3071|       |
 3072|      5|    if (!u->buffering) {
  ------------------
  |  Branch (3072:9): [True: 5, False: 0]
  ------------------
 3073|       |
 3074|      5|#if (NGX_HTTP_CACHE)
 3075|       |
 3076|      5|        if (r->cache) {
  ------------------
  |  Branch (3076:13): [True: 0, False: 5]
  ------------------
 3077|      0|            ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
 3078|      0|        }
 3079|       |
 3080|      5|#endif
 3081|       |
 3082|      5|        if (u->input_filter == NULL) {
  ------------------
  |  Branch (3082:13): [True: 0, False: 5]
  ------------------
 3083|      0|            u->input_filter_init = ngx_http_upstream_non_buffered_filter_init;
 3084|      0|            u->input_filter = ngx_http_upstream_non_buffered_filter;
 3085|      0|            u->input_filter_ctx = r;
 3086|      0|        }
 3087|       |
 3088|      5|        u->read_event_handler = ngx_http_upstream_process_non_buffered_upstream;
 3089|      5|        r->write_event_handler =
 3090|      5|                             ngx_http_upstream_process_non_buffered_downstream;
 3091|       |
 3092|      5|        r->limit_rate = 0;
 3093|      5|        r->limit_rate_set = 1;
 3094|       |
 3095|      5|        if (u->input_filter_init(u->input_filter_ctx) == NGX_ERROR) {
  ------------------
  |  |   39|      5|#define  NGX_ERROR      -1
  ------------------
  |  Branch (3095:13): [True: 0, False: 5]
  ------------------
 3096|      0|            ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3097|      0|            return;
 3098|      0|        }
 3099|       |
 3100|      5|        if (clcf->tcp_nodelay && ngx_tcp_nodelay(c) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (3100:13): [True: 5, False: 0]
  |  Branch (3100:34): [True: 0, False: 5]
  ------------------
 3101|      0|            ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3102|      0|            return;
 3103|      0|        }
 3104|       |
 3105|      5|        n = u->buffer.last - u->buffer.pos;
 3106|       |
 3107|      5|        if (n) {
  ------------------
  |  Branch (3107:13): [True: 4, False: 1]
  ------------------
 3108|      4|            u->buffer.last = u->buffer.pos;
 3109|       |
 3110|      4|            u->state->response_length += n;
 3111|       |
 3112|      4|            if (u->input_filter(u->input_filter_ctx, n) == NGX_ERROR) {
  ------------------
  |  |   39|      4|#define  NGX_ERROR      -1
  ------------------
  |  Branch (3112:17): [True: 0, False: 4]
  ------------------
 3113|      0|                ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3114|      0|                return;
 3115|      0|            }
 3116|       |
 3117|      4|            ngx_http_upstream_process_non_buffered_downstream(r);
 3118|       |
 3119|      4|        } else {
 3120|      1|            u->buffer.pos = u->buffer.start;
 3121|      1|            u->buffer.last = u->buffer.start;
 3122|       |
 3123|      1|            if (ngx_http_send_special(r, NGX_HTTP_FLUSH) == NGX_ERROR) {
  ------------------
  |  |  145|      1|#define NGX_HTTP_FLUSH  2
  ------------------
                          if (ngx_http_send_special(r, NGX_HTTP_FLUSH) == NGX_ERROR) {
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
  |  Branch (3123:17): [True: 0, False: 1]
  ------------------
 3124|      0|                ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3125|      0|                return;
 3126|      0|            }
 3127|       |
 3128|      1|            ngx_http_upstream_process_non_buffered_upstream(r, u);
 3129|      1|        }
 3130|       |
 3131|      5|        return;
 3132|      5|    }
 3133|       |
 3134|       |    /* TODO: preallocate event_pipe bufs, look "Content-Length" */
 3135|       |
 3136|      0|#if (NGX_HTTP_CACHE)
 3137|       |
 3138|      0|    if (r->cache && r->cache->file.fd != NGX_INVALID_FILE) {
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
  |  Branch (3138:9): [True: 0, False: 0]
  |  Branch (3138:21): [True: 0, False: 0]
  ------------------
 3139|      0|        ngx_pool_run_cleanup_file(r->pool, r->cache->file.fd);
 3140|      0|        r->cache->file.fd = NGX_INVALID_FILE;
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
 3141|      0|    }
 3142|       |
 3143|      0|    switch (ngx_http_test_predicates(r, u->conf->no_cache)) {
 3144|       |
 3145|      0|    case NGX_ERROR:
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (3145:5): [True: 0, False: 0]
  ------------------
 3146|      0|        ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3147|      0|        return;
 3148|       |
 3149|      0|    case NGX_DECLINED:
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (3149:5): [True: 0, False: 0]
  ------------------
 3150|      0|        u->cacheable = 0;
 3151|      0|        break;
 3152|       |
 3153|      0|    default: /* NGX_OK */
  ------------------
  |  Branch (3153:5): [True: 0, False: 0]
  ------------------
 3154|       |
 3155|      0|        if (u->cache_status == NGX_HTTP_CACHE_BYPASS) {
  ------------------
  |  |   18|      0|#define NGX_HTTP_CACHE_BYPASS        2
  ------------------
  |  Branch (3155:13): [True: 0, False: 0]
  ------------------
 3156|       |
 3157|       |            /* create cache if previously bypassed */
 3158|       |
 3159|      0|            if (ngx_http_file_cache_create(r) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3159:17): [True: 0, False: 0]
  ------------------
 3160|      0|                ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3161|      0|                return;
 3162|      0|            }
 3163|      0|        }
 3164|       |
 3165|      0|        break;
 3166|      0|    }
 3167|       |
 3168|      0|    if (u->cacheable) {
  ------------------
  |  Branch (3168:9): [True: 0, False: 0]
  ------------------
 3169|      0|        time_t  now, valid;
 3170|       |
 3171|      0|        now = ngx_time();
  ------------------
  |  |   36|      0|#define ngx_time()           ngx_cached_time->sec
  ------------------
 3172|       |
 3173|      0|        valid = r->cache->valid_sec;
 3174|       |
 3175|      0|        if (valid == 0) {
  ------------------
  |  Branch (3175:13): [True: 0, False: 0]
  ------------------
 3176|      0|            valid = ngx_http_file_cache_valid(u->conf->cache_valid,
 3177|      0|                                              u->headers_in.status_n);
 3178|      0|            if (valid) {
  ------------------
  |  Branch (3178:17): [True: 0, False: 0]
  ------------------
 3179|      0|                r->cache->valid_sec = now + valid;
 3180|      0|            }
 3181|      0|        }
 3182|       |
 3183|      0|        if (valid) {
  ------------------
  |  Branch (3183:13): [True: 0, False: 0]
  ------------------
 3184|      0|            r->cache->date = now;
 3185|      0|            r->cache->body_start = (u_short) (u->buffer.pos - u->buffer.start);
 3186|       |
 3187|      0|            if (u->headers_in.status_n == NGX_HTTP_OK
  ------------------
  |  |   78|      0|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (3187:17): [True: 0, False: 0]
  ------------------
 3188|      0|                || u->headers_in.status_n == NGX_HTTP_PARTIAL_CONTENT)
  ------------------
  |  |   82|      0|#define NGX_HTTP_PARTIAL_CONTENT           206
  ------------------
  |  Branch (3188:20): [True: 0, False: 0]
  ------------------
 3189|      0|            {
 3190|      0|                r->cache->last_modified = u->headers_in.last_modified_time;
 3191|       |
 3192|      0|                if (u->headers_in.etag) {
  ------------------
  |  Branch (3192:21): [True: 0, False: 0]
  ------------------
 3193|      0|                    r->cache->etag = u->headers_in.etag->value;
 3194|       |
 3195|      0|                } else {
 3196|      0|                    ngx_str_null(&r->cache->etag);
  ------------------
  |  |   44|      0|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
 3197|      0|                }
 3198|       |
 3199|      0|            } else {
 3200|      0|                r->cache->last_modified = -1;
 3201|      0|                ngx_str_null(&r->cache->etag);
  ------------------
  |  |   44|      0|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
 3202|      0|            }
 3203|       |
 3204|      0|            if (ngx_http_file_cache_set_header(r, u->buffer.start) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3204:17): [True: 0, False: 0]
  ------------------
 3205|      0|                ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3206|      0|                return;
 3207|      0|            }
 3208|       |
 3209|      0|        } else {
 3210|      0|            u->cacheable = 0;
 3211|      0|        }
 3212|      0|    }
 3213|       |
 3214|      0|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
 3215|      0|                   "http cacheable: %d", u->cacheable);
 3216|       |
 3217|      0|    if (u->cacheable == 0 && r->cache) {
  ------------------
  |  Branch (3217:9): [True: 0, False: 0]
  |  Branch (3217:30): [True: 0, False: 0]
  ------------------
 3218|      0|        ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
 3219|      0|    }
 3220|       |
 3221|      0|    if (r->header_only && !u->cacheable && !u->store) {
  ------------------
  |  Branch (3221:9): [True: 0, False: 0]
  |  Branch (3221:27): [True: 0, False: 0]
  |  Branch (3221:44): [True: 0, False: 0]
  ------------------
 3222|      0|        ngx_http_upstream_finalize_request(r, u, 0);
 3223|      0|        return;
 3224|      0|    }
 3225|       |
 3226|      0|#endif
 3227|       |
 3228|      0|    p = u->pipe;
 3229|       |
 3230|      0|    p->output_filter = ngx_http_upstream_output_filter;
 3231|      0|    p->output_ctx = r;
 3232|      0|    p->tag = u->output.tag;
 3233|      0|    p->bufs = u->conf->bufs;
 3234|      0|    p->busy_size = u->conf->busy_buffers_size;
 3235|      0|    p->upstream = u->peer.connection;
 3236|      0|    p->downstream = c;
 3237|      0|    p->pool = r->pool;
 3238|      0|    p->log = c->log;
 3239|      0|    p->limit_rate = u->conf->limit_rate;
 3240|      0|    p->start_sec = ngx_time();
  ------------------
  |  |   36|      0|#define ngx_time()           ngx_cached_time->sec
  ------------------
 3241|       |
 3242|      0|    p->cacheable = u->cacheable || u->store;
  ------------------
  |  Branch (3242:20): [True: 0, False: 0]
  |  Branch (3242:36): [True: 0, False: 0]
  ------------------
 3243|       |
 3244|      0|    p->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t));
 3245|      0|    if (p->temp_file == NULL) {
  ------------------
  |  Branch (3245:9): [True: 0, False: 0]
  ------------------
 3246|      0|        ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3247|      0|        return;
 3248|      0|    }
 3249|       |
 3250|      0|    p->temp_file->file.fd = NGX_INVALID_FILE;
  ------------------
  |  |   49|      0|#define NGX_INVALID_FILE         -1
  ------------------
 3251|      0|    p->temp_file->file.log = c->log;
 3252|      0|    p->temp_file->path = u->conf->temp_path;
 3253|      0|    p->temp_file->pool = r->pool;
 3254|       |
 3255|      0|    if (p->cacheable) {
  ------------------
  |  Branch (3255:9): [True: 0, False: 0]
  ------------------
 3256|      0|        p->temp_file->persistent = 1;
 3257|       |
 3258|      0|#if (NGX_HTTP_CACHE)
 3259|      0|        if (r->cache && !r->cache->file_cache->use_temp_path) {
  ------------------
  |  Branch (3259:13): [True: 0, False: 0]
  |  Branch (3259:25): [True: 0, False: 0]
  ------------------
 3260|      0|            p->temp_file->path = r->cache->file_cache->path;
 3261|      0|            p->temp_file->file.name = r->cache->file.name;
 3262|      0|        }
 3263|      0|#endif
 3264|       |
 3265|      0|    } else {
 3266|      0|        p->temp_file->log_level = NGX_LOG_WARN;
  ------------------
  |  |   21|      0|#define NGX_LOG_WARN              5
  ------------------
 3267|      0|        p->temp_file->warn = "an upstream response is buffered "
 3268|      0|                             "to a temporary file";
 3269|      0|    }
 3270|       |
 3271|      0|    p->max_temp_file_size = u->conf->max_temp_file_size;
 3272|      0|    p->temp_file_write_size = u->conf->temp_file_write_size;
 3273|       |
 3274|       |#if (NGX_THREADS)
 3275|       |    if (clcf->aio == NGX_HTTP_AIO_THREADS && clcf->aio_write) {
 3276|       |        p->thread_handler = ngx_http_upstream_thread_handler;
 3277|       |        p->thread_ctx = r;
 3278|       |    }
 3279|       |#endif
 3280|       |
 3281|      0|    p->preread_bufs = ngx_alloc_chain_link(r->pool);
 3282|      0|    if (p->preread_bufs == NULL) {
  ------------------
  |  Branch (3282:9): [True: 0, False: 0]
  ------------------
 3283|      0|        ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3284|      0|        return;
 3285|      0|    }
 3286|       |
 3287|      0|    p->preread_bufs->buf = &u->buffer;
 3288|      0|    p->preread_bufs->next = NULL;
 3289|      0|    u->buffer.recycled = 1;
 3290|       |
 3291|      0|    p->preread_size = u->buffer.last - u->buffer.pos;
 3292|       |
 3293|      0|    if (u->cacheable) {
  ------------------
  |  Branch (3293:9): [True: 0, False: 0]
  ------------------
 3294|       |
 3295|      0|        p->buf_to_file = ngx_calloc_buf(r->pool);
  ------------------
  |  |  145|      0|#define ngx_calloc_buf(pool) ngx_pcalloc(pool, sizeof(ngx_buf_t))
  ------------------
 3296|      0|        if (p->buf_to_file == NULL) {
  ------------------
  |  Branch (3296:13): [True: 0, False: 0]
  ------------------
 3297|      0|            ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3298|      0|            return;
 3299|      0|        }
 3300|       |
 3301|      0|        p->buf_to_file->start = u->buffer.start;
 3302|      0|        p->buf_to_file->pos = u->buffer.start;
 3303|      0|        p->buf_to_file->last = u->buffer.pos;
 3304|      0|        p->buf_to_file->temporary = 1;
 3305|      0|    }
 3306|       |
 3307|      0|    if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
  ------------------
  |  |  245|      0|#define NGX_USE_IOCP_EVENT       0x00000200
  ------------------
  |  Branch (3307:9): [True: 0, False: 0]
  ------------------
 3308|       |        /* the posted aio operation may corrupt a shadow buffer */
 3309|      0|        p->single_buf = 1;
 3310|      0|    }
 3311|       |
 3312|       |    /* TODO: p->free_bufs = 0 if use ngx_create_chain_of_bufs() */
 3313|      0|    p->free_bufs = 1;
 3314|       |
 3315|       |    /*
 3316|       |     * event_pipe would do u->buffer.last += p->preread_size
 3317|       |     * as though these bytes were read
 3318|       |     */
 3319|      0|    u->buffer.last = u->buffer.pos;
 3320|       |
 3321|      0|    if (u->conf->cyclic_temp_file) {
  ------------------
  |  Branch (3321:9): [True: 0, False: 0]
  ------------------
 3322|       |
 3323|       |        /*
 3324|       |         * we need to disable the use of sendfile() if we use cyclic temp file
 3325|       |         * because the writing a new data may interfere with sendfile()
 3326|       |         * that uses the same kernel file pages (at least on FreeBSD)
 3327|       |         */
 3328|       |
 3329|      0|        p->cyclic_temp_file = 1;
 3330|      0|        c->sendfile = 0;
 3331|       |
 3332|      0|    } else {
 3333|      0|        p->cyclic_temp_file = 0;
 3334|      0|    }
 3335|       |
 3336|      0|    p->read_timeout = u->conf->read_timeout;
 3337|      0|    p->send_timeout = clcf->send_timeout;
 3338|      0|    p->send_lowat = clcf->send_lowat;
 3339|       |
 3340|      0|    p->length = -1;
 3341|       |
 3342|      0|    if (u->input_filter_init
  ------------------
  |  Branch (3342:9): [True: 0, False: 0]
  ------------------
 3343|      0|        && u->input_filter_init(p->input_ctx) != NGX_OK)
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (3343:12): [True: 0, False: 0]
  ------------------
 3344|      0|    {
 3345|      0|        ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3346|      0|        return;
 3347|      0|    }
 3348|       |
 3349|      0|    u->read_event_handler = ngx_http_upstream_process_upstream;
 3350|      0|    r->write_event_handler = ngx_http_upstream_process_downstream;
 3351|       |
 3352|      0|    ngx_http_upstream_process_upstream(r, u);
 3353|      0|}
ngx_http_upstream.c:ngx_http_upstream_process_non_buffered_upstream:
 3665|      1|{
 3666|      1|    ngx_connection_t  *c;
 3667|       |
 3668|      1|    c = u->peer.connection;
 3669|       |
 3670|      1|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
 3671|      1|                   "http upstream process non buffered upstream");
 3672|       |
 3673|      1|    c->log->action = "reading upstream";
 3674|       |
 3675|      1|    if (c->read->timedout) {
  ------------------
  |  Branch (3675:9): [True: 0, False: 1]
  ------------------
 3676|      0|        ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");
  ------------------
  |  |   44|      0|#define NGX_ETIMEDOUT     ETIMEDOUT
  ------------------
 3677|      0|        ngx_http_upstream_finalize_request(r, u, NGX_HTTP_GATEWAY_TIME_OUT);
  ------------------
  |  |  142|      0|#define NGX_HTTP_GATEWAY_TIME_OUT          504
  ------------------
 3678|      0|        return;
 3679|      0|    }
 3680|       |
 3681|      1|    ngx_http_upstream_process_non_buffered_request(r, 0);
 3682|      1|}
ngx_http_upstream.c:ngx_http_upstream_process_non_buffered_request:
 3688|      5|{
 3689|      5|    size_t                     size;
 3690|      5|    ssize_t                    n;
 3691|      5|    ngx_buf_t                 *b;
 3692|      5|    ngx_int_t                  rc;
 3693|      5|    ngx_uint_t                 flags;
 3694|      5|    ngx_connection_t          *downstream, *upstream;
 3695|      5|    ngx_http_upstream_t       *u;
 3696|      5|    ngx_http_core_loc_conf_t  *clcf;
 3697|       |
 3698|      5|    u = r->upstream;
 3699|      5|    downstream = r->connection;
 3700|      5|    upstream = u->peer.connection;
 3701|       |
 3702|      5|    b = &u->buffer;
 3703|       |
 3704|      5|    do_write = do_write || u->length == 0;
  ------------------
  |  Branch (3704:16): [True: 4, False: 1]
  |  Branch (3704:28): [True: 0, False: 1]
  ------------------
 3705|       |
 3706|     22|    for ( ;; ) {
 3707|       |
 3708|     22|        if (do_write) {
  ------------------
  |  Branch (3708:13): [True: 21, False: 1]
  ------------------
 3709|       |
 3710|     21|            if (u->out_bufs || u->busy_bufs || downstream->buffered) {
  ------------------
  |  Branch (3710:17): [True: 1, False: 20]
  |  Branch (3710:32): [True: 0, False: 20]
  |  Branch (3710:48): [True: 9, False: 11]
  ------------------
 3711|     10|                rc = ngx_http_output_filter(r, u->out_bufs);
 3712|       |
 3713|     10|                if (rc == NGX_ERROR) {
  ------------------
  |  |   39|     10|#define  NGX_ERROR      -1
  ------------------
  |  Branch (3713:21): [True: 0, False: 10]
  ------------------
 3714|      0|                    ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3715|      0|                    return;
 3716|      0|                }
 3717|       |
 3718|     10|                ngx_chain_update_chains(r->pool, &u->free_bufs, &u->busy_bufs,
 3719|     10|                                        &u->out_bufs, u->output.tag);
 3720|     10|            }
 3721|       |
 3722|     21|            if (u->busy_bufs == NULL) {
  ------------------
  |  Branch (3722:17): [True: 20, False: 1]
  ------------------
 3723|       |
 3724|     20|                if (u->length == 0
  ------------------
  |  Branch (3724:21): [True: 0, False: 20]
  ------------------
 3725|     20|                    || (upstream->read->eof && u->length == -1))
  ------------------
  |  Branch (3725:25): [True: 0, False: 20]
  |  Branch (3725:48): [True: 0, False: 0]
  ------------------
 3726|      0|                {
 3727|      0|                    ngx_http_upstream_finalize_request(r, u, 0);
 3728|      0|                    return;
 3729|      0|                }
 3730|       |
 3731|     20|                if (upstream->read->eof) {
  ------------------
  |  Branch (3731:21): [True: 0, False: 20]
  ------------------
 3732|      0|                    ngx_log_error(NGX_LOG_ERR, upstream->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3733|      0|                                  "upstream prematurely closed connection");
 3734|       |
 3735|      0|                    ngx_http_upstream_finalize_request(r, u,
 3736|      0|                                                       NGX_HTTP_BAD_GATEWAY);
  ------------------
  |  |  140|      0|#define NGX_HTTP_BAD_GATEWAY               502
  ------------------
 3737|      0|                    return;
 3738|      0|                }
 3739|       |
 3740|     20|                if (upstream->read->error || u->error) {
  ------------------
  |  Branch (3740:21): [True: 0, False: 20]
  |  Branch (3740:46): [True: 0, False: 20]
  ------------------
 3741|      0|                    ngx_http_upstream_finalize_request(r, u,
 3742|      0|                                                       NGX_HTTP_BAD_GATEWAY);
  ------------------
  |  |  140|      0|#define NGX_HTTP_BAD_GATEWAY               502
  ------------------
 3743|      0|                    return;
 3744|      0|                }
 3745|       |
 3746|     20|                b->pos = b->start;
 3747|     20|                b->last = b->start;
 3748|     20|            }
 3749|     21|        }
 3750|       |
 3751|     22|        size = b->end - b->last;
 3752|       |
 3753|     22|        if (size && upstream->read->ready) {
  ------------------
  |  Branch (3753:13): [True: 21, False: 1]
  |  Branch (3753:21): [True: 17, False: 4]
  ------------------
 3754|       |
 3755|     17|            n = upstream->recv(upstream, b->last, size);
 3756|       |
 3757|     17|            if (n == NGX_AGAIN) {
  ------------------
  |  |   40|     17|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (3757:17): [True: 0, False: 17]
  ------------------
 3758|      0|                break;
 3759|      0|            }
 3760|       |
 3761|     17|            if (n > 0) {
  ------------------
  |  Branch (3761:17): [True: 13, False: 4]
  ------------------
 3762|     13|                u->state->bytes_received += n;
 3763|     13|                u->state->response_length += n;
 3764|       |
 3765|     13|                if (u->input_filter(u->input_filter_ctx, n) == NGX_ERROR) {
  ------------------
  |  |   39|     13|#define  NGX_ERROR      -1
  ------------------
  |  Branch (3765:21): [True: 0, False: 13]
  ------------------
 3766|      0|                    ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3767|      0|                    return;
 3768|      0|                }
 3769|     13|            }
 3770|       |
 3771|     17|            do_write = 1;
 3772|       |
 3773|     17|            continue;
 3774|     17|        }
 3775|       |
 3776|      5|        break;
 3777|     22|    }
 3778|       |
 3779|      5|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      5|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 3780|       |
 3781|      5|    if (downstream->data == r) {
  ------------------
  |  Branch (3781:9): [True: 5, False: 0]
  ------------------
 3782|      5|        if (ngx_handle_write_event(downstream->write, clcf->send_lowat)
  ------------------
  |  Branch (3782:13): [True: 0, False: 5]
  ------------------
 3783|      5|            != NGX_OK)
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 3784|      0|        {
 3785|      0|            ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3786|      0|            return;
 3787|      0|        }
 3788|      5|    }
 3789|       |
 3790|      5|    if (downstream->write->active && !downstream->write->ready) {
  ------------------
  |  Branch (3790:9): [True: 0, False: 5]
  |  Branch (3790:38): [True: 0, False: 0]
  ------------------
 3791|      0|        ngx_add_timer(downstream->write, clcf->send_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 3792|       |
 3793|      5|    } else if (downstream->write->timer_set) {
  ------------------
  |  Branch (3793:16): [True: 0, False: 5]
  ------------------
 3794|      0|        ngx_del_timer(downstream->write);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 3795|      0|    }
 3796|       |
 3797|      5|    if (upstream->read->eof || upstream->read->error) {
  ------------------
  |  Branch (3797:9): [True: 0, False: 5]
  |  Branch (3797:32): [True: 0, False: 5]
  ------------------
 3798|      0|        flags = NGX_CLOSE_EVENT;
  ------------------
  |  |  281|      0|#define NGX_CLOSE_EVENT    1
  ------------------
 3799|       |
 3800|      5|    } else {
 3801|      5|        flags = 0;
 3802|      5|    }
 3803|       |
 3804|      5|    if (ngx_handle_read_event(upstream->read, flags) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (3804:9): [True: 0, False: 5]
  ------------------
 3805|      0|        ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 3806|      0|        return;
 3807|      0|    }
 3808|       |
 3809|      5|    if (upstream->read->active && !upstream->read->ready) {
  ------------------
  |  Branch (3809:9): [True: 0, False: 5]
  |  Branch (3809:35): [True: 0, False: 0]
  ------------------
 3810|      0|        ngx_add_timer(upstream->read, u->conf->read_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 3811|       |
 3812|      5|    } else if (upstream->read->timer_set) {
  ------------------
  |  Branch (3812:16): [True: 5, False: 0]
  ------------------
 3813|      5|        ngx_del_timer(upstream->read);
  ------------------
  |  |  411|      5|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 3814|      5|    }
 3815|      5|}
ngx_http_upstream.c:ngx_http_upstream_process_non_buffered_downstream:
 3637|      4|{
 3638|      4|    ngx_event_t          *wev;
 3639|      4|    ngx_connection_t     *c;
 3640|      4|    ngx_http_upstream_t  *u;
 3641|       |
 3642|      4|    c = r->connection;
 3643|      4|    u = r->upstream;
 3644|      4|    wev = c->write;
 3645|       |
 3646|      4|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
 3647|      4|                   "http upstream process non buffered downstream");
 3648|       |
 3649|      4|    c->log->action = "sending to client";
 3650|       |
 3651|      4|    if (wev->timedout) {
  ------------------
  |  Branch (3651:9): [True: 0, False: 4]
  ------------------
 3652|      0|        c->timedout = 1;
 3653|      0|        ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out");
  ------------------
  |  |   44|      0|#define NGX_ETIMEDOUT     ETIMEDOUT
  ------------------
 3654|      0|        ngx_http_upstream_finalize_request(r, u, NGX_HTTP_REQUEST_TIME_OUT);
  ------------------
  |  |   97|      0|#define NGX_HTTP_REQUEST_TIME_OUT          408
  ------------------
 3655|      0|        return;
 3656|      0|    }
 3657|       |
 3658|      4|    ngx_http_upstream_process_non_buffered_request(r, 1);
 3659|      4|}
ngx_http_upstream.c:ngx_http_upstream_send_request:
 2081|      5|{
 2082|      5|    ngx_int_t          rc;
 2083|      5|    ngx_connection_t  *c;
 2084|       |
 2085|      5|    c = u->peer.connection;
 2086|       |
 2087|      5|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
 2088|      5|                   "http upstream send request");
 2089|       |
 2090|      5|    if (u->state->connect_time == (ngx_msec_t) -1) {
  ------------------
  |  Branch (2090:9): [True: 5, False: 0]
  ------------------
 2091|      5|        u->state->connect_time = ngx_current_msec - u->start_time;
 2092|      5|    }
 2093|       |
 2094|      5|    if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (2094:9): [True: 5, False: 0]
  |  Branch (2094:29): [True: 0, False: 5]
  ------------------
 2095|      0|        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
  ------------------
  |  |   20|      0|#define NGX_HTTP_UPSTREAM_FT_ERROR           0x00000002
  ------------------
 2096|      0|        return;
 2097|      0|    }
 2098|       |
 2099|      5|    c->log->action = "sending request to upstream";
 2100|       |
 2101|      5|    rc = ngx_http_upstream_send_request_body(r, u, do_write);
 2102|       |
 2103|      5|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      5|#define  NGX_ERROR      -1
  ------------------
  |  Branch (2103:9): [True: 0, False: 5]
  ------------------
 2104|      0|        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
  ------------------
  |  |   20|      0|#define NGX_HTTP_UPSTREAM_FT_ERROR           0x00000002
  ------------------
 2105|      0|        return;
 2106|      0|    }
 2107|       |
 2108|      5|    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
  ------------------
  |  |   84|      5|#define NGX_HTTP_SPECIAL_RESPONSE          300
  ------------------
  |  Branch (2108:9): [True: 0, False: 5]
  ------------------
 2109|      0|        ngx_http_upstream_finalize_request(r, u, rc);
 2110|      0|        return;
 2111|      0|    }
 2112|       |
 2113|      5|    if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      5|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (2113:9): [True: 0, False: 5]
  ------------------
 2114|      0|        if (!c->write->ready || u->request_body_blocked) {
  ------------------
  |  Branch (2114:13): [True: 0, False: 0]
  |  Branch (2114:33): [True: 0, False: 0]
  ------------------
 2115|      0|            ngx_add_timer(c->write, u->conf->send_timeout);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 2116|       |
 2117|      0|        } else if (c->write->timer_set) {
  ------------------
  |  Branch (2117:20): [True: 0, False: 0]
  ------------------
 2118|      0|            ngx_del_timer(c->write);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 2119|      0|        }
 2120|       |
 2121|      0|        if (ngx_handle_write_event(c->write, u->conf->send_lowat) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2121:13): [True: 0, False: 0]
  ------------------
 2122|      0|            ngx_http_upstream_finalize_request(r, u,
 2123|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2124|      0|            return;
 2125|      0|        }
 2126|       |
 2127|      0|        if (c->write->ready && c->tcp_nopush == NGX_TCP_NOPUSH_SET) {
  ------------------
  |  Branch (2127:13): [True: 0, False: 0]
  |  Branch (2127:32): [True: 0, False: 0]
  ------------------
 2128|      0|            if (ngx_tcp_push(c->fd) == -1) {
  ------------------
  |  Branch (2128:17): [True: 0, False: 0]
  ------------------
 2129|      0|                ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2130|      0|                              ngx_tcp_push_n " failed");
 2131|      0|                ngx_http_upstream_finalize_request(r, u,
 2132|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2133|      0|                return;
 2134|      0|            }
 2135|       |
 2136|      0|            c->tcp_nopush = NGX_TCP_NOPUSH_UNSET;
 2137|      0|        }
 2138|       |
 2139|      0|        if (c->read->ready) {
  ------------------
  |  Branch (2139:13): [True: 0, False: 0]
  ------------------
 2140|      0|            ngx_post_event(c->read, &ngx_posted_events);
  ------------------
  |  |   19|      0|    if (!(ev)->posted) {                                                      \
  |  |  ------------------
  |  |  |  Branch (19:9): [True: 0, False: 0]
  |  |  ------------------
  |  |   20|      0|        (ev)->posted = 1;                                                     \
  |  |   21|      0|        ngx_queue_insert_tail(q, &(ev)->queue);                               \
  |  |  ------------------
  |  |  |  |   44|      0|    (x)->prev = (h)->prev;                                                    \
  |  |  |  |   45|      0|    (x)->prev->next = x;                                                      \
  |  |  |  |   46|      0|    (x)->next = h;                                                            \
  |  |  |  |   47|      0|    (h)->prev = x
  |  |  ------------------
  |  |   22|      0|                                                                              \
  |  |   23|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, "post event %p", ev);\
  |  |   24|      0|                                                                              \
  |  |   25|      0|    } else  {                                                                 \
  |  |   26|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                      \
  |  |   27|      0|                       "update posted event %p", ev);                         \
  |  |   28|      0|    }
  ------------------
 2141|      0|        }
 2142|       |
 2143|      0|        return;
 2144|      0|    }
 2145|       |
 2146|       |    /* rc == NGX_OK */
 2147|       |
 2148|      5|    if (c->write->timer_set) {
  ------------------
  |  Branch (2148:9): [True: 0, False: 5]
  ------------------
 2149|      0|        ngx_del_timer(c->write);
  ------------------
  |  |  411|      0|#define ngx_del_timer        ngx_event_del_timer
  ------------------
 2150|      0|    }
 2151|       |
 2152|      5|    if (c->tcp_nopush == NGX_TCP_NOPUSH_SET) {
  ------------------
  |  Branch (2152:9): [True: 0, False: 5]
  ------------------
 2153|      0|        if (ngx_tcp_push(c->fd) == -1) {
  ------------------
  |  Branch (2153:13): [True: 0, False: 0]
  ------------------
 2154|      0|            ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2155|      0|                          ngx_tcp_push_n " failed");
 2156|      0|            ngx_http_upstream_finalize_request(r, u,
 2157|      0|                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2158|      0|            return;
 2159|      0|        }
 2160|       |
 2161|      0|        c->tcp_nopush = NGX_TCP_NOPUSH_UNSET;
 2162|      0|    }
 2163|       |
 2164|      5|    if (!u->conf->preserve_output) {
  ------------------
  |  Branch (2164:9): [True: 5, False: 0]
  ------------------
 2165|      5|        u->write_event_handler = ngx_http_upstream_dummy_handler;
 2166|      5|    }
 2167|       |
 2168|      5|    if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  |  Branch (2168:9): [True: 0, False: 5]
  ------------------
 2169|      0|        ngx_http_upstream_finalize_request(r, u,
 2170|      0|                                           NGX_HTTP_INTERNAL_SERVER_ERROR);
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
 2171|      0|        return;
 2172|      0|    }
 2173|       |
 2174|      5|    if (!u->request_body_sent) {
  ------------------
  |  Branch (2174:9): [True: 5, False: 0]
  ------------------
 2175|      5|        u->request_body_sent = 1;
 2176|       |
 2177|      5|        if (u->header_sent) {
  ------------------
  |  Branch (2177:13): [True: 0, False: 5]
  ------------------
 2178|      0|            return;
 2179|      0|        }
 2180|       |
 2181|      5|        ngx_add_timer(c->read, u->conf->read_timeout);
  ------------------
  |  |  410|      5|#define ngx_add_timer        ngx_event_add_timer
  ------------------
 2182|       |
 2183|      5|        if (c->read->ready) {
  ------------------
  |  Branch (2183:13): [True: 5, False: 0]
  ------------------
 2184|      5|            ngx_http_upstream_process_header(r, u);
 2185|      5|            return;
 2186|      5|        }
 2187|      5|    }
 2188|      5|}
ngx_http_upstream.c:ngx_http_upstream_send_request_body:
 2194|      5|{
 2195|      5|    ngx_int_t                  rc;
 2196|      5|    ngx_chain_t               *out, *cl, *ln;
 2197|      5|    ngx_connection_t          *c;
 2198|      5|    ngx_http_core_loc_conf_t  *clcf;
 2199|       |
 2200|      5|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2201|      5|                   "http upstream send request body");
 2202|       |
 2203|      5|    if (!r->request_body_no_buffering) {
  ------------------
  |  Branch (2203:9): [True: 5, False: 0]
  ------------------
 2204|       |
 2205|       |        /* buffered request body */
 2206|       |
 2207|      5|        if (!u->request_sent) {
  ------------------
  |  Branch (2207:13): [True: 5, False: 0]
  ------------------
 2208|      5|            u->request_sent = 1;
 2209|      5|            out = u->request_bufs;
 2210|       |
 2211|      5|        } else {
 2212|      0|            out = NULL;
 2213|      0|        }
 2214|       |
 2215|      5|        rc = ngx_output_chain(&u->output, out);
 2216|       |
 2217|      5|        if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      5|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (2217:13): [True: 0, False: 5]
  ------------------
 2218|      0|            u->request_body_blocked = 1;
 2219|       |
 2220|      5|        } else {
 2221|      5|            u->request_body_blocked = 0;
 2222|      5|        }
 2223|       |
 2224|      5|        return rc;
 2225|      5|    }
 2226|       |
 2227|      0|    if (!u->request_sent) {
  ------------------
  |  Branch (2227:9): [True: 0, False: 0]
  ------------------
 2228|      0|        u->request_sent = 1;
 2229|      0|        out = u->request_bufs;
 2230|       |
 2231|      0|        if (r->request_body->bufs) {
  ------------------
  |  Branch (2231:13): [True: 0, False: 0]
  ------------------
 2232|      0|            for (cl = out; cl->next; cl = cl->next) { /* void */ }
  ------------------
  |  Branch (2232:28): [True: 0, False: 0]
  ------------------
 2233|      0|            cl->next = r->request_body->bufs;
 2234|      0|            r->request_body->bufs = NULL;
 2235|      0|        }
 2236|       |
 2237|      0|        c = u->peer.connection;
 2238|      0|        clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
 2239|       |
 2240|      0|        if (clcf->tcp_nodelay && ngx_tcp_nodelay(c) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2240:13): [True: 0, False: 0]
  |  Branch (2240:34): [True: 0, False: 0]
  ------------------
 2241|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2242|      0|        }
 2243|       |
 2244|      0|        r->read_event_handler = ngx_http_upstream_read_request_handler;
 2245|       |
 2246|      0|    } else {
 2247|      0|        out = NULL;
 2248|      0|    }
 2249|       |
 2250|      0|    for ( ;; ) {
 2251|       |
 2252|      0|        if (do_write) {
  ------------------
  |  Branch (2252:13): [True: 0, False: 0]
  ------------------
 2253|      0|            rc = ngx_output_chain(&u->output, out);
 2254|       |
 2255|      0|            if (rc == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (2255:17): [True: 0, False: 0]
  ------------------
 2256|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2257|      0|            }
 2258|       |
 2259|      0|            while (out) {
  ------------------
  |  Branch (2259:20): [True: 0, False: 0]
  ------------------
 2260|      0|                ln = out;
 2261|      0|                out = out->next;
 2262|      0|                ngx_free_chain(r->pool, ln);
  ------------------
  |  |  149|      0|    (cl)->next = (pool)->chain;                                              \
  |  |  150|      0|    (pool)->chain = (cl)
  ------------------
 2263|      0|            }
 2264|       |
 2265|      0|            if (rc == NGX_AGAIN) {
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  |  Branch (2265:17): [True: 0, False: 0]
  ------------------
 2266|      0|                u->request_body_blocked = 1;
 2267|       |
 2268|      0|            } else {
 2269|      0|                u->request_body_blocked = 0;
 2270|      0|            }
 2271|       |
 2272|      0|            if (rc == NGX_OK && !r->reading_body) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2272:17): [True: 0, False: 0]
  |  Branch (2272:33): [True: 0, False: 0]
  ------------------
 2273|      0|                break;
 2274|      0|            }
 2275|      0|        }
 2276|       |
 2277|      0|        if (r->reading_body) {
  ------------------
  |  Branch (2277:13): [True: 0, False: 0]
  ------------------
 2278|       |            /* read client request body */
 2279|       |
 2280|      0|            rc = ngx_http_read_unbuffered_request_body(r);
 2281|       |
 2282|      0|            if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
  ------------------
  |  |   84|      0|#define NGX_HTTP_SPECIAL_RESPONSE          300
  ------------------
  |  Branch (2282:17): [True: 0, False: 0]
  ------------------
 2283|      0|                return rc;
 2284|      0|            }
 2285|       |
 2286|      0|            out = r->request_body->bufs;
 2287|      0|            r->request_body->bufs = NULL;
 2288|      0|        }
 2289|       |
 2290|       |        /* stop if there is nothing to send */
 2291|       |
 2292|      0|        if (out == NULL) {
  ------------------
  |  Branch (2292:13): [True: 0, False: 0]
  ------------------
 2293|      0|            rc = NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
 2294|      0|            break;
 2295|      0|        }
 2296|       |
 2297|      0|        do_write = 1;
 2298|      0|    }
 2299|       |
 2300|      0|    if (!r->reading_body) {
  ------------------
  |  Branch (2300:9): [True: 0, False: 0]
  ------------------
 2301|      0|        if (!u->store && !r->post_action && !u->conf->ignore_client_abort) {
  ------------------
  |  Branch (2301:13): [True: 0, False: 0]
  |  Branch (2301:26): [True: 0, False: 0]
  |  Branch (2301:45): [True: 0, False: 0]
  ------------------
 2302|      0|            r->read_event_handler =
 2303|      0|                                  ngx_http_upstream_rd_check_broken_connection;
 2304|      0|        }
 2305|      0|    }
 2306|       |
 2307|      0|    return rc;
 2308|      0|}

ngx_http_upstream_init_round_robin:
   33|      1|{
   34|      1|    ngx_url_t                      u;
   35|      1|    ngx_uint_t                     i, j, n, w, t;
   36|      1|    ngx_http_upstream_server_t    *server;
   37|      1|    ngx_http_upstream_rr_peer_t   *peer, **peerp;
   38|      1|    ngx_http_upstream_rr_peers_t  *peers, *backup;
   39|       |
   40|      1|    us->peer.init = ngx_http_upstream_init_round_robin_peer;
   41|       |
   42|      1|    if (us->servers) {
  ------------------
  |  Branch (42:9): [True: 1, False: 0]
  ------------------
   43|      1|        server = us->servers->elts;
   44|       |
   45|      1|        n = 0;
   46|      1|        w = 0;
   47|      1|        t = 0;
   48|       |
   49|     11|        for (i = 0; i < us->servers->nelts; i++) {
  ------------------
  |  Branch (49:21): [True: 10, False: 1]
  ------------------
   50|     10|            if (server[i].backup) {
  ------------------
  |  Branch (50:17): [True: 0, False: 10]
  ------------------
   51|      0|                continue;
   52|      0|            }
   53|       |
   54|     10|            n += server[i].naddrs;
   55|     10|            w += server[i].naddrs * server[i].weight;
   56|       |
   57|     10|            if (!server[i].down) {
  ------------------
  |  Branch (57:17): [True: 10, False: 0]
  ------------------
   58|     10|                t += server[i].naddrs;
   59|     10|            }
   60|     10|        }
   61|       |
   62|      1|        if (n == 0) {
  ------------------
  |  Branch (62:13): [True: 0, False: 1]
  ------------------
   63|      0|            ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   64|      0|                          "no servers in upstream \"%V\" in %s:%ui",
   65|      0|                          &us->host, us->file_name, us->line);
   66|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   67|      0|        }
   68|       |
   69|      1|        peers = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_rr_peers_t));
   70|      1|        if (peers == NULL) {
  ------------------
  |  Branch (70:13): [True: 0, False: 1]
  ------------------
   71|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   72|      0|        }
   73|       |
   74|      1|        peer = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_rr_peer_t) * n);
   75|      1|        if (peer == NULL) {
  ------------------
  |  Branch (75:13): [True: 0, False: 1]
  ------------------
   76|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   77|      0|        }
   78|       |
   79|      1|        peers->single = (n == 1);
   80|      1|        peers->number = n;
   81|      1|        peers->weighted = (w != n);
   82|      1|        peers->total_weight = w;
   83|      1|        peers->tries = t;
   84|      1|        peers->name = &us->host;
   85|       |
   86|      1|        n = 0;
   87|      1|        peerp = &peers->peer;
   88|       |
   89|     11|        for (i = 0; i < us->servers->nelts; i++) {
  ------------------
  |  Branch (89:21): [True: 10, False: 1]
  ------------------
   90|     10|            if (server[i].backup) {
  ------------------
  |  Branch (90:17): [True: 0, False: 10]
  ------------------
   91|      0|                continue;
   92|      0|            }
   93|       |
   94|     20|            for (j = 0; j < server[i].naddrs; j++) {
  ------------------
  |  Branch (94:25): [True: 10, False: 10]
  ------------------
   95|     10|                peer[n].sockaddr = server[i].addrs[j].sockaddr;
   96|     10|                peer[n].socklen = server[i].addrs[j].socklen;
   97|     10|                peer[n].name = server[i].addrs[j].name;
   98|     10|                peer[n].weight = server[i].weight;
   99|     10|                peer[n].effective_weight = server[i].weight;
  100|     10|                peer[n].current_weight = 0;
  101|     10|                peer[n].max_conns = server[i].max_conns;
  102|     10|                peer[n].max_fails = server[i].max_fails;
  103|     10|                peer[n].fail_timeout = server[i].fail_timeout;
  104|     10|                peer[n].down = server[i].down;
  105|     10|                peer[n].server = server[i].name;
  106|       |
  107|     10|                *peerp = &peer[n];
  108|     10|                peerp = &peer[n].next;
  109|     10|                n++;
  110|     10|            }
  111|     10|        }
  112|       |
  113|      1|        us->peer.data = peers;
  114|       |
  115|       |        /* backup servers */
  116|       |
  117|      1|        n = 0;
  118|      1|        w = 0;
  119|      1|        t = 0;
  120|       |
  121|     11|        for (i = 0; i < us->servers->nelts; i++) {
  ------------------
  |  Branch (121:21): [True: 10, False: 1]
  ------------------
  122|     10|            if (!server[i].backup) {
  ------------------
  |  Branch (122:17): [True: 10, False: 0]
  ------------------
  123|     10|                continue;
  124|     10|            }
  125|       |
  126|      0|            n += server[i].naddrs;
  127|      0|            w += server[i].naddrs * server[i].weight;
  128|       |
  129|      0|            if (!server[i].down) {
  ------------------
  |  Branch (129:17): [True: 0, False: 0]
  ------------------
  130|      0|                t += server[i].naddrs;
  131|      0|            }
  132|      0|        }
  133|       |
  134|      1|        if (n == 0) {
  ------------------
  |  Branch (134:13): [True: 1, False: 0]
  ------------------
  135|      1|            return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  136|      1|        }
  137|       |
  138|      0|        backup = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_rr_peers_t));
  139|      0|        if (backup == NULL) {
  ------------------
  |  Branch (139:13): [True: 0, False: 0]
  ------------------
  140|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  141|      0|        }
  142|       |
  143|      0|        peer = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_rr_peer_t) * n);
  144|      0|        if (peer == NULL) {
  ------------------
  |  Branch (144:13): [True: 0, False: 0]
  ------------------
  145|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  146|      0|        }
  147|       |
  148|      0|        peers->single = 0;
  149|      0|        backup->single = 0;
  150|      0|        backup->number = n;
  151|      0|        backup->weighted = (w != n);
  152|      0|        backup->total_weight = w;
  153|      0|        backup->tries = t;
  154|      0|        backup->name = &us->host;
  155|       |
  156|      0|        n = 0;
  157|      0|        peerp = &backup->peer;
  158|       |
  159|      0|        for (i = 0; i < us->servers->nelts; i++) {
  ------------------
  |  Branch (159:21): [True: 0, False: 0]
  ------------------
  160|      0|            if (!server[i].backup) {
  ------------------
  |  Branch (160:17): [True: 0, False: 0]
  ------------------
  161|      0|                continue;
  162|      0|            }
  163|       |
  164|      0|            for (j = 0; j < server[i].naddrs; j++) {
  ------------------
  |  Branch (164:25): [True: 0, False: 0]
  ------------------
  165|      0|                peer[n].sockaddr = server[i].addrs[j].sockaddr;
  166|      0|                peer[n].socklen = server[i].addrs[j].socklen;
  167|      0|                peer[n].name = server[i].addrs[j].name;
  168|      0|                peer[n].weight = server[i].weight;
  169|      0|                peer[n].effective_weight = server[i].weight;
  170|      0|                peer[n].current_weight = 0;
  171|      0|                peer[n].max_conns = server[i].max_conns;
  172|      0|                peer[n].max_fails = server[i].max_fails;
  173|      0|                peer[n].fail_timeout = server[i].fail_timeout;
  174|      0|                peer[n].down = server[i].down;
  175|      0|                peer[n].server = server[i].name;
  176|       |
  177|      0|                *peerp = &peer[n];
  178|      0|                peerp = &peer[n].next;
  179|      0|                n++;
  180|      0|            }
  181|      0|        }
  182|       |
  183|      0|        peers->next = backup;
  184|       |
  185|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  186|      0|    }
  187|       |
  188|       |
  189|       |    /* an upstream implicitly defined by proxy_pass, etc. */
  190|       |
  191|      0|    if (us->port == 0) {
  ------------------
  |  Branch (191:9): [True: 0, False: 0]
  ------------------
  192|      0|        ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  193|      0|                      "no port in upstream \"%V\" in %s:%ui",
  194|      0|                      &us->host, us->file_name, us->line);
  195|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  196|      0|    }
  197|       |
  198|      0|    ngx_memzero(&u, sizeof(ngx_url_t));
  ------------------
  |  |   88|      0|#define ngx_memzero(buf, n)       (void) memset(buf, 0, n)
  ------------------
  199|       |
  200|      0|    u.host = us->host;
  201|      0|    u.port = us->port;
  202|       |
  203|      0|    if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (203:9): [True: 0, False: 0]
  ------------------
  204|      0|        if (u.err) {
  ------------------
  |  Branch (204:13): [True: 0, False: 0]
  ------------------
  205|      0|            ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  206|      0|                          "%s in upstream \"%V\" in %s:%ui",
  207|      0|                          u.err, &us->host, us->file_name, us->line);
  208|      0|        }
  209|       |
  210|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  211|      0|    }
  212|       |
  213|      0|    n = u.naddrs;
  214|       |
  215|      0|    peers = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_rr_peers_t));
  216|      0|    if (peers == NULL) {
  ------------------
  |  Branch (216:9): [True: 0, False: 0]
  ------------------
  217|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  218|      0|    }
  219|       |
  220|      0|    peer = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_rr_peer_t) * n);
  221|      0|    if (peer == NULL) {
  ------------------
  |  Branch (221:9): [True: 0, False: 0]
  ------------------
  222|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  223|      0|    }
  224|       |
  225|      0|    peers->single = (n == 1);
  226|      0|    peers->number = n;
  227|      0|    peers->weighted = 0;
  228|      0|    peers->total_weight = n;
  229|      0|    peers->tries = n;
  230|      0|    peers->name = &us->host;
  231|       |
  232|      0|    peerp = &peers->peer;
  233|       |
  234|      0|    for (i = 0; i < u.naddrs; i++) {
  ------------------
  |  Branch (234:17): [True: 0, False: 0]
  ------------------
  235|      0|        peer[i].sockaddr = u.addrs[i].sockaddr;
  236|      0|        peer[i].socklen = u.addrs[i].socklen;
  237|      0|        peer[i].name = u.addrs[i].name;
  238|      0|        peer[i].weight = 1;
  239|      0|        peer[i].effective_weight = 1;
  240|      0|        peer[i].current_weight = 0;
  241|      0|        peer[i].max_conns = 0;
  242|      0|        peer[i].max_fails = 1;
  243|      0|        peer[i].fail_timeout = 10;
  244|      0|        *peerp = &peer[i];
  245|      0|        peerp = &peer[i].next;
  246|      0|    }
  247|       |
  248|      0|    us->peer.data = peers;
  249|       |
  250|       |    /* implicitly defined upstream has no backup servers */
  251|       |
  252|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  253|      0|}
ngx_http_upstream_init_round_robin_peer:
  259|      5|{
  260|      5|    ngx_uint_t                         n;
  261|      5|    ngx_http_upstream_rr_peer_data_t  *rrp;
  262|       |
  263|      5|    rrp = r->upstream->peer.data;
  264|       |
  265|      5|    if (rrp == NULL) {
  ------------------
  |  Branch (265:9): [True: 5, False: 0]
  ------------------
  266|      5|        rrp = ngx_palloc(r->pool, sizeof(ngx_http_upstream_rr_peer_data_t));
  267|      5|        if (rrp == NULL) {
  ------------------
  |  Branch (267:13): [True: 0, False: 5]
  ------------------
  268|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  269|      0|        }
  270|       |
  271|      5|        r->upstream->peer.data = rrp;
  272|      5|    }
  273|       |
  274|      5|    rrp->peers = us->peer.data;
  275|      5|    rrp->current = NULL;
  276|      5|    rrp->config = 0;
  277|       |
  278|      5|    n = rrp->peers->number;
  279|       |
  280|      5|    if (rrp->peers->next && rrp->peers->next->number > n) {
  ------------------
  |  Branch (280:9): [True: 0, False: 5]
  |  Branch (280:29): [True: 0, False: 0]
  ------------------
  281|      0|        n = rrp->peers->next->number;
  282|      0|    }
  283|       |
  284|      5|    if (n <= 8 * sizeof(uintptr_t)) {
  ------------------
  |  Branch (284:9): [True: 5, False: 0]
  ------------------
  285|      5|        rrp->tried = &rrp->data;
  286|      5|        rrp->data = 0;
  287|       |
  288|      5|    } else {
  289|      0|        n = (n + (8 * sizeof(uintptr_t) - 1)) / (8 * sizeof(uintptr_t));
  290|       |
  291|      0|        rrp->tried = ngx_pcalloc(r->pool, n * sizeof(uintptr_t));
  292|      0|        if (rrp->tried == NULL) {
  ------------------
  |  Branch (292:13): [True: 0, False: 0]
  ------------------
  293|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  294|      0|        }
  295|      0|    }
  296|       |
  297|      5|    r->upstream->peer.get = ngx_http_upstream_get_round_robin_peer;
  298|      5|    r->upstream->peer.free = ngx_http_upstream_free_round_robin_peer;
  299|      5|    r->upstream->peer.tries = ngx_http_upstream_tries(rrp->peers);
  ------------------
  |  |   13|      5|#define ngx_http_upstream_tries(p) ((p)->tries                                \
  |  |   14|      5|                                    + ((p)->next ? (p)->next->tries : 0))
  |  |  ------------------
  |  |  |  Branch (14:40): [True: 0, False: 5]
  |  |  ------------------
  ------------------
  300|       |#if (NGX_HTTP_SSL)
  301|       |    r->upstream->peer.set_session =
  302|       |                               ngx_http_upstream_set_round_robin_peer_session;
  303|       |    r->upstream->peer.save_session =
  304|       |                               ngx_http_upstream_save_round_robin_peer_session;
  305|       |#endif
  306|       |
  307|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  308|      5|}
ngx_http_upstream_get_round_robin_peer:
  432|      5|{
  433|      5|    ngx_http_upstream_rr_peer_data_t  *rrp = data;
  434|       |
  435|      5|    ngx_int_t                      rc;
  436|      5|    ngx_uint_t                     i, n;
  437|      5|    ngx_http_upstream_rr_peer_t   *peer;
  438|      5|    ngx_http_upstream_rr_peers_t  *peers;
  439|       |
  440|      5|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
  441|      5|                   "get rr peer, try: %ui", pc->tries);
  442|       |
  443|      5|    pc->cached = 0;
  444|      5|    pc->connection = NULL;
  445|       |
  446|      5|    peers = rrp->peers;
  447|      5|    ngx_http_upstream_rr_peers_wlock(peers);
  ------------------
  |  |   94|      5|    if (peers->shpool) {                                                      \
  |  |  ------------------
  |  |  |  Branch (94:9): [True: 0, False: 5]
  |  |  ------------------
  |  |   95|      0|        ngx_rwlock_wlock(&peers->rwlock);                                     \
  |  |   96|      0|    }
  ------------------
  448|       |
  449|      5|    if (peers->single) {
  ------------------
  |  Branch (449:9): [True: 0, False: 5]
  ------------------
  450|      0|        peer = peers->peer;
  451|       |
  452|      0|        if (peer->down) {
  ------------------
  |  Branch (452:13): [True: 0, False: 0]
  ------------------
  453|      0|            goto failed;
  454|      0|        }
  455|       |
  456|      0|        if (peer->max_conns && peer->conns >= peer->max_conns) {
  ------------------
  |  Branch (456:13): [True: 0, False: 0]
  |  Branch (456:32): [True: 0, False: 0]
  ------------------
  457|      0|            goto failed;
  458|      0|        }
  459|       |
  460|      0|        rrp->current = peer;
  461|       |
  462|      5|    } else {
  463|       |
  464|       |        /* there are several peers */
  465|       |
  466|      5|        peer = ngx_http_upstream_get_peer(rrp);
  467|       |
  468|      5|        if (peer == NULL) {
  ------------------
  |  Branch (468:13): [True: 0, False: 5]
  ------------------
  469|      0|            goto failed;
  470|      0|        }
  471|       |
  472|      5|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0,
  473|      5|                       "get rr peer, current: %p %i",
  474|      5|                       peer, peer->current_weight);
  475|      5|    }
  476|       |
  477|      5|    pc->sockaddr = peer->sockaddr;
  478|      5|    pc->socklen = peer->socklen;
  479|      5|    pc->name = &peer->name;
  480|       |
  481|      5|    peer->conns++;
  482|       |
  483|      5|    ngx_http_upstream_rr_peers_unlock(peers);
  ------------------
  |  |  100|      5|    if (peers->shpool) {                                                      \
  |  |  ------------------
  |  |  |  Branch (100:9): [True: 0, False: 5]
  |  |  ------------------
  |  |  101|      0|        ngx_rwlock_unlock(&peers->rwlock);                                    \
  |  |  102|      0|    }
  ------------------
  484|       |
  485|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  486|       |
  487|      0|failed:
  488|       |
  489|      0|    if (peers->next) {
  ------------------
  |  Branch (489:9): [True: 0, False: 0]
  ------------------
  490|       |
  491|      0|        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0, "backup servers");
  492|       |
  493|      0|        rrp->peers = peers->next;
  494|       |
  495|      0|        n = (rrp->peers->number + (8 * sizeof(uintptr_t) - 1))
  496|      0|                / (8 * sizeof(uintptr_t));
  497|       |
  498|      0|        for (i = 0; i < n; i++) {
  ------------------
  |  Branch (498:21): [True: 0, False: 0]
  ------------------
  499|      0|            rrp->tried[i] = 0;
  500|      0|        }
  501|       |
  502|      0|        ngx_http_upstream_rr_peers_unlock(peers);
  ------------------
  |  |  100|      0|    if (peers->shpool) {                                                      \
  |  |  ------------------
  |  |  |  Branch (100:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  101|      0|        ngx_rwlock_unlock(&peers->rwlock);                                    \
  |  |  102|      0|    }
  ------------------
  503|       |
  504|      0|        rc = ngx_http_upstream_get_round_robin_peer(pc, rrp);
  505|       |
  506|      0|        if (rc != NGX_BUSY) {
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  |  Branch (506:13): [True: 0, False: 0]
  ------------------
  507|      0|            return rc;
  508|      0|        }
  509|       |
  510|      0|        ngx_http_upstream_rr_peers_wlock(peers);
  ------------------
  |  |   94|      0|    if (peers->shpool) {                                                      \
  |  |  ------------------
  |  |  |  Branch (94:9): [True: 0, False: 0]
  |  |  ------------------
  |  |   95|      0|        ngx_rwlock_wlock(&peers->rwlock);                                     \
  |  |   96|      0|    }
  ------------------
  511|      0|    }
  512|       |
  513|      0|    ngx_http_upstream_rr_peers_unlock(peers);
  ------------------
  |  |  100|      0|    if (peers->shpool) {                                                      \
  |  |  ------------------
  |  |  |  Branch (100:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  101|      0|        ngx_rwlock_unlock(&peers->rwlock);                                    \
  |  |  102|      0|    }
  ------------------
  514|       |
  515|      0|    pc->name = peers->name;
  516|       |
  517|      0|    return NGX_BUSY;
  ------------------
  |  |   41|      0|#define  NGX_BUSY       -3
  ------------------
  518|      0|}
ngx_http_upstream_round_robin.c:ngx_http_upstream_get_peer:
  523|      5|{
  524|      5|    time_t                        now;
  525|      5|    uintptr_t                     m;
  526|      5|    ngx_int_t                     total;
  527|      5|    ngx_uint_t                    i, n, p;
  528|      5|    ngx_http_upstream_rr_peer_t  *peer, *best;
  529|       |
  530|      5|    now = ngx_time();
  ------------------
  |  |   36|      5|#define ngx_time()           ngx_cached_time->sec
  ------------------
  531|       |
  532|      5|    best = NULL;
  533|      5|    total = 0;
  534|       |
  535|      5|#if (NGX_SUPPRESS_WARN)
  536|      5|    p = 0;
  537|      5|#endif
  538|       |
  539|      5|    for (peer = rrp->peers->peer, i = 0;
  540|     55|         peer;
  ------------------
  |  Branch (540:10): [True: 50, False: 5]
  ------------------
  541|     50|         peer = peer->next, i++)
  542|     50|    {
  543|     50|        n = i / (8 * sizeof(uintptr_t));
  544|     50|        m = (uintptr_t) 1 << i % (8 * sizeof(uintptr_t));
  545|       |
  546|     50|        if (rrp->tried[n] & m) {
  ------------------
  |  Branch (546:13): [True: 0, False: 50]
  ------------------
  547|      0|            continue;
  548|      0|        }
  549|       |
  550|     50|        if (peer->down) {
  ------------------
  |  Branch (550:13): [True: 0, False: 50]
  ------------------
  551|      0|            continue;
  552|      0|        }
  553|       |
  554|     50|        if (peer->max_fails
  ------------------
  |  Branch (554:13): [True: 0, False: 50]
  ------------------
  555|     50|            && peer->fails >= peer->max_fails
  ------------------
  |  Branch (555:16): [True: 0, False: 0]
  ------------------
  556|     50|            && now - peer->checked <= peer->fail_timeout)
  ------------------
  |  Branch (556:16): [True: 0, False: 0]
  ------------------
  557|      0|        {
  558|      0|            continue;
  559|      0|        }
  560|       |
  561|     50|        if (peer->max_conns && peer->conns >= peer->max_conns) {
  ------------------
  |  Branch (561:13): [True: 0, False: 50]
  |  Branch (561:32): [True: 0, False: 0]
  ------------------
  562|      0|            continue;
  563|      0|        }
  564|       |
  565|     50|        peer->current_weight += peer->effective_weight;
  566|     50|        total += peer->effective_weight;
  567|       |
  568|     50|        if (peer->effective_weight < peer->weight) {
  ------------------
  |  Branch (568:13): [True: 0, False: 50]
  ------------------
  569|      0|            peer->effective_weight++;
  570|      0|        }
  571|       |
  572|     50|        if (best == NULL || peer->current_weight > best->current_weight) {
  ------------------
  |  Branch (572:13): [True: 5, False: 45]
  |  Branch (572:29): [True: 4, False: 41]
  ------------------
  573|      9|            best = peer;
  574|      9|            p = i;
  575|      9|        }
  576|     50|    }
  577|       |
  578|      5|    if (best == NULL) {
  ------------------
  |  Branch (578:9): [True: 0, False: 5]
  ------------------
  579|      0|        return NULL;
  580|      0|    }
  581|       |
  582|      5|    rrp->current = best;
  583|       |
  584|      5|    n = p / (8 * sizeof(uintptr_t));
  585|      5|    m = (uintptr_t) 1 << p % (8 * sizeof(uintptr_t));
  586|       |
  587|      5|    rrp->tried[n] |= m;
  588|       |
  589|      5|    best->current_weight -= total;
  590|       |
  591|      5|    if (now - best->checked > best->fail_timeout) {
  ------------------
  |  Branch (591:9): [True: 5, False: 0]
  ------------------
  592|      5|        best->checked = now;
  593|      5|    }
  594|       |
  595|      5|    return best;
  596|      5|}

ngx_http_add_variable:
  416|    111|{
  417|    111|    ngx_int_t                   rc;
  418|    111|    ngx_uint_t                  i;
  419|    111|    ngx_hash_key_t             *key;
  420|    111|    ngx_http_variable_t        *v;
  421|    111|    ngx_http_core_main_conf_t  *cmcf;
  422|       |
  423|    111|    if (name->len == 0) {
  ------------------
  |  Branch (423:9): [True: 0, False: 111]
  ------------------
  424|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  425|      0|                           "invalid variable name \"$\"");
  426|      0|        return NULL;
  427|      0|    }
  428|       |
  429|    111|    if (flags & NGX_HTTP_VAR_PREFIX) {
  ------------------
  |  |   34|    111|#define NGX_HTTP_VAR_PREFIX       32
  ------------------
  |  Branch (429:9): [True: 9, False: 102]
  ------------------
  430|      9|        return ngx_http_add_prefix_variable(cf, name, flags);
  431|      9|    }
  432|       |
  433|    102|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|    102|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  434|       |
  435|    102|    key = cmcf->variables_keys->keys.elts;
  436|  5.25k|    for (i = 0; i < cmcf->variables_keys->keys.nelts; i++) {
  ------------------
  |  Branch (436:17): [True: 5.15k, False: 102]
  ------------------
  437|  5.15k|        if (name->len != key[i].key.len
  ------------------
  |  Branch (437:13): [True: 4.93k, False: 212]
  ------------------
  438|  5.15k|            || ngx_strncasecmp(name->data, key[i].key.data, name->len) != 0)
  ------------------
  |  Branch (438:16): [True: 212, False: 0]
  ------------------
  439|  5.15k|        {
  440|  5.15k|            continue;
  441|  5.15k|        }
  442|       |
  443|      0|        v = key[i].value;
  444|       |
  445|      0|        if (!(v->flags & NGX_HTTP_VAR_CHANGEABLE)) {
  ------------------
  |  |   29|      0|#define NGX_HTTP_VAR_CHANGEABLE   1
  ------------------
  |  Branch (445:13): [True: 0, False: 0]
  ------------------
  446|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  447|      0|                               "the duplicate \"%V\" variable", name);
  448|      0|            return NULL;
  449|      0|        }
  450|       |
  451|      0|        if (!(flags & NGX_HTTP_VAR_WEAK)) {
  ------------------
  |  |   33|      0|#define NGX_HTTP_VAR_WEAK         16
  ------------------
  |  Branch (451:13): [True: 0, False: 0]
  ------------------
  452|      0|            v->flags &= ~NGX_HTTP_VAR_WEAK;
  ------------------
  |  |   33|      0|#define NGX_HTTP_VAR_WEAK         16
  ------------------
  453|      0|        }
  454|       |
  455|      0|        return v;
  456|      0|    }
  457|       |
  458|    102|    v = ngx_palloc(cf->pool, sizeof(ngx_http_variable_t));
  459|    102|    if (v == NULL) {
  ------------------
  |  Branch (459:9): [True: 0, False: 102]
  ------------------
  460|      0|        return NULL;
  461|      0|    }
  462|       |
  463|    102|    v->name.len = name->len;
  464|    102|    v->name.data = ngx_pnalloc(cf->pool, name->len);
  465|    102|    if (v->name.data == NULL) {
  ------------------
  |  Branch (465:9): [True: 0, False: 102]
  ------------------
  466|      0|        return NULL;
  467|      0|    }
  468|       |
  469|    102|    ngx_strlow(v->name.data, name->data, name->len);
  470|       |
  471|    102|    v->set_handler = NULL;
  472|    102|    v->get_handler = NULL;
  473|    102|    v->data = 0;
  474|    102|    v->flags = flags;
  475|    102|    v->index = 0;
  476|       |
  477|    102|    rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v, 0);
  478|       |
  479|    102|    if (rc == NGX_ERROR) {
  ------------------
  |  |   39|    102|#define  NGX_ERROR      -1
  ------------------
  |  Branch (479:9): [True: 0, False: 102]
  ------------------
  480|      0|        return NULL;
  481|      0|    }
  482|       |
  483|    102|    if (rc == NGX_BUSY) {
  ------------------
  |  |   41|    102|#define  NGX_BUSY       -3
  ------------------
  |  Branch (483:9): [True: 0, False: 102]
  ------------------
  484|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  485|      0|                           "conflicting variable name \"%V\"", name);
  486|      0|        return NULL;
  487|      0|    }
  488|       |
  489|    102|    return v;
  490|    102|}
ngx_http_get_variable_index:
  550|     17|{
  551|     17|    ngx_uint_t                  i;
  552|     17|    ngx_http_variable_t        *v;
  553|     17|    ngx_http_core_main_conf_t  *cmcf;
  554|       |
  555|     17|    if (name->len == 0) {
  ------------------
  |  Branch (555:9): [True: 0, False: 17]
  ------------------
  556|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  557|      0|                           "invalid variable name \"$\"");
  558|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  559|      0|    }
  560|       |
  561|     17|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|     17|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  562|       |
  563|     17|    v = cmcf->variables.elts;
  564|       |
  565|     17|    if (v == NULL) {
  ------------------
  |  Branch (565:9): [True: 1, False: 16]
  ------------------
  566|      1|        if (ngx_array_init(&cmcf->variables, cf->pool, 4,
  ------------------
  |  Branch (566:13): [True: 0, False: 1]
  ------------------
  567|      1|                           sizeof(ngx_http_variable_t))
  568|      1|            != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  569|      0|        {
  570|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  571|      0|        }
  572|       |
  573|     16|    } else {
  574|    103|        for (i = 0; i < cmcf->variables.nelts; i++) {
  ------------------
  |  Branch (574:21): [True: 93, False: 10]
  ------------------
  575|     93|            if (name->len != v[i].name.len
  ------------------
  |  Branch (575:17): [True: 78, False: 15]
  ------------------
  576|     93|                || ngx_strncasecmp(name->data, v[i].name.data, name->len) != 0)
  ------------------
  |  Branch (576:20): [True: 9, False: 6]
  ------------------
  577|     87|            {
  578|     87|                continue;
  579|     87|            }
  580|       |
  581|      6|            return i;
  582|     93|        }
  583|     16|    }
  584|       |
  585|     11|    v = ngx_array_push(&cmcf->variables);
  586|     11|    if (v == NULL) {
  ------------------
  |  Branch (586:9): [True: 0, False: 11]
  ------------------
  587|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  588|      0|    }
  589|       |
  590|     11|    v->name.len = name->len;
  591|     11|    v->name.data = ngx_pnalloc(cf->pool, name->len);
  592|     11|    if (v->name.data == NULL) {
  ------------------
  |  Branch (592:9): [True: 0, False: 11]
  ------------------
  593|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  594|      0|    }
  595|       |
  596|     11|    ngx_strlow(v->name.data, name->data, name->len);
  597|       |
  598|     11|    v->set_handler = NULL;
  599|     11|    v->get_handler = NULL;
  600|     11|    v->data = 0;
  601|     11|    v->flags = 0;
  602|     11|    v->index = cmcf->variables.nelts - 1;
  603|       |
  604|     11|    return v->index;
  605|     11|}
ngx_http_get_indexed_variable:
  610|     94|{
  611|     94|    ngx_http_variable_t        *v;
  612|     94|    ngx_http_core_main_conf_t  *cmcf;
  613|       |
  614|     94|    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  ------------------
  |  |   56|     94|    (r)->main_conf[module.ctx_index]
  ------------------
  615|       |
  616|     94|    if (cmcf->variables.nelts <= index) {
  ------------------
  |  Branch (616:9): [True: 0, False: 94]
  ------------------
  617|      0|        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  618|      0|                      "unknown variable index: %ui", index);
  619|      0|        return NULL;
  620|      0|    }
  621|       |
  622|     94|    if (r->variables[index].not_found || r->variables[index].valid) {
  ------------------
  |  Branch (622:9): [True: 26, False: 68]
  |  Branch (622:42): [True: 21, False: 47]
  ------------------
  623|     47|        return &r->variables[index];
  624|     47|    }
  625|       |
  626|     47|    v = cmcf->variables.elts;
  627|       |
  628|     47|    if (ngx_http_variable_depth == 0) {
  ------------------
  |  Branch (628:9): [True: 0, False: 47]
  ------------------
  629|      0|        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  630|      0|                      "cycle while evaluating variable \"%V\"",
  631|      0|                      &v[index].name);
  632|      0|        return NULL;
  633|      0|    }
  634|       |
  635|     47|    ngx_http_variable_depth--;
  636|       |
  637|     47|    if (v[index].get_handler(r, &r->variables[index], v[index].data)
  ------------------
  |  Branch (637:9): [True: 47, False: 0]
  ------------------
  638|     47|        == NGX_OK)
  ------------------
  |  |   38|     47|#define  NGX_OK          0
  ------------------
  639|     47|    {
  640|     47|        ngx_http_variable_depth++;
  641|       |
  642|     47|        if (v[index].flags & NGX_HTTP_VAR_NOCACHEABLE) {
  ------------------
  |  |   30|     47|#define NGX_HTTP_VAR_NOCACHEABLE  2
  ------------------
  |  Branch (642:13): [True: 10, False: 37]
  ------------------
  643|     10|            r->variables[index].no_cacheable = 1;
  644|     10|        }
  645|       |
  646|     47|        return &r->variables[index];
  647|     47|    }
  648|       |
  649|      0|    ngx_http_variable_depth++;
  650|       |
  651|      0|    r->variables[index].valid = 0;
  652|      0|    r->variables[index].not_found = 1;
  653|       |
  654|      0|    return NULL;
  655|     47|}
ngx_http_map_find:
 2472|     11|{
 2473|     11|    void        *value;
 2474|     11|    u_char      *low;
 2475|     11|    size_t       len;
 2476|     11|    ngx_uint_t   key;
 2477|       |
 2478|     11|    len = match->len;
 2479|       |
 2480|     11|    if (len) {
  ------------------
  |  Branch (2480:9): [True: 0, False: 11]
  ------------------
 2481|      0|        low = ngx_pnalloc(r->pool, len);
 2482|      0|        if (low == NULL) {
  ------------------
  |  Branch (2482:13): [True: 0, False: 0]
  ------------------
 2483|      0|            return NULL;
 2484|      0|        }
 2485|       |
 2486|     11|    } else {
 2487|     11|        low = NULL;
 2488|     11|    }
 2489|       |
 2490|     11|    key = ngx_hash_strlow(low, match->data, len);
 2491|       |
 2492|     11|    value = ngx_hash_find_combined(&map->hash, key, low, len);
 2493|     11|    if (value) {
  ------------------
  |  Branch (2493:9): [True: 0, False: 11]
  ------------------
 2494|      0|        return value;
 2495|      0|    }
 2496|       |
 2497|     11|#if (NGX_PCRE)
 2498|       |
 2499|     11|    if (len && map->nregex) {
  ------------------
  |  Branch (2499:9): [True: 0, False: 11]
  |  Branch (2499:16): [True: 0, False: 0]
  ------------------
 2500|      0|        ngx_int_t              n;
 2501|      0|        ngx_uint_t             i;
 2502|      0|        ngx_http_map_regex_t  *reg;
 2503|       |
 2504|      0|        reg = map->regex;
 2505|       |
 2506|      0|        for (i = 0; i < map->nregex; i++) {
  ------------------
  |  Branch (2506:21): [True: 0, False: 0]
  ------------------
 2507|       |
 2508|      0|            n = ngx_http_regex_exec(r, reg[i].regex, match);
 2509|       |
 2510|      0|            if (n == NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (2510:17): [True: 0, False: 0]
  ------------------
 2511|      0|                return reg[i].value;
 2512|      0|            }
 2513|       |
 2514|      0|            if (n == NGX_DECLINED) {
  ------------------
  |  |   43|      0|#define  NGX_DECLINED   -5
  ------------------
  |  Branch (2514:17): [True: 0, False: 0]
  ------------------
 2515|      0|                continue;
 2516|      0|            }
 2517|       |
 2518|       |            /* NGX_ERROR */
 2519|       |
 2520|      0|            return NULL;
 2521|      0|        }
 2522|      0|    }
 2523|       |
 2524|     11|#endif
 2525|       |
 2526|     11|    return NULL;
 2527|     11|}
ngx_http_regex_compile:
 2543|      1|{
 2544|      1|    u_char                     *p;
 2545|      1|    size_t                      size;
 2546|      1|    ngx_str_t                   name;
 2547|      1|    ngx_uint_t                  i, n;
 2548|      1|    ngx_http_variable_t        *v;
 2549|      1|    ngx_http_regex_t           *re;
 2550|      1|    ngx_http_regex_variable_t  *rv;
 2551|      1|    ngx_http_core_main_conf_t  *cmcf;
 2552|       |
 2553|      1|    rc->pool = cf->pool;
 2554|       |
 2555|      1|    if (ngx_regex_compile(rc) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (2555:9): [True: 0, False: 1]
  ------------------
 2556|      0|        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V", &rc->err);
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
 2557|      0|        return NULL;
 2558|      0|    }
 2559|       |
 2560|      1|    re = ngx_pcalloc(cf->pool, sizeof(ngx_http_regex_t));
 2561|      1|    if (re == NULL) {
  ------------------
  |  Branch (2561:9): [True: 0, False: 1]
  ------------------
 2562|      0|        return NULL;
 2563|      0|    }
 2564|       |
 2565|      1|    re->regex = rc->regex;
 2566|      1|    re->ncaptures = rc->captures;
 2567|      1|    re->name = rc->pattern;
 2568|       |
 2569|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 2570|      1|    cmcf->ncaptures = ngx_max(cmcf->ncaptures, re->ncaptures);
  ------------------
  |  |  109|      1|#define ngx_max(val1, val2)  ((val1 < val2) ? (val2) : (val1))
  |  |  ------------------
  |  |  |  Branch (109:31): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 2571|       |
 2572|      1|    n = (ngx_uint_t) rc->named_captures;
 2573|       |
 2574|      1|    if (n == 0) {
  ------------------
  |  Branch (2574:9): [True: 0, False: 1]
  ------------------
 2575|      0|        return re;
 2576|      0|    }
 2577|       |
 2578|      1|    rv = ngx_palloc(rc->pool, n * sizeof(ngx_http_regex_variable_t));
 2579|      1|    if (rv == NULL) {
  ------------------
  |  Branch (2579:9): [True: 0, False: 1]
  ------------------
 2580|      0|        return NULL;
 2581|      0|    }
 2582|       |
 2583|      1|    re->variables = rv;
 2584|      1|    re->nvariables = n;
 2585|       |
 2586|      1|    size = rc->name_size;
 2587|      1|    p = rc->names;
 2588|       |
 2589|      2|    for (i = 0; i < n; i++) {
  ------------------
  |  Branch (2589:17): [True: 1, False: 1]
  ------------------
 2590|      1|        rv[i].capture = 2 * ((p[0] << 8) + p[1]);
 2591|       |
 2592|      1|        name.data = &p[2];
 2593|      1|        name.len = ngx_strlen(name.data);
  ------------------
  |  |   61|      1|#define ngx_strlen(s)       strlen((const char *) s)
  ------------------
 2594|       |
 2595|      1|        v = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE);
  ------------------
  |  |   29|      1|#define NGX_HTTP_VAR_CHANGEABLE   1
  ------------------
 2596|      1|        if (v == NULL) {
  ------------------
  |  Branch (2596:13): [True: 0, False: 1]
  ------------------
 2597|      0|            return NULL;
 2598|      0|        }
 2599|       |
 2600|      1|        rv[i].index = ngx_http_get_variable_index(cf, &name);
 2601|      1|        if (rv[i].index == NGX_ERROR) {
  ------------------
  |  |   39|      1|#define  NGX_ERROR      -1
  ------------------
  |  Branch (2601:13): [True: 0, False: 1]
  ------------------
 2602|      0|            return NULL;
 2603|      0|        }
 2604|       |
 2605|      1|        v->get_handler = ngx_http_variable_not_found;
 2606|       |
 2607|      1|        p += size;
 2608|      1|    }
 2609|       |
 2610|      1|    return re;
 2611|      1|}
ngx_http_regex_exec:
 2616|      3|{
 2617|      3|    ngx_int_t                   rc, index;
 2618|      3|    ngx_uint_t                  i, n, len;
 2619|      3|    ngx_http_variable_value_t  *vv;
 2620|      3|    ngx_http_core_main_conf_t  *cmcf;
 2621|       |
 2622|      3|    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  ------------------
  |  |   56|      3|    (r)->main_conf[module.ctx_index]
  ------------------
 2623|       |
 2624|      3|    if (re->ncaptures) {
  ------------------
  |  Branch (2624:9): [True: 3, False: 0]
  ------------------
 2625|      3|        len = cmcf->ncaptures;
 2626|       |
 2627|      3|        if (r->captures == NULL || r->realloc_captures) {
  ------------------
  |  Branch (2627:13): [True: 3, False: 0]
  |  Branch (2627:36): [True: 0, False: 0]
  ------------------
 2628|      3|            r->realloc_captures = 0;
 2629|       |
 2630|      3|            r->captures = ngx_palloc(r->pool, len * sizeof(int));
 2631|      3|            if (r->captures == NULL) {
  ------------------
  |  Branch (2631:17): [True: 0, False: 3]
  ------------------
 2632|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2633|      0|            }
 2634|      3|        }
 2635|       |
 2636|      3|    } else {
 2637|      0|        len = 0;
 2638|      0|    }
 2639|       |
 2640|      3|    rc = ngx_regex_exec(re->regex, s, r->captures, len);
 2641|       |
 2642|      3|    if (rc == NGX_REGEX_NO_MATCHED) {
  ------------------
  |  |   29|      3|#define NGX_REGEX_NO_MATCHED   PCRE_ERROR_NOMATCH    /* -1 */
  ------------------
  |  Branch (2642:9): [True: 3, False: 0]
  ------------------
 2643|      3|        return NGX_DECLINED;
  ------------------
  |  |   43|      3|#define  NGX_DECLINED   -5
  ------------------
 2644|      3|    }
 2645|       |
 2646|      0|    if (rc < 0) {
  ------------------
  |  Branch (2646:9): [True: 0, False: 0]
  ------------------
 2647|      0|        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2648|      0|                      ngx_regex_exec_n " failed: %i on \"%V\" using \"%V\"",
 2649|      0|                      rc, s, &re->name);
 2650|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2651|      0|    }
 2652|       |
 2653|      0|    for (i = 0; i < re->nvariables; i++) {
  ------------------
  |  Branch (2653:17): [True: 0, False: 0]
  ------------------
 2654|       |
 2655|      0|        n = re->variables[i].capture;
 2656|      0|        index = re->variables[i].index;
 2657|      0|        vv = &r->variables[index];
 2658|       |
 2659|      0|        vv->len = r->captures[n + 1] - r->captures[n];
 2660|      0|        vv->valid = 1;
 2661|      0|        vv->no_cacheable = 0;
 2662|      0|        vv->not_found = 0;
 2663|      0|        vv->data = &s->data[r->captures[n]];
 2664|       |
 2665|       |#if (NGX_DEBUG)
 2666|       |        {
 2667|       |        ngx_http_variable_t  *v;
 2668|       |
 2669|       |        v = cmcf->variables.elts;
 2670|       |
 2671|       |        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
 2672|       |                       "http regex set $%V to \"%v\"", &v[index].name, vv);
 2673|       |        }
 2674|       |#endif
 2675|      0|    }
 2676|       |
 2677|      0|    r->ncaptures = rc * 2;
 2678|      0|    r->captures_data = s->data;
 2679|       |
 2680|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
 2681|      0|}
ngx_http_variables_add_core_vars:
 2688|      1|{
 2689|      1|    ngx_http_variable_t        *cv, *v;
 2690|      1|    ngx_http_core_main_conf_t  *cmcf;
 2691|       |
 2692|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 2693|       |
 2694|      1|    cmcf->variables_keys = ngx_pcalloc(cf->temp_pool,
 2695|      1|                                       sizeof(ngx_hash_keys_arrays_t));
 2696|      1|    if (cmcf->variables_keys == NULL) {
  ------------------
  |  Branch (2696:9): [True: 0, False: 1]
  ------------------
 2697|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2698|      0|    }
 2699|       |
 2700|      1|    cmcf->variables_keys->pool = cf->pool;
 2701|      1|    cmcf->variables_keys->temp_pool = cf->pool;
 2702|       |
 2703|      1|    if (ngx_hash_keys_array_init(cmcf->variables_keys, NGX_HASH_SMALL)
  ------------------
  |  |   65|      1|#define NGX_HASH_SMALL            1
  ------------------
  |  Branch (2703:9): [True: 0, False: 1]
  ------------------
 2704|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2705|      0|    {
 2706|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2707|      0|    }
 2708|       |
 2709|      1|    if (ngx_array_init(&cmcf->prefix_variables, cf->pool, 8,
  ------------------
  |  Branch (2709:9): [True: 0, False: 1]
  ------------------
 2710|      1|                       sizeof(ngx_http_variable_t))
 2711|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2712|      0|    {
 2713|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2714|      0|    }
 2715|       |
 2716|     74|    for (cv = ngx_http_core_variables; cv->name.len; cv++) {
  ------------------
  |  Branch (2716:40): [True: 73, False: 1]
  ------------------
 2717|     73|        v = ngx_http_add_variable(cf, &cv->name, cv->flags);
 2718|     73|        if (v == NULL) {
  ------------------
  |  Branch (2718:13): [True: 0, False: 73]
  ------------------
 2719|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2720|      0|        }
 2721|       |
 2722|     73|        *v = *cv;
 2723|     73|    }
 2724|       |
 2725|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2726|      1|}
ngx_http_variables_init_vars:
 2731|      1|{
 2732|      1|    size_t                      len;
 2733|      1|    ngx_uint_t                  i, n;
 2734|      1|    ngx_hash_key_t             *key;
 2735|      1|    ngx_hash_init_t             hash;
 2736|      1|    ngx_http_variable_t        *v, *av, *pv;
 2737|      1|    ngx_http_core_main_conf_t  *cmcf;
 2738|       |
 2739|       |    /* set the handlers for the indexed http variables */
 2740|       |
 2741|      1|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      1|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
 2742|       |
 2743|      1|    v = cmcf->variables.elts;
 2744|      1|    pv = cmcf->prefix_variables.elts;
 2745|      1|    key = cmcf->variables_keys->keys.elts;
 2746|       |
 2747|     12|    for (i = 0; i < cmcf->variables.nelts; i++) {
  ------------------
  |  Branch (2747:17): [True: 11, False: 1]
  ------------------
 2748|       |
 2749|    699|        for (n = 0; n < cmcf->variables_keys->keys.nelts; n++) {
  ------------------
  |  Branch (2749:21): [True: 698, False: 1]
  ------------------
 2750|       |
 2751|    698|            av = key[n].value;
 2752|       |
 2753|    698|            if (v[i].name.len == key[n].key.len
  ------------------
  |  Branch (2753:17): [True: 32, False: 666]
  ------------------
 2754|    698|                && ngx_strncmp(v[i].name.data, key[n].key.data, v[i].name.len)
  ------------------
  |  |   53|     32|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (2754:20): [True: 10, False: 22]
  ------------------
 2755|     32|                   == 0)
 2756|     10|            {
 2757|     10|                v[i].get_handler = av->get_handler;
 2758|     10|                v[i].data = av->data;
 2759|       |
 2760|     10|                av->flags |= NGX_HTTP_VAR_INDEXED;
  ------------------
  |  |   31|     10|#define NGX_HTTP_VAR_INDEXED      4
  ------------------
 2761|     10|                v[i].flags = av->flags;
 2762|       |
 2763|     10|                av->index = i;
 2764|       |
 2765|     10|                if (av->get_handler == NULL
  ------------------
  |  Branch (2765:21): [True: 0, False: 10]
  ------------------
 2766|     10|                    || (av->flags & NGX_HTTP_VAR_WEAK))
  ------------------
  |  |   33|     10|#define NGX_HTTP_VAR_WEAK         16
  ------------------
  |  Branch (2766:24): [True: 0, False: 10]
  ------------------
 2767|      0|                {
 2768|      0|                    break;
 2769|      0|                }
 2770|       |
 2771|     10|                goto next;
 2772|     10|            }
 2773|    698|        }
 2774|       |
 2775|      1|        len = 0;
 2776|      1|        av = NULL;
 2777|       |
 2778|     10|        for (n = 0; n < cmcf->prefix_variables.nelts; n++) {
  ------------------
  |  Branch (2778:21): [True: 9, False: 1]
  ------------------
 2779|      9|            if (v[i].name.len >= pv[n].name.len && v[i].name.len > len
  ------------------
  |  Branch (2779:17): [True: 4, False: 5]
  |  Branch (2779:52): [True: 4, False: 0]
  ------------------
 2780|      9|                && ngx_strncmp(v[i].name.data, pv[n].name.data, pv[n].name.len)
  ------------------
  |  |   53|      4|#define ngx_strncmp(s1, s2, n)  strncmp((const char *) s1, (const char *) s2, n)
  ------------------
  |  Branch (2780:20): [True: 1, False: 3]
  ------------------
 2781|      4|                   == 0)
 2782|      1|            {
 2783|      1|                av = &pv[n];
 2784|      1|                len = pv[n].name.len;
 2785|      1|            }
 2786|      9|        }
 2787|       |
 2788|      1|        if (av) {
  ------------------
  |  Branch (2788:13): [True: 1, False: 0]
  ------------------
 2789|      1|            v[i].get_handler = av->get_handler;
 2790|      1|            v[i].data = (uintptr_t) &v[i].name;
 2791|      1|            v[i].flags = av->flags;
 2792|       |
 2793|      1|            goto next;
 2794|      1|        }
 2795|       |
 2796|      0|        if (v[i].get_handler == NULL) {
  ------------------
  |  Branch (2796:13): [True: 0, False: 0]
  ------------------
 2797|      0|            ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2798|      0|                          "unknown \"%V\" variable", &v[i].name);
 2799|       |
 2800|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2801|      0|        }
 2802|       |
 2803|     11|    next:
 2804|     11|        continue;
 2805|      0|    }
 2806|       |
 2807|       |
 2808|    103|    for (n = 0; n < cmcf->variables_keys->keys.nelts; n++) {
  ------------------
  |  Branch (2808:17): [True: 102, False: 1]
  ------------------
 2809|    102|        av = key[n].value;
 2810|       |
 2811|    102|        if (av->flags & NGX_HTTP_VAR_NOHASH) {
  ------------------
  |  |   32|    102|#define NGX_HTTP_VAR_NOHASH       8
  ------------------
  |  Branch (2811:13): [True: 11, False: 91]
  ------------------
 2812|     11|            key[n].key.data = NULL;
 2813|     11|        }
 2814|    102|    }
 2815|       |
 2816|       |
 2817|      1|    hash.hash = &cmcf->variables_hash;
 2818|      1|    hash.key = ngx_hash_key;
 2819|      1|    hash.max_size = cmcf->variables_hash_max_size;
 2820|      1|    hash.bucket_size = cmcf->variables_hash_bucket_size;
 2821|      1|    hash.name = "variables_hash";
 2822|      1|    hash.pool = cf->pool;
 2823|      1|    hash.temp_pool = NULL;
 2824|       |
 2825|      1|    if (ngx_hash_init(&hash, cmcf->variables_keys->keys.elts,
  ------------------
  |  Branch (2825:9): [True: 0, False: 1]
  ------------------
 2826|      1|                      cmcf->variables_keys->keys.nelts)
 2827|      1|        != NGX_OK)
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2828|      0|    {
 2829|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 2830|      0|    }
 2831|       |
 2832|      1|    cmcf->variables_keys = NULL;
 2833|       |
 2834|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2835|      1|}
ngx_http_variables.c:ngx_http_add_prefix_variable:
  495|      9|{
  496|      9|    ngx_uint_t                  i;
  497|      9|    ngx_http_variable_t        *v;
  498|      9|    ngx_http_core_main_conf_t  *cmcf;
  499|       |
  500|      9|    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
  ------------------
  |  |   62|      9|    ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
  ------------------
  501|       |
  502|      9|    v = cmcf->prefix_variables.elts;
  503|     45|    for (i = 0; i < cmcf->prefix_variables.nelts; i++) {
  ------------------
  |  Branch (503:17): [True: 36, False: 9]
  ------------------
  504|     36|        if (name->len != v[i].name.len
  ------------------
  |  Branch (504:13): [True: 36, False: 0]
  ------------------
  505|     36|            || ngx_strncasecmp(name->data, v[i].name.data, name->len) != 0)
  ------------------
  |  Branch (505:16): [True: 0, False: 0]
  ------------------
  506|     36|        {
  507|     36|            continue;
  508|     36|        }
  509|       |
  510|      0|        v = &v[i];
  511|       |
  512|      0|        if (!(v->flags & NGX_HTTP_VAR_CHANGEABLE)) {
  ------------------
  |  |   29|      0|#define NGX_HTTP_VAR_CHANGEABLE   1
  ------------------
  |  Branch (512:13): [True: 0, False: 0]
  ------------------
  513|      0|            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
  ------------------
  |  |   17|      0|#define NGX_LOG_EMERG             1
  ------------------
  514|      0|                               "the duplicate \"%V\" variable", name);
  515|      0|            return NULL;
  516|      0|        }
  517|       |
  518|      0|        if (!(flags & NGX_HTTP_VAR_WEAK)) {
  ------------------
  |  |   33|      0|#define NGX_HTTP_VAR_WEAK         16
  ------------------
  |  Branch (518:13): [True: 0, False: 0]
  ------------------
  519|      0|            v->flags &= ~NGX_HTTP_VAR_WEAK;
  ------------------
  |  |   33|      0|#define NGX_HTTP_VAR_WEAK         16
  ------------------
  520|      0|        }
  521|       |
  522|      0|        return v;
  523|      0|    }
  524|       |
  525|      9|    v = ngx_array_push(&cmcf->prefix_variables);
  526|      9|    if (v == NULL) {
  ------------------
  |  Branch (526:9): [True: 0, False: 9]
  ------------------
  527|      0|        return NULL;
  528|      0|    }
  529|       |
  530|      9|    v->name.len = name->len;
  531|      9|    v->name.data = ngx_pnalloc(cf->pool, name->len);
  532|      9|    if (v->name.data == NULL) {
  ------------------
  |  Branch (532:9): [True: 0, False: 9]
  ------------------
  533|      0|        return NULL;
  534|      0|    }
  535|       |
  536|      9|    ngx_strlow(v->name.data, name->data, name->len);
  537|       |
  538|      9|    v->set_handler = NULL;
  539|      9|    v->get_handler = NULL;
  540|      9|    v->data = 0;
  541|      9|    v->flags = flags;
  542|      9|    v->index = 0;
  543|       |
  544|      9|    return v;
  545|      9|}
ngx_http_variables.c:ngx_http_variable_not_found:
 2535|     11|{
 2536|     11|    v->not_found = 1;
 2537|     11|    return NGX_OK;
  ------------------
  |  |   38|     11|#define  NGX_OK          0
  ------------------
 2538|     11|}
ngx_http_variables.c:ngx_http_variable_header:
  813|      5|{
  814|      5|    return ngx_http_variable_headers_internal(r, v, data, ',');
  815|      5|}
ngx_http_variables.c:ngx_http_variable_headers_internal:
  829|      5|{
  830|      5|    size_t            len;
  831|      5|    u_char           *p, *end;
  832|      5|    ngx_table_elt_t  *h, *th;
  833|       |
  834|      5|    h = *(ngx_table_elt_t **) ((char *) r + data);
  835|       |
  836|      5|    len = 0;
  837|       |
  838|      5|    for (th = h; th; th = th->next) {
  ------------------
  |  Branch (838:18): [True: 0, False: 5]
  ------------------
  839|       |
  840|      0|        if (th->hash == 0) {
  ------------------
  |  Branch (840:13): [True: 0, False: 0]
  ------------------
  841|      0|            continue;
  842|      0|        }
  843|       |
  844|      0|        len += th->value.len + 2;
  845|      0|    }
  846|       |
  847|      5|    if (len == 0) {
  ------------------
  |  Branch (847:9): [True: 5, False: 0]
  ------------------
  848|      5|        v->not_found = 1;
  849|      5|        return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
  850|      5|    }
  851|       |
  852|      0|    len -= 2;
  853|       |
  854|      0|    v->valid = 1;
  855|      0|    v->no_cacheable = 0;
  856|      0|    v->not_found = 0;
  857|       |
  858|      0|    if (h->next == NULL) {
  ------------------
  |  Branch (858:9): [True: 0, False: 0]
  ------------------
  859|      0|        v->len = h->value.len;
  860|      0|        v->data = h->value.data;
  861|       |
  862|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  863|      0|    }
  864|       |
  865|      0|    p = ngx_pnalloc(r->pool, len);
  866|      0|    if (p == NULL) {
  ------------------
  |  Branch (866:9): [True: 0, False: 0]
  ------------------
  867|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  868|      0|    }
  869|       |
  870|      0|    v->len = len;
  871|      0|    v->data = p;
  872|       |
  873|      0|    end = p + len;
  874|       |
  875|      0|    for (th = h; th; th = th->next) {
  ------------------
  |  Branch (875:18): [True: 0, False: 0]
  ------------------
  876|       |
  877|      0|        if (th->hash == 0) {
  ------------------
  |  Branch (877:13): [True: 0, False: 0]
  ------------------
  878|      0|            continue;
  879|      0|        }
  880|       |
  881|      0|        p = ngx_copy(p, th->value.data, th->value.len);
  ------------------
  |  |  138|      0|#define ngx_copy                  ngx_cpymem
  |  |  ------------------
  |  |  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  |  |  ------------------
  ------------------
  882|       |
  883|      0|        if (p == end) {
  ------------------
  |  Branch (883:13): [True: 0, False: 0]
  ------------------
  884|      0|            break;
  885|      0|        }
  886|       |
  887|      0|        *p++ = sep; *p++ = ' ';
  888|      0|    }
  889|       |
  890|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  891|      0|}
ngx_http_variables.c:ngx_http_variable_remote_addr:
 1302|      5|{
 1303|      5|    v->len = r->connection->addr_text.len;
 1304|      5|    v->valid = 1;
 1305|      5|    v->no_cacheable = 0;
 1306|      5|    v->not_found = 0;
 1307|      5|    v->data = r->connection->addr_text.data;
 1308|       |
 1309|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 1310|      5|}
ngx_http_variables.c:ngx_http_variable_remote_port:
 1316|      5|{
 1317|      5|    ngx_uint_t  port;
 1318|       |
 1319|      5|    v->len = 0;
 1320|      5|    v->valid = 1;
 1321|      5|    v->no_cacheable = 0;
 1322|      5|    v->not_found = 0;
 1323|       |
 1324|      5|    v->data = ngx_pnalloc(r->pool, sizeof("65535") - 1);
 1325|      5|    if (v->data == NULL) {
  ------------------
  |  Branch (1325:9): [True: 0, False: 5]
  ------------------
 1326|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
 1327|      0|    }
 1328|       |
 1329|      5|    port = ngx_inet_get_port(r->connection->sockaddr);
 1330|       |
 1331|      5|    if (port > 0 && port < 65536) {
  ------------------
  |  Branch (1331:9): [True: 0, False: 5]
  |  Branch (1331:21): [True: 0, False: 0]
  ------------------
 1332|      0|        v->len = ngx_sprintf(v->data, "%ui", port) - v->data;
 1333|      0|    }
 1334|       |
 1335|      5|    return NGX_OK;
  ------------------
  |  |   38|      5|#define  NGX_OK          0
  ------------------
 1336|      5|}

ngx_http_write_filter:
   49|     16|{
   50|     16|    off_t                      size, sent, nsent, limit;
   51|     16|    ngx_uint_t                 last, flush, sync;
   52|     16|    ngx_msec_t                 delay;
   53|     16|    ngx_chain_t               *cl, *ln, **ll, *chain;
   54|     16|    ngx_connection_t          *c;
   55|     16|    ngx_http_core_loc_conf_t  *clcf;
   56|       |
   57|     16|    c = r->connection;
   58|       |
   59|     16|    if (c->error) {
  ------------------
  |  Branch (59:9): [True: 0, False: 16]
  ------------------
   60|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   61|      0|    }
   62|       |
   63|     16|    size = 0;
   64|     16|    flush = 0;
   65|     16|    sync = 0;
   66|     16|    last = 0;
   67|     16|    ll = &r->out;
   68|       |
   69|       |    /* find the size, the flush point and the last link of the saved chain */
   70|       |
   71|     27|    for (cl = r->out; cl; cl = cl->next) {
  ------------------
  |  Branch (71:23): [True: 11, False: 16]
  ------------------
   72|     11|        ll = &cl->next;
   73|       |
   74|     11|        ngx_log_debug7(NGX_LOG_DEBUG_EVENT, c->log, 0,
   75|     11|                       "write old buf t:%d f:%d %p, pos %p, size: %z "
   76|     11|                       "file: %O, size: %O",
   77|     11|                       cl->buf->temporary, cl->buf->in_file,
   78|     11|                       cl->buf->start, cl->buf->pos,
   79|     11|                       cl->buf->last - cl->buf->pos,
   80|     11|                       cl->buf->file_pos,
   81|     11|                       cl->buf->file_last - cl->buf->file_pos);
   82|       |
   83|     11|        if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
  ------------------
  |  |  137|     11|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|     11|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 7, False: 4]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 4]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|     11|                            ((b)->file_last - (b)->file_pos))
  ------------------
                      if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
  ------------------
  |  |  129|      4|    (((b)->flush || (b)->last_buf || (b)->sync)                              \
  |  |  ------------------
  |  |  |  Branch (129:7): [True: 4, False: 0]
  |  |  |  Branch (129:21): [True: 0, False: 0]
  |  |  |  Branch (129:38): [True: 0, False: 0]
  |  |  ------------------
  |  |  130|      4|     && !ngx_buf_in_memory(b) && !(b)->in_file)
  |  |  ------------------
  |  |  |  |  125|      8|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 4]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 4]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (130:34): [True: 4, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (83:13): [True: 4, False: 7]
  ------------------
   84|      0|            ngx_log_error(NGX_LOG_ALERT, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   85|      0|                          "zero size buf in writer "
   86|      0|                          "t:%d r:%d f:%d %p %p-%p %p %O-%O",
   87|      0|                          cl->buf->temporary,
   88|      0|                          cl->buf->recycled,
   89|      0|                          cl->buf->in_file,
   90|      0|                          cl->buf->start,
   91|      0|                          cl->buf->pos,
   92|      0|                          cl->buf->last,
   93|      0|                          cl->buf->file,
   94|      0|                          cl->buf->file_pos,
   95|      0|                          cl->buf->file_last);
   96|       |
   97|      0|            ngx_debug_point();
   98|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   99|      0|        }
  100|       |
  101|     11|        if (ngx_buf_size(cl->buf) < 0) {
  ------------------
  |  |  137|     11|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|     11|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 7, False: 4]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 4]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|     11|                            ((b)->file_last - (b)->file_pos))
  ------------------
  |  Branch (101:13): [True: 0, False: 11]
  ------------------
  102|      0|            ngx_log_error(NGX_LOG_ALERT, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  103|      0|                          "negative size buf in writer "
  104|      0|                          "t:%d r:%d f:%d %p %p-%p %p %O-%O",
  105|      0|                          cl->buf->temporary,
  106|      0|                          cl->buf->recycled,
  107|      0|                          cl->buf->in_file,
  108|      0|                          cl->buf->start,
  109|      0|                          cl->buf->pos,
  110|      0|                          cl->buf->last,
  111|      0|                          cl->buf->file,
  112|      0|                          cl->buf->file_pos,
  113|      0|                          cl->buf->file_last);
  114|       |
  115|      0|            ngx_debug_point();
  116|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  117|      0|        }
  118|       |
  119|     11|        size += ngx_buf_size(cl->buf);
  ------------------
  |  |  137|     11|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|     11|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 7, False: 4]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 4]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|     11|                            ((b)->file_last - (b)->file_pos))
  ------------------
  120|       |
  121|     11|        if (cl->buf->flush || cl->buf->recycled) {
  ------------------
  |  Branch (121:13): [True: 4, False: 7]
  |  Branch (121:31): [True: 0, False: 7]
  ------------------
  122|      4|            flush = 1;
  123|      4|        }
  124|       |
  125|     11|        if (cl->buf->sync) {
  ------------------
  |  Branch (125:13): [True: 0, False: 11]
  ------------------
  126|      0|            sync = 1;
  127|      0|        }
  128|       |
  129|     11|        if (cl->buf->last_buf) {
  ------------------
  |  Branch (129:13): [True: 0, False: 11]
  ------------------
  130|      0|            last = 1;
  131|      0|        }
  132|     11|    }
  133|       |
  134|       |    /* add the new chain to the existent one */
  135|       |
  136|     25|    for (ln = in; ln; ln = ln->next) {
  ------------------
  |  Branch (136:19): [True: 9, False: 16]
  ------------------
  137|      9|        cl = ngx_alloc_chain_link(r->pool);
  138|      9|        if (cl == NULL) {
  ------------------
  |  Branch (138:13): [True: 0, False: 9]
  ------------------
  139|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  140|      0|        }
  141|       |
  142|      9|        cl->buf = ln->buf;
  143|      9|        *ll = cl;
  144|      9|        ll = &cl->next;
  145|       |
  146|      9|        ngx_log_debug7(NGX_LOG_DEBUG_EVENT, c->log, 0,
  147|      9|                       "write new buf t:%d f:%d %p, pos %p, size: %z "
  148|      9|                       "file: %O, size: %O",
  149|      9|                       cl->buf->temporary, cl->buf->in_file,
  150|      9|                       cl->buf->start, cl->buf->pos,
  151|      9|                       cl->buf->last - cl->buf->pos,
  152|      9|                       cl->buf->file_pos,
  153|      9|                       cl->buf->file_last - cl->buf->file_pos);
  154|       |
  155|      9|        if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
  ------------------
  |  |  137|      9|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      9|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 3, False: 6]
  |  |  |  |  |  Branch (125:55): [True: 5, False: 1]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      9|                            ((b)->file_last - (b)->file_pos))
  ------------------
                      if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
  ------------------
  |  |  129|      1|    (((b)->flush || (b)->last_buf || (b)->sync)                              \
  |  |  ------------------
  |  |  |  Branch (129:7): [True: 1, False: 0]
  |  |  |  Branch (129:21): [True: 0, False: 0]
  |  |  |  Branch (129:38): [True: 0, False: 0]
  |  |  ------------------
  |  |  130|      1|     && !ngx_buf_in_memory(b) && !(b)->in_file)
  |  |  ------------------
  |  |  |  |  125|      2|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 1]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 1]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (130:34): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (155:13): [True: 1, False: 8]
  ------------------
  156|      0|            ngx_log_error(NGX_LOG_ALERT, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  157|      0|                          "zero size buf in writer "
  158|      0|                          "t:%d r:%d f:%d %p %p-%p %p %O-%O",
  159|      0|                          cl->buf->temporary,
  160|      0|                          cl->buf->recycled,
  161|      0|                          cl->buf->in_file,
  162|      0|                          cl->buf->start,
  163|      0|                          cl->buf->pos,
  164|      0|                          cl->buf->last,
  165|      0|                          cl->buf->file,
  166|      0|                          cl->buf->file_pos,
  167|      0|                          cl->buf->file_last);
  168|       |
  169|      0|            ngx_debug_point();
  170|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  171|      0|        }
  172|       |
  173|      9|        if (ngx_buf_size(cl->buf) < 0) {
  ------------------
  |  |  137|      9|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      9|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 3, False: 6]
  |  |  |  |  |  Branch (125:55): [True: 5, False: 1]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      9|                            ((b)->file_last - (b)->file_pos))
  ------------------
  |  Branch (173:13): [True: 0, False: 9]
  ------------------
  174|      0|            ngx_log_error(NGX_LOG_ALERT, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  175|      0|                          "negative size buf in writer "
  176|      0|                          "t:%d r:%d f:%d %p %p-%p %p %O-%O",
  177|      0|                          cl->buf->temporary,
  178|      0|                          cl->buf->recycled,
  179|      0|                          cl->buf->in_file,
  180|      0|                          cl->buf->start,
  181|      0|                          cl->buf->pos,
  182|      0|                          cl->buf->last,
  183|      0|                          cl->buf->file,
  184|      0|                          cl->buf->file_pos,
  185|      0|                          cl->buf->file_last);
  186|       |
  187|      0|            ngx_debug_point();
  188|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  189|      0|        }
  190|       |
  191|      9|        size += ngx_buf_size(cl->buf);
  ------------------
  |  |  137|      9|    (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos):                  \
  |  |  ------------------
  |  |  |  |  125|      9|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 3, False: 6]
  |  |  |  |  |  Branch (125:55): [True: 5, False: 1]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      9|                            ((b)->file_last - (b)->file_pos))
  ------------------
  192|       |
  193|      9|        if (cl->buf->flush || cl->buf->recycled) {
  ------------------
  |  Branch (193:13): [True: 2, False: 7]
  |  Branch (193:31): [True: 0, False: 7]
  ------------------
  194|      2|            flush = 1;
  195|      2|        }
  196|       |
  197|      9|        if (cl->buf->sync) {
  ------------------
  |  Branch (197:13): [True: 0, False: 9]
  ------------------
  198|      0|            sync = 1;
  199|      0|        }
  200|       |
  201|      9|        if (cl->buf->last_buf) {
  ------------------
  |  Branch (201:13): [True: 2, False: 7]
  ------------------
  202|      2|            last = 1;
  203|      2|        }
  204|      9|    }
  205|       |
  206|     16|    *ll = NULL;
  207|       |
  208|     16|    ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
  209|     16|                   "http write filter: l:%ui f:%ui s:%O", last, flush, size);
  210|       |
  211|     16|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|     16|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  212|       |
  213|       |    /*
  214|       |     * avoid the output if there are no last buf, no flush point,
  215|       |     * there are the incoming bufs and the size of all bufs
  216|       |     * is smaller than "postpone_output" directive
  217|       |     */
  218|       |
  219|     16|    if (!last && !flush && in && size < (off_t) clcf->postpone_output) {
  ------------------
  |  Branch (219:9): [True: 14, False: 2]
  |  Branch (219:18): [True: 8, False: 6]
  |  Branch (219:28): [True: 3, False: 5]
  |  Branch (219:34): [True: 2, False: 1]
  ------------------
  220|      2|        return NGX_OK;
  ------------------
  |  |   38|      2|#define  NGX_OK          0
  ------------------
  221|      2|    }
  222|       |
  223|     14|    if (c->write->delayed) {
  ------------------
  |  Branch (223:9): [True: 14, False: 0]
  ------------------
  224|     14|        c->buffered |= NGX_HTTP_WRITE_BUFFERED;
  ------------------
  |  |  148|     14|#define NGX_HTTP_WRITE_BUFFERED            0x10
  ------------------
  225|     14|        return NGX_AGAIN;
  ------------------
  |  |   40|     14|#define  NGX_AGAIN      -2
  ------------------
  226|     14|    }
  227|       |
  228|      0|    if (size == 0
  ------------------
  |  Branch (228:9): [True: 0, False: 0]
  ------------------
  229|      0|        && !(c->buffered & NGX_LOWLEVEL_BUFFERED)
  ------------------
  |  |  118|      0|#define NGX_LOWLEVEL_BUFFERED  0x0f
  ------------------
  |  Branch (229:12): [True: 0, False: 0]
  ------------------
  230|      0|        && !(last && c->need_last_buf)
  ------------------
  |  Branch (230:14): [True: 0, False: 0]
  |  Branch (230:22): [True: 0, False: 0]
  ------------------
  231|      0|        && !(flush && c->need_flush_buf))
  ------------------
  |  Branch (231:14): [True: 0, False: 0]
  |  Branch (231:23): [True: 0, False: 0]
  ------------------
  232|      0|    {
  233|      0|        if (last || flush || sync) {
  ------------------
  |  Branch (233:13): [True: 0, False: 0]
  |  Branch (233:21): [True: 0, False: 0]
  |  Branch (233:30): [True: 0, False: 0]
  ------------------
  234|      0|            for (cl = r->out; cl; /* void */) {
  ------------------
  |  Branch (234:31): [True: 0, False: 0]
  ------------------
  235|      0|                ln = cl;
  236|      0|                cl = cl->next;
  237|      0|                ngx_free_chain(r->pool, ln);
  ------------------
  |  |  149|      0|    (cl)->next = (pool)->chain;                                              \
  |  |  150|      0|    (pool)->chain = (cl)
  ------------------
  238|      0|            }
  239|       |
  240|      0|            r->out = NULL;
  241|      0|            c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
  ------------------
  |  |  148|      0|#define NGX_HTTP_WRITE_BUFFERED            0x10
  ------------------
  242|       |
  243|      0|            if (last) {
  ------------------
  |  Branch (243:17): [True: 0, False: 0]
  ------------------
  244|      0|                r->response_sent = 1;
  245|      0|            }
  246|       |
  247|      0|            return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  248|      0|        }
  249|       |
  250|      0|        ngx_log_error(NGX_LOG_ALERT, c->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  251|      0|                      "the http output chain is empty");
  252|       |
  253|      0|        ngx_debug_point();
  254|       |
  255|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  256|      0|    }
  257|       |
  258|      0|    if (!r->limit_rate_set) {
  ------------------
  |  Branch (258:9): [True: 0, False: 0]
  ------------------
  259|      0|        r->limit_rate = ngx_http_complex_value_size(r, clcf->limit_rate, 0);
  260|      0|        r->limit_rate_set = 1;
  261|      0|    }
  262|       |
  263|      0|    if (r->limit_rate) {
  ------------------
  |  Branch (263:9): [True: 0, False: 0]
  ------------------
  264|       |
  265|      0|        if (!r->limit_rate_after_set) {
  ------------------
  |  Branch (265:13): [True: 0, False: 0]
  ------------------
  266|      0|            r->limit_rate_after = ngx_http_complex_value_size(r,
  267|      0|                                                    clcf->limit_rate_after, 0);
  268|      0|            r->limit_rate_after_set = 1;
  269|      0|        }
  270|       |
  271|      0|        limit = (off_t) r->limit_rate * (ngx_time() - r->start_sec + 1)
  ------------------
  |  |   36|      0|#define ngx_time()           ngx_cached_time->sec
  ------------------
  272|      0|                - (c->sent - r->limit_rate_after);
  273|       |
  274|      0|        if (limit <= 0) {
  ------------------
  |  Branch (274:13): [True: 0, False: 0]
  ------------------
  275|      0|            c->write->delayed = 1;
  276|      0|            delay = (ngx_msec_t) (- limit * 1000 / r->limit_rate + 1);
  277|      0|            ngx_add_timer(c->write, delay);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
  278|       |
  279|      0|            c->buffered |= NGX_HTTP_WRITE_BUFFERED;
  ------------------
  |  |  148|      0|#define NGX_HTTP_WRITE_BUFFERED            0x10
  ------------------
  280|       |
  281|      0|            return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  282|      0|        }
  283|       |
  284|      0|        if (clcf->sendfile_max_chunk
  ------------------
  |  Branch (284:13): [True: 0, False: 0]
  ------------------
  285|      0|            && (off_t) clcf->sendfile_max_chunk < limit)
  ------------------
  |  Branch (285:16): [True: 0, False: 0]
  ------------------
  286|      0|        {
  287|      0|            limit = clcf->sendfile_max_chunk;
  288|      0|        }
  289|       |
  290|      0|    } else {
  291|      0|        limit = clcf->sendfile_max_chunk;
  292|      0|    }
  293|       |
  294|      0|    sent = c->sent;
  295|       |
  296|      0|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
  297|      0|                   "http write filter limit %O", limit);
  298|       |
  299|      0|    chain = c->send_chain(c, r->out, limit);
  300|       |
  301|      0|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
  302|      0|                   "http write filter %p", chain);
  303|       |
  304|      0|    if (chain == NGX_CHAIN_ERROR) {
  ------------------
  |  |  122|      0|#define NGX_CHAIN_ERROR     (ngx_chain_t *) NGX_ERROR
  |  |  ------------------
  |  |  |  |   39|      0|#define  NGX_ERROR      -1
  |  |  ------------------
  ------------------
  |  Branch (304:9): [True: 0, False: 0]
  ------------------
  305|      0|        c->error = 1;
  306|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  307|      0|    }
  308|       |
  309|      0|    if (r->limit_rate) {
  ------------------
  |  Branch (309:9): [True: 0, False: 0]
  ------------------
  310|       |
  311|      0|        nsent = c->sent;
  312|       |
  313|      0|        if (r->limit_rate_after) {
  ------------------
  |  Branch (313:13): [True: 0, False: 0]
  ------------------
  314|       |
  315|      0|            sent -= r->limit_rate_after;
  316|      0|            if (sent < 0) {
  ------------------
  |  Branch (316:17): [True: 0, False: 0]
  ------------------
  317|      0|                sent = 0;
  318|      0|            }
  319|       |
  320|      0|            nsent -= r->limit_rate_after;
  321|      0|            if (nsent < 0) {
  ------------------
  |  Branch (321:17): [True: 0, False: 0]
  ------------------
  322|      0|                nsent = 0;
  323|      0|            }
  324|      0|        }
  325|       |
  326|      0|        delay = (ngx_msec_t) ((nsent - sent) * 1000 / r->limit_rate);
  327|       |
  328|      0|        if (delay > 0) {
  ------------------
  |  Branch (328:13): [True: 0, False: 0]
  ------------------
  329|      0|            c->write->delayed = 1;
  330|      0|            ngx_add_timer(c->write, delay);
  ------------------
  |  |  410|      0|#define ngx_add_timer        ngx_event_add_timer
  ------------------
  331|      0|        }
  332|      0|    }
  333|       |
  334|      0|    if (chain && c->write->ready && !c->write->delayed) {
  ------------------
  |  Branch (334:9): [True: 0, False: 0]
  |  Branch (334:18): [True: 0, False: 0]
  |  Branch (334:37): [True: 0, False: 0]
  ------------------
  335|      0|        ngx_post_event(c->write, &ngx_posted_next_events);
  ------------------
  |  |   19|      0|    if (!(ev)->posted) {                                                      \
  |  |  ------------------
  |  |  |  Branch (19:9): [True: 0, False: 0]
  |  |  ------------------
  |  |   20|      0|        (ev)->posted = 1;                                                     \
  |  |   21|      0|        ngx_queue_insert_tail(q, &(ev)->queue);                               \
  |  |  ------------------
  |  |  |  |   44|      0|    (x)->prev = (h)->prev;                                                    \
  |  |  |  |   45|      0|    (x)->prev->next = x;                                                      \
  |  |  |  |   46|      0|    (x)->next = h;                                                            \
  |  |  |  |   47|      0|    (h)->prev = x
  |  |  ------------------
  |  |   22|      0|                                                                              \
  |  |   23|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, "post event %p", ev);\
  |  |   24|      0|                                                                              \
  |  |   25|      0|    } else  {                                                                 \
  |  |   26|      0|        ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0,                      \
  |  |   27|      0|                       "update posted event %p", ev);                         \
  |  |   28|      0|    }
  ------------------
  336|      0|    }
  337|       |
  338|      0|    for (cl = r->out; cl && cl != chain; /* void */) {
  ------------------
  |  Branch (338:23): [True: 0, False: 0]
  |  Branch (338:29): [True: 0, False: 0]
  ------------------
  339|      0|        ln = cl;
  340|      0|        cl = cl->next;
  341|      0|        ngx_free_chain(r->pool, ln);
  ------------------
  |  |  149|      0|    (cl)->next = (pool)->chain;                                              \
  |  |  150|      0|    (pool)->chain = (cl)
  ------------------
  342|      0|    }
  343|       |
  344|      0|    r->out = chain;
  345|       |
  346|      0|    if (chain) {
  ------------------
  |  Branch (346:9): [True: 0, False: 0]
  ------------------
  347|      0|        c->buffered |= NGX_HTTP_WRITE_BUFFERED;
  ------------------
  |  |  148|      0|#define NGX_HTTP_WRITE_BUFFERED            0x10
  ------------------
  348|      0|        return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  349|      0|    }
  350|       |
  351|      0|    c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
  ------------------
  |  |  148|      0|#define NGX_HTTP_WRITE_BUFFERED            0x10
  ------------------
  352|       |
  353|      0|    if (last) {
  ------------------
  |  Branch (353:9): [True: 0, False: 0]
  ------------------
  354|      0|        r->response_sent = 1;
  355|      0|    }
  356|       |
  357|      0|    if ((c->buffered & NGX_LOWLEVEL_BUFFERED) && r->postponed == NULL) {
  ------------------
  |  |  118|      0|#define NGX_LOWLEVEL_BUFFERED  0x0f
  ------------------
  |  Branch (357:9): [True: 0, False: 0]
  |  Branch (357:50): [True: 0, False: 0]
  ------------------
  358|      0|        return NGX_AGAIN;
  ------------------
  |  |   40|      0|#define  NGX_AGAIN      -2
  ------------------
  359|      0|    }
  360|       |
  361|      0|    return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  362|      0|}
ngx_http_write_filter_module.c:ngx_http_write_filter_init:
  367|      1|{
  368|      1|    ngx_http_top_body_filter = ngx_http_write_filter;
  369|       |
  370|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  371|      1|}

ngx_http_v2_filter_module.c:ngx_http_v2_filter_init:
 2185|      1|{
 2186|      1|    ngx_http_next_header_filter = ngx_http_top_header_filter;
 2187|      1|    ngx_http_top_header_filter = ngx_http_v2_header_filter;
 2188|       |
 2189|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
 2190|      1|}
ngx_http_v2_filter_module.c:ngx_http_v2_header_filter:
  135|      7|{
  136|      7|    u_char                     status, *pos, *start, *p, *tmp;
  137|      7|    size_t                     len, tmp_len;
  138|      7|    ngx_str_t                  host, location;
  139|      7|    ngx_uint_t                 i, port, fin;
  140|      7|    ngx_list_part_t           *part;
  141|      7|    ngx_table_elt_t           *header;
  142|      7|    ngx_connection_t          *fc;
  143|      7|    ngx_http_cleanup_t        *cln;
  144|      7|    ngx_http_v2_stream_t      *stream;
  145|      7|    ngx_http_v2_out_frame_t   *frame;
  146|      7|    ngx_http_v2_connection_t  *h2c;
  147|      7|    ngx_http_core_loc_conf_t  *clcf;
  148|      7|    ngx_http_core_srv_conf_t  *cscf;
  149|      7|    u_char                     addr[NGX_SOCKADDR_STRLEN];
  150|       |
  151|      7|    static const u_char nginx[5] = "\x84\xaa\x63\x55\xe7";
  152|      7|#if (NGX_HTTP_GZIP)
  153|      7|    static const u_char accept_encoding[12] =
  154|      7|        "\x8b\x84\x84\x2d\x69\x5b\x05\x44\x3c\x86\xaa\x6f";
  155|      7|#endif
  156|       |
  157|      7|    static size_t nginx_ver_len = ngx_http_v2_literal_size(NGINX_VER);
  ------------------
  |  |   24|      7|    (ngx_http_v2_integer_octets(sizeof(h) - 1) + sizeof(h) - 1)
  |  |  ------------------
  |  |  |  |   21|      7|#define ngx_http_v2_integer_octets(v)  (1 + (v) / 127)
  |  |  ------------------
  ------------------
  158|      7|    static u_char nginx_ver[ngx_http_v2_literal_size(NGINX_VER)];
  159|       |
  160|      7|    static size_t nginx_ver_build_len =
  161|      7|                                  ngx_http_v2_literal_size(NGINX_VER_BUILD);
  ------------------
  |  |   24|      7|    (ngx_http_v2_integer_octets(sizeof(h) - 1) + sizeof(h) - 1)
  |  |  ------------------
  |  |  |  |   21|      7|#define ngx_http_v2_integer_octets(v)  (1 + (v) / 127)
  |  |  ------------------
  ------------------
  162|      7|    static u_char nginx_ver_build[ngx_http_v2_literal_size(NGINX_VER_BUILD)];
  163|       |
  164|      7|    stream = r->stream;
  165|       |
  166|      7|    if (!stream) {
  ------------------
  |  Branch (166:9): [True: 7, False: 0]
  ------------------
  167|      7|        return ngx_http_next_header_filter(r);
  168|      7|    }
  169|       |
  170|      0|    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
  171|      0|                   "http2 header filter");
  172|       |
  173|      0|    if (r->header_sent) {
  ------------------
  |  Branch (173:9): [True: 0, False: 0]
  ------------------
  174|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  175|      0|    }
  176|       |
  177|      0|    r->header_sent = 1;
  178|       |
  179|      0|    if (r != r->main) {
  ------------------
  |  Branch (179:9): [True: 0, False: 0]
  ------------------
  180|      0|        return NGX_OK;
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  181|      0|    }
  182|       |
  183|      0|    fc = r->connection;
  184|       |
  185|      0|    if (fc->error) {
  ------------------
  |  Branch (185:9): [True: 0, False: 0]
  ------------------
  186|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  187|      0|    }
  188|       |
  189|      0|    if (r->method == NGX_HTTP_HEAD) {
  ------------------
  |  |   31|      0|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
  |  Branch (189:9): [True: 0, False: 0]
  ------------------
  190|      0|        r->header_only = 1;
  191|      0|    }
  192|       |
  193|      0|    switch (r->headers_out.status) {
  194|       |
  195|      0|    case NGX_HTTP_OK:
  ------------------
  |  |   78|      0|#define NGX_HTTP_OK                        200
  ------------------
  |  Branch (195:5): [True: 0, False: 0]
  ------------------
  196|      0|        status = ngx_http_v2_indexed(NGX_HTTP_V2_STATUS_200_INDEX);
  ------------------
  |  |  368|      0|#define ngx_http_v2_indexed(i)      (128 + (i))
  ------------------
  197|      0|        break;
  198|       |
  199|      0|    case NGX_HTTP_NO_CONTENT:
  ------------------
  |  |   81|      0|#define NGX_HTTP_NO_CONTENT                204
  ------------------
  |  Branch (199:5): [True: 0, False: 0]
  ------------------
  200|      0|        r->header_only = 1;
  201|       |
  202|      0|        ngx_str_null(&r->headers_out.content_type);
  ------------------
  |  |   44|      0|#define ngx_str_null(str)   (str)->len = 0; (str)->data = NULL
  ------------------
  203|       |
  204|      0|        r->headers_out.content_length = NULL;
  205|      0|        r->headers_out.content_length_n = -1;
  206|       |
  207|      0|        r->headers_out.last_modified_time = -1;
  208|      0|        r->headers_out.last_modified = NULL;
  209|       |
  210|      0|        status = ngx_http_v2_indexed(NGX_HTTP_V2_STATUS_204_INDEX);
  ------------------
  |  |  368|      0|#define ngx_http_v2_indexed(i)      (128 + (i))
  ------------------
  211|      0|        break;
  212|       |
  213|      0|    case NGX_HTTP_PARTIAL_CONTENT:
  ------------------
  |  |   82|      0|#define NGX_HTTP_PARTIAL_CONTENT           206
  ------------------
  |  Branch (213:5): [True: 0, False: 0]
  ------------------
  214|      0|        status = ngx_http_v2_indexed(NGX_HTTP_V2_STATUS_206_INDEX);
  ------------------
  |  |  368|      0|#define ngx_http_v2_indexed(i)      (128 + (i))
  ------------------
  215|      0|        break;
  216|       |
  217|      0|    case NGX_HTTP_NOT_MODIFIED:
  ------------------
  |  |   88|      0|#define NGX_HTTP_NOT_MODIFIED              304
  ------------------
  |  Branch (217:5): [True: 0, False: 0]
  ------------------
  218|      0|        r->header_only = 1;
  219|      0|        status = ngx_http_v2_indexed(NGX_HTTP_V2_STATUS_304_INDEX);
  ------------------
  |  |  368|      0|#define ngx_http_v2_indexed(i)      (128 + (i))
  ------------------
  220|      0|        break;
  221|       |
  222|      0|    default:
  ------------------
  |  Branch (222:5): [True: 0, False: 0]
  ------------------
  223|      0|        r->headers_out.last_modified_time = -1;
  224|      0|        r->headers_out.last_modified = NULL;
  225|       |
  226|      0|        switch (r->headers_out.status) {
  227|       |
  228|      0|        case NGX_HTTP_BAD_REQUEST:
  ------------------
  |  |   92|      0|#define NGX_HTTP_BAD_REQUEST               400
  ------------------
  |  Branch (228:9): [True: 0, False: 0]
  ------------------
  229|      0|            status = ngx_http_v2_indexed(NGX_HTTP_V2_STATUS_400_INDEX);
  ------------------
  |  |  368|      0|#define ngx_http_v2_indexed(i)      (128 + (i))
  ------------------
  230|      0|            break;
  231|       |
  232|      0|        case NGX_HTTP_NOT_FOUND:
  ------------------
  |  |   95|      0|#define NGX_HTTP_NOT_FOUND                 404
  ------------------
  |  Branch (232:9): [True: 0, False: 0]
  ------------------
  233|      0|            status = ngx_http_v2_indexed(NGX_HTTP_V2_STATUS_404_INDEX);
  ------------------
  |  |  368|      0|#define ngx_http_v2_indexed(i)      (128 + (i))
  ------------------
  234|      0|            break;
  235|       |
  236|      0|        case NGX_HTTP_INTERNAL_SERVER_ERROR:
  ------------------
  |  |  138|      0|#define NGX_HTTP_INTERNAL_SERVER_ERROR     500
  ------------------
  |  Branch (236:9): [True: 0, False: 0]
  ------------------
  237|      0|            status = ngx_http_v2_indexed(NGX_HTTP_V2_STATUS_500_INDEX);
  ------------------
  |  |  368|      0|#define ngx_http_v2_indexed(i)      (128 + (i))
  ------------------
  238|      0|            break;
  239|       |
  240|      0|        default:
  ------------------
  |  Branch (240:9): [True: 0, False: 0]
  ------------------
  241|      0|            status = 0;
  242|      0|        }
  243|      0|    }
  244|       |
  245|      0|    h2c = stream->connection;
  246|       |
  247|      0|    if (!h2c->push_disabled && !h2c->goaway
  ------------------
  |  Branch (247:9): [True: 0, False: 0]
  |  Branch (247:32): [True: 0, False: 0]
  ------------------
  248|      0|        && stream->node->id % 2 == 1
  ------------------
  |  Branch (248:12): [True: 0, False: 0]
  ------------------
  249|      0|        && r->method != NGX_HTTP_HEAD)
  ------------------
  |  |   31|      0|#define NGX_HTTP_HEAD                      0x00000004
  ------------------
  |  Branch (249:12): [True: 0, False: 0]
  ------------------
  250|      0|    {
  251|      0|        if (ngx_http_v2_push_resources(r) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (251:13): [True: 0, False: 0]
  ------------------
  252|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  253|      0|        }
  254|      0|    }
  255|       |
  256|      0|    len = h2c->table_update ? 1 : 0;
  ------------------
  |  Branch (256:11): [True: 0, False: 0]
  ------------------
  257|       |
  258|      0|    len += status ? 1 : 1 + ngx_http_v2_literal_size("418");
  ------------------
  |  |   24|      0|    (ngx_http_v2_integer_octets(sizeof(h) - 1) + sizeof(h) - 1)
  |  |  ------------------
  |  |  |  |   21|      0|#define ngx_http_v2_integer_octets(v)  (1 + (v) / 127)
  |  |  ------------------
  ------------------
  |  Branch (258:12): [True: 0, False: 0]
  ------------------
  259|       |
  260|      0|    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  ------------------
  |  |   58|      0|#define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
  ------------------
  261|       |
  262|      0|    if (r->headers_out.server == NULL) {
  ------------------
  |  Branch (262:9): [True: 0, False: 0]
  ------------------
  263|       |
  264|      0|        if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
  ------------------
  |  |   59|      0|#define NGX_HTTP_SERVER_TOKENS_ON       1
  ------------------
  |  Branch (264:13): [True: 0, False: 0]
  ------------------
  265|      0|            len += 1 + nginx_ver_len;
  266|       |
  267|      0|        } else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) {
  ------------------
  |  |   60|      0|#define NGX_HTTP_SERVER_TOKENS_BUILD    2
  ------------------
  |  Branch (267:20): [True: 0, False: 0]
  ------------------
  268|      0|            len += 1 + nginx_ver_build_len;
  269|       |
  270|      0|        } else {
  271|      0|            len += 1 + sizeof(nginx);
  272|      0|        }
  273|      0|    }
  274|       |
  275|      0|    if (r->headers_out.date == NULL) {
  ------------------
  |  Branch (275:9): [True: 0, False: 0]
  ------------------
  276|      0|        len += 1 + ngx_http_v2_literal_size("Wed, 31 Dec 1986 18:00:00 GMT");
  ------------------
  |  |   24|      0|    (ngx_http_v2_integer_octets(sizeof(h) - 1) + sizeof(h) - 1)
  |  |  ------------------
  |  |  |  |   21|      0|#define ngx_http_v2_integer_octets(v)  (1 + (v) / 127)
  |  |  ------------------
  ------------------
  277|      0|    }
  278|       |
  279|      0|    if (r->headers_out.content_type.len) {
  ------------------
  |  Branch (279:9): [True: 0, False: 0]
  ------------------
  280|      0|        len += 1 + NGX_HTTP_V2_INT_OCTETS + r->headers_out.content_type.len;
  ------------------
  |  |   23|      0|#define NGX_HTTP_V2_INT_OCTETS           4
  ------------------
  281|       |
  282|      0|        if (r->headers_out.content_type_len == r->headers_out.content_type.len
  ------------------
  |  Branch (282:13): [True: 0, False: 0]
  ------------------
  283|      0|            && r->headers_out.charset.len)
  ------------------
  |  Branch (283:16): [True: 0, False: 0]
  ------------------
  284|      0|        {
  285|      0|            len += sizeof("; charset=") - 1 + r->headers_out.charset.len;
  286|      0|        }
  287|      0|    }
  288|       |
  289|      0|    if (r->headers_out.content_length == NULL
  ------------------
  |  Branch (289:9): [True: 0, False: 0]
  ------------------
  290|      0|        && r->headers_out.content_length_n >= 0)
  ------------------
  |  Branch (290:12): [True: 0, False: 0]
  ------------------
  291|      0|    {
  292|      0|        len += 1 + ngx_http_v2_integer_octets(NGX_OFF_T_LEN) + NGX_OFF_T_LEN;
  ------------------
  |  |   21|      0|#define ngx_http_v2_integer_octets(v)  (1 + (v) / 127)
  ------------------
                      len += 1 + ngx_http_v2_integer_octets(NGX_OFF_T_LEN) + NGX_OFF_T_LEN;
  ------------------
  |  |  202|      0|#define NGX_OFF_T_LEN  (sizeof("-9223372036854775808") - 1)
  ------------------
  293|      0|    }
  294|       |
  295|      0|    if (r->headers_out.last_modified == NULL
  ------------------
  |  Branch (295:9): [True: 0, False: 0]
  ------------------
  296|      0|        && r->headers_out.last_modified_time != -1)
  ------------------
  |  Branch (296:12): [True: 0, False: 0]
  ------------------
  297|      0|    {
  298|      0|        len += 1 + ngx_http_v2_literal_size("Wed, 31 Dec 1986 18:00:00 GMT");
  ------------------
  |  |   24|      0|    (ngx_http_v2_integer_octets(sizeof(h) - 1) + sizeof(h) - 1)
  |  |  ------------------
  |  |  |  |   21|      0|#define ngx_http_v2_integer_octets(v)  (1 + (v) / 127)
  |  |  ------------------
  ------------------
  299|      0|    }
  300|       |
  301|      0|    if (r->headers_out.location && r->headers_out.location->value.len) {
  ------------------
  |  Branch (301:9): [True: 0, False: 0]
  |  Branch (301:36): [True: 0, False: 0]
  ------------------
  302|       |
  303|      0|        if (r->headers_out.location->value.data[0] == '/'
  ------------------
  |  Branch (303:13): [True: 0, False: 0]
  ------------------
  304|      0|            && clcf->absolute_redirect)
  ------------------
  |  Branch (304:16): [True: 0, False: 0]
  ------------------
  305|      0|        {
  306|      0|            if (clcf->server_name_in_redirect) {
  ------------------
  |  Branch (306:17): [True: 0, False: 0]
  ------------------
  307|      0|                cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  ------------------
  |  |   57|      0|#define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
  ------------------
  308|      0|                host = cscf->server_name;
  309|       |
  310|      0|            } else if (r->headers_in.server.len) {
  ------------------
  |  Branch (310:24): [True: 0, False: 0]
  ------------------
  311|      0|                host = r->headers_in.server;
  312|       |
  313|      0|            } else {
  314|      0|                host.len = NGX_SOCKADDR_STRLEN;
  ------------------
  |  |   24|      0|#define NGX_SOCKADDR_STRLEN   NGX_UNIX_ADDRSTRLEN
  |  |  ------------------
  |  |  |  |   20|      0|    (sizeof("unix:") - 1 +                                                   \
  |  |  |  |   21|      0|     sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path))
  |  |  ------------------
  ------------------
  315|      0|                host.data = addr;
  316|       |
  317|      0|                if (ngx_connection_local_sockaddr(fc, &host, 0) != NGX_OK) {
  ------------------
  |  |   38|      0|#define  NGX_OK          0
  ------------------
  |  Branch (317:21): [True: 0, False: 0]
  ------------------
  318|      0|                    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  319|      0|                }
  320|      0|            }
  321|       |
  322|      0|            port = ngx_inet_get_port(fc->local_sockaddr);
  323|       |
  324|      0|            location.len = sizeof("https://") - 1 + host.len
  325|      0|                           + r->headers_out.location->value.len;
  326|       |
  327|      0|            if (clcf->port_in_redirect) {
  ------------------
  |  Branch (327:17): [True: 0, False: 0]
  ------------------
  328|       |
  329|       |#if (NGX_HTTP_SSL)
  330|       |                if (fc->ssl)
  331|       |                    port = (port == 443) ? 0 : port;
  332|       |                else
  333|       |#endif
  334|      0|                    port = (port == 80) ? 0 : port;
  ------------------
  |  Branch (334:28): [True: 0, False: 0]
  ------------------
  335|       |
  336|      0|            } else {
  337|      0|                port = 0;
  338|      0|            }
  339|       |
  340|      0|            if (port) {
  ------------------
  |  Branch (340:17): [True: 0, False: 0]
  ------------------
  341|      0|                location.len += sizeof(":65535") - 1;
  342|      0|            }
  343|       |
  344|      0|            location.data = ngx_pnalloc(r->pool, location.len);
  345|      0|            if (location.data == NULL) {
  ------------------
  |  Branch (345:17): [True: 0, False: 0]
  ------------------
  346|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  347|      0|            }
  348|       |
  349|      0|            p = ngx_cpymem(location.data, "http", sizeof("http") - 1);
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  350|       |
  351|       |#if (NGX_HTTP_SSL)
  352|       |            if (fc->ssl) {
  353|       |                *p++ = 's';
  354|       |            }
  355|       |#endif
  356|       |
  357|      0|            *p++ = ':'; *p++ = '/'; *p++ = '/';
  358|      0|            p = ngx_cpymem(p, host.data, host.len);
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  359|       |
  360|      0|            if (port) {
  ------------------
  |  Branch (360:17): [True: 0, False: 0]
  ------------------
  361|      0|                p = ngx_sprintf(p, ":%ui", port);
  362|      0|            }
  363|       |
  364|      0|            p = ngx_cpymem(p, r->headers_out.location->value.data,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  365|      0|                              r->headers_out.location->value.len);
  366|       |
  367|       |            /* update r->headers_out.location->value for possible logging */
  368|       |
  369|      0|            r->headers_out.location->value.len = p - location.data;
  370|      0|            r->headers_out.location->value.data = location.data;
  371|      0|            ngx_str_set(&r->headers_out.location->key, "Location");
  ------------------
  |  |   43|      0|    (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
  ------------------
  372|      0|        }
  373|       |
  374|      0|        r->headers_out.location->hash = 0;
  375|       |
  376|      0|        len += 1 + NGX_HTTP_V2_INT_OCTETS + r->headers_out.location->value.len;
  ------------------
  |  |   23|      0|#define NGX_HTTP_V2_INT_OCTETS           4
  ------------------
  377|      0|    }
  378|       |
  379|      0|    tmp_len = len;
  380|       |
  381|      0|#if (NGX_HTTP_GZIP)
  382|      0|    if (r->gzip_vary) {
  ------------------
  |  Branch (382:9): [True: 0, False: 0]
  ------------------
  383|      0|        if (clcf->gzip_vary) {
  ------------------
  |  Branch (383:13): [True: 0, False: 0]
  ------------------
  384|      0|            len += 1 + sizeof(accept_encoding);
  385|       |
  386|      0|        } else {
  387|      0|            r->gzip_vary = 0;
  388|      0|        }
  389|      0|    }
  390|      0|#endif
  391|       |
  392|      0|    part = &r->headers_out.headers.part;
  393|      0|    header = part->elts;
  394|       |
  395|      0|    for (i = 0; /* void */; i++) {
  396|       |
  397|      0|        if (i >= part->nelts) {
  ------------------
  |  Branch (397:13): [True: 0, False: 0]
  ------------------
  398|      0|            if (part->next == NULL) {
  ------------------
  |  Branch (398:17): [True: 0, False: 0]
  ------------------
  399|      0|                break;
  400|      0|            }
  401|       |
  402|      0|            part = part->next;
  403|      0|            header = part->elts;
  404|      0|            i = 0;
  405|      0|        }
  406|       |
  407|      0|        if (header[i].hash == 0) {
  ------------------
  |  Branch (407:13): [True: 0, False: 0]
  ------------------
  408|      0|            continue;
  409|      0|        }
  410|       |
  411|      0|        if (header[i].key.len > NGX_HTTP_V2_MAX_FIELD) {
  ------------------
  |  |   25|      0|    (127 + (1 << (NGX_HTTP_V2_INT_OCTETS - 1) * 7) - 1)
  |  |  ------------------
  |  |  |  |   23|      0|#define NGX_HTTP_V2_INT_OCTETS           4
  |  |  ------------------
  ------------------
  |  Branch (411:13): [True: 0, False: 0]
  ------------------
  412|      0|            ngx_log_error(NGX_LOG_CRIT, fc->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  413|      0|                          "too long response header name: \"%V\"",
  414|      0|                          &header[i].key);
  415|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  416|      0|        }
  417|       |
  418|      0|        if (header[i].value.len > NGX_HTTP_V2_MAX_FIELD) {
  ------------------
  |  |   25|      0|    (127 + (1 << (NGX_HTTP_V2_INT_OCTETS - 1) * 7) - 1)
  |  |  ------------------
  |  |  |  |   23|      0|#define NGX_HTTP_V2_INT_OCTETS           4
  |  |  ------------------
  ------------------
  |  Branch (418:13): [True: 0, False: 0]
  ------------------
  419|      0|            ngx_log_error(NGX_LOG_CRIT, fc->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  420|      0|                          "too long response header value: \"%V: %V\"",
  421|      0|                          &header[i].key, &header[i].value);
  422|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  423|      0|        }
  424|       |
  425|      0|        len += 1 + NGX_HTTP_V2_INT_OCTETS + header[i].key.len
  ------------------
  |  |   23|      0|#define NGX_HTTP_V2_INT_OCTETS           4
  ------------------
  426|      0|                 + NGX_HTTP_V2_INT_OCTETS + header[i].value.len;
  ------------------
  |  |   23|      0|#define NGX_HTTP_V2_INT_OCTETS           4
  ------------------
  427|       |
  428|      0|        if (header[i].key.len > tmp_len) {
  ------------------
  |  Branch (428:13): [True: 0, False: 0]
  ------------------
  429|      0|            tmp_len = header[i].key.len;
  430|      0|        }
  431|       |
  432|      0|        if (header[i].value.len > tmp_len) {
  ------------------
  |  Branch (432:13): [True: 0, False: 0]
  ------------------
  433|      0|            tmp_len = header[i].value.len;
  434|      0|        }
  435|      0|    }
  436|       |
  437|      0|    tmp = ngx_palloc(r->pool, tmp_len);
  438|      0|    pos = ngx_pnalloc(r->pool, len);
  439|       |
  440|      0|    if (pos == NULL || tmp == NULL) {
  ------------------
  |  Branch (440:9): [True: 0, False: 0]
  |  Branch (440:24): [True: 0, False: 0]
  ------------------
  441|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  442|      0|    }
  443|       |
  444|      0|    start = pos;
  445|       |
  446|      0|    if (h2c->table_update) {
  ------------------
  |  Branch (446:9): [True: 0, False: 0]
  ------------------
  447|      0|        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  448|      0|                       "http2 table size update: 0");
  449|      0|        *pos++ = (1 << 5) | 0;
  450|      0|        h2c->table_update = 0;
  451|      0|    }
  452|       |
  453|      0|    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  454|      0|                   "http2 output header: \":status: %03ui\"",
  455|      0|                   r->headers_out.status);
  456|       |
  457|      0|    if (status) {
  ------------------
  |  Branch (457:9): [True: 0, False: 0]
  ------------------
  458|      0|        *pos++ = status;
  459|       |
  460|      0|    } else {
  461|      0|        *pos++ = ngx_http_v2_inc_indexed(NGX_HTTP_V2_STATUS_INDEX);
  ------------------
  |  |  369|      0|#define ngx_http_v2_inc_indexed(i)  (64 + (i))
  ------------------
  462|      0|        *pos++ = NGX_HTTP_V2_ENCODE_RAW | 3;
  ------------------
  |  |  376|      0|#define NGX_HTTP_V2_ENCODE_RAW            0
  ------------------
  463|      0|        pos = ngx_sprintf(pos, "%03ui", r->headers_out.status);
  464|      0|    }
  465|       |
  466|      0|    if (r->headers_out.server == NULL) {
  ------------------
  |  Branch (466:9): [True: 0, False: 0]
  ------------------
  467|       |
  468|      0|        if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
  ------------------
  |  |   59|      0|#define NGX_HTTP_SERVER_TOKENS_ON       1
  ------------------
  |  Branch (468:13): [True: 0, False: 0]
  ------------------
  469|      0|            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  470|      0|                           "http2 output header: \"server: %s\"",
  471|      0|                           NGINX_VER);
  472|       |
  473|      0|        } else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) {
  ------------------
  |  |   60|      0|#define NGX_HTTP_SERVER_TOKENS_BUILD    2
  ------------------
  |  Branch (473:20): [True: 0, False: 0]
  ------------------
  474|      0|            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  475|      0|                           "http2 output header: \"server: %s\"",
  476|      0|                           NGINX_VER_BUILD);
  477|       |
  478|      0|        } else {
  479|      0|            ngx_log_debug0(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  480|      0|                           "http2 output header: \"server: nginx\"");
  481|      0|        }
  482|       |
  483|      0|        *pos++ = ngx_http_v2_inc_indexed(NGX_HTTP_V2_SERVER_INDEX);
  ------------------
  |  |  369|      0|#define ngx_http_v2_inc_indexed(i)  (64 + (i))
  ------------------
  484|       |
  485|      0|        if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
  ------------------
  |  |   59|      0|#define NGX_HTTP_SERVER_TOKENS_ON       1
  ------------------
  |  Branch (485:13): [True: 0, False: 0]
  ------------------
  486|      0|            if (nginx_ver[0] == '\0') {
  ------------------
  |  Branch (486:17): [True: 0, False: 0]
  ------------------
  487|      0|                p = ngx_http_v2_write_value(nginx_ver, (u_char *) NGINX_VER,
  ------------------
  |  |  374|      0|    ngx_http_v2_string_encode(dst, src, len, tmp, 0)
  ------------------
  488|      0|                                            sizeof(NGINX_VER) - 1, tmp);
  489|      0|                nginx_ver_len = p - nginx_ver;
  490|      0|            }
  491|       |
  492|      0|            pos = ngx_cpymem(pos, nginx_ver, nginx_ver_len);
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  493|       |
  494|      0|        } else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) {
  ------------------
  |  |   60|      0|#define NGX_HTTP_SERVER_TOKENS_BUILD    2
  ------------------
  |  Branch (494:20): [True: 0, False: 0]
  ------------------
  495|      0|            if (nginx_ver_build[0] == '\0') {
  ------------------
  |  Branch (495:17): [True: 0, False: 0]
  ------------------
  496|      0|                p = ngx_http_v2_write_value(nginx_ver_build,
  ------------------
  |  |  374|      0|    ngx_http_v2_string_encode(dst, src, len, tmp, 0)
  ------------------
  497|      0|                                            (u_char *) NGINX_VER_BUILD,
  498|      0|                                            sizeof(NGINX_VER_BUILD) - 1, tmp);
  499|      0|                nginx_ver_build_len = p - nginx_ver_build;
  500|      0|            }
  501|       |
  502|      0|            pos = ngx_cpymem(pos, nginx_ver_build, nginx_ver_build_len);
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  503|       |
  504|      0|        } else {
  505|      0|            pos = ngx_cpymem(pos, nginx, sizeof(nginx));
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  506|      0|        }
  507|      0|    }
  508|       |
  509|      0|    if (r->headers_out.date == NULL) {
  ------------------
  |  Branch (509:9): [True: 0, False: 0]
  ------------------
  510|      0|        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  511|      0|                       "http2 output header: \"date: %V\"",
  512|      0|                       &ngx_cached_http_time);
  513|       |
  514|      0|        *pos++ = ngx_http_v2_inc_indexed(NGX_HTTP_V2_DATE_INDEX);
  ------------------
  |  |  369|      0|#define ngx_http_v2_inc_indexed(i)  (64 + (i))
  ------------------
  515|      0|        pos = ngx_http_v2_write_value(pos, ngx_cached_http_time.data,
  ------------------
  |  |  374|      0|    ngx_http_v2_string_encode(dst, src, len, tmp, 0)
  ------------------
  516|      0|                                      ngx_cached_http_time.len, tmp);
  517|      0|    }
  518|       |
  519|      0|    if (r->headers_out.content_type.len) {
  ------------------
  |  Branch (519:9): [True: 0, False: 0]
  ------------------
  520|      0|        *pos++ = ngx_http_v2_inc_indexed(NGX_HTTP_V2_CONTENT_TYPE_INDEX);
  ------------------
  |  |  369|      0|#define ngx_http_v2_inc_indexed(i)  (64 + (i))
  ------------------
  521|       |
  522|      0|        if (r->headers_out.content_type_len == r->headers_out.content_type.len
  ------------------
  |  Branch (522:13): [True: 0, False: 0]
  ------------------
  523|      0|            && r->headers_out.charset.len)
  ------------------
  |  Branch (523:16): [True: 0, False: 0]
  ------------------
  524|      0|        {
  525|      0|            len = r->headers_out.content_type.len + sizeof("; charset=") - 1
  526|      0|                  + r->headers_out.charset.len;
  527|       |
  528|      0|            p = ngx_pnalloc(r->pool, len);
  529|      0|            if (p == NULL) {
  ------------------
  |  Branch (529:17): [True: 0, False: 0]
  ------------------
  530|      0|                return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  531|      0|            }
  532|       |
  533|      0|            p = ngx_cpymem(p, r->headers_out.content_type.data,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  534|      0|                           r->headers_out.content_type.len);
  535|       |
  536|      0|            p = ngx_cpymem(p, "; charset=", sizeof("; charset=") - 1);
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  537|       |
  538|      0|            p = ngx_cpymem(p, r->headers_out.charset.data,
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  539|      0|                           r->headers_out.charset.len);
  540|       |
  541|       |            /* updated r->headers_out.content_type is also needed for logging */
  542|       |
  543|      0|            r->headers_out.content_type.len = len;
  544|      0|            r->headers_out.content_type.data = p - len;
  545|      0|        }
  546|       |
  547|      0|        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  548|      0|                       "http2 output header: \"content-type: %V\"",
  549|      0|                       &r->headers_out.content_type);
  550|       |
  551|      0|        pos = ngx_http_v2_write_value(pos, r->headers_out.content_type.data,
  ------------------
  |  |  374|      0|    ngx_http_v2_string_encode(dst, src, len, tmp, 0)
  ------------------
  552|      0|                                      r->headers_out.content_type.len, tmp);
  553|      0|    }
  554|       |
  555|      0|    if (r->headers_out.content_length == NULL
  ------------------
  |  Branch (555:9): [True: 0, False: 0]
  ------------------
  556|      0|        && r->headers_out.content_length_n >= 0)
  ------------------
  |  Branch (556:12): [True: 0, False: 0]
  ------------------
  557|      0|    {
  558|      0|        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  559|      0|                       "http2 output header: \"content-length: %O\"",
  560|      0|                       r->headers_out.content_length_n);
  561|       |
  562|      0|        *pos++ = ngx_http_v2_inc_indexed(NGX_HTTP_V2_CONTENT_LENGTH_INDEX);
  ------------------
  |  |  369|      0|#define ngx_http_v2_inc_indexed(i)  (64 + (i))
  ------------------
  563|       |
  564|      0|        p = pos;
  565|      0|        pos = ngx_sprintf(pos + 1, "%O", r->headers_out.content_length_n);
  566|      0|        *p = NGX_HTTP_V2_ENCODE_RAW | (u_char) (pos - p - 1);
  ------------------
  |  |  376|      0|#define NGX_HTTP_V2_ENCODE_RAW            0
  ------------------
  567|      0|    }
  568|       |
  569|      0|    if (r->headers_out.last_modified == NULL
  ------------------
  |  Branch (569:9): [True: 0, False: 0]
  ------------------
  570|      0|        && r->headers_out.last_modified_time != -1)
  ------------------
  |  Branch (570:12): [True: 0, False: 0]
  ------------------
  571|      0|    {
  572|      0|        *pos++ = ngx_http_v2_inc_indexed(NGX_HTTP_V2_LAST_MODIFIED_INDEX);
  ------------------
  |  |  369|      0|#define ngx_http_v2_inc_indexed(i)  (64 + (i))
  ------------------
  573|       |
  574|      0|        ngx_http_time(pos, r->headers_out.last_modified_time);
  575|      0|        len = sizeof("Wed, 31 Dec 1986 18:00:00 GMT") - 1;
  576|       |
  577|      0|        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  578|      0|                       "http2 output header: \"last-modified: %*s\"",
  579|      0|                       len, pos);
  580|       |
  581|       |        /*
  582|       |         * Date will always be encoded using huffman in the temporary buffer,
  583|       |         * so it's safe here to use src and dst pointing to the same address.
  584|       |         */
  585|      0|        pos = ngx_http_v2_write_value(pos, pos, len, tmp);
  ------------------
  |  |  374|      0|    ngx_http_v2_string_encode(dst, src, len, tmp, 0)
  ------------------
  586|      0|    }
  587|       |
  588|      0|    if (r->headers_out.location && r->headers_out.location->value.len) {
  ------------------
  |  Branch (588:9): [True: 0, False: 0]
  |  Branch (588:36): [True: 0, False: 0]
  ------------------
  589|      0|        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  590|      0|                       "http2 output header: \"location: %V\"",
  591|      0|                       &r->headers_out.location->value);
  592|       |
  593|      0|        *pos++ = ngx_http_v2_inc_indexed(NGX_HTTP_V2_LOCATION_INDEX);
  ------------------
  |  |  369|      0|#define ngx_http_v2_inc_indexed(i)  (64 + (i))
  ------------------
  594|      0|        pos = ngx_http_v2_write_value(pos, r->headers_out.location->value.data,
  ------------------
  |  |  374|      0|    ngx_http_v2_string_encode(dst, src, len, tmp, 0)
  ------------------
  595|      0|                                      r->headers_out.location->value.len, tmp);
  596|      0|    }
  597|       |
  598|      0|#if (NGX_HTTP_GZIP)
  599|      0|    if (r->gzip_vary) {
  ------------------
  |  Branch (599:9): [True: 0, False: 0]
  ------------------
  600|      0|        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  601|      0|                       "http2 output header: \"vary: Accept-Encoding\"");
  602|       |
  603|      0|        *pos++ = ngx_http_v2_inc_indexed(NGX_HTTP_V2_VARY_INDEX);
  ------------------
  |  |  369|      0|#define ngx_http_v2_inc_indexed(i)  (64 + (i))
  ------------------
  604|      0|        pos = ngx_cpymem(pos, accept_encoding, sizeof(accept_encoding));
  ------------------
  |  |  107|      0|#define ngx_cpymem(dst, src, n)   (((u_char *) memcpy(dst, src, n)) + (n))
  ------------------
  605|      0|    }
  606|      0|#endif
  607|       |
  608|      0|    part = &r->headers_out.headers.part;
  609|      0|    header = part->elts;
  610|       |
  611|      0|    for (i = 0; /* void */; i++) {
  612|       |
  613|      0|        if (i >= part->nelts) {
  ------------------
  |  Branch (613:13): [True: 0, False: 0]
  ------------------
  614|      0|            if (part->next == NULL) {
  ------------------
  |  Branch (614:17): [True: 0, False: 0]
  ------------------
  615|      0|                break;
  616|      0|            }
  617|       |
  618|      0|            part = part->next;
  619|      0|            header = part->elts;
  620|      0|            i = 0;
  621|      0|        }
  622|       |
  623|      0|        if (header[i].hash == 0) {
  ------------------
  |  Branch (623:13): [True: 0, False: 0]
  ------------------
  624|      0|            continue;
  625|      0|        }
  626|       |
  627|       |#if (NGX_DEBUG)
  628|       |        if (fc->log->log_level & NGX_LOG_DEBUG_HTTP) {
  629|       |            ngx_strlow(tmp, header[i].key.data, header[i].key.len);
  630|       |
  631|       |            ngx_log_debug3(NGX_LOG_DEBUG_HTTP, fc->log, 0,
  632|       |                           "http2 output header: \"%*s: %V\"",
  633|       |                           header[i].key.len, tmp, &header[i].value);
  634|       |        }
  635|       |#endif
  636|       |
  637|      0|        *pos++ = 0;
  638|       |
  639|      0|        pos = ngx_http_v2_write_name(pos, header[i].key.data,
  ------------------
  |  |  372|      0|    ngx_http_v2_string_encode(dst, src, len, tmp, 1)
  ------------------
  640|      0|                                     header[i].key.len, tmp);
  641|       |
  642|      0|        pos = ngx_http_v2_write_value(pos, header[i].value.data,
  ------------------
  |  |  374|      0|    ngx_http_v2_string_encode(dst, src, len, tmp, 0)
  ------------------
  643|      0|                                      header[i].value.len, tmp);
  644|      0|    }
  645|       |
  646|      0|    fin = r->header_only
  ------------------
  |  Branch (646:11): [True: 0, False: 0]
  ------------------
  647|      0|          || (r->headers_out.content_length_n == 0 && !r->expect_trailers);
  ------------------
  |  Branch (647:15): [True: 0, False: 0]
  |  Branch (647:55): [True: 0, False: 0]
  ------------------
  648|       |
  649|      0|    frame = ngx_http_v2_create_headers_frame(r, start, pos, fin);
  650|      0|    if (frame == NULL) {
  ------------------
  |  Branch (650:9): [True: 0, False: 0]
  ------------------
  651|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  652|      0|    }
  653|       |
  654|      0|    ngx_http_v2_queue_blocked_frame(h2c, frame);
  655|       |
  656|      0|    stream->queued++;
  657|       |
  658|      0|    cln = ngx_http_cleanup_add(r, 0);
  659|      0|    if (cln == NULL) {
  ------------------
  |  Branch (659:9): [True: 0, False: 0]
  ------------------
  660|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  661|      0|    }
  662|       |
  663|      0|    cln->handler = ngx_http_v2_filter_cleanup;
  664|      0|    cln->data = stream;
  665|       |
  666|      0|    fc->send_chain = ngx_http_v2_send_chain;
  667|      0|    fc->need_last_buf = 1;
  668|      0|    fc->need_flush_buf = 1;
  669|       |
  670|      0|    return ngx_http_v2_filter_send(fc, stream);
  671|      0|}

ngx_http_v2_module.c:ngx_http_v2_add_variables:
  222|      1|{
  223|      1|    ngx_http_variable_t  *var, *v;
  224|       |
  225|      2|    for (v = ngx_http_v2_vars; v->name.len; v++) {
  ------------------
  |  Branch (225:32): [True: 1, False: 1]
  ------------------
  226|      1|        var = ngx_http_add_variable(cf, &v->name, v->flags);
  227|      1|        if (var == NULL) {
  ------------------
  |  Branch (227:13): [True: 0, False: 1]
  ------------------
  228|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  229|      0|        }
  230|       |
  231|      1|        var->get_handler = v->get_handler;
  232|      1|        var->data = v->data;
  233|      1|    }
  234|       |
  235|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  236|      1|}
ngx_http_v2_module.c:ngx_http_v2_create_main_conf:
  282|      1|{
  283|      1|    ngx_http_v2_main_conf_t  *h2mcf;
  284|       |
  285|      1|    h2mcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_v2_main_conf_t));
  286|      1|    if (h2mcf == NULL) {
  ------------------
  |  Branch (286:9): [True: 0, False: 1]
  ------------------
  287|      0|        return NULL;
  288|      0|    }
  289|       |
  290|      1|    h2mcf->recv_buffer_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      1|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  291|       |
  292|      1|    return h2mcf;
  293|      1|}
ngx_http_v2_module.c:ngx_http_v2_init_main_conf:
  298|      1|{
  299|      1|    ngx_http_v2_main_conf_t *h2mcf = conf;
  300|       |
  301|      1|    ngx_conf_init_size_value(h2mcf->recv_buffer_size, 256 * 1024);
  ------------------
  |  |  196|      1|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (196:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  197|      1|        conf = default;                                                      \
  |  |  198|      1|    }
  ------------------
  302|       |
  303|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  304|      1|}
ngx_http_v2_module.c:ngx_http_v2_create_srv_conf:
  309|      3|{
  310|      3|    ngx_http_v2_srv_conf_t  *h2scf;
  311|       |
  312|      3|    h2scf = ngx_pcalloc(cf->pool, sizeof(ngx_http_v2_srv_conf_t));
  313|      3|    if (h2scf == NULL) {
  ------------------
  |  Branch (313:9): [True: 0, False: 3]
  ------------------
  314|      0|        return NULL;
  315|      0|    }
  316|       |
  317|      3|    h2scf->pool_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      3|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  318|       |
  319|      3|    h2scf->concurrent_streams = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      3|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  320|      3|    h2scf->concurrent_pushes = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      3|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  321|       |
  322|      3|    h2scf->preread_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      3|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  323|       |
  324|      3|    h2scf->streams_index_mask = NGX_CONF_UNSET_UINT;
  ------------------
  |  |   57|      3|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  ------------------
  325|       |
  326|      3|    return h2scf;
  327|      3|}
ngx_http_v2_module.c:ngx_http_v2_merge_srv_conf:
  332|      1|{
  333|      1|    ngx_http_v2_srv_conf_t *prev = parent;
  334|      1|    ngx_http_v2_srv_conf_t *conf = child;
  335|       |
  336|      1|    ngx_conf_merge_size_value(conf->pool_size, prev->pool_size, 4096);
  ------------------
  |  |  231|      1|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  232|      1|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      1|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  233|      1|    }
  ------------------
  337|       |
  338|      1|    ngx_conf_merge_uint_value(conf->concurrent_streams,
  ------------------
  |  |  216|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  217|      1|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  218|      1|    }
  ------------------
  339|      1|                              prev->concurrent_streams, 128);
  340|      1|    ngx_conf_merge_uint_value(conf->concurrent_pushes,
  ------------------
  |  |  216|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  217|      1|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  218|      1|    }
  ------------------
  341|      1|                              prev->concurrent_pushes, 10);
  342|       |
  343|      1|    ngx_conf_merge_size_value(conf->preread_size, prev->preread_size, 65536);
  ------------------
  |  |  231|      1|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  232|      1|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      1|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  233|      1|    }
  ------------------
  344|       |
  345|      1|    ngx_conf_merge_uint_value(conf->streams_index_mask,
  ------------------
  |  |  216|      1|    if (conf == NGX_CONF_UNSET_UINT) {                                       \
  |  |  ------------------
  |  |  |  |   57|      2|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  217|      1|        conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   57|      1|#define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
  |  |  ------------------
  |  |  |  Branch (217:16): [True: 1, False: 0]
  |  |  ------------------
  |  |  218|      1|    }
  ------------------
  346|      1|                              prev->streams_index_mask, 32 - 1);
  347|       |
  348|      1|    return NGX_CONF_OK;
  ------------------
  |  |   63|      1|#define NGX_CONF_OK          NULL
  ------------------
  349|      1|}
ngx_http_v2_module.c:ngx_http_v2_create_loc_conf:
  354|      4|{
  355|      4|    ngx_http_v2_loc_conf_t  *h2lcf;
  356|       |
  357|      4|    h2lcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_v2_loc_conf_t));
  358|      4|    if (h2lcf == NULL) {
  ------------------
  |  Branch (358:9): [True: 0, False: 4]
  ------------------
  359|      0|        return NULL;
  360|      0|    }
  361|       |
  362|       |    /*
  363|       |     * set by ngx_pcalloc():
  364|       |     *
  365|       |     *     h2lcf->pushes = NULL;
  366|       |     */
  367|       |
  368|      4|    h2lcf->chunk_size = NGX_CONF_UNSET_SIZE;
  ------------------
  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  ------------------
  369|       |
  370|      4|    h2lcf->push_preload = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  371|      4|    h2lcf->push = NGX_CONF_UNSET;
  ------------------
  |  |   56|      4|#define NGX_CONF_UNSET       -1
  ------------------
  372|       |
  373|      4|    return h2lcf;
  374|      4|}
ngx_http_v2_module.c:ngx_http_v2_merge_loc_conf:
  379|      2|{
  380|      2|    ngx_http_v2_loc_conf_t *prev = parent;
  381|      2|    ngx_http_v2_loc_conf_t *conf = child;
  382|       |
  383|      2|    ngx_conf_merge_size_value(conf->chunk_size, prev->chunk_size, 8 * 1024);
  ------------------
  |  |  231|      2|    if (conf == NGX_CONF_UNSET_SIZE) {                                       \
  |  |  ------------------
  |  |  |  |   59|      4|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (231:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  232|      2|        conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
  |  |  ------------------
  |  |  |  |   59|      2|#define NGX_CONF_UNSET_SIZE  (size_t) -1
  |  |  ------------------
  |  |  |  Branch (232:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  233|      2|    }
  ------------------
  384|       |
  385|      2|    ngx_conf_merge_value(conf->push, prev->push, 1);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  386|       |
  387|      2|    if (conf->push && conf->pushes == NULL) {
  ------------------
  |  Branch (387:9): [True: 2, False: 0]
  |  Branch (387:23): [True: 2, False: 0]
  ------------------
  388|      2|        conf->pushes = prev->pushes;
  389|      2|    }
  390|       |
  391|      2|    ngx_conf_merge_value(conf->push_preload, prev->push_preload, 0);
  ------------------
  |  |  206|      2|    if (conf == NGX_CONF_UNSET) {                                            \
  |  |  ------------------
  |  |  |  |   56|      4|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 2, False: 0]
  |  |  ------------------
  |  |  207|      2|        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
  |  |  ------------------
  |  |  |  |   56|      2|#define NGX_CONF_UNSET       -1
  |  |  ------------------
  |  |  |  Branch (207:16): [True: 1, False: 1]
  |  |  ------------------
  |  |  208|      2|    }
  ------------------
  392|       |
  393|      2|    return NGX_CONF_OK;
  ------------------
  |  |   63|      2|#define NGX_CONF_OK          NULL
  ------------------
  394|      2|}
ngx_http_v2_module.c:ngx_http_v2_module_init:
  275|      1|{
  276|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  277|      1|}

ngx_alloc:
   19|  1.32k|{
   20|  1.32k|    void  *p;
   21|       |
   22|  1.32k|    p = malloc(size);
   23|  1.32k|    if (p == NULL) {
  ------------------
  |  Branch (23:9): [True: 0, False: 1.32k]
  ------------------
   24|      0|        ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   25|      0|                      "malloc(%uz) failed", size);
   26|      0|    }
   27|       |
   28|  1.32k|    ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size);
   29|       |
   30|  1.32k|    return p;
   31|  1.32k|}
ngx_memalign:
   53|     43|{
   54|     43|    void  *p;
   55|     43|    int    err;
   56|       |
   57|     43|    err = posix_memalign(&p, alignment, size);
   58|       |
   59|     43|    if (err) {
  ------------------
  |  Branch (59:9): [True: 0, False: 43]
  ------------------
   60|      0|        ngx_log_error(NGX_LOG_EMERG, log, err,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   61|      0|                      "posix_memalign(%uz, %uz) failed", alignment, size);
   62|      0|        p = NULL;
   63|      0|    }
   64|       |
   65|     43|    ngx_log_debug3(NGX_LOG_DEBUG_ALLOC, log, 0,
   66|     43|                   "posix_memalign: %p:%uz @%uz", p, size, alignment);
   67|       |
   68|     43|    return p;
   69|     43|}

ngx_strerror_init:
   96|      1|{
   97|      1|    char       *msg;
   98|      1|    u_char     *p;
   99|      1|    size_t      len;
  100|      1|    ngx_err_t   err;
  101|       |
  102|      1|#if (NGX_SYS_NERR)
  103|      1|    ngx_first_error = 0;
  104|      1|    ngx_last_error = NGX_SYS_NERR;
  ------------------
  |  |  242|      1|#define NGX_SYS_NERR  135
  ------------------
  105|       |
  106|       |#elif (EPERM > 1000 && EPERM < 0x7fffffff - 1000)
  107|       |
  108|       |    /*
  109|       |     * If number of errors is not known, and EPERM error code has large
  110|       |     * but reasonable value, guess possible error codes based on the error
  111|       |     * messages returned by strerror(), starting from EPERM.  Notably,
  112|       |     * this covers GNU/Hurd, where errors start at 0x40000001.
  113|       |     */
  114|       |
  115|       |    for (err = EPERM; err > EPERM - 1000; err--) {
  116|       |        ngx_set_errno(0);
  117|       |        msg = strerror(err);
  118|       |
  119|       |        if (errno == EINVAL
  120|       |            || msg == NULL
  121|       |            || strncmp(msg, "Unknown error", 13) == 0)
  122|       |        {
  123|       |            continue;
  124|       |        }
  125|       |
  126|       |        ngx_first_error = err;
  127|       |    }
  128|       |
  129|       |    for (err = EPERM; err < EPERM + 1000; err++) {
  130|       |        ngx_set_errno(0);
  131|       |        msg = strerror(err);
  132|       |
  133|       |        if (errno == EINVAL
  134|       |            || msg == NULL
  135|       |            || strncmp(msg, "Unknown error", 13) == 0)
  136|       |        {
  137|       |            continue;
  138|       |        }
  139|       |
  140|       |        ngx_last_error = err + 1;
  141|       |    }
  142|       |
  143|       |#else
  144|       |
  145|       |    /*
  146|       |     * If number of errors is not known, guess it based on the error
  147|       |     * messages returned by strerror().
  148|       |     */
  149|       |
  150|       |    ngx_first_error = 0;
  151|       |
  152|       |    for (err = 0; err < 1000; err++) {
  153|       |        ngx_set_errno(0);
  154|       |        msg = strerror(err);
  155|       |
  156|       |        if (errno == EINVAL
  157|       |            || msg == NULL
  158|       |            || strncmp(msg, "Unknown error", 13) == 0)
  159|       |        {
  160|       |            continue;
  161|       |        }
  162|       |
  163|       |        ngx_last_error = err + 1;
  164|       |    }
  165|       |
  166|       |#endif
  167|       |
  168|       |    /*
  169|       |     * ngx_strerror() is not ready to work at this stage, therefore,
  170|       |     * malloc() is used and possible errors are logged using strerror().
  171|       |     */
  172|       |
  173|      1|    len = (ngx_last_error - ngx_first_error) * sizeof(ngx_str_t);
  174|       |
  175|      1|    ngx_sys_errlist = malloc(len);
  176|      1|    if (ngx_sys_errlist == NULL) {
  ------------------
  |  Branch (176:9): [True: 0, False: 1]
  ------------------
  177|      0|        goto failed;
  178|      0|    }
  179|       |
  180|    136|    for (err = ngx_first_error; err < ngx_last_error; err++) {
  ------------------
  |  Branch (180:33): [True: 135, False: 1]
  ------------------
  181|    135|        msg = strerror(err);
  182|       |
  183|    135|        if (msg == NULL) {
  ------------------
  |  Branch (183:13): [True: 0, False: 135]
  ------------------
  184|      0|            ngx_sys_errlist[err - ngx_first_error] = ngx_unknown_error;
  185|      0|            continue;
  186|      0|        }
  187|       |
  188|    135|        len = ngx_strlen(msg);
  ------------------
  |  |   61|    135|#define ngx_strlen(s)       strlen((const char *) s)
  ------------------
  189|       |
  190|    135|        p = malloc(len);
  191|    135|        if (p == NULL) {
  ------------------
  |  Branch (191:13): [True: 0, False: 135]
  ------------------
  192|      0|            goto failed;
  193|      0|        }
  194|       |
  195|    135|        ngx_memcpy(p, msg, len);
  ------------------
  |  |  106|    135|#define ngx_memcpy(dst, src, n)   (void) memcpy(dst, src, n)
  ------------------
  196|    135|        ngx_sys_errlist[err - ngx_first_error].len = len;
  197|    135|        ngx_sys_errlist[err - ngx_first_error].data = p;
  198|    135|    }
  199|       |
  200|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  201|       |
  202|      0|failed:
  203|       |
  204|      0|    err = errno;
  205|      0|    ngx_log_stderr(0, "malloc(%uz) failed (%d: %s)", len, err, strerror(err));
  206|       |
  207|      0|    return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  208|      1|}

ngx_read_file:
   32|      1|{
   33|      1|    ssize_t  n;
   34|       |
   35|      1|    ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0,
   36|      1|                   "read: %d, %p, %uz, %O", file->fd, buf, size, offset);
   37|       |
   38|      1|#if (NGX_HAVE_PREAD)
   39|       |
   40|      1|    n = pread(file->fd, buf, size, offset);
   41|       |
   42|      1|    if (n == -1) {
  ------------------
  |  Branch (42:9): [True: 0, False: 1]
  ------------------
   43|      0|        ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   44|      0|                      "pread() \"%s\" failed", file->name.data);
   45|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   46|      0|    }
   47|       |
   48|       |#else
   49|       |
   50|       |    if (file->sys_offset != offset) {
   51|       |        if (lseek(file->fd, offset, SEEK_SET) == -1) {
   52|       |            ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
   53|       |                          "lseek() \"%s\" failed", file->name.data);
   54|       |            return NGX_ERROR;
   55|       |        }
   56|       |
   57|       |        file->sys_offset = offset;
   58|       |    }
   59|       |
   60|       |    n = read(file->fd, buf, size);
   61|       |
   62|       |    if (n == -1) {
   63|       |        ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
   64|       |                      "read() \"%s\" failed", file->name.data);
   65|       |        return NGX_ERROR;
   66|       |    }
   67|       |
   68|       |    file->sys_offset += n;
   69|       |
   70|       |#endif
   71|       |
   72|      1|    file->offset += n;
   73|       |
   74|      1|    return n;
   75|      1|}
ngx_write_file:
  194|     36|{
  195|     36|    ssize_t    n, written;
  196|     36|    ngx_err_t  err;
  197|       |
  198|     36|    ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0,
  199|     36|                   "write: %d, %p, %uz, %O", file->fd, buf, size, offset);
  200|       |
  201|     36|    written = 0;
  202|       |
  203|     36|#if (NGX_HAVE_PWRITE)
  204|       |
  205|     36|    for ( ;; ) {
  206|     36|        n = pwrite(file->fd, buf + written, size, offset);
  207|       |
  208|     36|        if (n == -1) {
  ------------------
  |  Branch (208:13): [True: 0, False: 36]
  ------------------
  209|      0|            err = ngx_errno;
  ------------------
  |  |   69|      0|#define ngx_errno                  errno
  ------------------
  210|       |
  211|      0|            if (err == NGX_EINTR) {
  ------------------
  |  |   22|      0|#define NGX_EINTR         EINTR
  ------------------
  |  Branch (211:17): [True: 0, False: 0]
  ------------------
  212|      0|                ngx_log_debug0(NGX_LOG_DEBUG_CORE, file->log, err,
  213|      0|                               "pwrite() was interrupted");
  214|      0|                continue;
  215|      0|            }
  216|       |
  217|      0|            ngx_log_error(NGX_LOG_CRIT, file->log, err,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  218|      0|                          "pwrite() \"%s\" failed", file->name.data);
  219|      0|            return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  220|      0|        }
  221|       |
  222|     36|        file->offset += n;
  223|     36|        written += n;
  224|       |
  225|     36|        if ((size_t) n == size) {
  ------------------
  |  Branch (225:13): [True: 36, False: 0]
  ------------------
  226|     36|            return written;
  227|     36|        }
  228|       |
  229|      0|        offset += n;
  230|      0|        size -= n;
  231|      0|    }
  232|       |
  233|       |#else
  234|       |
  235|       |    if (file->sys_offset != offset) {
  236|       |        if (lseek(file->fd, offset, SEEK_SET) == -1) {
  237|       |            ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
  238|       |                          "lseek() \"%s\" failed", file->name.data);
  239|       |            return NGX_ERROR;
  240|       |        }
  241|       |
  242|       |        file->sys_offset = offset;
  243|       |    }
  244|       |
  245|       |    for ( ;; ) {
  246|       |        n = write(file->fd, buf + written, size);
  247|       |
  248|       |        if (n == -1) {
  249|       |            err = ngx_errno;
  250|       |
  251|       |            if (err == NGX_EINTR) {
  252|       |                ngx_log_debug0(NGX_LOG_DEBUG_CORE, file->log, err,
  253|       |                               "write() was interrupted");
  254|       |                continue;
  255|       |            }
  256|       |
  257|       |            ngx_log_error(NGX_LOG_CRIT, file->log, err,
  258|       |                          "write() \"%s\" failed", file->name.data);
  259|       |            return NGX_ERROR;
  260|       |        }
  261|       |
  262|       |        file->sys_offset += n;
  263|       |        file->offset += n;
  264|       |        written += n;
  265|       |
  266|       |        if ((size_t) n == size) {
  267|       |            return written;
  268|       |        }
  269|       |
  270|       |        size -= n;
  271|       |    }
  272|       |#endif
  273|     36|}
ngx_open_tempfile:
  278|      5|{
  279|      5|    ngx_fd_t  fd;
  280|       |
  281|      5|    fd = open((const char *) name, O_CREAT|O_EXCL|O_RDWR,
  282|      5|              access ? access : 0600);
  ------------------
  |  Branch (282:15): [True: 0, False: 5]
  ------------------
  283|       |
  284|      5|    if (fd != -1 && !persistent) {
  ------------------
  |  Branch (284:9): [True: 5, False: 0]
  |  Branch (284:21): [True: 5, False: 0]
  ------------------
  285|      5|        (void) unlink((const char *) name);
  286|      5|    }
  287|       |
  288|      5|    return fd;
  289|      5|}
ngx_write_chain_to_file:
  295|     47|{
  296|     47|    ssize_t        total, n;
  297|     47|    ngx_iovec_t    vec;
  298|     47|    struct iovec   iovs[NGX_IOVS_PREALLOCATE];
  299|       |
  300|       |    /* use pwrite() if there is the only buf in a chain */
  301|       |
  302|     47|    if (cl->next == NULL) {
  ------------------
  |  Branch (302:9): [True: 36, False: 11]
  ------------------
  303|     36|        return ngx_write_file(file, cl->buf->pos,
  304|     36|                              (size_t) (cl->buf->last - cl->buf->pos),
  305|     36|                              offset);
  306|     36|    }
  307|       |
  308|     11|    total = 0;
  309|       |
  310|     11|    vec.iovs = iovs;
  311|     11|    vec.nalloc = NGX_IOVS_PREALLOCATE;
  ------------------
  |  |   58|     11|#define NGX_IOVS_PREALLOCATE  64
  ------------------
  312|       |
  313|     11|    do {
  314|       |        /* create the iovec and coalesce the neighbouring bufs */
  315|     11|        cl = ngx_chain_to_iovec(&vec, cl);
  316|       |
  317|       |        /* use pwrite() if there is the only iovec buffer */
  318|       |
  319|     11|        if (vec.count == 1) {
  ------------------
  |  Branch (319:13): [True: 0, False: 11]
  ------------------
  320|      0|            n = ngx_write_file(file, (u_char *) iovs[0].iov_base,
  321|      0|                               iovs[0].iov_len, offset);
  322|       |
  323|      0|            if (n == NGX_ERROR) {
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  |  Branch (323:17): [True: 0, False: 0]
  ------------------
  324|      0|                return n;
  325|      0|            }
  326|       |
  327|      0|            return total + n;
  328|      0|        }
  329|       |
  330|     11|        n = ngx_writev_file(file, &vec, offset);
  331|       |
  332|     11|        if (n == NGX_ERROR) {
  ------------------
  |  |   39|     11|#define  NGX_ERROR      -1
  ------------------
  |  Branch (332:13): [True: 0, False: 11]
  ------------------
  333|      0|            return n;
  334|      0|        }
  335|       |
  336|     11|        offset += n;
  337|     11|        total += n;
  338|       |
  339|     11|    } while (cl);
  ------------------
  |  Branch (339:14): [True: 0, False: 11]
  ------------------
  340|       |
  341|     11|    return total;
  342|     11|}
ngx_files.c:ngx_chain_to_iovec:
  347|     11|{
  348|     11|    size_t         total, size;
  349|     11|    u_char        *prev;
  350|     11|    ngx_uint_t     n;
  351|     11|    struct iovec  *iov;
  352|       |
  353|     11|    iov = NULL;
  354|     11|    prev = NULL;
  355|     11|    total = 0;
  356|     11|    n = 0;
  357|       |
  358|     40|    for ( /* void */ ; cl; cl = cl->next) {
  ------------------
  |  Branch (358:24): [True: 29, False: 11]
  ------------------
  359|       |
  360|     29|        if (ngx_buf_special(cl->buf)) {
  ------------------
  |  |  129|     29|    (((b)->flush || (b)->last_buf || (b)->sync)                              \
  |  |  ------------------
  |  |  |  Branch (129:7): [True: 0, False: 29]
  |  |  |  Branch (129:21): [True: 0, False: 29]
  |  |  |  Branch (129:38): [True: 0, False: 29]
  |  |  ------------------
  |  |  130|     29|     && !ngx_buf_in_memory(b) && !(b)->in_file)
  |  |  ------------------
  |  |  |  |  125|     29|#define ngx_buf_in_memory(b)       ((b)->temporary || (b)->memory || (b)->mmap)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (125:37): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:55): [True: 0, False: 0]
  |  |  |  |  |  Branch (125:70): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (130:34): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  361|      0|            continue;
  362|      0|        }
  363|       |
  364|     29|        size = cl->buf->last - cl->buf->pos;
  365|       |
  366|     29|        if (prev == cl->buf->pos) {
  ------------------
  |  Branch (366:13): [True: 0, False: 29]
  ------------------
  367|      0|            iov->iov_len += size;
  368|       |
  369|     29|        } else {
  370|     29|            if (n == vec->nalloc) {
  ------------------
  |  Branch (370:17): [True: 0, False: 29]
  ------------------
  371|      0|                break;
  372|      0|            }
  373|       |
  374|     29|            iov = &vec->iovs[n++];
  375|       |
  376|     29|            iov->iov_base = (void *) cl->buf->pos;
  377|     29|            iov->iov_len = size;
  378|     29|        }
  379|       |
  380|     29|        prev = cl->buf->pos + size;
  381|     29|        total += size;
  382|     29|    }
  383|       |
  384|     11|    vec->count = n;
  385|     11|    vec->size = total;
  386|       |
  387|     11|    return cl;
  388|     11|}
ngx_files.c:ngx_writev_file:
  393|     11|{
  394|     11|    ssize_t    n;
  395|     11|    ngx_err_t  err;
  396|       |
  397|     11|    ngx_log_debug3(NGX_LOG_DEBUG_CORE, file->log, 0,
  398|     11|                   "writev: %d, %uz, %O", file->fd, vec->size, offset);
  399|       |
  400|     11|#if (NGX_HAVE_PWRITEV)
  401|       |
  402|     11|eintr:
  403|       |
  404|     11|    n = pwritev(file->fd, vec->iovs, vec->count, offset);
  405|       |
  406|     11|    if (n == -1) {
  ------------------
  |  Branch (406:9): [True: 0, False: 11]
  ------------------
  407|      0|        err = ngx_errno;
  ------------------
  |  |   69|      0|#define ngx_errno                  errno
  ------------------
  408|       |
  409|      0|        if (err == NGX_EINTR) {
  ------------------
  |  |   22|      0|#define NGX_EINTR         EINTR
  ------------------
  |  Branch (409:13): [True: 0, False: 0]
  ------------------
  410|      0|            ngx_log_debug0(NGX_LOG_DEBUG_CORE, file->log, err,
  411|      0|                           "pwritev() was interrupted");
  412|      0|            goto eintr;
  413|      0|        }
  414|       |
  415|      0|        ngx_log_error(NGX_LOG_CRIT, file->log, err,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  416|      0|                      "pwritev() \"%s\" failed", file->name.data);
  417|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  418|      0|    }
  419|       |
  420|     11|    if ((size_t) n != vec->size) {
  ------------------
  |  Branch (420:9): [True: 0, False: 11]
  ------------------
  421|      0|        ngx_log_error(NGX_LOG_CRIT, file->log, 0,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  422|      0|                      "pwritev() \"%s\" has written only %z of %uz",
  423|      0|                      file->name.data, n, vec->size);
  424|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
  425|      0|    }
  426|       |
  427|       |#else
  428|       |
  429|       |    if (file->sys_offset != offset) {
  430|       |        if (lseek(file->fd, offset, SEEK_SET) == -1) {
  431|       |            ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
  432|       |                          "lseek() \"%s\" failed", file->name.data);
  433|       |            return NGX_ERROR;
  434|       |        }
  435|       |
  436|       |        file->sys_offset = offset;
  437|       |    }
  438|       |
  439|       |eintr:
  440|       |
  441|       |    n = writev(file->fd, vec->iovs, vec->count);
  442|       |
  443|       |    if (n == -1) {
  444|       |        err = ngx_errno;
  445|       |
  446|       |        if (err == NGX_EINTR) {
  447|       |            ngx_log_debug0(NGX_LOG_DEBUG_CORE, file->log, err,
  448|       |                           "writev() was interrupted");
  449|       |            goto eintr;
  450|       |        }
  451|       |
  452|       |        ngx_log_error(NGX_LOG_CRIT, file->log, err,
  453|       |                      "writev() \"%s\" failed", file->name.data);
  454|       |        return NGX_ERROR;
  455|       |    }
  456|       |
  457|       |    if ((size_t) n != vec->size) {
  458|       |        ngx_log_error(NGX_LOG_CRIT, file->log, 0,
  459|       |                      "writev() \"%s\" has written only %z of %uz",
  460|       |                      file->name.data, n, vec->size);
  461|       |        return NGX_ERROR;
  462|       |    }
  463|       |
  464|       |    file->sys_offset += n;
  465|       |
  466|       |#endif
  467|       |
  468|     11|    file->offset += n;
  469|       |
  470|     11|    return n;
  471|     11|}

ngx_os_specific_init:
   35|      1|{
   36|      1|    struct utsname  u;
   37|       |
   38|      1|    if (uname(&u) == -1) {
  ------------------
  |  Branch (38:9): [True: 0, False: 1]
  ------------------
   39|      0|        ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "uname() failed");
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   40|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   41|      0|    }
   42|       |
   43|      1|    (void) ngx_cpystrn(ngx_linux_kern_ostype, (u_char *) u.sysname,
   44|      1|                       sizeof(ngx_linux_kern_ostype));
   45|       |
   46|      1|    (void) ngx_cpystrn(ngx_linux_kern_osrelease, (u_char *) u.release,
   47|      1|                       sizeof(ngx_linux_kern_osrelease));
   48|       |
   49|      1|    ngx_os_io = ngx_linux_io;
   50|       |
   51|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   52|      1|}
ngx_os_specific_status:
   57|      1|{
   58|      1|    ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
  ------------------
  |  |   86|      1|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 1]
  |  |  ------------------
  ------------------
   59|      1|                  ngx_linux_kern_ostype, ngx_linux_kern_osrelease);
   60|      1|}

ngx_os_init:
   36|      1|{
   37|      1|    ngx_time_t  *tp;
   38|      1|    ngx_uint_t   n;
   39|      1|#if (NGX_HAVE_LEVEL1_DCACHE_LINESIZE)
   40|      1|    long         size;
   41|      1|#endif
   42|       |
   43|      1|#if (NGX_HAVE_OS_SPECIFIC_INIT)
   44|      1|    if (ngx_os_specific_init(log) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (44:9): [True: 0, False: 1]
  ------------------
   45|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   46|      0|    }
   47|      1|#endif
   48|       |
   49|      1|    if (ngx_init_setproctitle(log) != NGX_OK) {
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
  |  Branch (49:9): [True: 0, False: 1]
  ------------------
   50|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   51|      0|    }
   52|       |
   53|      1|    ngx_pagesize = getpagesize();
   54|      1|    ngx_cacheline_size = NGX_CPU_CACHE_LINE;
  ------------------
  |  |  109|      1|#define NGX_CPU_CACHE_LINE  64
  ------------------
   55|       |
   56|     13|    for (n = ngx_pagesize; n >>= 1; ngx_pagesize_shift++) { /* void */ }
  ------------------
  |  Branch (56:28): [True: 12, False: 1]
  ------------------
   57|       |
   58|      1|#if (NGX_HAVE_SC_NPROCESSORS_ONLN)
   59|      1|    if (ngx_ncpu == 0) {
  ------------------
  |  Branch (59:9): [True: 1, False: 0]
  ------------------
   60|      1|        ngx_ncpu = sysconf(_SC_NPROCESSORS_ONLN);
   61|      1|    }
   62|      1|#endif
   63|       |
   64|      1|    if (ngx_ncpu < 1) {
  ------------------
  |  Branch (64:9): [True: 0, False: 1]
  ------------------
   65|      0|        ngx_ncpu = 1;
   66|      0|    }
   67|       |
   68|      1|#if (NGX_HAVE_LEVEL1_DCACHE_LINESIZE)
   69|      1|    size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
   70|      1|    if (size > 0) {
  ------------------
  |  Branch (70:9): [True: 1, False: 0]
  ------------------
   71|      1|        ngx_cacheline_size = size;
   72|      1|    }
   73|      1|#endif
   74|       |
   75|      1|    ngx_cpuinfo();
   76|       |
   77|      1|    if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
  ------------------
  |  Branch (77:9): [True: 0, False: 1]
  ------------------
   78|      0|        ngx_log_error(NGX_LOG_ALERT, log, errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   79|      0|                      "getrlimit(RLIMIT_NOFILE) failed");
   80|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   81|      0|    }
   82|       |
   83|      1|    ngx_max_sockets = (ngx_int_t) rlmt.rlim_cur;
   84|       |
   85|      1|#if (NGX_HAVE_INHERITED_NONBLOCK || NGX_HAVE_ACCEPT4)
   86|      1|    ngx_inherited_nonblocking = 1;
   87|       |#else
   88|       |    ngx_inherited_nonblocking = 0;
   89|       |#endif
   90|       |
   91|      1|    tp = ngx_timeofday();
  ------------------
  |  |   37|      1|#define ngx_timeofday()      (ngx_time_t *) ngx_cached_time
  ------------------
   92|      1|    srandom(((unsigned) ngx_pid << 16) ^ tp->sec ^ tp->msec);
   93|       |
   94|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   95|      1|}
ngx_os_status:
  100|      1|{
  101|      1|    ngx_log_error(NGX_LOG_NOTICE, log, 0, NGINX_VER_BUILD);
  ------------------
  |  |   86|      1|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  102|       |
  103|       |#ifdef NGX_COMPILER
  104|       |    ngx_log_error(NGX_LOG_NOTICE, log, 0, "built by " NGX_COMPILER);
  105|       |#endif
  106|       |
  107|      1|#if (NGX_HAVE_OS_SPECIFIC_INIT)
  108|      1|    ngx_os_specific_status(log);
  109|      1|#endif
  110|       |
  111|      1|    ngx_log_error(NGX_LOG_NOTICE, log, 0,
  ------------------
  |  |   86|      1|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  112|      1|                  "getrlimit(RLIMIT_NOFILE): %r:%r",
  113|      1|                  rlmt.rlim_cur, rlmt.rlim_max);
  114|      1|}

ngx_init_setproctitle:
   36|      1|{
   37|      1|    u_char      *p;
   38|      1|    size_t       size;
   39|      1|    ngx_uint_t   i;
   40|       |
   41|      1|    size = 0;
   42|       |
   43|     32|    for (i = 0; environ[i]; i++) {
  ------------------
  |  Branch (43:17): [True: 31, False: 1]
  ------------------
   44|     31|        size += ngx_strlen(environ[i]) + 1;
  ------------------
  |  |   61|     31|#define ngx_strlen(s)       strlen((const char *) s)
  ------------------
   45|     31|    }
   46|       |
   47|      1|    p = ngx_alloc(size, log);
   48|      1|    if (p == NULL) {
  ------------------
  |  Branch (48:9): [True: 0, False: 1]
  ------------------
   49|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   50|      0|    }
   51|       |
   52|      1|    ngx_os_argv_last = ngx_os_argv[0];
   53|       |
   54|      2|    for (i = 0; ngx_os_argv[i]; i++) {
  ------------------
  |  Branch (54:17): [True: 1, False: 1]
  ------------------
   55|      1|        if (ngx_os_argv_last == ngx_os_argv[i]) {
  ------------------
  |  Branch (55:13): [True: 1, False: 0]
  ------------------
   56|      1|            ngx_os_argv_last = ngx_os_argv[i] + ngx_strlen(ngx_os_argv[i]) + 1;
  ------------------
  |  |   61|      1|#define ngx_strlen(s)       strlen((const char *) s)
  ------------------
   57|      1|        }
   58|      1|    }
   59|       |
   60|     32|    for (i = 0; environ[i]; i++) {
  ------------------
  |  Branch (60:17): [True: 31, False: 1]
  ------------------
   61|     31|        if (ngx_os_argv_last == environ[i]) {
  ------------------
  |  Branch (61:13): [True: 1, False: 30]
  ------------------
   62|       |
   63|      1|            size = ngx_strlen(environ[i]) + 1;
  ------------------
  |  |   61|      1|#define ngx_strlen(s)       strlen((const char *) s)
  ------------------
   64|      1|            ngx_os_argv_last = environ[i] + size;
   65|       |
   66|      1|            ngx_cpystrn(p, (u_char *) environ[i], size);
   67|      1|            environ[i] = (char *) p;
   68|      1|            p += size;
   69|      1|        }
   70|     31|    }
   71|       |
   72|      1|    ngx_os_argv_last--;
   73|       |
   74|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   75|      1|}

ngx_shm_alloc:
   16|      1|{
   17|      1|    shm->addr = (u_char *) mmap(NULL, shm->size,
   18|      1|                                PROT_READ|PROT_WRITE,
   19|      1|                                MAP_ANON|MAP_SHARED, -1, 0);
   20|       |
   21|      1|    if (shm->addr == MAP_FAILED) {
  ------------------
  |  Branch (21:9): [True: 0, False: 1]
  ------------------
   22|      0|        ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno,
  ------------------
  |  |   86|      0|    if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (86:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   23|      0|                      "mmap(MAP_ANON|MAP_SHARED, %uz) failed", shm->size);
   24|      0|        return NGX_ERROR;
  ------------------
  |  |   39|      0|#define  NGX_ERROR      -1
  ------------------
   25|      0|    }
   26|       |
   27|      1|    return NGX_OK;
  ------------------
  |  |   38|      1|#define  NGX_OK          0
  ------------------
   28|      1|}

ngx_nonblocking:
   28|      6|{
   29|      6|    int  nb;
   30|       |
   31|      6|    nb = 1;
   32|       |
   33|      6|    return ioctl(s, FIONBIO, &nb);
   34|      6|}

ngx_timezone_update:
   26|      1|{
   27|       |#if (NGX_FREEBSD)
   28|       |
   29|       |    if (getenv("TZ")) {
   30|       |        return;
   31|       |    }
   32|       |
   33|       |    putenv("TZ=UTC");
   34|       |
   35|       |    tzset();
   36|       |
   37|       |    unsetenv("TZ");
   38|       |
   39|       |    tzset();
   40|       |
   41|       |#elif (NGX_LINUX)
   42|      1|    time_t      s;
   43|      1|    struct tm  *t;
   44|      1|    char        buf[4];
   45|       |
   46|      1|    s = time(0);
   47|       |
   48|      1|    t = localtime(&s);
   49|       |
   50|      1|    strftime(buf, 4, "%H", t);
   51|       |
   52|      1|#endif
   53|      1|}
ngx_localtime:
   58|      2|{
   59|      2|#if (NGX_HAVE_LOCALTIME_R)
   60|      2|    (void) localtime_r(&s, tm);
   61|       |
   62|       |#else
   63|       |    ngx_tm_t  *t;
   64|       |
   65|       |    t = localtime(&s);
   66|       |    *tm = *t;
   67|       |
   68|       |#endif
   69|       |
   70|      2|    tm->ngx_tm_mon++;
  ------------------
  |  |   25|      2|#define ngx_tm_mon            tm_mon
  ------------------
   71|      2|    tm->ngx_tm_year += 1900;
  ------------------
  |  |   26|      2|#define ngx_tm_year           tm_year
  ------------------
   72|      2|}

