wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Wget-dev] wget2 | Unimplemented option '--ignore-length' (#439)


From: Archit Pandey
Subject: Re: [Wget-dev] wget2 | Unimplemented option '--ignore-length' (#439)
Date: Wed, 23 Oct 2019 06:33:53 +0000



Archit Pandey commented:


Hello all,

I'm having some troubles while reproducing the error with spurious 
`Content-Length` headers. Here's the test case I've tried:
```c
#include <config.h>

#include <stdlib.h> // exit()
#include "libtest.h"

int main(void)
{
        wget_test_url_t urls[]={
                {       .name = "/index.html",
                        .code = "200 Dontcare",
                        .body =
                                "<html><head><title>Main 
Page</title><body><p>This is index.html</p>" \
                                "</body></html>",
                        .headers = {
                                "Content-Type: text/html",
                                "Content-Length: 2",
                        },
                },
        };

        // functions won't come back if an error occurs
        wget_test_start_server(
                WGET_TEST_RESPONSE_URLS, &urls, countof(urls),
                WGET_TEST_FEATURE_MHD,
                0);

        wget_test(
                WGET_TEST_KEEP_TMPFILES, 1,
                WGET_TEST_OPTIONS, "",
                WGET_TEST_REQUEST_URL, "index.html",
                WGET_TEST_EXPECTED_ERROR_CODE, 0,
                WGET_TEST_EXPECTED_FILES, &(wget_test_file_t []) {
                        { urls[0].name + 1, urls[0].body },
                        {       NULL } },
                0);

        exit(EXIT_SUCCESS);
}
```

The `Content-Length` header is set to 2, whereas the expected length is 81 
bytes. However, I do not see any error when running the test.

However, when I set `Content-Length` to 0, I get this error:
```bash
Saving 'index.html'
HTTP response 200 OK [http://localhost:36957/index.html]
Unexpected content in index.html []
  Expected 81 bytes:
<html><head><title>Main Page</title><body><p>This is 
index.html</p></body></html>
  Got 81 bytes:
`X&▒%V
FAIL test-ignore-length (exit status: 1)
```

Is this the error we are aiming to fix using the new option `--ignore-length`? 
Or am I missing something in my example?

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/issues/439#note_234263509
You're receiving this email because of your account on gitlab.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]