REDROOM
PHP 8.3.31
Path:
Logout
Edit File
Size: 1.72 KB
Close
/proc/self/root/opt/alt/tests/alt-php83-pecl-oauth_2.0.7-2.el8/tests/server.inc
Text
Base64
<?php function http_server_skipif($socket_string) { if (!function_exists('pcntl_fork')) die('skip pcntl_fork() not available'); if (!function_exists('posix_kill')) die('skip posix_kill() not available'); if (!stream_socket_server($socket_string)) die('skip stream_socket_server() failed'); } /* Minimal HTTP server with predefined responses. * * $socket_string is the socket to create and listen on (e.g. tcp://127.0.0.1:1234) * $files is an array of files containing N responses for N expected requests. Server dies after N requests. * $output is a stream on which everything sent by clients is written to */ function http_server($socket_string, array $files, &$output = null) { ini_set('default_socket_timeout', 5); pcntl_alarm(10); $server = stream_socket_server($socket_string, $errno, $errstr); if (!$server) { return false; } if ($output === null) { if (false===($output = tmpfile())) { return false; } } $pid = pcntl_fork(); if ($pid == -1) { die('could not fork'); } else if ($pid) { return $pid; } foreach($files as $file) { $sock = stream_socket_accept($server); if (!$sock) { exit(1); } // read headers $content_length = 0; while (false!==($line=trim(fgets($sock)))) { fwrite($output, "$line\r\n"); if (''===$line) { break; } else { if (preg_match('#^Content-Length:\s*([[:digit:]]+)\s*$#i', $line, $matches)) { $content_length = (int) $matches[1]; } } } // read content if ($content_length > 0) { $line = fread($sock, $content_length); fwrite($output, "$line\r\n"); } // send response fputs($sock, $file); fclose($sock); } exit(0); } function http_server_kill($pid) { posix_kill($pid, SIGTERM); pcntl_waitpid($pid, $status); } ?>
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 17
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
bug21426.phpt
296 B
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
bug_64308.phpt
348 B
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
oauth.inc
274 B
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
oauth_curl_debug_handler.phpt
869 B
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
oauth_reqtoken.phpt
2.48 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
oauth_sbs.phpt
2.11 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
oauth_standard.phpt
3.12 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
oauth_urlencode.phpt
235 B
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
plaintext.phpt
1.03 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
plaintext2.phpt
1.61 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
reqtoken_bug44603.phpt
2.03 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
reqtoken_php.phpt
2.17 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
sbs.phpt
1.90 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
server.inc
1.72 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
skip.inc
1.22 KB
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
test.pem
493 B
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
urlencode.phpt
235 B
lrw-r--r--
2024-09-30 12:53:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).