-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathphp_swoole_library.h
2340 lines (2323 loc) Β· 85.5 KB
/
php_swoole_library.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Generated by build-library.php, Please DO NOT modify!
*/
static const char* swoole_library_source_constants =
"\n"
"define('SWOOLE_LIBRARY', true);\n";
static const char* swoole_library_source_std_exec =
"\n"
"function swoole_exec(string $command, &$output = null, &$returnVar = null)\n"
"{\n"
" $result = Swoole\\Coroutine::exec($command);\n"
" if ($result) {\n"
" $outputList = explode(PHP_EOL, $result['output']);\n"
" if ($output) {\n"
" $output = array_merge($output, $outputList);\n"
" } else {\n"
" $output = $outputList;\n"
" }\n"
" $returnVar = $result['code'];\n"
" return end($outputList);\n"
" } else {\n"
" return false;\n"
" }\n"
"}\n"
"\n"
"function swoole_shell_exec(string $cmd)\n"
"{\n"
" $result = Swoole\\Coroutine::exec($cmd);\n"
" if ($result && '' !== $result['output']) {\n"
" return $result['output'];\n"
" }\n"
" return null;\n"
"}\n";
static const char* swoole_library_source_core_curl_exception =
"\n"
"\n"
"namespace Swoole\\Curl;\n"
"\n"
"use Swoole;\n"
"\n"
"class Exception extends Swoole\\Exception\n"
"{\n"
"\n"
"}\n";
static const char* swoole_library_source_core_http_status_code =
"\n"
"\n"
"namespace Swoole\\Http;\n"
"\n"
"abstract class StatusCode\n"
"{\n"
" const CONTINUE = 100;\n"
" const SWITCHING_PROTOCOLS = 101;\n"
" const PROCESSING = 102;\n"
" const OK = 200;\n"
" const CREATED = 201;\n"
" const ACCEPTED = 202;\n"
" const NON_AUTHORITATIVE_INFORMATION = 203;\n"
" const NO_CONTENT = 204;\n"
" const RESET_CONTENT = 205;\n"
" const PARTIAL_CONTENT = 206;\n"
" const MULTI_STATUS = 207;\n"
" const ALREADY_REPORTED = 208;\n"
" const IM_USED = 226;\n"
" const MULTIPLE_CHOICES = 300;\n"
" const MOVED_PERMANENTLY = 301;\n"
" const FOUND = 302;\n"
" const SEE_OTHER = 303;\n"
" const NOT_MODIFIED = 304;\n"
" const USE_PROXY = 305;\n"
" const SWITCH_PROXY = 306;\n"
" const TEMPORARY_REDIRECT = 307;\n"
" const PERMANENT_REDIRECT = 308;\n"
" const BAD_REQUEST = 400;\n"
" const UNAUTHORIZED = 401;\n"
" const PAYMENT_REQUIRED = 402;\n"
" const FORBIDDEN = 403;\n"
" const NOT_FOUND = 404;\n"
" const METHOD_NOT_ALLOWED = 405;\n"
" const NOT_ACCEPTABLE = 406;\n"
" const PROXY_AUTHENTICATION_REQUIRED = 407;\n"
" const REQUEST_TIME_OUT = 408;\n"
" const CONFLICT = 409;\n"
" const GONE = 410;\n"
" const LENGTH_REQUIRED = 411;\n"
" const PRECONDITION_FAILED = 412;\n"
" const REQUEST_ENTITY_TOO_LARGE = 413;\n"
" const REQUEST_URI_TOO_LARGE = 414;\n"
" const UNSUPPORTED_MEDIA_TYPE = 415;\n"
" const REQUESTED_RANGE_NOT_SATISFIABLE = 416;\n"
" const EXPECTATION_FAILED = 417;\n"
" const MISDIRECTED_REQUEST = 421;\n"
" const UNPROCESSABLE_ENTITY = 422;\n"
" const LOCKED = 423;\n"
" const FAILED_DEPENDENCY = 424;\n"
" const UNORDERED_COLLECTION = 425;\n"
" const UPGRADE_REQUIRED = 426;\n"
" const PRECONDITION_REQUIRED = 428;\n"
" const TOO_MANY_REQUESTS = 429;\n"
" const REQUEST_HEADER_FIELDS_TOO_LARGE = 431;\n"
" const UNAVAILABLE_FOR_LEGAL_REASONS = 451;\n"
" const INTERNAL_SERVER_ERROR = 500;\n"
" const NOT_IMPLEMENTED = 501;\n"
" const BAD_GATEWAY = 502;\n"
" const SERVICE_UNAVAILABLE = 503;\n"
" const GATEWAY_TIME_OUT = 504;\n"
" const HTTP_VERSION_NOT_SUPPORTED = 505;\n"
" const VARIANT_ALSO_NEGOTIATES = 506;\n"
" const INSUFFICIENT_STORAGE = 507;\n"
" const LOOP_DETECTED = 508;\n"
" const NOT_EXTENDED = 510;\n"
" const NETWORK_AUTHENTICATION_REQUIRED = 511;\n"
"\n"
" protected static $reasonPhrases = [\n"
" self::CONTINUE => 'Continue',\n"
" self::SWITCHING_PROTOCOLS => 'Switching Protocols',\n"
" self::PROCESSING => 'Processing',\n"
" self::OK => 'OK',\n"
" self::CREATED => 'Created',\n"
" self::ACCEPTED => 'Accepted',\n"
" self::NON_AUTHORITATIVE_INFORMATION => 'Non-Authoritative Information',\n"
" self::NO_CONTENT => 'No Content',\n"
" self::RESET_CONTENT => 'Reset Content',\n"
" self::PARTIAL_CONTENT => 'Partial Content',\n"
" self::MULTI_STATUS => 'Multi-status',\n"
" self::ALREADY_REPORTED => 'Already Reported',\n"
" self::IM_USED => 'IM Used',\n"
" self::MULTIPLE_CHOICES => 'Multiple Choices',\n"
" self::MOVED_PERMANENTLY => 'Moved Permanently',\n"
" self::FOUND => 'Found',\n"
" self::SEE_OTHER => 'See Other',\n"
" self::NOT_MODIFIED => 'Not Modified',\n"
" self::USE_PROXY => 'Use Proxy',\n"
" self::SWITCH_PROXY => 'Switch Proxy',\n"
" self::TEMPORARY_REDIRECT => 'Temporary Redirect',\n"
" self::PERMANENT_REDIRECT => 'Permanent Redirect',\n"
" self::BAD_REQUEST => 'Bad Request',\n"
" self::UNAUTHORIZED => 'Unauthorized',\n"
" self::PAYMENT_REQUIRED => 'Payment Required',\n"
" self::FORBIDDEN => 'Forbidden',\n"
" self::NOT_FOUND => 'Not Found',\n"
" self::METHOD_NOT_ALLOWED => 'Method Not Allowed',\n"
" self::NOT_ACCEPTABLE => 'Not Acceptable',\n"
" self::PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required',\n"
" self::REQUEST_TIME_OUT => 'Request Time-out',\n"
" self::CONFLICT => 'Conflict',\n"
" self::GONE => 'Gone',\n"
" self::LENGTH_REQUIRED => 'Length Required',\n"
" self::PRECONDITION_FAILED => 'Precondition Failed',\n"
" self::REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large',\n"
" self::REQUEST_URI_TOO_LARGE => 'Request-URI Too Large',\n"
" self::UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type',\n"
" self::REQUESTED_RANGE_NOT_SATISFIABLE => 'Requested range not satisfiable',\n"
" self::EXPECTATION_FAILED => 'Expectation Failed',\n"
" self::MISDIRECTED_REQUEST => 'Unprocessable Entity',\n"
" self::UNPROCESSABLE_ENTITY => 'Unprocessable Entity',\n"
" self::LOCKED => 'Locked',\n"
" self::FAILED_DEPENDENCY => 'Failed Dependency',\n"
" self::UNORDERED_COLLECTION => 'Unordered Collection',\n"
" self::UPGRADE_REQUIRED => 'Upgrade Required',\n"
" self::PRECONDITION_REQUIRED => 'Precondition Required',\n"
" self::TOO_MANY_REQUESTS => 'Too Many Requests',\n"
" self::REQUEST_HEADER_FIELDS_TOO_LARGE => 'Request Header Fields Too Large',\n"
" self::UNAVAILABLE_FOR_LEGAL_REASONS => 'Unavailable For Legal Reasons',\n"
" self::INTERNAL_SERVER_ERROR => 'Internal Server Error',\n"
" self::NOT_IMPLEMENTED => 'Not Implemented',\n"
" self::BAD_GATEWAY => 'Bad Gateway',\n"
" self::SERVICE_UNAVAILABLE => 'Service Unavailable',\n"
" self::GATEWAY_TIME_OUT => 'Gateway Time-out',\n"
" self::HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version not supported',\n"
" self::VARIANT_ALSO_NEGOTIATES => 'Variant Also Negotiates',\n"
" self::INSUFFICIENT_STORAGE => 'Insufficient Storage',\n"
" self::LOOP_DETECTED => 'Loop Detected',\n"
" self::NOT_EXTENDED => 'Not Extended',\n"
" self::NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required'\n"
" ];\n"
"\n"
" /**\n"
" * getReasonPhrase\n"
" * @param int $value\n"
" * @return string\n"
" */\n"
" public static function getReasonPhrase(int $value): string\n"
" {\n"
" return static::$reasonPhrases[$value] ?? 'Unknown';\n"
" }\n"
"}\n";
static const char* swoole_library_source_core_curl_handler =
"\n"
"\n"
"namespace Swoole\\Curl;\n"
"\n"
"\n"
"use Swoole;\n"
"use Swoole\\Coroutine\\Http\\Client;\n"
"use CURLFile;\n"
"use Iterator;\n"
"\n"
"class Handler\n"
"{\n"
" private const ERRORS = [\n"
" CURLE_URL_MALFORMAT => 'No URL set!',\n"
" ];\n"
"\n"
" /**\n"
" * @var Client\n"
" */\n"
" private $client;\n"
" private $info = [\n"
" 'url' => '',\n"
" 'content_type' => '',\n"
" 'http_code' => 0,\n"
" 'header_size' => 0,\n"
" 'request_size' => 0,\n"
" 'filetime' => -1,\n"
" 'ssl_verify_result' => 0,\n"
" 'redirect_count' => 0,\n"
" 'total_time' => 5.3E-5,\n"
" 'namelookup_time' => 0.0,\n"
" 'connect_time' => 0.0,\n"
" 'pretransfer_time' => 0.0,\n"
" 'size_upload' => 0.0,\n"
" 'size_download' => 0.0,\n"
" 'speed_download' => 0.0,\n"
" 'speed_upload' => 0.0,\n"
" 'download_content_length' => -1.0,\n"
" 'upload_content_length' => -1.0,\n"
" 'starttransfer_time' => 0.0,\n"
" 'redirect_time' => 0.0,\n"
" 'redirect_url' => '',\n"
" 'primary_ip' => '',\n"
" 'certinfo' => [],\n"
" 'primary_port' => 0,\n"
" 'local_ip' => '',\n"
" 'local_port' => 0,\n"
" 'http_version' => 0,\n"
" 'protocol' => 0,\n"
" 'ssl_verifyresult' => 0,\n"
" 'scheme' => '',\n"
" ];\n"
"\n"
" private $withHeaderOut = false;\n"
" private $withFileTime = false;\n"
" private $urlInfo;\n"
" private $postData;\n"
" private $outputStream;\n"
" private $proxy;\n"
" private $clientOptions = [];\n"
" private $followLocation = false;\n"
" private $autoReferer = false;\n"
" private $maxRedirs;\n"
" private $withHeader = false;\n"
" private $nobody = false;\n"
"\n"
" /** @var callable */\n"
" private $headerFunction;\n"
" /** @var callable */\n"
" private $readFunction;\n"
" /** @var callable */\n"
" private $writeFunction;\n"
" /** @var callable */\n"
" private $progressFunction;\n"
"\n"
" public $returnTransfer = false;\n"
" public $method = 'GET';\n"
" public $headers = [];\n"
"\n"
" public $transfer;\n"
"\n"
" public $errCode = 0;\n"
" public $errMsg = '';\n"
"\n"
" public function __construct($url = null)\n"
" {\n"
" if ($url) {\n"
" $this->create($url);\n"
" }\n"
" }\n"
"\n"
" private function create(string $url): void\n"
" {\n"
" if (!swoole_string($url)->contains('://')) {\n"
" $url = 'http://' . $url;\n"
" }\n"
" $this->info['url'] = $url;\n"
" $info = parse_url($url);\n"
" $proto = swoole_array_default_value($info, 'scheme');\n"
" if ($proto != 'http' and $proto != 'https') {\n"
" $this->setError(CURLE_UNSUPPORTED_PROTOCOL, \"Protocol \\\"{$proto}\\\" not supported or disabled in libcurl\");\n"
" return;\n"
" }\n"
" $ssl = $proto === 'https';\n"
" if (empty($info['port'])) {\n"
" $port = $ssl ? 443 : 80;\n"
" } else {\n"
" $port = intval($info['port']);\n"
" }\n"
" $this->urlInfo = $info;\n"
" $this->client = new Client($info['host'], $port, $ssl);\n"
" }\n"
"\n"
" public function execute()\n"
" {\n"
" $this->info['redirect_count'] = $this->info['starttransfer_time'] = 0;\n"
" $this->info['redirect_url'] = '';\n"
" $timeBegin = microtime(true);\n"
" /**\n"
" * Socket\n"
" */\n"
" $client = $this->client;\n"
" if (!$client) {\n"
" if (!$this->errCode) {\n"
" $this->setError(CURLE_URL_MALFORMAT);\n"
" }\n"
" return false;\n"
" }\n"
" $isRedirect = false;\n"
" do {\n"
" if ($isRedirect and !$client) {\n"
" $proto = swoole_array_default_value($this->urlInfo, 'scheme');\n"
" if ($proto != 'http' and $proto != 'https') {\n"
" $this->setError(CURLE_UNSUPPORTED_PROTOCOL, \"Protocol \\\"{$proto}\\\" not supported or disabled in libcurl\");\n"
" return false;\n"
" }\n"
" $ssl = $proto === 'https';\n"
" if (empty($this->urlInfo['port'])) {\n"
" $port = $ssl ? 443 : 80;\n"
" } else {\n"
" $port = intval($this->urlInfo['port']);\n"
" }\n"
" $client = new Client($this->urlInfo['host'], $port, $ssl);\n"
" }\n"
" /**\n"
" * Http Proxy\n"
" */\n"
" if ($this->proxy) {\n"
" list($proxy_host, $proxy_port) = explode(':', $this->proxy);\n"
" if (!filter_var($proxy_host, FILTER_VALIDATE_IP)) {\n"
" $ip = Swoole\\Coroutine::gethostbyname($proxy_host);\n"
" if (!$ip) {\n"
" $this->setError(CURLE_COULDNT_RESOLVE_PROXY, 'Could not resolve proxy: ' . $proxy_host);\n"
" return false;\n"
" } else {\n"
" $proxy_host = $ip;\n"
" }\n"
" }\n"
" $client->set(['http_proxy_host' => $proxy_host, 'http_proxy_port' => $proxy_port]);\n"
" }\n"
" /**\n"
" * Client Options\n"
" */\n"
" if ($this->clientOptions) {\n"
" $client->set($this->clientOptions);\n"
" }\n"
" $client->setMethod($this->method);\n"
" /**\n"
" * Upload File\n"
" */\n"
" if ($this->postData and is_array($this->postData)) {\n"
" foreach ($this->postData as $k => $v) {\n"
" if ($v instanceof CURLFile) {\n"
" $client->addFile($v->getFilename(), $k, $v->getMimeType() ?: 'application/octet-stream', $v->getPostFilename());\n"
" unset($this->postData[$k]);\n"
" }\n"
" }\n"
" }\n"
" /**\n"
" * Post Data\n"
" */\n"
" if ($this->postData) {\n"
" if (is_string($this->postData) and empty($this->headers['Content-Type'])) {\n"
" $this->headers['Content-Type'] = 'application/x-www-form-urlencoded';\n"
" }\n"
" $client->setData($this->postData);\n"
" $this->postData = [];\n"
" }\n"
" /**\n"
" * Http Header\n"
" */\n"
" $this->headers['Host'] = $this->urlInfo['host'] . (isset($this->urlInfo['port']) ? (':' . $this->urlInfo['port']) : '');\n"
" $client->setHeaders($this->headers);\n"
" /**\n"
" * Execute\n"
" */\n"
" $executeResult = $client->execute($this->getUrl());\n"
" if (!$executeResult) {\n"
" $errCode = $client->errCode;\n"
" if ($errCode == SWOOLE_ERROR_DNSLOOKUP_RESOLVE_FAILED or $errCode == SWOOLE_ERROR_DNSLOOKUP_RESOLVE_TIMEOUT) {\n"
" $this->setError(CURLE_COULDNT_RESOLVE_HOST, 'Could not resolve host: ' . $client->host);\n"
" }\n"
" $this->info['total_time'] = microtime(true) - $timeBegin;\n"
" return false;\n"
" }\n"
" if ($client->statusCode >= 300 and $client->statusCode < 400 and isset($client->headers['location'])) {\n"
" $redirectParsedUrl = $this->getRedirectUrl($client->headers['location']);\n"
" $redirectUrl = $this->unparseUrl($redirectParsedUrl);\n"
" if ($this->followLocation and (null === $this->maxRedirs or $this->info['redirect_count'] < $this->maxRedirs)) {\n"
" $isRedirect = true;\n"
" if (0 === $this->info['redirect_count']) {\n"
" $this->info['starttransfer_time'] = microtime(true) - $timeBegin;\n"
" $redirectBeginTime = microtime(true);\n"
" }\n"
" // force GET\n"
" if (in_array($client->statusCode, [301, 302, 303])) {\n"
" $this->method = 'GET';\n"
" }\n"
" if ($this->urlInfo['host'] !== $redirectParsedUrl['host'] or ($this->urlInfo['port'] ?? null) !== ($redirectParsedUrl['port'] ?? null) or $this->urlInfo['scheme'] !== $redirectParsedUrl['scheme']) {\n"
" // If host, port, and scheme are the same, reuse $client. Otherwise, release the old $client\n"
" $client = null;\n"
" }\n"
" if ($this->autoReferer) {\n"
" $this->headers['Referer'] = $this->info['url'];\n"
" }\n"
" $this->urlInfo = $redirectParsedUrl;\n"
" $this->info['url'] = $redirectUrl;\n"
" $this->info['redirect_count']++;\n"
" } else {\n"
" $this->info['redirect_url'] = $redirectUrl;\n"
" break;\n"
" }\n"
" } else {\n"
" break;\n"
" }\n"
" } while (true);\n"
" $this->info['total_time'] = microtime(true) - $timeBegin;\n"
" $this->info['http_code'] = $client->statusCode;\n"
" $this->info['content_type'] = $client->headers['content-type'] ?? '';\n"
" $this->info['size_download'] = $this->info['download_content_length'] = strlen($client->body);;\n"
" $this->info['speed_download'] = 1 / $this->info['total_time'] * $this->info['size_download'];\n"
" if (isset($redirectBeginTime)) {\n"
" $this->info['redirect_time'] = microtime(true) - $redirectBeginTime;\n"
" }\n"
"\n"
" $headerContent = '';\n"
" if ($client->headers) {\n"
" $cb = $this->headerFunction;\n"
" if ($client->statusCode > 0) {\n"
" $row = 'HTTP/1.1 ' . $client->statusCode . ' ' . Swoole\\Http\\StatusCode::getReasonPhrase($client->statusCode) . \"\\r\\n\";\n"
" if ($cb) {\n"
" $cb($this, $row);\n"
" }\n"
" $headerContent .= $row;\n"
" }\n"
" foreach ($client->headers as $k => $v) {\n"
" $row = \"$k: $v\\r\\n\";\n"
" if ($cb) {\n"
" $cb($this, $row);\n"
" }\n"
" $headerContent .= $row;\n"
" }\n"
" $headerContent .= \"\\r\\n\";\n"
" $this->info['header_size'] = strlen($headerContent);\n"
" if ($cb) {\n"
" $cb($this, '');\n"
" }\n"
" } else {\n"
" $this->info['header_size'] = 0;\n"
" }\n"
"\n"
" if ($client->body and $this->readFunction) {\n"
" $cb = $this->readFunction;\n"
" $cb($this, $this->outputStream, strlen($client->body));\n"
" }\n"
"\n"
" if ($this->withHeader) {\n"
" $transfer = $headerContent . $client->body;\n"
" } else {\n"
" $transfer = $client->body;\n"
" }\n"
"\n"
" if ($this->withHeaderOut) {\n"
" $headerOutContent = $client->getHeaderOut();\n"
" $this->info['request_header'] = $headerOutContent ? $headerOutContent . \"\\r\\n\\r\\n\" : '';\n"
" }\n"
" if ($this->withFileTime) {\n"
" if (!empty($client->headers['last-modified'])) {\n"
" $this->info['filetime'] = strtotime($client->headers['last-modified']);\n"
" } else {\n"
" $this->info['filetime'] = -1;\n"
" }\n"
" }\n"
"\n"
" if ($this->returnTransfer) {\n"
" return $this->transfer = $transfer;\n"
" } else {\n"
" if ($this->outputStream) {\n"
" return fwrite($this->outputStream, $transfer) === strlen($transfer);\n"
" } else {\n"
" echo $transfer;\n"
" }\n"
" return true;\n"
" }\n"
" }\n"
"\n"
" public function close(): void\n"
" {\n"
" $this->client = null;\n"
" }\n"
"\n"
" private function setError($code, $msg = ''): void\n"
" {\n"
" $this->errCode = $code;\n"
" $this->errMsg = $msg ? $msg : self::ERRORS[$code];\n"
" }\n"
"\n"
" private function getUrl(): string\n"
" {\n"
" if (empty($this->urlInfo['path'])) {\n"
" $url = '/';\n"
" } else {\n"
" $url = $this->urlInfo['path'];\n"
" }\n"
" if (!empty($this->urlInfo['query'])) {\n"
" $url .= '?' . $this->urlInfo['query'];\n"
" }\n"
" if (!empty($this->urlInfo['fragment'])) {\n"
" $url .= '#' . $this->urlInfo['fragment'];\n"
" }\n"
" return $url;\n"
" }\n"
"\n"
" /**\n"
" * @param int $opt\n"
" * @param $value\n"
" * @return bool\n"
" * @throws Swoole\\Curl\\Exception\n"
" */\n"
" public function setOption(int $opt, $value): bool\n"
" {\n"
" switch ($opt) {\n"
" /**\n"
" * Basic\n"
" */\n"
" case CURLOPT_URL:\n"
" $this->create($value);\n"
" break;\n"
" case CURLOPT_RETURNTRANSFER:\n"
" $this->returnTransfer = $value;\n"
" $this->transfer = '';\n"
" break;\n"
" case CURLOPT_ENCODING:\n"
" if (empty($value)) {\n"
" $value = 'gzip';\n"
" }\n"
" $this->headers['Accept-Encoding'] = $value;\n"
" break;\n"
" case CURLOPT_PROXY:\n"
" $this->proxy = $value;\n"
" break;\n"
" case CURLOPT_NOBODY:\n"
" $this->nobody = boolval($value);\n"
" $this->method = 'HEAD';\n"
" break;\n"
" /**\n"
" * Ignore options\n"
" */\n"
" case CURLOPT_SSLVERSION:\n"
" case CURLOPT_NOSIGNAL:\n"
" case CURLOPT_FRESH_CONNECT:\n"
" /**\n"
" * From PHP 5.1.3, this option has no effect: the raw output will always be returned when CURLOPT_RETURNTRANSFER is used.\n"
" */\n"
" case CURLOPT_BINARYTRANSFER:\n"
" /**\n"
" * TODO\n"
" */\n"
" case CURLOPT_VERBOSE:\n"
" case CURLOPT_DNS_CACHE_TIMEOUT:\n"
" break;\n"
" /**\n"
" * SSL\n"
" */\n"
" case CURLOPT_SSL_VERIFYHOST:\n"
" break;\n"
" case CURLOPT_SSL_VERIFYPEER:\n"
" $this->clientOptions['ssl_verify_peer'] = $value;\n"
" break;\n"
" /**\n"
" * Http Post\n"
" */\n"
" case CURLOPT_POST:\n"
" $this->method = 'POST';\n"
" break;\n"
" case CURLOPT_POSTFIELDS:\n"
" $this->postData = $value;\n"
" $this->method = 'POST';\n"
" break;\n"
" /**\n"
" * Upload\n"
" */\n"
" case CURLOPT_SAFE_UPLOAD:\n"
" if (!$value) {\n"
" trigger_error('curl_setopt(): Disabling safe uploads is no longer supported', E_USER_WARNING);\n"
" }\n"
" break;\n"
" /**\n"
" * Http Header\n"
" */\n"
" case CURLOPT_HTTPHEADER:\n"
" if (!is_array($value) and !($value instanceof Iterator)) {\n"
" trigger_error('swoole_curl_setopt(): You must pass either an object or an array with the CURLOPT_HTTPHEADER argument', E_USER_WARNING);\n"
" return false;\n"
" }\n"
" foreach ($value as $header) {\n"
" list($k, $v) = explode(':', $header);\n"
" $v = trim($v);\n"
" if ($v) {\n"
" $this->headers[$k] = $v;\n"
" }\n"
" }\n"
" break;\n"
" case CURLOPT_REFERER:\n"
" $this->headers['Referer'] = $value;\n"
" break;\n"
"\n"
" case CURLINFO_HEADER_OUT:\n"
" $this->withHeaderOut = boolval($value);\n"
" break;\n"
"\n"
" case CURLOPT_FILETIME:\n"
" $this->withFileTime = boolval($value);\n"
" break;\n"
"\n"
" case CURLOPT_USERAGENT:\n"
" $this->headers['User-Agent'] = $value;\n"
" break;\n"
"\n"
" case CURLOPT_CUSTOMREQUEST:\n"
" break;\n"
" case CURLOPT_PROTOCOLS:\n"
" if ($value > 3) {\n"
" throw new Swoole\\Curl\\Exception(\"option[{$opt}={$value}] not supported\");\n"
" }\n"
" break;\n"
" case CURLOPT_HTTP_VERSION:\n"
" if ($value != CURL_HTTP_VERSION_1_1) {\n"
" trigger_error(\"swoole_curl: http version[{$value}] not supported\", E_USER_WARNING);\n"
" }\n"
" break;\n"
" /**\n"
" * Http Cookie\n"
" */\n"
" case CURLOPT_COOKIE:\n"
" $this->headers['Cookie'] = $value;\n"
" break;\n"
" case CURLOPT_CONNECTTIMEOUT:\n"
" $this->clientOptions['connect_timeout'] = $value;\n"
" break;\n"
" case CURLOPT_CONNECTTIMEOUT_MS:\n"
" $this->clientOptions['connect_timeout'] = $value / 1000;\n"
" break;\n"
" case CURLOPT_TIMEOUT:\n"
" $this->clientOptions['timeout'] = $value;\n"
" break;\n"
" case CURLOPT_TIMEOUT_MS:\n"
" $this->clientOptions['timeout'] = $value / 1000;\n"
" break;\n"
" case CURLOPT_FILE:\n"
" $this->outputStream = $value;\n"
" break;\n"
" case CURLOPT_HEADER:\n"
" $this->withHeader = $value;\n"
" break;\n"
" case CURLOPT_HEADERFUNCTION:\n"
" $this->headerFunction = $value;\n"
" break;\n"
" case CURLOPT_READFUNCTION:\n"
" $this->readFunction = $value;\n"
" break;\n"
" case CURLOPT_WRITEFUNCTION:\n"
" $this->writeFunction = $value;\n"
" break;\n"
" case CURLOPT_PROGRESSFUNCTION:\n"
" $this->progressFunction = $value;\n"
" break;\n"
" case CURLOPT_USERPWD:\n"
" $this->headers['Authorization'] = 'Basic ' . base64_encode($value);\n"
" break;\n"
" case CURLOPT_FOLLOWLOCATION:\n"
" $this->followLocation = $value;\n"
" break;\n"
" case CURLOPT_AUTOREFERER:\n"
" $this->autoReferer = $value;\n"
" break;\n"
" case CURLOPT_MAXREDIRS:\n"
" $this->maxRedirs = $value;\n"
" break;\n"
" default:\n"
" throw new Swoole\\Curl\\Exception(\"option[{$opt}] not supported\");\n"
" }\n"
" return true;\n"
" }\n"
"\n"
" public function reset(): void\n"
" {\n"
" }\n"
"\n"
" public function getInfo()\n"
" {\n"
" return $this->info;\n"
" }\n"
"\n"
" private function unparseUrl(array $parsedUrl): string\n"
" {\n"
" $scheme = ($parsedUrl['scheme'] ?? 'http') . '://';\n"
" $host = $parsedUrl['host'] ?? '';\n"
" $port = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '';\n"
" $user = $parsedUrl['user'] ?? '';\n"
" $pass = isset($parsedUrl['pass']) ? ':' . $parsedUrl['pass'] : '';\n"
" $pass = ($user or $pass) ? \"$pass@\" : '';\n"
" $path = $parsedUrl['path'] ?? '';\n"
" $query = (isset($parsedUrl['query']) and '' !== $parsedUrl['query']) ? '?' . $parsedUrl['query'] : '';\n"
" $fragment = isset($parsedUrl['fragment']) ? '#' . $parsedUrl['fragment'] : '';\n"
" return $scheme . $user . $pass . $host . $port . $path . $query . $fragment;\n"
" }\n"
"\n"
" private function getRedirectUrl(string $location): array\n"
" {\n"
" $uri = parse_url($location);\n"
" if (isset($uri['host'])) {\n"
" $redirectUri = $uri;\n"
" } else {\n"
" if (!isset($location[0])) {\n"
" return [];\n"
" }\n"
" $redirectUri = $this->urlInfo;\n"
" $redirectUri['query'] = '';\n"
" if ('/' === $location[0]) {\n"
" $redirectUri['path'] = $location;\n"
" } else {\n"
" $path = dirname($redirectUri['path'] ?? '');\n"
" if ('.' === $path) {\n"
" $path = '/';\n"
" }\n"
" if (isset($location[1]) and './' === substr($location, 0, 2)) {\n"
" $location = substr($location, 2);\n"
" }\n"
" $redirectUri['path'] = $path . $location;\n"
" }\n"
" foreach ($uri as $k => $v) {\n"
" if (!in_array($k, ['path', 'query'])) {\n"
" $redirectUri[$k] = $v;\n"
" }\n"
" }\n"
" }\n"
" return $redirectUri;\n"
" }\n"
"}\n";
static const char* swoole_library_source_ext_curl =
"\n"
"\n"
"function swoole_curl_init($url = null): Swoole\\Curl\\Handler\n"
"{\n"
" return new Swoole\\Curl\\Handler($url);\n"
"}\n"
"\n"
"/**\n"
" * @param Swoole\\Curl\\Handler $obj\n"
" * @param $opt\n"
" * @param $value\n"
" * @return bool\n"
" * @throws Swoole\\Curl\\Exception\n"
" */\n"
"function swoole_curl_setopt(Swoole\\Curl\\Handler $obj, $opt, $value): bool\n"
"{\n"
" return $obj->setOption($opt, $value);\n"
"}\n"
"\n"
"/**\n"
" * @param Swoole\\Curl\\Handler $obj\n"
" * @param $array\n"
" * @return bool\n"
" * @throws Swoole\\Curl\\Exception\n"
" */\n"
"function swoole_curl_setopt_array(Swoole\\Curl\\Handler $obj, $array): bool\n"
"{\n"
" foreach ($array as $k => $v) {\n"
" if ($obj->setOption($k, $v) === false) {\n"
" return false;\n"
" }\n"
" }\n"
" return true;\n"
"}\n"
"\n"
"function swoole_curl_exec(Swoole\\Curl\\Handler $obj)\n"
"{\n"
" return $obj->execute();\n"
"}\n"
"\n"
"function swoole_curl_multi_getcontent(Swoole\\Curl\\Handler $obj): ?string\n"
"{\n"
" return $obj->transfer;\n"
"}\n"
"\n"
"function swoole_curl_close(Swoole\\Curl\\Handler $obj): void\n"
"{\n"
" $obj->close();\n"
"}\n"
"\n"
"function swoole_curl_error(Swoole\\Curl\\Handler $obj): string\n"
"{\n"
" return $obj->errMsg;\n"
"}\n"
"\n"
"function swoole_curl_errno(Swoole\\Curl\\Handler $obj): int\n"
"{\n"
" return $obj->errCode;\n"
"}\n"
"\n"
"function swoole_curl_reset(Swoole\\Curl\\Handler $obj): void\n"
"{\n"
" $obj->reset();\n"
"}\n"
"\n"
"function swoole_curl_getinfo(Swoole\\Curl\\Handler $obj, int $opt = 0)\n"
"{\n"
" $info = $obj->getInfo();\n"
" if ($opt) {\n"
" switch ($opt) {\n"
" case CURLINFO_EFFECTIVE_URL:\n"
" return $info['url'];\n"
" case CURLINFO_HTTP_CODE:\n"
" return $info['http_code'];\n"
" case CURLINFO_CONTENT_TYPE:\n"
" return $info['content_type'];\n"
" case CURLINFO_REDIRECT_COUNT:\n"
" return $info['redirect_count'];\n"
" case CURLINFO_REDIRECT_URL:\n"
" return $info['redirect_url'];\n"
" case CURLINFO_TOTAL_TIME:\n"
" return $info['total_time'];\n"
" case CURLINFO_STARTTRANSFER_TIME:\n"
" return $info['starttransfer_time'];\n"
" case CURLINFO_SIZE_DOWNLOAD:\n"
" return $info['size_download'];\n"
" case CURLINFO_SPEED_DOWNLOAD:\n"
" return $info['speed_download'];\n"
" case CURLINFO_REDIRECT_TIME:\n"
" return $info['redirect_time'];\n"
" case CURLINFO_HEADER_SIZE:\n"
" return $info['header_size'];\n"
" default:\n"
" return null;\n"
" }\n"
" } else {\n"
" return $info;\n"
" }\n"
"}\n";
static const char* swoole_library_source_core_constant =
"\n"
"\n"
"namespace Swoole;\n"
"\n"
"class Constant\n"
"{\n"
" const EVENT_RECEIVE = 'receive';\n"
" const EVENT_CONNECT = 'connect';\n"
" const EVENT_CLOSE = 'close';\n"
" const EVENT_PACKET = 'packet';\n"
" const EVENT_REQUEST = 'request';\n"
" const EVENT_MESSAGE = 'message';\n"
" const EVENT_OPEN = 'open';\n"
" const EVENT_HANDSHAKE = 'handshake';\n"
" const EVENT_TASK = 'task';\n"
" const EVENT_FINISH = 'finish';\n"
" const EVENT_START = 'start';\n"
" const EVENT_SHUTDOWN = 'shutdown';\n"
" const EVENT_WORKER_START = 'workerStart';\n"
" const EVENT_WORKER_EXIT = 'workerExit';\n"
" const EVENT_WORKER_ERROR = 'workerError';\n"
" const EVENT_WORKER_STOP = 'workerStop';\n"
" const EVENT_MANAGER_START = 'managerStart';\n"
" const EVENT_MANAGER_STOP = 'managerStop';\n"
" const EVENT_ERROR = 'error';\n"
"\n"
" /* {{{ OPTION */\n"
" const OPTION_ENABLE_SIGNALFD = 'enable_signalfd';\n"
" const OPTION_DNS_CACHE_REFRESH_TIME = 'dns_cache_refresh_time';\n"
" const OPTION_SOCKET_BUFFER_SIZE = 'socket_buffer_size';\n"
" const OPTION_LOG_LEVEL = 'log_level';\n"
" const OPTION_THREAD_NUM = 'thread_num';\n"
" const OPTION_MIN_THREAD_NUM = 'min_thread_num';\n"
" const OPTION_MAX_THREAD_NUM = 'max_thread_num';\n"
" const OPTION_DISPLAY_ERRORS = 'display_errors';\n"
" const OPTION_SOCKET_DONTWAIT = 'socket_dontwait';\n"
" const OPTION_DNS_LOOKUP_RANDOM = 'dns_lookup_random';\n"
" const OPTION_DNS_SERVER = 'dns_server';\n"
" const OPTION_USE_ASYNC_RESOLVER = 'use_async_resolver';\n"
" const OPTION_ENABLE_COROUTINE = 'enable_coroutine';\n"
" const OPTION_ENABLE_REUSE_PORT = 'enable_reuse_port';\n"
" const OPTION_SSL_METHOD = 'ssl_method';\n"
" const OPTION_SSL_PROTOCOLS = 'ssl_protocols';\n"
" const OPTION_SSL_COMPRESS = 'ssl_compress';\n"
" const OPTION_SSL_CERT_FILE = 'ssl_cert_file';\n"
" const OPTION_SSL_KEY_FILE = 'ssl_key_file';\n"
" const OPTION_SSL_PASSPHRASE = 'ssl_passphrase';\n"
" const OPTION_SSL_HOST_NAME = 'ssl_host_name';\n"
" const OPTION_SSL_VERIFY_PEER = 'ssl_verify_peer';\n"
" const OPTION_SSL_ALLOW_SELF_SIGNED = 'ssl_allow_self_signed';\n"
" const OPTION_SSL_CAFILE = 'ssl_cafile';\n"
" const OPTION_SSL_CAPATH = 'ssl_capath';\n"
" const OPTION_SSL_VERIFY_DEPTH = 'ssl_verify_depth';\n"
" const OPTION_OPEN_EOF_CHECK = 'open_eof_check';\n"
" const OPTION_OPEN_EOF_SPLIT = 'open_eof_split';\n"
" const OPTION_PACKAGE_EOF = 'package_eof';\n"
" const OPTION_OPEN_MQTT_PROTOCOL = 'open_mqtt_protocol';\n"
" const OPTION_OPEN_LENGTH_CHECK = 'open_length_check';\n"
" const OPTION_PACKAGE_LENGTH_TYPE = 'package_length_type';\n"
" const OPTION_PACKAGE_LENGTH_OFFSET = 'package_length_offset';\n"
" const OPTION_PACKAGE_BODY_OFFSET = 'package_body_offset';\n"
" const OPTION_PACKAGE_LENGTH_FUNC = 'package_length_func';\n"
" const OPTION_PACKAGE_MAX_LENGTH = 'package_max_length';\n"
" const OPTION_BUFFER_HIGH_WATERMARK = 'buffer_high_watermark';\n"
" const OPTION_BUFFER_LOW_WATERMARK = 'buffer_low_watermark';\n"
" const OPTION_BIND_PORT = 'bind_port';\n"
" const OPTION_BIND_ADDRESS = 'bind_address';\n"
" const OPTION_OPEN_TCP_NODELAY = 'open_tcp_nodelay';\n"
" const OPTION_SOCKS5_HOST = 'socks5_host';\n"
" const OPTION_SOCKS5_PORT = 'socks5_port';\n"
" const OPTION_SOCKS5_USERNAME = 'socks5_username';\n"
" const OPTION_SOCKS5_PASSWORD = 'socks5_password';\n"
" const OPTION_HTTP_PROXY_HOST = 'http_proxy_host';\n"
" const OPTION_HTTP_PROXY_PORT = 'http_proxy_port';\n"
" const OPTION_HTTP_PROXY_USERNAME = 'http_proxy_username';\n"
" const OPTION_HTTP_PROXY_USER = 'http_proxy_user';\n"
" const OPTION_HTTP_PROXY_PASSWORD = 'http_proxy_password';\n"
" const OPTION_TIMEOUT = 'timeout';\n"
" const OPTION_CONNECT_TIMEOUT = 'connect_timeout';\n"
" const OPTION_READ_TIMEOUT = 'read_timeout';\n"
" const OPTION_WRITE_TIMEOUT = 'write_timeout';\n"
" const OPTION_SSL_DISABLE_COMPRESSION = 'ssl_disable_compression';\n"
" const OPTION_MAX_COROUTINE = 'max_coroutine';\n"
" const OPTION_HOOK_FLAGS = 'hook_flags';\n"
" const OPTION_C_STACK_SIZE = 'c_stack_size';\n"
" const OPTION_STACK_SIZE = 'stack_size';\n"
" const OPTION_SOCKET_CONNECT_TIMEOUT = 'socket_connect_timeout';\n"
" const OPTION_SOCKET_TIMEOUT = 'socket_timeout';\n"
" const OPTION_SOCKET_READ_TIMEOUT = 'socket_read_timeout';\n"
" const OPTION_SOCKET_WRITE_TIMEOUT = 'socket_write_timeout';\n"
" const OPTION_TRACE_FLAGS = 'trace_flags';\n"
" const OPTION_DNS_CACHE_EXPIRE = 'dns_cache_expire';\n"
" const OPTION_DNS_CACHE_CAPACITY = 'dns_cache_capacity';\n"
" const OPTION_AIO_CORE_WORKER_NUM = 'aio_core_worker_num';\n"
" const OPTION_AIO_WORKER_NUM = 'aio_worker_num';\n"
" const OPTION_AIO_MAX_WAIT_TIME = 'aio_max_wait_time';\n"
" const OPTION_AIO_MAX_IDLE_TIME = 'aio_max_idle_time';\n"
" const OPTION_RECONNECT = 'reconnect';\n"
" const OPTION_DEFER = 'defer';\n"
" const OPTION_KEEP_ALIVE = 'keep_alive';\n"
" const OPTION_WEBSOCKET_MASK = 'websocket_mask';\n"
" const OPTION_HOST = 'host';\n"
" const OPTION_PORT = 'port';\n"
" const OPTION_SSL = 'ssl';\n"
" const OPTION_USER = 'user';\n"
" const OPTION_PASSWORD = 'password';\n"
" const OPTION_DATABASE = 'database';\n"
" const OPTION_CHARSET = 'charset';\n"
" const OPTION_STRICT_TYPE = 'strict_type';\n"
" const OPTION_FETCH_MODE = 'fetch_mode';\n"
" const OPTION_SERIALIZE = 'serialize';\n"
" const OPTION_COMPATIBILITY_MODE = 'compatibility_mode';\n"
" const OPTION_CHROOT = 'chroot';\n"
" const OPTION_GROUP = 'group';\n"
" const OPTION_DAEMONIZE = 'daemonize';\n"
" const OPTION_DEBUG_MODE = 'debug_mode';\n"
" const OPTION_PID_FILE = 'pid_file';\n"
" const OPTION_REACTOR_NUM = 'reactor_num';\n"
" const OPTION_SINGLE_THREAD = 'single_thread';\n"
" const OPTION_WORKER_NUM = 'worker_num';\n"
" const OPTION_MAX_WAIT_TIME = 'max_wait_time';\n"
" const OPTION_MAX_CORO_NUM = 'max_coro_num';\n"
" const OPTION_SEND_TIMEOUT = 'send_timeout';\n"
" const OPTION_DISPATCH_MODE = 'dispatch_mode';\n"
" const OPTION_SEND_YIELD = 'send_yield';\n"
" const OPTION_DISPATCH_FUNC = 'dispatch_func';\n"
" const OPTION_LOG_FILE = 'log_file';\n"
" const OPTION_DISCARD_TIMEOUT_REQUEST = 'discard_timeout_request';\n"
" const OPTION_ENABLE_UNSAFE_EVENT = 'enable_unsafe_event';\n"
" const OPTION_ENABLE_DELAY_RECEIVE = 'enable_delay_receive';\n"
" const OPTION_TASK_USE_OBJECT = 'task_use_object';\n"
" const OPTION_TASK_ENABLE_COROUTINE = 'task_enable_coroutine';\n"
" const OPTION_TASK_WORKER_NUM = 'task_worker_num';\n"
" const OPTION_TASK_IPC_MODE = 'task_ipc_mode';\n"
" const OPTION_TASK_TMPDIR = 'task_tmpdir';\n"
" const OPTION_TASK_MAX_REQUEST = 'task_max_request';\n"
" const OPTION_TASK_MAX_REQUEST_GRACE = 'task_max_request_grace';\n"
" const OPTION_MAX_CONNECTION = 'max_connection';\n"
" const OPTION_MAX_CONN = 'max_conn';\n"
" const OPTION_HEARTBEAT_CHECK_INTERVAL = 'heartbeat_check_interval';\n"
" const OPTION_HEARTBEAT_IDLE_TIME = 'heartbeat_idle_time';\n"
" const OPTION_MAX_REQUEST = 'max_request';\n"
" const OPTION_MAX_REQUEST_GRACE = 'max_request_grace';\n"
" const OPTION_RELOAD_ASYNC = 'reload_async';\n"