Lines Matching refs:SG
139 if (SG(callback_func)) { in PHP_FUNCTION()
140 zval_ptr_dtor(&SG(callback_func)); in PHP_FUNCTION()
141 SG(fci_cache) = empty_fcall_info_cache; in PHP_FUNCTION()
144 SG(callback_func) = callback_func; in PHP_FUNCTION()
146 Z_ADDREF_P(SG(callback_func)); in PHP_FUNCTION()
160 …if (zend_fcall_info_init(SG(callback_func), 0, &fci, &SG(fci_cache), &callback_name, &callback_err… in sapi_run_header_callback()
163 error = zend_call_function(&fci, &SG(fci_cache) TSRMLS_CC); in sapi_run_header_callback()
184 if (SG(request_info).post_entry && SG(request_info).content_type_dup) { in sapi_handle_post()
185 SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg TSRMLS_CC); in sapi_handle_post()
186 efree(SG(request_info).content_type_dup); in sapi_handle_post()
187 SG(request_info).content_type_dup = NULL; in sapi_handle_post()
194 uint content_type_length = strlen(SG(request_info).content_type); in sapi_read_post_data()
195 char *content_type = estrndup(SG(request_info).content_type, content_type_length); in sapi_read_post_data()
221 if (zend_hash_find(&SG(known_post_content_types), content_type, in sapi_read_post_data()
224 SG(request_info).post_entry = post_entry; in sapi_read_post_data()
228 SG(request_info).post_entry = NULL; in sapi_read_post_data()
231 SG(request_info).content_type_dup = NULL; in sapi_read_post_data()
240 SG(request_info).content_type_dup = content_type; in sapi_read_post_data()
263 SG(read_post_bytes) += read_bytes; in sapi_read_post_block()
267 SG(post_read) = 1; in sapi_read_post_block()
275 if ((SG(post_max_size) > 0) && (SG(request_info).content_length > SG(post_max_size))) { in SAPI_POST_READER_FUNC()
277 SG(request_info).content_length, SG(post_max_size)); in SAPI_POST_READER_FUNC()
282 …SG(request_info).request_body = php_stream_temp_create_ex(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZ… in SAPI_POST_READER_FUNC()
293 if (php_stream_write(SG(request_info).request_body, buffer, read_bytes) != read_bytes) { in SAPI_POST_READER_FUNC()
295 php_stream_truncate_set_size(SG(request_info).request_body, 0); in SAPI_POST_READER_FUNC()
301 if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) { in SAPI_POST_READER_FUNC()
302 …ING, "Actual POST length does not match Content-Length, and exceeds %ld bytes", SG(post_max_size)); in SAPI_POST_READER_FUNC()
311 php_stream_rewind(SG(request_info).request_body); in SAPI_POST_READER_FUNC()
321 if (SG(default_mimetype)) { in get_default_content_type()
322 mimetype = SG(default_mimetype); in get_default_content_type()
323 mimetype_len = strlen(SG(default_mimetype)); in get_default_content_type()
328 if (SG(default_charset)) { in get_default_content_type()
329 charset = SG(default_charset); in get_default_content_type()
330 charset_len = strlen(SG(default_charset)); in get_default_content_type()
388 charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET; in sapi_apply_default_charset()
407 if (SG(request_info).headers_read == 1) in sapi_activate_headers_only()
409 SG(request_info).headers_read = 1; in sapi_activate_headers_only()
410 zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), in sapi_activate_headers_only()
412 SG(sapi_headers).send_default_content_type = 1; in sapi_activate_headers_only()
415 SG(sapi_headers).http_status_line = NULL; in sapi_activate_headers_only()
416 SG(sapi_headers).mimetype = NULL; in sapi_activate_headers_only()
417 SG(read_post_bytes) = 0; in sapi_activate_headers_only()
418 SG(request_info).request_body = NULL; in sapi_activate_headers_only()
419 SG(request_info).current_user = NULL; in sapi_activate_headers_only()
420 SG(request_info).current_user_length = 0; in sapi_activate_headers_only()
421 SG(request_info).no_headers = 0; in sapi_activate_headers_only()
422 SG(request_info).post_entry = NULL; in sapi_activate_headers_only()
423 SG(global_request_time) = 0; in sapi_activate_headers_only()
429 if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) { in sapi_activate_headers_only()
430 SG(request_info).headers_only = 1; in sapi_activate_headers_only()
432 SG(request_info).headers_only = 0; in sapi_activate_headers_only()
434 if (SG(server_context)) { in sapi_activate_headers_only()
435 SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C); in sapi_activate_headers_only()
451 …zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_fre… in sapi_activate()
452 SG(sapi_headers).send_default_content_type = 1; in sapi_activate()
457 SG(sapi_headers).http_status_line = NULL; in sapi_activate()
458 SG(sapi_headers).mimetype = NULL; in sapi_activate()
459 SG(headers_sent) = 0; in sapi_activate()
460 SG(callback_run) = 0; in sapi_activate()
461 SG(callback_func) = NULL; in sapi_activate()
462 SG(read_post_bytes) = 0; in sapi_activate()
463 SG(request_info).request_body = NULL; in sapi_activate()
464 SG(request_info).current_user = NULL; in sapi_activate()
465 SG(request_info).current_user_length = 0; in sapi_activate()
466 SG(request_info).no_headers = 0; in sapi_activate()
467 SG(request_info).post_entry = NULL; in sapi_activate()
468 SG(request_info).proto_num = 1000; /* Default to HTTP 1.0 */ in sapi_activate()
469 SG(global_request_time) = 0; in sapi_activate()
470 SG(post_read) = 0; in sapi_activate()
472 if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) { in sapi_activate()
473 SG(request_info).headers_only = 1; in sapi_activate()
475 SG(request_info).headers_only = 0; in sapi_activate()
477 SG(rfc1867_uploaded_files) = NULL; in sapi_activate()
480 if (SG(server_context)) { in sapi_activate()
482 && SG(request_info).content_type in sapi_activate()
483 && SG(request_info).request_method in sapi_activate()
484 && !strcmp(SG(request_info).request_method, "POST")) { in sapi_activate()
489 SG(request_info).content_type_dup = NULL; in sapi_activate()
493 SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C); in sapi_activate()
507 if (SG(sapi_headers).http_status_line) { in sapi_send_headers_free()
508 efree(SG(sapi_headers).http_status_line); in sapi_send_headers_free()
509 SG(sapi_headers).http_status_line = NULL; in sapi_send_headers_free()
515 zend_llist_destroy(&SG(sapi_headers).headers); in sapi_deactivate()
516 if (SG(request_info).request_body) { in sapi_deactivate()
517 SG(request_info).request_body = NULL; in sapi_deactivate()
518 } else if (SG(server_context)) { in sapi_deactivate()
519 if (!SG(post_read)) { in sapi_deactivate()
529 if (SG(request_info).auth_user) { in sapi_deactivate()
530 efree(SG(request_info).auth_user); in sapi_deactivate()
532 if (SG(request_info).auth_password) { in sapi_deactivate()
533 efree(SG(request_info).auth_password); in sapi_deactivate()
535 if (SG(request_info).auth_digest) { in sapi_deactivate()
536 efree(SG(request_info).auth_digest); in sapi_deactivate()
538 if (SG(request_info).content_type_dup) { in sapi_deactivate()
539 efree(SG(request_info).content_type_dup); in sapi_deactivate()
541 if (SG(request_info).current_user) { in sapi_deactivate()
542 efree(SG(request_info).current_user); in sapi_deactivate()
547 if (SG(rfc1867_uploaded_files)) { in sapi_deactivate()
550 if (SG(sapi_headers).mimetype) { in sapi_deactivate()
551 efree(SG(sapi_headers).mimetype); in sapi_deactivate()
552 SG(sapi_headers).mimetype = NULL; in sapi_deactivate()
555 SG(sapi_started) = 0; in sapi_deactivate()
556 SG(headers_sent) = 0; in sapi_deactivate()
557 SG(callback_run) = 0; in sapi_deactivate()
558 if (SG(callback_func)) { in sapi_deactivate()
559 zval_ptr_dtor(&SG(callback_func)); in sapi_deactivate()
561 SG(request_info).headers_read = 0; in sapi_deactivate()
562 SG(global_request_time) = 0; in sapi_deactivate()
568 SG(server_context) = NULL; in sapi_initialize_empty_request()
569 SG(request_info).request_method = NULL; in sapi_initialize_empty_request()
570 SG(request_info).auth_digest = SG(request_info).auth_user = SG(request_info).auth_password = NULL; in sapi_initialize_empty_request()
571 SG(request_info).content_type_dup = NULL; in sapi_initialize_empty_request()
595 if (SG(sapi_headers).http_response_code == ncode) { in sapi_update_response_code()
599 if (SG(sapi_headers).http_status_line) { in sapi_update_response_code()
600 efree(SG(sapi_headers).http_status_line); in sapi_update_response_code()
601 SG(sapi_headers).http_status_line = NULL; in sapi_update_response_code()
603 SG(sapi_headers).http_response_code = ncode; in sapi_update_response_code()
658 (SAPI_HEADER_ADD & sapi_module.header_handler(sapi_header, op, &SG(sapi_headers) TSRMLS_CC))) { in sapi_header_add_op()
666 … sapi_remove_header(&SG(sapi_headers).headers, sapi_header->header, strlen(sapi_header->header)); in sapi_header_add_op()
670 zend_llist_add_element(&SG(sapi_headers).headers, (void *) sapi_header); in sapi_header_add_op()
684 if (SG(headers_sent) && !SG(request_info).no_headers) { in sapi_header_op()
718 sapi_module.header_handler(&sapi_header, op, &SG(sapi_headers) TSRMLS_CC); in sapi_header_op()
720 zend_llist_clean(&SG(sapi_headers).headers); in sapi_header_op()
746 sapi_module.header_handler(&sapi_header, op, &SG(sapi_headers) TSRMLS_CC); in sapi_header_op()
748 sapi_remove_header(&SG(sapi_headers).headers, header_line, header_line_len); in sapi_header_op()
779 if (SG(sapi_headers).http_status_line) { in sapi_header_op()
780 efree(SG(sapi_headers).http_status_line); in sapi_header_op()
782 SG(sapi_headers).http_status_line = header_line; in sapi_header_op()
803 if (!SG(sapi_headers).mimetype){ in sapi_header_op()
804 SG(sapi_headers).mimetype = estrdup(mimetype); in sapi_header_op()
817 SG(sapi_headers).send_default_content_type = 0; in sapi_header_op()
827 if ((SG(sapi_headers).http_response_code < 300 || in sapi_header_op()
828 SG(sapi_headers).http_response_code > 399) && in sapi_header_op()
829 SG(sapi_headers).http_response_code != 201) { in sapi_header_op()
833 } else if (SG(request_info).proto_num > 1000 && in sapi_header_op()
834 SG(request_info).request_method && in sapi_header_op()
835 strcmp(SG(request_info).request_method, "HEAD") && in sapi_header_op()
836 strcmp(SG(request_info).request_method, "GET")) { in sapi_header_op()
863 if (SG(headers_sent) || SG(request_info).no_headers || SG(callback_run)) { in sapi_send_headers()
870 if (SG(sapi_headers).send_default_content_type && sapi_module.send_headers) { in sapi_send_headers()
874 SG(sapi_headers).mimetype = get_default_content_type(0, &len TSRMLS_CC); in sapi_send_headers()
878 memcpy(default_header.header + sizeof("Content-type: ") - 1, SG(sapi_headers).mimetype, len + 1); in sapi_send_headers()
880 SG(sapi_headers).send_default_content_type = 0; in sapi_send_headers()
883 if (SG(callback_func) && !SG(callback_run)) { in sapi_send_headers()
884 SG(callback_run) = 1; in sapi_send_headers()
888 SG(headers_sent) = 1; in sapi_send_headers()
891 retval = sapi_module.send_headers(&SG(sapi_headers) TSRMLS_CC); in sapi_send_headers()
904 if (SG(sapi_headers).http_status_line) { in sapi_send_headers()
905 http_status_line.header = SG(sapi_headers).http_status_line; in sapi_send_headers()
906 http_status_line.header_len = strlen(SG(sapi_headers).http_status_line); in sapi_send_headers()
909 …http_status_line.header_len = slprintf(buf, sizeof(buf), "HTTP/1.0 %d X", SG(sapi_headers).http_re… in sapi_send_headers()
911 sapi_module.send_header(&http_status_line, SG(server_context) TSRMLS_CC); in sapi_send_headers()
913 …zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) sapi_modul… in sapi_send_headers()
914 if(SG(sapi_headers).send_default_content_type) { in sapi_send_headers()
918 sapi_module.send_header(&default_header, SG(server_context) TSRMLS_CC); in sapi_send_headers()
921 sapi_module.send_header(NULL, SG(server_context) TSRMLS_CC); in sapi_send_headers()
925 SG(headers_sent) = 0; in sapi_send_headers()
952 if (SG(sapi_started) && EG(in_execution)) { in sapi_register_post_entry()
955 return zend_hash_add(&SG(known_post_content_types), in sapi_register_post_entry()
962 if (SG(sapi_started) && EG(in_execution)) { in sapi_unregister_post_entry()
965 zend_hash_del(&SG(known_post_content_types), post_entry->content_type, in sapi_unregister_post_entry()
972 if (SG(sapi_started) && EG(in_execution)) { in sapi_register_default_post_reader()
982 if (SG(sapi_started) && EG(in_execution)) { in sapi_register_treat_data()
991 if (SG(sapi_started) && EG(in_execution)) { in sapi_register_input_filter()
1002 sapi_module.flush(SG(server_context)); in sapi_flush()
1014 …if (!SG(request_info).path_translated || (VCWD_STAT(SG(request_info).path_translated, &SG(global_s… in sapi_get_stat()
1017 return &SG(global_stat); in sapi_get_stat()
1081 if(SG(global_request_time)) return SG(global_request_time); in sapi_get_request_time()
1083 if (sapi_module.get_request_time && SG(server_context)) { in sapi_get_request_time()
1084 SG(global_request_time) = sapi_module.get_request_time(TSRMLS_C); in sapi_get_request_time()
1088 SG(global_request_time) = (double)(tp.tv_sec + tp.tv_usec / 1000000.00); in sapi_get_request_time()
1090 SG(global_request_time) = (double)time(0); in sapi_get_request_time()
1093 return SG(global_request_time); in sapi_get_request_time()