Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30042

Re: Read binary file

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Read binary file
Date 2016-03-18 00:43 +0100
Organization albasani.net
Message-ID <ncfff1$64e$1@news.albasani.net> (permalink)
References (2 earlier) <ncdmil$1ser$1@gioia.aioe.org> <2237637.9AE1fihV9u@PointedEars.de> <nceuqd$756$1@news.albasani.net> <6005521.MME42bj82n@PointedEars.de> <ncf81p$mqu$1@gioia.aioe.org>

Show all headers | View raw


Herbert Kleebauer wrote:
> On 17.03.2016 21:43, Thomas 'PointedEars' Lahn wrote:
>> Stefan Weiss wrote:
>>> So, now that the copyright situation has been explained, what's the
>>> trivial solution?
> 
>> Transparent HTTP proxying with mod_rewrite, mod_proxy, mod_proxy_http & 
> 
> That's neither a trivial solution nor a solution at all.

Right, that doesn't really solve the problem. It makes server B fetch
the image from server A, which is what you wanted to avoid in the first
place.

Proxying (or even caching) foreign content works, but it also changes
the setup and possibly the legal situation. I'm not a lawyer, so I can't
comment on how this would affect your project.

And no, I wouldn't see that as a "trivial" solution either.

> The user only gets the the url of the original picture and the url of
> the modifcation file. The user doesn't use a proxy.

The idea was that your server would act as a proxy for the remote
original images. From the POV of the user (and the browser), the images
would appear to originate from your server, and the same-origin policy
would not pose a problem.

> I can understand why a server doesn't deliver the picture if it
> doesn't like a referer header, but I can't understand the
> restrictions by the browser. I see it as a fundamental function to
> read any accessible file on any web server into a javascript array
> (even by removing the referer header if necessary).

It's not JavaScript that imposes these restrictions, it's the
environment (the browser). Browsers had to adopt this policy to protect
users from scripts on malicious websites: without it, any script on any
site would have a form of remote control over the browser - including
requesting and processing data from another site you're currently logged
into, or posting to the site with your credentials (cookies).
(By the way, scripts can still send GET/POST requests to off-origin
sites, but they typically cannot access the response.)

The unfortunate side-effect of this protection is that some legitimate
requests to off-origin sources are now also blocked by default.

I don't see any clean way around this in your case, unless you can
convince the original image hosts to opt in to CORS. Other workarounds
include the proxying described by TL, browser extensions, and user
scripts (for example, GreaseMonkey scripts can use GM_xmlhttpRequest()
which isn't restricted to the same origin).

>>>> There is no javascript.
>>> ???????????
>> See the reference to the “ES Matrix” in my signature.
> 
> <html><head><title>jpg</title>
> <script type="text/javascript">
[...]
> It is declared as javascript and therefore it is by definition javascript.
> Whether it is processed by a javascript, JavaScript or a ECMAScript
> interpreter doesn't matter, by definition the code itself is javascript
> code.

Please just ignore the "there is no javascript" comment.
Thomas Lahn has a stick up his ass about the spelling of JavaScript;
this has caused endless flames and debates over the years (see
<https://goo.gl/W4CQaX> if you're feeling masochistic). The less
attention we pay to it, the better.


- stefan

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Read binary file Herbert Kleebauer <klee@unibwm.de> - 2016-03-16 23:20 +0100
  Re: Read binary file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-17 01:04 +0100
    Re: Read binary file Stefan Weiss <krewecherl@gmail.com> - 2016-03-17 02:34 +0100
      Re: Read binary file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-17 07:56 +0100
    Re: Read binary file Herbert Kleebauer <klee@unibwm.de> - 2016-03-17 08:31 +0100
      Re: Read binary file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-17 19:10 +0100
        Re: Read binary file Stefan Weiss <krewecherl@gmail.com> - 2016-03-17 19:59 +0100
          Re: Read binary file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-17 21:43 +0100
            Re: Read binary file Herbert Kleebauer <klee@unibwm.de> - 2016-03-17 22:36 +0100
              Re: Read binary file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-17 23:15 +0100
              Re: Read binary file Stefan Weiss <krewecherl@gmail.com> - 2016-03-18 00:43 +0100
                Re: Read binary file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-18 17:22 +0100
                Re: Read binary file Herbert Kleebauer <klee@unibwm.de> - 2016-03-18 21:14 +0100
                Re: Read binary file Matthias Wiehl <mw@kwarg.de> - 2016-03-19 00:02 +0100
                Re: Read binary file Herbert Kleebauer <klee@unibwm.de> - 2016-03-19 08:48 +0100
                There is no javascript (was: Read binary file) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-19 13:02 +0100
                Re: There is no javascript (was: Read binary file) Mark - <nonemail@spamspamapam.net> - 2016-03-19 14:33 +0000
                Re: There is no javascript (was: Read binary file) Andrew Poulos <ap_prog@hotmail.com> - 2016-03-20 14:30 +1100
                Re: There is no javascript (was: Read binary file) Mark - <nonemail@spamspamapam.net> - 2016-03-20 13:07 +0000
                Re: There is no javascript (was: Read binary file) John Harris <niam@jghnorth.org.uk.invalid> - 2016-03-20 10:39 +0000
                Re: There is no javascript (was: Read binary file) John Harris <niam@jghnorth.org.uk.invalid> - 2016-03-20 11:19 +0000
                Re: There is no javascript (was: Read binary file) Philip Herlihy <thiswillbounceback@you.com> - 2016-03-21 17:06 +0000
                Re: Read binary file Scott Sauyet <scott.sauyet@gmail.com> - 2016-03-22 17:18 -0700
                Re: Read binary file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-23 10:12 +0100
                Re: Read binary file John Harris <niam@jghnorth.org.uk.invalid> - 2016-03-23 16:27 +0000
                Re: Read binary file Herbert Kleebauer <klee@unibwm.de> - 2016-03-24 10:41 +0100
                Re: Read binary file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-24 11:14 +0100
                Re: Read binary file John Harris <niam@jghnorth.org.uk.invalid> - 2016-03-24 11:41 +0000
                Re: Read binary file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-24 13:36 +0100
                Re: Read binary file John Harris <niam@jghnorth.org.uk.invalid> - 2016-03-25 10:07 +0000
                Re: Read binary file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-25 11:28 +0100
                Re: Read binary file "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-03-24 11:31 +0100
                Re: Read binary file Herbert Kleebauer <klee@unibwm.de> - 2016-03-24 12:34 +0100
                Re: Read binary file "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-03-24 17:15 +0100
                Re: Read binary file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-24 11:33 +0000
                Re: Read binary file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-24 11:05 +0100
                Re: Read binary file Scott Sauyet <scott.sauyet@gmail.com> - 2016-03-23 20:16 -0700
                Re: Read binary file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-24 10:36 +0100
                Re: Read binary file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-24 11:18 +0100
                Re: Read binary file Scott Sauyet <scott.sauyet@gmail.com> - 2016-03-27 10:22 -0700
                Re: Read binary file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-28 00:18 +0200
                Re: Read binary file Scott Sauyet <scott.sauyet@gmail.com> - 2016-03-28 05:35 -0700
                Re: Read binary file "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-29 00:53 +0200
  Re: Read binary file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-17 02:23 +0100
  Re: Read binary file Herbert Kleebauer <klee@unibwm.de> - 2016-03-17 08:42 +0100
  Re: Read binary file Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-03-20 22:03 +0000

csiph-web