When is a download registered as such?

21

3

When viewing images on google images, one might accidentally click on "save image as", or "view image" (which somehow sometimes prompts a download as well). This then opens a window asking if you want to download said file. However, if you cancel before anything gets saved, is this still seen as a download from the "server" side? Since i am not that well versed in this topic, my use of "server" just covers whatever entity might record/save said activity.

Felix R

Posted 2019-01-13T08:52:56.583

Reputation: 349

4Registered as such by whom? Many log analysis software (ie awstats, goaccess) considers a download any file with a particular suffixes (.zip, .pdf...). The list of extensions is usually configurable. Other software may use different approaches. – jjmontes – 2019-01-14T15:06:00.387

Answers

52

Seen from the server side, there is absolutely no technical difference between "transferring for viewing in a browser window" and "downloading for storage".

Maybe a server will provide a (smaller) preview and the (larger) real image for download, and can distinguish which one has been accessed. But it can register (and log) only the access to these files, the IP address the request came from, a generic "id string" of the browser software - not the intent of a client.

But file access does not always result from human interaction with a client computer. On the one hand, browsers store images and other website data on your system even if you don't even use "save image as...". On the other hand, many browsers even "follow links" (that is: download things!) in advance, to speed up navigation. The browser cache even might get into your local backup that way, even if you never willfully accessed these files!

Finally, using "save as" and cancelling (not selecting a destination filename) may or may not initiate a download, depending on the implementation of the browser you are using.

jvb

Posted 2019-01-13T08:52:56.583

Reputation: 1 697

12Heck: "save as" may or may not initiate a download, regardless of cancelling - if the browser already has the image, why request it from the server again ("no cache" hints and such notwithstanding). – minnmass – 2019-01-14T03:37:25.640

6

Actually, there can be a difference, in terms of the Content-Disposition HTTP header: inline indicates a view in the browser, attachment a download.

– Uwe Keim – 2019-01-14T06:48:30.827

13@UweKeim it's actually a hint from the server. Normally browser would follow it but the server has no way to judge if the client is actually a browser nor if it's going to respect this header. curl https://www.google.com/ -H 'User-Agent: I am really a web browser, trust me' >> /dev/null ;) – ElmoVanKielmo – 2019-01-14T07:31:42.453

1... and to show that it's more than theoretical, consider PDF's. Historically those have been treated by browsers as downloads, but modern browsers can directly display them. – MSalters – 2019-01-14T09:57:25.990

1The browser will initiate a download unless that URL, etc. are already in the browser's cache. Otherwise, the browser has no way to tell what the file name might be, the type of document it is, or even if there is any file contents to save. The browser will issue some kind of request to the server, and the server will "count" that however it wants. – Christopher Schultz – 2019-01-14T18:01:23.657

@ChristopherSchultz if you "Save image as" a image that is already visible in the browser, it always has been downloaded by the browser before. How would the browser display it otherwise? – Josef says Reinstate Monica – 2019-01-15T11:50:55.600

@ElmoVanKielmo: And pretty soon Google recognizes that User-Agent. Pretty funny though. – Joshua – 2019-01-15T20:14:58.033

@Josef Load page. Clear Cache. Click "Save Image As...". Or just run without a cache. OR use HTTPS. Depending upon how smart your browser is (or what headers the server returns), it might download the file again. – Christopher Schultz – 2019-01-20T18:10:32.190

7

Since i am not that well versed in this topic, my use of "server" just covers whatever entity might record/watch/save said activity.

While the HTTP server doesn't see the canceled download, there may be Javascript code on the page that monitors such events.

Javascript has event handlers that can be used to detect a right click on the image, and it is quite likely that one could monitor other mouse movements to guess at what choice you make from the popup menu. After that, the script can easily send the information to server immediately, or store it in local browser storage and send it later.

In the specific case of Google Image search, the Javascript on that page does have multiple handlers listening to the mouse events. However the code is obfuscated so it is not easy to tell what kind of monitoring it does.

jpa

Posted 2019-01-13T08:52:56.583

Reputation: 201

1"Save Target As" will usually contact the server to get the file name, type, size. Possibly with a HEAD HTTP request rather than a GET. – Ben Voigt – 2019-01-14T19:53:58.767

@BenVoigt there is a big difference between "Save Target As" and "save image as". One is for links, the other for images which are already visible and therefore have been downloaded before. – Josef says Reinstate Monica – 2019-01-15T11:52:07.303

@Josef: True, but I see nothing in the question that indicates OP wants to limit himself to content already in cache. In fact I see a strong suggestion to the contrary, in the phrase 'cancel before anything gets saved'. – Ben Voigt – 2019-01-15T14:20:38.717

6

This is server dependent.

The server would be able to register when the download is started (think about it, it must know because it suggests a name).

The server could also keep track of how many bytes were transferred and if/when the connection closed, which can show if the diwnload completed.

There are also other possibilities like resumed dowloads and multithreaded downloads - but again, the server could know and record all this.

Note that in the particular case of right clicking and downloading an image it is possible that the download would not register as a download at all due to client side caching.

davidgo

Posted 2019-01-13T08:52:56.583

Reputation: 49 152

The server does not suggest a name. No additional network requests were made when I right click on your avatar and selected "save image as" – DavidPostill – 2019-01-13T12:17:34.367

9@DavidPostill Depends on how the download is initiated. If you follow a link or redirect to a resource, and the server responds with Content-Disposition: attachment; filename="…" so that the browser shows the download prompt, then even when cancelling the download the server will know about the request - and probably can even distinguish that the download was aborted. – Bergi – 2019-01-13T13:53:25.203

4

If ... you cancel before anything gets saved, does the "server" notice/record this as a download?

A remote server should not notice any download activity as no download has been started.

However, a remote server knows that you have already downloaded the image in order to display it in your browser ... and a copy will be in your browser cache ...

Any "entity" monitoring your local machine directly could record something regarding that activity.

DavidPostill

Posted 2019-01-13T08:52:56.583

Reputation: 118 938

2"Save as..." will make a request, won't it? Browser has to know what name to suggest, for one. The url migh be just plain /download but the Content-Disposition header will contain the actual file name. – data – 2019-01-13T12:11:40.993

1@data No. The name is in the html of the downloaded page. – DavidPostill – 2019-01-13T12:13:35.640

1Do note that some browsers such as Chrome eagerly pre-download and cache URLs that appear in the webpage you're visiting. – Tobia Tesan – 2019-01-13T13:33:23.753

3@DavidPostill You are mistaken. The name can be overridden by the Content-Disposition header (already mentioned to you a couple of times), meaning a request must be made first. In addition, browsers can and do begin the payload download before you've chosen a destination directory. – Lightness Races with Monica – 2019-01-13T22:33:51.680

6Every web browser I know of will start the download as soon as you click the link, and has done so for at least the past twenty years. They won't wait for you to pick a filename -- they'll save to a temporary file (or memory) and re-name it once you hit "OK". – Mark – 2019-01-14T00:45:34.153

Plus, what's more troubling is that the server infrastructure will not only have noticed that they sent you a random picture to display, but a picture which you explicitly requested using such-and-such keywords. The fact whether they know that you saved it to disk is actually a lesser concern. – Damon – 2019-01-14T10:56:55.950