[whatwg] element "img" with HTTP POST method

On Thu, 2010-12-09 at 11:01 -0800, Adam Barth wrote:

> We've seen use cases for a similar feature for iframes and hyperlinks.
>  For example:
> 
> <a href="/logout" post-data>Logout</a>
> 
> would be more semantically correct that just <a
> href="/logout">Logout</a> because it would generate a POST instead of
> a GET.
> 
> Adam
> 
> 
> On Thu, Dec 9, 2010 at 10:59 AM, Martin Janecke <whatwg.org at kaor.in> wrote:
> > Hi all,
> >
> > What is your opinion on enabling the HTTP POST method for the img element? The motivation behind this is that there are services which generate images automatically based on parameters given -- nowadays provided as query string in a GET request -- for inclusion in web pages. I've listed examples below. However, these query strings can get really long and it seems to me that the HTTP POST method would be more appropriate than the GET method for such services. Not only because it would better match the intended use of these methods (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9), but also for practical reasons: URLs in GET requests are (inconsistently) limited in length by browsers and server software, which limits these services (inconsistently). And long URLs bloat server logs.
> >
> > This could be implemented with an optional attribute, e.g. "post-data". The client would request the source using the POST method if the attribute is present and send the attribute's value as the request's message body.
> >
> > Martin
> >
> > PS: This doesn't necessarily need to be restricted to img elements. If you encountered use cases for other elements that embed content, feel free to add them.
> >
> >
> > === Example/Use Cases ===
> >
> > (1) MimeTeX and MathTeX are used to display mathematical formulae in web pages. This is often used in science forums. Info:
> >
> > http://www.forkosh.com/mathtex.html
> > http://www.forkosh.com/mimetex.html
> >
> > Current use in web pages:
> >
> > <img src="http://www.forkosh.dreamhost.com/mathtex.cgi?\begin{align}%0D%0A\Gamma(z)%20%26%3D%20\lim_{n\to\infty}\frac{n!\;n^z}{z\;(z%2B1)\cdots(z%2Bn)}%20%3D%20\frac{1}{z}\prod_{n%3D1}^\infty\frac{\left(1%2B\frac{1}{n}\right)^z}{1%2B\frac{z}{n}}%20\\%0D%0A\Gamma(z)%20%26%3D%20\frac{e^{-\gamma%20z}}{z}\prod_{n%3D1}^\infty\left(1%2B\frac{z}{n}\right)^{-1}e^{z/n}%0D%0A\end{align}" alt="gamma function definition">
> >
> > Possible future use:
> >
> > <img src="http://www.forkosh.dreamhost.com/mathtex.cgi" post-data="\begin{align}%0D%0A\Gamma(z)%20%26%3D%20\lim_{n\to\infty}\frac{n!\;n^z}{z\;(z%2B1)\cdots(z%2Bn)}%20%3D%20\frac{1}{z}\prod_{n%3D1}^\infty\frac{\left(1%2B\frac{1}{n}\right)^z}{1%2B\frac{z}{n}}%20\\%0D%0A\Gamma(z)%20%26%3D%20\frac{e^{-\gamma%20z}}{z}\prod_{n%3D1}^\infty\left(1%2B\frac{z}{n}\right)^{-1}e^{z/n}%0D%0A\end{align}" alt="gamma function definition">
> >
> >
> > (2) QR-Code generators encode texts or URLs in a way that can be easily read by devices such as cell phones with built-in cameras. Info and generator:
> >
> > http://qrcode.kaywa.com/
> >
> > Current use in web pages:
> >
> > <img src="http://qrcode.kaywa.com/img.php?s=8&d=Ah%2C%20distinctly%20I%20remember%20it%20was%20in%20the%20bleak%20December%2C%0D%0AAnd%20each%20separate%20dying%20ember%20wrought%20its%20ghost%20upon%20the%20floor." alt="qrcode">
> >
> > Possible future use:
> >
> > <img src="http://qrcode.kaywa.com/img.php" post-data="s=8&d=Ah%2C%20distinctly%20I%20remember%20it%20was%20in%20the%20bleak%20December%2C%0D%0AAnd%20each%20separate%20dying%20ember%20wrought%20its%20ghost%20upon%20the%20floor." alt="qrcode">
> >
> >



It makes sense in the case of a link like that, as it is changing some
state on the server, which is what POST data was intended to do. If
images are called with POST data, then that would prevent them being
cached, which can be done with GET as GET isn't meant to change any
state on the server, meaning potentially a lot more traffic to save some
log files from getting a bit big.

Thanks,
Ash
http://www.ashleysheridan.co.uk


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20101209/130d82d7/attachment.htm>

Received on Thursday, 9 December 2010 11:04:51 UTC