Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  Content-Encoding: gzip for rendered html

Guest
Posted: Sat Jan 05, 2008 7:22 pm Reply with quote
Guest
I got this working for just a yaws appmod without erlyweb. I return
to yaws:

{ok, ZippedData} = yaws_zlib:gzip(list_to_binary(Whatever))
[{html, Zipped},
{header, {"Content-Encoding", "gzip"}} ].

but I'm having trouble doing this for an erlyweb app.

I was going to use the {response, Elems} feature to send back the
Content-Encoding header, but how I use yaws_zlib:gzip to zip up the
final rendered html?



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Thu Jan 10, 2008 7:34 am Reply with quote
Guest
Hmm... right now there is no way of doing it, but it would be pretty
easy to enable it. Currently, ErlyWeb ignores the return value of
after_render controller hooks. All we need to do is make ErlyWeb take
this value and return it instead of the pre-hook rendered data. Then,
in your html_container component, you could implement this hook and
return

{response, [{html, Zipped},
{header, {"Content-Encoding", "gzip"}}]}

It would be an easy fix but it may break existing after_render hooks
that already return something other than the rendered iolist.

Yariv

On Jan 5, 2008 11:21 AM, andrewfromfly <oneone@gmail.com> wrote:
>
> I got this working for just a yaws appmod without erlyweb. I return
> to yaws:
>
> {ok, ZippedData} = yaws_zlib:gzip(list_to_binary(Whatever))
> [{html, Zipped},
> {header, {"Content-Encoding", "gzip"}} ].
>
> but I'm having trouble doing this for an erlyweb app.
>
> I was going to use the {response, Elems} feature to send back the
> Content-Encoding header, but how I use yaws_zlib:gzip to zip up the
> final rendered html?
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Thu Jan 10, 2008 2:55 pm Reply with quote
Guest
It's a really important feature I think. I can't switch over my sites
to erly unless I can compress the HTML on the fly. Otherwise my
bandwidth bill would kill me.

On Jan 9, 11:33
Guest
Posted: Fri Jan 11, 2008 2:36 am Reply with quote
Guest
No problem -- I'll add it. It should be simple.

On Jan 10, 2008 6:54 AM, andrewfromfly <oneone@gmail.com> wrote:
>
> It's a really important feature I think. I can't switch over my sites
> to erly unless I can compress the HTML on the fly. Otherwise my
> bandwidth bill would kill me.
>
> On Jan 9, 11:33pm, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> > Hmm... right now there is no way of doing it, but it would be pretty
> > easy to enable it. Currently, ErlyWeb ignores the return value of
> > after_render controller hooks. All we need to do is make ErlyWeb take
> > this value and return it instead of the pre-hook rendered data. Then,
> > in your html_container component, you could implement this hook and
> > return
> >
> > {response, [{html, Zipped},
> > {header, {"Content-Encoding", "gzip"}}]}
> >
> > It would be an easy fix but it may break existing after_render hooks
> > that already return something other than the rendered iolist.
> >
> > Yariv
> >
>
> > On Jan 5, 2008 11:21 AM, andrewfromfly <one...@gmail.com> wrote:
> >
> >
> >
> > > I got this working for just a yaws appmod without erlyweb. I return
> > > to yaws:
> >
> > > {ok, ZippedData} = yaws_zlib:gzip(list_to_binary(Whatever))
> > > [{html, Zipped},
> > > {header, {"Content-Encoding", "gzip"}} ].
> >
> > > but I'm having trouble doing this for an erlyweb app.
> >
> > > I was going to use the {response, Elems} feature to send back the
> > > Content-Encoding header, but how I use yaws_zlib:gzip to zip up the
> > > final rendered html?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum