wget-dev
[Top][All Lists]
Advanced

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

Re: wget2 | Added simulation of interrupting responses while sending res


From: Rohan Fletcher
Subject: Re: wget2 | Added simulation of interrupting responses while sending response body in test server (!465)
Date: Fri, 31 Jan 2020 17:31:08 +0000



Rohan Fletcher commented:


The only place where the time is set on a file descripter is in 
`http_receive_response` 
(https://gitlab.com/gnuwget/wget2/blob/master/src/wget.c#L4010).

terminate is not true at this point as it is only used when the queue is 
exhausted or if ctrl-c is pushed, so the time is never one second less when the 
connection fails

```c
wget_http_response *http_receive_response(wget_http_connection *conn)
{
        wget_http_response *resp = wget_http_get_response_cb(conn);

        if (!resp)
                return NULL;

        struct body_callback_context *context = resp->req->body_user_data;
        if (context->outfd >= 0) {
                if (resp->last_modified) {
                        // EXECUTION GETS TO HERE
                        /* If program was aborted, we store file times one 
second less than the server time.
                         * So a later download with -N would start over instead 
of leaving incomplete data.
                         * Or a later download with -c -N would continue with a 
IF-MODIFIED-SINCE: HTTP header. */
                        if (config.xattr && !terminate)
                                write_xattr_last_modified(resp->last_modified, 
context->outfd);

                        set_file_mtime(context->outfd, resp->last_modified - 
terminate);
                }

                if (config.fsync_policy) {
                        if (fsync(context->outfd) < 0 && errno == EIO) {
                                error_printf(_("Failed to fsync errno=%d\n"), 
errno);
                                set_exit_status(EXIT_STATUS_IO);
                        }
                }

                close(context->outfd);
                context->outfd = -1;
        }
```

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




reply via email to

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