Author: bklaas
Date: Fri Oct 29 07:53:41 2010
New Revision: 9206
URL: http://svn.slimdevices.com/jive?rev=9206&view=rev
Log:
r40...@daddymac (orig r9200): adrian | 2010-10-22 15:05:02 -0500
Bug: N/A
Description: add http redirect support for GET
r40...@daddymac (orig r9205): bklaas | 2010-10-29 09:53:28 -0500
r40...@daddymac (orig r9203): bklaas | 2010-10-26 13:16:14 -0500
Bug: n/a
Description: make track title widget use all available space for height, so
tall chars like Ö scroll properly
Modified:
7.6/branches/new-setup/ (props changed)
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/RequestHttp.lua
Propchange: 7.6/branches/new-setup/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Oct 29 07:53:41 2010
@@ -13,8 +13,8 @@
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-skin:4552
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/new-alsa:6567
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8423
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:9195
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.6/trunk:9197
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:9203
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.6/trunk:9205
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378
Modified:
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua?rev=9206&r1=9205&r2=9206&view=diff
==============================================================================
---
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
(original)
+++
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
Fri Oct 29 07:53:41 2010
@@ -2838,6 +2838,7 @@
h = 32,
nptrack = {
w = screenWidth - _tracklayout.x - 10,
+ h = WH_FILL,
align = _tracklayout.align,
lineHeight = _tracklayout.lineHeight,
fg = _tracklayout.fg,
Modified:
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/RequestHttp.lua
URL:
http://svn.slimdevices.com/jive/7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/RequestHttp.lua?rev=9206&r1=9205&r2=9206&view=diff
==============================================================================
---
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/RequestHttp.lua
(original)
+++
7.6/branches/new-setup/squeezeplay/src/squeezeplay/share/jive/net/RequestHttp.lua
Fri Oct 29 07:53:41 2010
@@ -49,6 +49,9 @@
local Task = require("jive.ui.Task")
local log = require("jive.utils.log").logger("net.http")
+
+local jnt = jnt
+local jive = jive
-- our class
module(..., oo.class)
@@ -178,6 +181,8 @@
["sink"] = sink,
["stream"] = stream,
},
+ -- stash options in case of redirect
+ options = options,
})
end
@@ -333,10 +338,11 @@
-- abort if we have no sink
if sink then
- -- the HTTP layer has read any data coming with a 404, but we
do not care
- -- only send data back in case of 200!
local code, err = self:t_getResponseStatus()
+
+ -- handle 200 OK
if code == 200 then
+
if self.t_httpResponse.stream then
sink(data, nil, self)
else
@@ -345,6 +351,50 @@
sink(nil, nil, self)
end
end
+
+ -- handle redirects
+ elseif (code == 301 or code == 302 or code == 307) and
self.t_httpRequest.method == 'GET' and
+ (not self.redirect or self.redirect < 5) then
+
+ local redirectUrl =
self.t_httpResponse.headers["Location"]
+ log:info(code, " redirect: ", redirectUrl)
+
+ -- recreate headers and parsed uri
+ local defaults = {
+ host = "",
+ port = 80,
+ path = "/",
+ scheme = "http"
+ }
+ local parsed = url.parse(redirectUrl, defaults)
+
+ local defHeaders = {}
+ if self.options and self.options.headers then
+ for k, v in pairs(self.options.headers) do
+ defHeaders[k] = v
+ end
+ end
+ if parsed.host ~= "" then
+ defHeaders["Host"] = parsed.host
+ if parsed.port ~= 80 then
+ defHeaders["Host"] = defHeaders["Host"]
.. ':' .. parsed.port
+ end
+ end
+
+ self.redirect = (self.redirect or 0) + 1
+
+ self.t_httpRequest.headers = defHeaders
+ self.t_httpRequest.uri = parsed
+
+ self.t_httpResponse.statusCode = false
+ self.t_httpResponse.statusLine = false
+ self.t_httpResponse.headers = false
+ self.t_httpResponse.body = ""
+ self.t_httpResponse.done = false
+
+ jive.net.SocketHttp(jnt, parsed.host, parsed.port,
url):fetch(self)
+
+ -- handle errors
else
if not err then
err = "HTTP request failed with code" .. code
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins