It seems that AsyncHead may be returning the wrong response code in the scenario below where a URL redirects to AWS S3. Curl responds with 302, which matches the Status header, but Roku (2.9 <<correction 3.0 build 2206>> :!: ) seems to return 403 even though the status header shows 302.
Sub AsyncHeadTest()
' curl -X HEAD -v
http://posterous.com/getfile/files.post ... ne_161.jpg' * About to connect() to posterous.com port 80 (#0)
' * Trying 184.106.20.99... connected
' * Connected to posterous.com (184.106.20.99) port 80 (#0)
' > HEAD /getfile/files.posterous.com/ggmiller/hupoWXCzTYANdgdA5jwUwcZ9VPENsteT4H1TGTnyN44QSbFWWGGidVQ0Ylls/ystone_161.jpg HTTP/1.1
' > User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
' > Host: posterous.com
' > Accept: */*
' >
' < HTTP/1.1 302 Found
' < Server: nginx/0.7.65
' < Date: Thu, 23 Jun 2011 04:00:14 GMT
' < Content-Type: text/html
' < Connection: close
' < Status: 302 Found
' < Location:
http://s3.amazonaws.com/files.posterous ... nnmpjus%3D' < Content-Length: 0
' <
' * Closing connection #0
transfer = CreateObject("roUrlTransfer")
port = CreateObject("roMessagePort")
print "Transfer identity:" + Stri(transfer.GetIdentity())
transfer.SetPort(port)
transfer.SetUrl("http://posterous.com/getfile/files.posterous.com/ggmiller/hupoWXCzTYANdgdA5jwUwcZ9VPENsteT4H1TGTnyN44QSbFWWGGidVQ0Ylls/ystone_161.jpg")
transfer.AsyncHead()
msg = wait(0, port)
if type(msg) = "roUrlEvent" then
code = msg.GetResponseCode()
print "HTTP Response Code: " + Stri(code)
print "Identity:" + Stri(msg.GetSourceIdentity())
headers = msg.GetResponseHeaders()
for each header in headers
print header + ":" + headers[header]
next
end if
'Transfer identity: 957483920
'HTTP Response Code: 403
'Identity: 957483920
'connection:close
'location:http://s3.amazonaws.com/files.posterous.com/ggmiller/hupoWXCzTYANdgdA5jwUwcZ9VPENsteT4H1TGTnyN44QSbFWWGGidVQ0Ylls/ystone_161.jpg?AWSAccessKeyId=AKIAJFZAE65UYRT34AOQ&Expires=1308804634&Signature=7Ln8iFYrOu992vVKupNNVQAmgzc%3D
'status:302 Found
'date:Thu, 23 Jun 2011 04:45:34 GMT
'content-length:0
'content-type:text/html
'server:nginx/0.7.65
End Sub