[whatwg] element "img" with HTTP POST method

Martin Janecke whatwg.org at kaor.in
Thu Dec 9 10:59:02 PST 2010


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">



More information about the whatwg mailing list