Skip to content

wget works but lightpanda has error.ConnectionResetByPeer #467

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

Open
marcuskbr opened this issue Mar 14, 2025 · 3 comments
Open

wget works but lightpanda has error.ConnectionResetByPeer #467

marcuskbr opened this issue Mar 14, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@marcuskbr
Copy link

This works:
wget -O ttt https://www.volksbankinostwestfalen.de/

This fails:

./lightpanda-2025-03-14 fetch --dump https://www.volksbankinostwestfalen.de/
error(cli): 'https://www.volksbankinostwestfalen.de/' fetching error (error.ConnectionResetByPeer)

error: ConnectionResetByPeer
@krichprollsch krichprollsch self-assigned this Mar 18, 2025
@krichprollsch krichprollsch added the bug Something isn't working label Mar 18, 2025
@krichprollsch
Copy link
Member

$ zig build run -- fetch  https://www.volksbankinostwestfalen.de/                                                                                                                                                                             15:15:35 [1/9204]
debug(cli): Fetch mode: url https://www.volksbankinostwestfalen.de/, dump false
debug(browser): start js env
debug(browser): setup global env
debug(polyfill): load polyfill-fetch: undefined
debug(browser): inspector context created
debug: Inspector contextCreated called
debug(browser): starting GET https://www.volksbankinostwestfalen.de/
error(cli): 'https://www.volksbankinostwestfalen.de/' fetching error (error.ConnectionResetByPeer)

error: ConnectionResetByPeer
/usr/local/zig-0.13.0/lib/std/posix.zig:843:27: 0x1b96b51 in read (lightpanda)
            .CONNRESET => return error.ConnectionResetByPeer,
                          ^
/usr/local/zig-0.13.0/lib/std/net.zig:1821:9: 0x1bdc490 in read (lightpanda)
        return posix.read(self.handle, buffer);
        ^
/home/pierre/wrk/browser/vendor/tls.zig/src/record.zig:70:31: 0x1bdc0ab in next (lightpanda)
                    const n = try r.inner_reader.read(r.buffer[r.end..]);
                              ^
/home/pierre/wrk/browser/vendor/tls.zig/src/record.zig:78:26: 0x1c44a6a in nextDecrypt (lightpanda)
            const rec = (try r.next()) orelse return null;
                         ^
/home/pierre/wrk/browser/vendor/tls.zig/src/connection.zig:71:55: 0x1deea48 in nextRecord (lightpanda)
                const content_type, const cleartext = try c.rec_rdr.nextDecrypt(&c.cipher) orelse return null;
                                                      ^
/home/pierre/wrk/browser/vendor/tls.zig/src/connection.zig:63:46: 0x1d0c8bc in next (lightpanda)
            const content_type, const data = try c.nextRecord() orelse return null;
                                             ^
/home/pierre/wrk/browser/vendor/tls.zig/src/connection.zig:212:34: 0x1d0c6a4 in readv (lightpanda)
                    c.read_buf = try c.next() orelse break;
                                 ^
/home/pierre/wrk/browser/src/http/Client.zig:233:66: 0x1c48df7 in readvDirectTls (lightpanda)
                error.ConnectionResetByPeer, error.BrokenPipe => return error.ConnectionResetByPeer,
                                                                 ^
/home/pierre/wrk/browser/src/http/Client.zig:243:13: 0x1b88675 in readvDirect (lightpanda)
            return conn.readvDirectTls(buffers);
            ^
/home/pierre/wrk/browser/src/http/Client.zig:260:23: 0x1b2d22e in fill (lightpanda)
        const nread = try conn.readvDirect(&iovecs);
                      ^
/home/pierre/wrk/browser/src/http/Client.zig:990:17: 0x1ae6bce in wait (lightpanda)
                try connection.fill();
                ^
/home/pierre/wrk/browser/src/browser/loader.zig:76:9: 0x1ae23ea in get (lightpanda)
        try resp.req.wait();
        ^
/home/pierre/wrk/browser/src/browser/browser.zig:374:20: 0x1af3e75 in navigate (lightpanda)
        var resp = try self.session.loader.get(arena, self.uri);
                   ^
/home/pierre/wrk/browser/src/main.zig:110:21: 0x1afa2ae in main (lightpanda)
                    return err;
                    ^
run
└─ run lightpanda failure
error: the following command exited with error code 1:
/home/pierre/wrk/browser/.zig-cache/o/5b9deb890d188671421348ab172dfd4c/lightpanda fetch https://www.volksbankinostwestfalen.de/
Build Summary: 3/5 steps succeeded; 1 failed (disable with --summary none)
run transitive failure
└─ run lightpanda failure
error: the following build command failed with exit code 1:
/home/pierre/wrk/browser/.zig-cache/o/d8f113b6a18b1614868b9efb1a78495d/build /usr/local/zig-0.13.0/zig /home/pierre/wrk/browser /home/pierre/wrk/browser/.zig-cache /home/pierre/.cache/zig --seed 0x68a958ae -Zbea3f0ca19c626db run -- fetch https://www.volks
bankinostwestfalen.de/

@karlseguin
Copy link
Collaborator

It's responding to the User-Agent. Here, the server immediately closes the connection without sending a response:

curl https://www.volksbankinostwestfalen.de/ \
  -H "Host: www.volksbankinostwestfalen.de" \
  -H "User-Agent: Lightpanda/1.0" -v

Whereas, without the User-Agent, the server sends the response (a redirect):

curl https://www.volksbankinostwestfalen.de/ \
  -H "Host: www.volksbankinostwestfalen.de" -v

@marcuskbr
Copy link
Author

Thanks karlseguin!
I have not seen any option for lightpanda to set the UA.
It seems that the fetch command needs an option --user-agent <string>.
There is a commercial scraper that has options similar to --phone and --desktop which set the UA and the screen orientation and screen size. That would be even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants