Also move user_agent from BG to FG.
HashTable sm_protected_env_vars;
char *sm_allowed_env_vars;
-
- /* file.c */
- char *user_agent;
/* pageinfo.c */
long page_uid;
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("user_agent", NULL, PHP_INI_ALL, OnUpdateString, user_agent, php_basic_globals, basic_globals)
+ STD_PHP_INI_ENTRY("user_agent", NULL, PHP_INI_ALL, OnUpdateString, user_agent, php_file_globals, file_globals)
+ STD_PHP_INI_ENTRY("default_socket_timeout", "60", PHP_INI_ALL, OnUpdateInt, default_socket_timeout, php_file_globals, file_globals)
+ STD_PHP_INI_ENTRY("auto_detect_line_endings", "0", PHP_INI_ALL, OnUpdateInt, auto_detect_line_endings, php_file_globals, file_globals)
PHP_INI_END()
PHP_MINIT_FUNCTION(file)
int pclose_ret;
HashTable ht_persistent_socks;
size_t def_chunk_size;
+ int auto_detect_line_endings;
+ int default_socket_timeout;
+ char *user_agent;
} php_file_globals;
#ifdef ZTS
if (context &&
php_stream_context_get_option(context, "http", "user_agent", &ua_zval) == SUCCESS) {
ua_str = Z_STRVAL_PP(ua_zval);
- } else if (BG(user_agent)) {
- ua_str = BG(user_agent);
+ } else if (FG(user_agent)) {
+ ua_str = FG(user_agent);
}
if (ua_str) {
/* $Id$ */
/*#define DEBUG_MAIN_NETWORK 1*/
-#define MAX_CHUNKS_PER_READ 10
-#define SOCKET_DEFAULT_TIMEOUT 60
#include "php.h"
memset(sock, 0, sizeof(php_netstream_data_t));
sock->is_blocked = 1;
- sock->timeout.tv_sec = SOCKET_DEFAULT_TIMEOUT;
+ sock->timeout.tv_sec = FG(default_socket_timeout);
sock->socket = socket;
stream = php_stream_alloc_rel(&php_stream_socket_ops, sock, persistent, "r+");
ret->abstract = abstract;
ret->is_persistent = persistent;
ret->chunk_size = FG(def_chunk_size);
+
+ if (FG(auto_detect_line_endings))
+ ret->flags |= PHP_STREAM_FLAG_DETECT_EOL;
+
ret->rsrc_id = ZEND_REGISTER_RESOURCE(NULL, ret, php_file_le_stream());
strlcpy(ret->mode, mode, sizeof(ret->mode));
eol = memchr(readptr, '\n', avail);
}
- if (eol && ((ptrdiff_t)eol + 1 - (ptrdiff_t)readptr) <= maxlen - 1) {
+ if (eol && (size_t)((ptrdiff_t)eol + 1 - (ptrdiff_t)readptr) <= maxlen - 1) {
justread = eol + 1 - readptr;
} else {
eol = NULL;
max_execution_time = 30 ; Maximum execution time of each script, in seconds
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Define the User-Agent string
; user_agent="PHP"
+; Default timeout for socket based streams (seconds)
+default_socket_timeout = 60
+
+; If your scripts have to deal with files from Macintosh systems,
+; or you are running on a Mac and need to deal with files from
+; unix or win32 systems, setting this flag will cause PHP to
+; automatically detect the EOL character in those files so that
+; fgets() and file() will work regardless of the source of the file.
+; auto_detect_line_endings = Off
+
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
; Define the user agent for php to send
;user_agent="PHP"
+; Default timeout for socket based streams (seconds)
+default_socket_timeout = 60
+
+; If your scripts have to deal with files from Macintosh systems,
+; or you are running on a Mac and need to deal with files from
+; unix or win32 systems, setting this flag will cause PHP to
+; automatically detect the EOL character in those files so that
+; fgets() and file() will work regardless of the source of the file.
+; auto_detect_line_endings = Off
+
+
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;