Lines Matching refs:TG
61 #define TG(v) TSRMG(thttpd_globals_id, php_thttpd_globals *, v) macro
64 #define TG(v) (thttpd_globals.v) macro
72 if (TG(sbuf).c != 0) { in sapi_thttpd_ub_write()
73 smart_str_appendl_ex(&TG(sbuf), str, str_length, 1); in sapi_thttpd_ub_write()
78 PHP_SYS_CALL(n = send(TG(hc)->conn_fd, str, str_length, 0);); in sapi_thttpd_ub_write()
82 smart_str_appendl_ex(&TG(sbuf), str, str_length, 1); in sapi_thttpd_ub_write()
89 TG(hc)->bytes_sent += n; in sapi_thttpd_ub_write()
112 if (TG(sbuf).c == 0) { in do_writev()
113 PHP_SYS_CALL(n = writev(TG(hc)->conn_fd, vec, nvec);); in do_writev()
124 TG(hc)->bytes_sent += n; in do_writev()
148 smart_str_appendl_ex(&TG(sbuf), vec->iov_base, vec->iov_len, 1); in do_writev()
193 TG(hc)->status = SG(sapi_headers).http_response_code; in sapi_thttpd_send_headers()
204 if (!TG(seen_cl) && strncasecmp(h->header, CL_TOKEN, sizeof(CL_TOKEN)-1) == 0) { in sapi_thttpd_send_headers()
205 TG(seen_cl) = 1; in sapi_thttpd_send_headers()
206 } else if (!TG(seen_cn) && strncasecmp(h->header, CN_TOKEN, sizeof(CN_TOKEN)-1) == 0) { in sapi_thttpd_send_headers()
207 TG(seen_cn) = 1; in sapi_thttpd_send_headers()
223 if (TG(seen_cl) && !TG(seen_cn) && TG(hc)->do_keep_alive) { in sapi_thttpd_send_headers()
226 TG(hc)->do_keep_alive = 0; in sapi_thttpd_send_headers()
244 #define SIZEOF_UNCONSUMED_BYTES() (TG(hc)->read_idx - TG(hc)->checked_idx)
245 #define CONSUME_BYTES(n) do { TG(hc)->checked_idx += (n); } while (0)
252 if (TG(unconsumed_length) > 0) { in sapi_thttpd_read_post()
253 read_bytes = MIN(TG(unconsumed_length), count_bytes); in sapi_thttpd_read_post()
254 memcpy(buffer, TG(hc)->read_buf + TG(hc)->checked_idx, read_bytes); in sapi_thttpd_read_post()
255 TG(unconsumed_length) -= read_bytes; in sapi_thttpd_read_post()
264 return TG(hc)->cookie; in sapi_thttpd_read_cookies()
284 if (TG(hc)->one_one) { in sapi_thttpd_register_variables()
290 p = httpd_ntoa(&TG(hc)->client_addr); in sapi_thttpd_register_variables()
297 TG(hc)->hs->port)); in sapi_thttpd_register_variables()
300 memcpy(buf + 1, TG(hc)->pathinfo, strlen(TG(hc)->pathinfo) + 1); in sapi_thttpd_register_variables()
304 memcpy(buf + 1, TG(hc)->origfilename, strlen(TG(hc)->origfilename) + 1); in sapi_thttpd_register_variables()
308 if (TG(hc)->field[0]) { \ in sapi_thttpd_register_variables()
309 php_register_variable(#name, TG(hc)->field, track_vars_array TSRMLS_CC); \ in sapi_thttpd_register_variables()
324 if (TG(hc)->contentlength != -1) { in sapi_thttpd_register_variables()
327 TG(hc)->contentlength)); in sapi_thttpd_register_variables()
330 if (TG(hc)->authorization[0]) in sapi_thttpd_register_variables()
367 if (nfd) *nfd = TG(hc)->conn_fd;
439 TG(seen_cl) = 0;
440 TG(seen_cn) = 0;
441 TG(sbuf).c = 0;
442 SG(request_info).query_string = TG(hc)->query?strdup(TG(hc)->query):NULL;
444 smart_str_appends_ex(&s, TG(hc)->hs->cwd, 1);
445 smart_str_appends_ex(&s, TG(hc)->expnfilename, 1);
451 smart_str_appends_ex(&s, TG(hc)->origfilename, 1);
454 SG(request_info).request_method = httpd_method_str(TG(hc)->method);
455 if (TG(hc)->one_one) SG(request_info).proto_num = 1001;
458 if (TG(hc)->contenttype)
459 SG(request_info).content_type = strdup(TG(hc)->contenttype);
460 SG(request_info).content_length = TG(hc)->contentlength == -1 ? 0
461 : TG(hc)->contentlength;
463 TG(unconsumed_length) = SG(request_info).content_length;
465 php_handle_auth_data(TG(hc)->authorization TSRMLS_CC);
470 smart_str_free_ex(&TG(sbuf), 1);
658 TG(hc) = hc;
677 if (TG(seen_cl) == 0 || TG(seen_cn) == 1) {
678 TG(hc)->do_keep_alive = 0;
681 if (TG(sbuf).c != 0) {
682 if (TG(hc)->response)
683 free(TG(hc)->response);
685 TG(hc)->response = TG(sbuf).c;
686 TG(hc)->responselen = TG(sbuf).len;
687 TG(hc)->maxresponse = TG(sbuf).a;
689 TG(sbuf).c = 0;
690 TG(sbuf).len = 0;
691 TG(sbuf).a = 0;
712 TG(on_close) = arg;
718 if (TG(on_close)) TG(on_close)(fd);
724 return TG(hc)->conn_fd;
731 TG(hc)->file_address = (char *) 1;