v0.34.0_1
This commit is contained in:
1 parent
9b3d6731cc
commit
00f29f92c8
68 files changed
+2599
-513
No files matched your search
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
"""RustProxy 0.34.0 sendfile source-wiring assertions ONLY, not native tests."""
|
||||
from pathlib import Path
|
||||
import json
|
||||
import re
|
||||
|
||||
root = Path(__file__).resolve().parents[2]
|
||||
get = lambda path: (root / path).read_text()
|
||||
|
||||
model = get('src/web_server/config/model.rs')
|
||||
assert 'pub enum SendfileMode' in model and 'sendfile: SendfileMode::Off' in model
|
||||
assert 'pub sendfile: SendfileMode' in model
|
||||
assert 'sendfile: self.sendfile' in get('src/web_server/config/compile.rs')
|
||||
assert 'pub sendfile: SendfileMode' in get('src/web_server/config/validation.rs')
|
||||
assert 'service.sendfile = crate::web_server::SendfileMode::Off;' in get('src/runtime/types.rs')
|
||||
source = get('src/proxy/forward/web_source.rs')
|
||||
for guard in ('!enabled && identity_request', 'request_method == Method::GET',
|
||||
'response.status() == StatusCode::OK', 'content-encoding',
|
||||
'transfer-encoding', 'content-range', 'candidate.length',
|
||||
'http::Version::HTTP_11'):
|
||||
assert guard in source, guard
|
||||
assert 'content_encoding.is_none()' in get('src/web_server/response/file.rs')
|
||||
assert 'single_range.is_none()' in get('src/web_server/response/file.rs')
|
||||
assert 'opened.file.try_clone()' in get('src/web_server/response/file.rs')
|
||||
bridge = get('src/server/sendfile.rs')
|
||||
for item in ('libc::sendfile(', 'MAX_PENDING: usize = 8', 'MIN_SIZE: u64 = 64 * 1024',
|
||||
'registry.slots.is_empty()', 'native_sendfile_transfers_exact_file',
|
||||
'sendfile placeholder did not match', 'UnexpectedEof'):
|
||||
assert item in bridge, item
|
||||
assert 'pub(crate) mod sendfile' in get('src/server.rs')
|
||||
assert 'SendfileIo::new(stream)' in get('src/server/tls_runtime.rs')
|
||||
assert 'sendfile_slots' in get('src/server/http1_connection.rs')
|
||||
js = get('src/admin/web/web-server.js')
|
||||
html = get('src/admin/web/index.html')
|
||||
assert '"web-service-sendfile"' in js and 'sendfile: "off"' in js
|
||||
assert 'sendfile: $("web-service-sendfile").value' in js
|
||||
assert html.count('id="web-service-sendfile"') == 1
|
||||
assert 'value="auto"' in html
|
||||
for locale in ('en_US', 'pl_pl'):
|
||||
keys = json.loads(get(f'langs/{locale}.json'))['translations']
|
||||
assert all(k in keys for k in ('webServiceSendfile', 'webServiceSendfileHelp', 'webServiceSendfileAuto'))
|
||||
api = json.loads(get('src/admin/openapi.json'))
|
||||
assert 'sendfile' in json.dumps(api)
|
||||
print('PASS 0.34.0 sendfile source guards, default OFF, Linux syscall, UI, translations, API and scoped cache (STATIC ONLY)')
|
||||
Reference in new issue
Block a user