You can try with latest source and Lua:
1. Create a file in a directory mongoose/build with a name "foo.mg.lua" and
following content:
local site = mg.request_info.query_string or 'cesanta.com'
local sock = connect(site, 80)
if sock then
sock:send('GET / HTTP/1.0\r\n\r\n')
local x, reply = nil, ''
repeat x = sock:recv() if x then reply = reply .. x end until x == nil
sock:close()
mg.write(reply)
end
$ cd mongoose/build && git pull
$ make mongoose-lua && ./mongoose-lua
Now, browse on http://127.0.0.1:8080/x.mg.lua?<domain_or_ip_address>
For example http://127.0.0.1:8080/x.mg.lua?joker.com
On Mon, Dec 23, 2013 at 6:26 PM, Stefan Reich <
[email protected]> wrote:
> Hi!
>
> Could somebody post a code snippet of how to use mg_download to forward a
> request to another server?
>
> I just want to forward the whole response I get from the other server
> verbatim to my client (everything, HTTP headers and content).
>
> Stefan
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongoose-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/mongoose-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/groups/opt_out.