Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large body files #605

Closed
viktor-klestov opened this issue Dec 1, 2021 · 1 comment
Closed

Large body files #605

viktor-klestov opened this issue Dec 1, 2021 · 1 comment
Assignees
Labels
bug Something isn't working documentation Issue requires a documentation update

Comments

@viktor-klestov
Copy link

viktor-klestov commented Dec 1, 2021

Describe the bug
It doesn't handle large files. I have a 2.3G file that I want to be served as a response body. Unfortunately I get response with no body.
If I have "Response with 404 when the file path did not match any files" option checked, it returns 404, but file actually exists. Also when I truncate file it works as expected.

image

curl -v -X POST ... 'http://localhost:1900/csp/lpu11/DLO.Service.cls'

Error while serving the file content: File size (2428588349) is greater than 2 GB

File content:

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:s='http://www.w3.org/2001/XMLSchema'>
  <SOAP-ENV:Body>
<GetSprByIdResponse xmlns="..."><GetSprByIdResult>MQ==</GetSprByIdResult><pStream>{{VERY VERY LONG BASE64 STRING}}</pStream></GetSprByIdResponse>  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

To Reproduce
You just need a huge file, I guess

{
    "source": "mockoon:1.17.0",
    "data": [
        {
            "type": "environment",
            "item": {
                "uuid": "9f9f9770-52b4-11ec-a569-b7dcfa209caa",
                "lastMigration": 19,
                "name": "asulon",
                "endpointPrefix": "",
                "latency": 0,
                "port": 1900,
                "routes": [
                    {
                        "uuid": "9f9f9771-52b4-11ec-a569-b7dcfa209caa",
                        "documentation": "",
                        "method": "post",
                        "endpoint": "csp/lpu11/DLO.Service.cls",
                        "responses": [
                            {
                                "uuid": "9f9fbe80-52b4-11ec-a569-b7dcfa209caa",
                                "body": "",
                                "latency": 0,
                                "statusCode": 200,
                                "label": "",
                                "headers": [
                                    {
                                        "key": "Content-Type",
                                        "value": "text/xml"
                                    }
                                ],
                                "filePath": "/home/dietolog/response.encoded",
                                "sendFileAsBody": false,
                                "rules": [
                                    {
                                        "target": "header",
                                        "modifier": "SOAPAction",
                                        "value": "action",
                                        "operator": "equals"
                                    },
                                    {
                                        "target": "header",
                                        "modifier": "Content-Type",
                                        "value": "application/xml",
                                        "operator": "equals"
                                    }
                                ],
                                "rulesOperator": "AND",
                                "disableTemplating": true,
                                "fallbackTo404": true
                            }
                        ],
                        "enabled": true,
                        "randomResponse": false,
                        "sequentialResponse": false
                    }
                ],
                "proxyMode": false,
                "proxyHost": "",
                "cors": true,
                "headers": [
                    {
                        "key": "Content-Type",
                        "value": "text/xml"
                    }
                ],
                "proxyReqHeaders": [
                    {
                        "key": "",
                        "value": ""
                    }
                ],
                "proxyResHeaders": [
                    {
                        "key": "",
                        "value": ""
                    }
                ],
                "proxyRemovePrefix": false,
                "hostname": "0.0.0.0",
                "tlsOptions": {
                    "enabled": false,
                    "type": "CERT",
                    "pfxPath": "",
                    "certPath": "",
                    "keyPath": "",
                    "caPath": "",
                    "passphrase": ""
                }
            }
        }
    ]
}

Expected behavior
Response with the body

Mockoon version:
1.17.0

OS / OS version:
Ubuntu 20.04.3 LTS

@viktor-klestov
Copy link
Author

looks like problem here commons-server/src/libs/server.ts:448 readFile can't handle such size? May be stream read is possible?

@255kb 255kb added the bug Something isn't working label Dec 3, 2021
@255kb 255kb self-assigned this Jan 27, 2022
@255kb 255kb added enhancement documentation Issue requires a documentation update labels Jan 27, 2022
255kb pushed a commit to mockoon/mockoon.com that referenced this issue Jan 27, 2022
255kb pushed a commit to mockoon/mockoon.com that referenced this issue Jan 27, 2022
255kb pushed a commit to mockoon/commons-server that referenced this issue Jan 27, 2022
255kb pushed a commit to mockoon/mockoon.com that referenced this issue Jan 28, 2022
255kb pushed a commit to mockoon/mockoon.com that referenced this issue Feb 2, 2022
255kb pushed a commit to mockoon/mockoon.com that referenced this issue Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Issue requires a documentation update
Projects
Archived in project
Development

No branches or pull requests

2 participants