You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/04/03 01:21:41 UTC
[skywalking-php] branch master updated: Fix parent endpoint and peer in segment ref and tag url in entry span. (#63)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-php.git
The following commit(s) were added to refs/heads/master by this push:
new 9fa0827 Fix parent endpoint and peer in segment ref and tag url in entry span. (#63)
9fa0827 is described below
commit 9fa0827090883031fd8060f223281e3fc492b11f
Author: jmjoy <jm...@apache.org>
AuthorDate: Mon Apr 3 09:21:35 2023 +0800
Fix parent endpoint and peer in segment ref and tag url in entry span. (#63)
---
src/context.rs | 5 ++
src/errors.rs | 6 ++
src/plugin/plugin_curl.rs | 9 ++-
src/request.rs | 88 ++++++++++++++++-------
tests/common/mod.rs | 21 ++++--
tests/data/expected_context.yaml | 141 +++++++++++++++++++++++--------------
tests/php/fpm/curl-multi.enter.php | 6 +-
tests/php/fpm/curl.enter.php | 6 +-
tests/php/swoole/main.1.php | 2 +-
9 files changed, 194 insertions(+), 90 deletions(-)
diff --git a/src/context.rs b/src/context.rs
index 55ec7b8..88ab652 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -49,4 +49,9 @@ impl RequestContext {
) -> anyhow::Result<T> {
Self::try_with_global(request_id, |ctx| f(&mut ctx.tracing_context))
}
+
+ /// Primary endpoint name is used for endpoint dependency.
+ pub fn get_primary_span(&self) -> &Span {
+ &self.entry_span
+ }
}
diff --git a/src/errors.rs b/src/errors.rs
index 78f5a55..ce87805 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -31,3 +31,9 @@ impl From<Utf8Error> for Error {
Self::Anyhow(e.into())
}
}
+
+impl From<url::ParseError> for Error {
+ fn from(e: url::ParseError) -> Self {
+ Self::Anyhow(e.into())
+ }
+}
diff --git a/src/plugin/plugin_curl.rs b/src/plugin/plugin_curl.rs
index 75577cd..9a2e218 100644
--- a/src/plugin/plugin_curl.rs
+++ b/src/plugin/plugin_curl.rs
@@ -404,8 +404,13 @@ impl CurlPlugin {
}
fn inject_sw_header(request_id: Option<i64>, ch: ZVal, info: &CurlInfo) -> crate::Result<()> {
- let sw_header = RequestContext::try_with_global_ctx(request_id, |ctx| {
- Ok(encode_propagation(ctx, info.url.path(), &info.peer))
+ let sw_header = RequestContext::try_with_global(request_id, |req_ctx| {
+ let span_object = req_ctx.get_primary_span().span_object();
+ Ok(encode_propagation(
+ &req_ctx.tracing_context,
+ &span_object.operation_name,
+ &span_object.peer,
+ ))
})?;
let mut val = CURL_HEADERS
.with(|headers| headers.borrow_mut().remove(&info.cid))
diff --git a/src/request.rs b/src/request.rs
index 6a7a4e6..ec8d0a5 100644
--- a/src/request.rs
+++ b/src/request.rs
@@ -31,6 +31,7 @@ use std::{
sync::atomic::{AtomicBool, AtomicPtr, Ordering},
};
use tracing::{error, instrument, trace, warn};
+use url::Url;
#[instrument(skip_all)]
pub fn init() {
@@ -62,10 +63,10 @@ fn request_init_for_fpm() -> crate::Result<()> {
let server = get_page_request_server()?;
let header = get_page_request_header(server);
- let uri = get_page_request_uri(server);
+ let url = get_page_request_url(server)?;
let method = get_page_request_method(server);
- create_request_context(None, header.as_deref(), &method, &uri)
+ create_request_context(None, header.as_deref(), &method, &url)
}
fn request_shutdown_for_fpm() -> crate::Result<()> {
@@ -97,13 +98,34 @@ fn get_page_request_header(server: &ZArr) -> Option<String> {
}
}
-fn get_page_request_uri(server: &ZArr) -> String {
- server
+fn get_page_request_url(server: &ZArr) -> crate::Result<Url> {
+ let scheme = if [Some("1"), Some("on")]
+ .contains(&server.get("HTTPS").and_then(z_val_to_string).as_deref())
+ {
+ "https"
+ } else {
+ "http"
+ };
+
+ let addr = server
+ .get("HTTP_HOST")
+ .and_then(z_val_to_string)
+ .or_else(|| {
+ server
+ .get("SERVER_PORT")
+ .and_then(z_val_to_string)
+ .map(|port| format!("localhost:{}", port))
+ })
+ .unwrap_or_else(|| "UNKNOWN".to_string());
+
+ let uri = server
.get("REQUEST_URI")
.and_then(z_val_to_string)
.or_else(|| server.get("PHP_SELF").and_then(z_val_to_string))
.or_else(|| server.get("SCRIPT_NAME").and_then(z_val_to_string))
- .unwrap_or_else(|| "{unknown}".to_string())
+ .unwrap_or_else(|| "/UNKNOWN".to_string());
+
+ Ok(Url::parse(&format!("{}://{}{}", scheme, addr, uri))?)
}
fn get_page_request_method(server: &ZArr) -> String {
@@ -168,32 +190,29 @@ pub fn skywalking_hack_swoole_on_request(args: &mut [ZVal]) -> Result<(), Infall
}
fn request_init_for_swoole(request: &mut ZVal) -> crate::Result<()> {
- let request = request
- .as_mut_z_obj()
- .context("swoole request isn't object")?;
+ let request = request.as_z_obj().context("swoole request isn't object")?;
let fd = request
- .get_mut_property("fd")
+ .get_property("fd")
.as_long()
.context("swoole request fd not exists")?;
- let header = {
- let headers = request
- .get_mut_property("header")
- .as_z_arr()
- .context("swoole request header not exists")?;
- get_swoole_request_header(headers)
- };
+ let headers = request
+ .get_property("header")
+ .as_z_arr()
+ .context("swoole request header not exists")?;
+
+ let header = get_swoole_request_header(headers);
let server = request
- .get_mut_property("server")
+ .get_property("server")
.as_z_arr()
.context("swoole request server not exists")?;
- let uri = get_swoole_request_uri(server);
let method = get_swoole_request_method(server);
+ let url = get_swoole_request_url(server, headers)?;
- create_request_context(Some(fd), header.as_deref(), &method, &uri)
+ create_request_context(Some(fd), header.as_deref(), &method, &url)
}
fn request_shutdown_for_swoole(response: &mut ZVal) -> crate::Result<()> {
@@ -227,11 +246,30 @@ fn get_swoole_request_header(header: &ZArr) -> Option<String> {
}
}
-fn get_swoole_request_uri(server: &ZArr) -> String {
- server
+fn get_swoole_request_url(server: &ZArr, headers: &ZArr) -> crate::Result<Url> {
+ let addr = headers
+ .get("host")
+ .and_then(z_val_to_string)
+ .or_else(|| {
+ server
+ .get("server_port")
+ .and_then(z_val_to_string)
+ .map(|port| format!("localhost:{}", port))
+ })
+ .unwrap_or_else(|| "UNKNOWN".to_string());
+
+ let uri = server
.get("request_uri")
.and_then(z_val_to_string)
- .unwrap_or_else(|| "{unknown}".to_string())
+ .unwrap_or_else(|| "/UNKNOWN".to_string());
+
+ let query = server
+ .get("query_string")
+ .and_then(z_val_to_string)
+ .map(|s| format!("?{}", s))
+ .unwrap_or_default();
+
+ Ok(Url::parse(&format!("http://{}{}{}", addr, uri, query))?)
}
fn get_swoole_request_method(server: &ZArr) -> String {
@@ -242,7 +280,7 @@ fn get_swoole_request_method(server: &ZArr) -> String {
}
fn create_request_context(
- request_id: Option<i64>, header: Option<&str>, method: &str, uri: &str,
+ request_id: Option<i64>, header: Option<&str>, method: &str, url: &Url,
) -> crate::Result<()> {
let propagation = header
.map(decode_propagation)
@@ -253,7 +291,7 @@ fn create_request_context(
let mut ctx = tracer::create_trace_context();
- let operation_name = format!("{method}:{uri}");
+ let operation_name = format!("{}:{}", method, url.path());
let mut span = match propagation {
Some(propagation) => ctx.create_entry_span_with_propagation(&operation_name, &propagation),
None => ctx.create_entry_span(&operation_name),
@@ -261,7 +299,7 @@ fn create_request_context(
let mut span_object = span.span_object_mut();
span_object.component_id = COMPONENT_PHP_ID;
- span_object.add_tag("url", uri);
+ span_object.add_tag("url", url.to_string());
span_object.add_tag("http.method", method);
drop(span_object);
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index 1cb503b..f479983 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -163,7 +163,7 @@ async fn http_proxy_fpm_handler(
let mut params = fastcgi_client::Params::default()
.request_method(method)
- .query_string(query)
+ .query_string(&*query)
.server_addr(state.http_addr.ip().to_string())
.server_port(state.http_addr.port())
.remote_addr(remote_addr.ip().to_string())
@@ -176,7 +176,10 @@ async fn http_proxy_fpm_handler(
if key.as_str().starts_with("content-") {
param_key = key.as_str().replace('-', "_").to_uppercase();
- } else if key.as_str().starts_with("sw") || key.as_str().starts_with("x-") {
+ } else if key.as_str().starts_with("sw")
+ || key.as_str().starts_with("x-")
+ || key.as_str() == "host"
+ {
param_key = "HTTP_".to_owned() + &key.as_str().replace('-', "_").to_uppercase();
}
@@ -194,7 +197,7 @@ async fn http_proxy_fpm_handler(
buffer.extend_from_slice(&buf);
}
- let params = params_set_script(params, &path);
+ let params = params_set_script(params, &path, &query);
info!(?params, "proxy http to php-fpm");
@@ -231,12 +234,12 @@ async fn http_proxy_fpm_handler(
}
fn params_set_script<'a>(
- params: fastcgi_client::Params<'a>, script_name: &'a str,
+ params: fastcgi_client::Params<'a>, script_name: &'a str, query: &'a str,
) -> fastcgi_client::Params<'a> {
params
.script_name(script_name)
.script_filename(create_script_filename(script_name))
- .request_uri(script_name)
+ .request_uri(create_request_uri(script_name, query))
.document_uri(script_name)
}
@@ -252,6 +255,14 @@ fn create_script_filename(script_name: &str) -> String {
.to_owned()
}
+fn create_request_uri(script_name: &str, query: &str) -> String {
+ if query.is_empty() {
+ script_name.to_owned()
+ } else {
+ format!("{}?{}", script_name, query)
+ }
+}
+
#[instrument]
fn setup_php_fpm(index: usize, fpm_addr: &str) -> Child {
let php_fpm = env::var("PHP_FPM_BIN").unwrap_or_else(|_| "php-fpm".to_string());
diff --git a/tests/data/expected_context.yaml b/tests/data/expected_context.yaml
index 4c4d66b..8438727 100644
--- a/tests/data/expected_context.yaml
+++ b/tests/data/expected_context.yaml
@@ -31,13 +31,13 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /index.php }
+ - { key: url, value: "http://127.0.0.1:9011/index.php" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
refs:
- {
- parentEndpoint: /index.php,
- networkAddress: "127.0.0.1:9011",
+ parentEndpoint: "GET:/curl.enter.php",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 1,
parentTraceSegmentId: "not null",
@@ -59,13 +59,16 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /curl.test.php }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/curl.test.php?single=1",
+ }
- { key: http.method, value: POST }
- { key: http.status_code, value: "200" }
refs:
- {
- parentEndpoint: /curl.test.php,
- networkAddress: "127.0.0.1:9011",
+ parentEndpoint: "GET:/curl.enter.php",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 2,
parentTraceSegmentId: "not null",
@@ -87,13 +90,16 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /curl.test.php }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/curl.test.php?single=2",
+ }
- { key: http.method, value: POST }
- { key: http.status_code, value: "200" }
refs:
- {
- parentEndpoint: /curl.test.php,
- networkAddress: "127.0.0.1:9011",
+ parentEndpoint: "GET:/curl.enter.php",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 3,
parentTraceSegmentId: "not null",
@@ -115,13 +121,16 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /not-exists.php }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/not-exists.php?single=3",
+ }
- { key: http.method, value: GET }
- { key: http.status_code, value: "404" }
refs:
- {
- parentEndpoint: /not-exists.php,
- networkAddress: "127.0.0.1:9011",
+ parentEndpoint: "GET:/curl.enter.php",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 4,
parentTraceSegmentId: "not null",
@@ -143,13 +152,13 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /index.php }
+ - { key: url, value: "http://127.0.0.1:9011/index.php" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
refs:
- {
- parentEndpoint: /index.php,
- networkAddress: "127.0.0.1:9011",
+ parentEndpoint: "GET:/guzzle.php",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 1,
parentTraceSegmentId: "not null",
@@ -185,7 +194,10 @@ segmentItems:
peer: 127.0.0.1:9011
skipAnalysis: false
tags:
- - { key: url, value: "http://127.0.0.1:9011/curl.test.php" }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/curl.test.php?single=1",
+ }
- { key: status_code, value: "200" }
- operationName: /curl.test.php
parentSpanId: 0
@@ -199,7 +211,10 @@ segmentItems:
peer: 127.0.0.1:9011
skipAnalysis: false
tags:
- - { key: url, value: "http://127.0.0.1:9011/curl.test.php" }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/curl.test.php?single=2",
+ }
- { key: status_code, value: "200" }
- operationName: /not-exists.php
parentSpanId: 0
@@ -213,7 +228,10 @@ segmentItems:
peer: 127.0.0.1:9011
skipAnalysis: false
tags:
- - { key: url, value: "http://127.0.0.1:9011/not-exists.php" }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/not-exists.php?single=3",
+ }
- { key: status_code, value: "500" }
- operationName: /guzzle.php
parentSpanId: 0
@@ -241,7 +259,7 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /curl.enter.php }
+ - { key: url, value: "http://127.0.0.1:9011/curl.enter.php" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
- segmentId: "not null"
@@ -258,13 +276,16 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /not-exists.php }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/not-exists.php?multi=3",
+ }
- { key: http.method, value: GET }
- { key: http.status_code, value: "404" }
refs:
- {
- parentEndpoint: /not-exists.php,
- networkAddress: "127.0.0.1:9011",
+ parentEndpoint: "GET:/curl-multi.enter.php",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 3,
parentTraceSegmentId: "not null",
@@ -286,13 +307,16 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /curl.test.php }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/curl.test.php?multi=1",
+ }
- { key: http.method, value: POST }
- { key: http.status_code, value: "200" }
refs:
- {
- parentEndpoint: /curl.test.php,
- networkAddress: "127.0.0.1:9011",
+ parentEndpoint: "GET:/curl-multi.enter.php",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 1,
parentTraceSegmentId: "not null",
@@ -314,13 +338,16 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /curl.test.php }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/curl.test.php?multi=2",
+ }
- { key: http.method, value: POST }
- { key: http.status_code, value: "200" }
refs:
- {
- parentEndpoint: /curl.test.php,
- networkAddress: "127.0.0.1:9011",
+ parentEndpoint: "GET:/curl-multi.enter.php",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 2,
parentTraceSegmentId: "not null",
@@ -342,7 +369,10 @@ segmentItems:
peer: 127.0.0.1:9011
skipAnalysis: false
tags:
- - { key: url, value: "http://127.0.0.1:9011/not-exists.php" }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/not-exists.php?multi=3",
+ }
- { key: status_code, value: "500" }
- operationName: /curl.test.php
parentSpanId: 0
@@ -356,7 +386,10 @@ segmentItems:
peer: 127.0.0.1:9011
skipAnalysis: false
tags:
- - { key: url, value: "http://127.0.0.1:9011/curl.test.php" }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/curl.test.php?multi=2",
+ }
- { key: status_code, value: "200" }
- operationName: /curl.test.php
parentSpanId: 0
@@ -370,7 +403,10 @@ segmentItems:
peer: 127.0.0.1:9011
skipAnalysis: false
tags:
- - { key: url, value: "http://127.0.0.1:9011/curl.test.php" }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/curl.test.php?multi=1",
+ }
- { key: status_code, value: "200" }
- operationName: GET:/curl-multi.enter.php
parentSpanId: -1
@@ -384,7 +420,10 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /curl-multi.enter.php }
+ - {
+ key: url,
+ value: "http://127.0.0.1:9011/curl-multi.enter.php",
+ }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
- segmentId: "not null"
@@ -592,7 +631,7 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /pdo.php }
+ - { key: url, value: "http://127.0.0.1:9011/pdo.php" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
- segmentId: "not null"
@@ -671,7 +710,7 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /predis.php }
+ - { key: url, value: "http://127.0.0.1:9011/predis.php" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
- segmentId: 'not null'
@@ -722,9 +761,9 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - {key: url, value: /mysqli.php}
- - {key: http.method, value: GET}
- - {key: http.status_code, value: '200'}
+ - { key: url, value: "http://127.0.0.1:9011/mysqli.php" }
+ - { key: http.method, value: GET }
+ - { key: http.status_code, value: "200" }
- segmentId: 'not null'
spans:
- operationName: Memcached->set
@@ -838,7 +877,7 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /memcached.php }
+ - { key: url, value: "http://127.0.0.1:9011/memcached.php" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
- segmentId: "not null"
@@ -930,7 +969,7 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /redis.succ.php }
+ - { key: url, value: "http://127.0.0.1:9011/redis.succ.php" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
- segmentId: "not null"
@@ -983,7 +1022,7 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /redis.fail.php }
+ - { key: url, value: "http://127.0.0.1:9011/redis.fail.php" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
- serviceName: skywalking-agent-test-2
@@ -1017,13 +1056,13 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /guzzle.php }
+ - { key: url, value: "http://127.0.0.1:9012/guzzle.php" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
refs:
- {
- parentEndpoint: /guzzle.php,
- networkAddress: "127.0.0.1:9012",
+ parentEndpoint: "GET:/curl.enter.php",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 5,
parentTraceSegmentId: "not null",
@@ -1048,13 +1087,13 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: / }
+ - { key: url, value: "http://127.0.0.1:9501/?swoole=1" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
refs:
- {
- parentEndpoint: /,
- networkAddress: "127.0.0.1:9501",
+ parentEndpoint: "GET:/curl",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 1,
parentTraceSegmentId: "not null",
@@ -1076,7 +1115,7 @@ segmentItems:
peer: 127.0.0.1:9501
skipAnalysis: false
tags:
- - { key: url, value: "http://127.0.0.1:9501/" }
+ - { key: url, value: "http://127.0.0.1:9501/?swoole=1" }
- { key: status_code, value: "200" }
- operationName: /
parentSpanId: 0
@@ -1104,7 +1143,7 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: /curl }
+ - { key: url, value: "http://127.0.0.1:9501/curl" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
- serviceName: skywalking-agent-test-2-swoole
@@ -1124,13 +1163,13 @@ segmentItems:
peer: ""
skipAnalysis: false
tags:
- - { key: url, value: / }
+ - { key: url, value: "http://127.0.0.1:9502/" }
- { key: http.method, value: GET }
- { key: http.status_code, value: "200" }
refs:
- {
- parentEndpoint: /,
- networkAddress: "127.0.0.1:9502",
+ parentEndpoint: "GET:/curl",
+ networkAddress: "",
refType: CrossProcess,
parentSpanId: 2,
parentTraceSegmentId: "not null",
diff --git a/tests/php/fpm/curl-multi.enter.php b/tests/php/fpm/curl-multi.enter.php
index 75f4fbc..e48e378 100644
--- a/tests/php/fpm/curl-multi.enter.php
+++ b/tests/php/fpm/curl-multi.enter.php
@@ -28,7 +28,7 @@ require_once dirname(__DIR__) . "/vendor/autoload.php";
[
'curl' => (function () {
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9011/curl.test.php");
+ curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9011/curl.test.php?multi=1");
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
@@ -44,7 +44,7 @@ require_once dirname(__DIR__) . "/vendor/autoload.php";
'curl' => (function () {
$ch = curl_init();
curl_setopt_array($ch, [
- CURLOPT_URL => "http://127.0.0.1:9011/curl.test.php",
+ CURLOPT_URL => "http://127.0.0.1:9011/curl.test.php?multi=2",
CURLOPT_TIMEOUT => 10,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
@@ -60,7 +60,7 @@ require_once dirname(__DIR__) . "/vendor/autoload.php";
[
'curl' => (function () {
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9011/not-exists.php");
+ curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9011/not-exists.php?multi=3");
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
diff --git a/tests/php/fpm/curl.enter.php b/tests/php/fpm/curl.enter.php
index 82e8ef8..b3d51f4 100644
--- a/tests/php/fpm/curl.enter.php
+++ b/tests/php/fpm/curl.enter.php
@@ -32,7 +32,7 @@ require_once dirname(__DIR__) . "/vendor/autoload.php";
{
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9011/curl.test.php");
+ curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9011/curl.test.php?single=1");
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
@@ -46,7 +46,7 @@ require_once dirname(__DIR__) . "/vendor/autoload.php";
{
$ch = curl_init();
curl_setopt_array($ch, [
- CURLOPT_URL => "http://127.0.0.1:9011/curl.test.php",
+ CURLOPT_URL => "http://127.0.0.1:9011/curl.test.php?single=2",
CURLOPT_TIMEOUT => 10,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
@@ -60,7 +60,7 @@ require_once dirname(__DIR__) . "/vendor/autoload.php";
{
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9011/not-exists.php");
+ curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9011/not-exists.php?single=3");
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
diff --git a/tests/php/swoole/main.1.php b/tests/php/swoole/main.1.php
index 8d0bc7a..e70c685 100644
--- a/tests/php/swoole/main.1.php
+++ b/tests/php/swoole/main.1.php
@@ -43,7 +43,7 @@ $http->on('request', function ($request, $response) {
case "/curl":
{
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9501/");
+ curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:9501/?swoole=1");
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);