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

Resource with the 304 status code and the 'content-length: x' header does not load #1602

Closed
LavrovArtem opened this issue May 4, 2018 · 2 comments
Assignees
Labels
AREA: server STATE: Auto-locked Issues that were automatically locked by the Lock bot SYSTEM: pipeline TYPE: bug
Milestone

Comments

@LavrovArtem
Copy link
Contributor

Server for reproducing:

const net = require('net');

net.createServer(socket => {
    socket.on('data', data => {
        const stringData = data.toString();
        const url = stringData.match(/GET ([\s\S]+) HTTP/)[1];

        if (url === '/') {
            if (!/If\-None\-Match/ig.test(stringData)) {
                socket.write([
                    'HTTP/1.1 200 OK',
                    'ETag: "eyJ2ZXJzaW9uIjowLCJ1cmkiOiJwYWdlcy9ob21lIiwiaGFzaCI6InpuRDdTQT09In0="',
                    'Content-Length: 5',
                    '',
                    'Hello'
                ].join('\r\n'));
            } else {
                socket.write([
                    'HTTP/1.1 304 Not Modified',
                    'Content-Length: 5',
                    '',
                    ''
                ].join('\r\n'));
            }
        } else {
            socket.write('HTTP/1.1 404 Not Found');
            socket.end();
        }
    });
}).listen(8124, () => console.log('server bound'));

Proxy works fine if we remove the Content-Length header from server above from cached response or if we add body to this response.

Workaround is disable cache in browser.

@LavrovArtem
Copy link
Contributor Author

https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5

The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields.

LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue May 31, 2018
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Jun 13, 2018
AndreyBelym pushed a commit to AndreyBelym/testcafe-hammerhead that referenced this issue Feb 28, 2019
…ader does not load` (close DevExpress#1602) (DevExpress#1638)

* fix `Resource with the 304 status code and the 'content-length: x' header does not load` (close DevExpress#1602)

* fix tests

* fix review issue
@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked Issues that were automatically locked by the Lock bot label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AREA: server STATE: Auto-locked Issues that were automatically locked by the Lock bot SYSTEM: pipeline TYPE: bug
Projects
None yet
Development

No branches or pull requests

1 participant