MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).
it is begin of body:
30 80 06 09 2a 86 48 86 f7 0d 01 07 02 a0 80 30
but then write in response another sequence
30 ef bf bd 06 09 2a ef bf bd 48 ef bf bd ef bf
mockServer-1 | 2024-09-25 15:09:15 5.15.0 FINEST [id: 0xe938e47d, L:/172.21.0.2:1080 - R:/172.21.0.1:36978] WRITE(4578B)
mockServer-1 | +-------------------------------------------------+
mockServer-1 | | 0 1 2 3 4 5 6 7 8 9 a b c d e f |
mockServer-1 | +--------+-------------------------------------------------+----------------+
mockServer-1 | |00000000| 30 ef bf bd 06 09 2a ef bf bd 48 ef bf bd ef bf |0........H.....|
mockServer-1 | |00000010| bd 0d 01 07 02 ef bf bd ef bf bd 30 ef bf bd 10 |�/��0�|
mockServer-1 | |00000020| ef bf bd 02 01 01 31 0e 30 0c 06 08 2a ef bf bd |�10
�|
mockServer-1 | |00000030| 03 07 01 01 02 02 05 00 30 ef bf bd 06 09 2a ef |0� *�|
mockServer-1 | |00000040| bf bd 48 ef bf bd ef bf bd 0d 01 07 01 ef bf bd |��H��/�|
mockServer-1 | |00000050| ef bf bd 04 ef bf bd 0e ef bf bd 3c 3f 78 6d 6c |���<?xml|
mockServer-1 | |00000060| 20 76 65 72 73 69 6f 6e 3d 22 31 2e 30 22 20 65 | version="1.0" e|
mockServer-1 | |00000070| 6e 63 6f 64 69 6e 67 3d 22 55 54 46 2d 38 22 3f |ncoding="UTF-8"?|
mockServer-1 | |00000080| 3e 0a 3c 62 6b 69 5f 72 65 73 70 6f 6e 73 65 20 |>/<bki_response |
as i know character that cannot be encoded are replaced with EF BF BD in UTF-8
response headers that responsed my server report.com is
HTTP/1.1 200 OK
server: nginx
date: Wed, 25 Sep 2024 15:50:08 GMT
content-type: application/octet-stream; charset=UTF-8
transfer-encoding: chunked
x-powered-by: PHP/7.4.33
x-frame-options: SAMEORIGIN
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000; includeSubdomains;
yes i know that there is
content-type: application/octet-stream; charset=UTF-8
but why used utf-8 encoding for binary data? it is digital signature at the beginning of body may be or hash
as result i get wrongly rewrited bytes my mockserver(or netty)
why it not just rewrite it as is using binary bytes - without encoding?
is there a way to force mockserver to transfer original response(byte by byte) from server when forwarding?
5.15 latest
DOCKER
sorry for my english i hope my mindflow is recognizable))
steps to reproduce:
just setup mockserver to forwarding to serverA who response as
then - send request to mockserver - and it will answer
30 EF BF BD 06 09 2A EF BF BD
instead of correct response which should be
30 80 06 09 2A 86
i configure mockserver to forward request "httpForward": { "host": "report.com", "port": 15001, "scheme": "HTTP" }
in TRACE log i see that mockerver get byte sequence
2024-09-25 15:09:15 5.15.0 FINEST [id: 0xd0d31db3, L:/172.21.0.2:60920 - R:report.com:15001] RECEIVED(2048B) mockServer-1 | |00000180| 30 80 06 09 2a 86 48 86 f7 0d 01 07 01 a0 80 04 |0� *�H��/��| mockServer-1 | |00000190| 82 0e cc 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e |��<?xml version| mockServer-1 | |000001a0| 3d 22 31 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d |="1.0" encoding=| mockServer-1 | |000001b0| 22 55 54 46 2d 38 22 3f 3e 0a 3c 62 6b 69 5f 72 |"UTF-8"?>/<bki_r|
it is begin of body: 30 80 06 09 2a 86 48 86 f7 0d 01 07 02 a0 80 30 but then write in response another sequence 30 ef bf bd 06 09 2a ef bf bd 48 ef bf bd ef bf
mockServer-1 | 2024-09-25 15:09:15 5.15.0 FINEST [id: 0xe938e47d, L:/172.21.0.2:1080 - R:/172.21.0.1:36978] WRITE(4578B) mockServer-1 | +-------------------------------------------------+ mockServer-1 | | 0 1 2 3 4 5 6 7 8 9 a b c d e f | mockServer-1 | +--------+-------------------------------------------------+----------------+ mockServer-1 | |00000000| 30 ef bf bd 06 09 2a ef bf bd 48 ef bf bd ef bf |0........H.....| mockServer-1 | |00000010| bd 0d 01 07 02 ef bf bd ef bf bd 30 ef bf bd 10 |�/��0�| mockServer-1 | |00000020| ef bf bd 02 01 01 31 0e 30 0c 06 08 2a ef bf bd |�10 �| mockServer-1 | |00000030| 03 07 01 01 02 02 05 00 30 ef bf bd 06 09 2a ef |0� *�| mockServer-1 | |00000040| bf bd 48 ef bf bd ef bf bd 0d 01 07 01 ef bf bd |��H��/�| mockServer-1 | |00000050| ef bf bd 04 ef bf bd 0e ef bf bd 3c 3f 78 6d 6c |���<?xml| mockServer-1 | |00000060| 20 76 65 72 73 69 6f 6e 3d 22 31 2e 30 22 20 65 | version="1.0" e| mockServer-1 | |00000070| 6e 63 6f 64 69 6e 67 3d 22 55 54 46 2d 38 22 3f |ncoding="UTF-8"?| mockServer-1 | |00000080| 3e 0a 3c 62 6b 69 5f 72 65 73 70 6f 6e 73 65 20 |>/<bki_response |
as i know character that cannot be encoded are replaced with EF BF BD in UTF-8
response headers that responsed my server report.com is HTTP/1.1 200 OK server: nginx date: Wed, 25 Sep 2024 15:50:08 GMT content-type: application/octet-stream; charset=UTF-8 transfer-encoding: chunked x-powered-by: PHP/7.4.33 x-frame-options: SAMEORIGIN x-content-type-options: nosniff x-xss-protection: 1; mode=block strict-transport-security: max-age=31536000; includeSubdomains;
yes i know that there is content-type: application/octet-stream; charset=UTF-8 but why used utf-8 encoding for binary data? it is digital signature at the beginning of body may be or hash
as result i get wrongly rewrited bytes my mockserver(or netty) why it not just rewrite it as is using binary bytes - without encoding? is there a way to force mockserver to transfer original response(byte by byte) from server when forwarding?
5.15 latest DOCKER
sorry for my english i hope my mindflow is recognizable))