Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Cookies and Redirected URLs

From: reboler::bol::com::br at: 24-Dec-2003 22:35

Thanks Romano, I'll try here. Maybe if I pass you the URL, you can try to read it. That's what I need to know.. How can I read this URL? site: {http://www.scirus.com/sciruslink/?src=sd&url=http% 3A%2F%2Fwww.sciencedirect.com%2Fscience%3F_ob% 3DGatewayURL%26_origin%3DScienceSearch%26_method% 3DcitationSearch%26_piikey%3DS0031320302001012% 26_version%3D1%26_returnURL%3Dhttp%253A%252F% 252Fwww.scirus.com%253Ffrm%253Dsimple%2526query_1% 253Dmetadata%2526dsmem%253Don%26md5% 3D56a0932880eb7edb63c4e72a9a65af23} site: to-url site read site If you try it using IE you can read the page, but doing with rebol, it returns an error. Maybe you can read this URL. Thanks for your attention, Best Regards --DJ
> AFAIK you must rewrite or change the http handler. > > This is a very fast patch example to use like a startin
g point. Try it: i did
> not test it. Pay attention to email lines break. > > Search the response-
actions block to see the little changes. Perhaps you do
> not need to patch the 300 return code. > > You must redirect manually. > > rebol [] > > system/schemes/HTTP/handler/open: func [ > port "the port to open" > /local http-packet http-command response-
actions success error
> response-line > target headers http-version post-
data result generic-proxy? sub-protocol
> build-port send-and-check create-request > ] bind [ > port/locals: make object! [list: copy [] headers: n
one]
> generic-
proxy?: all [port/proxy/type = 'generic not none? port/pr oxy/host]
> build-port: func [] [ > sub-
protocol: either port/scheme = 'https ['ssl] ['tcp]
> open-proto/sub-protocol/generic port sub-
protocol
> port/url: rejoin [lowercase to-
string port/scheme "://" port/host
> either port/port-id <> 80 [join #":" port/port-
id] [copy ""] slash]
> if found? port/path [append port/url port/path] > if found? port/target [append port/url port/tar
get]
> if sub-protocol = 'ssl [ > if generic-proxy? [ > HTTP-Get-Header: make object! [ > Host: join port/host any [all [port
/port-id (port/port-id
> <> 80) join #":" port/port-id] #] > ] > user: get in port/proxy 'user > pass: get in port/proxy 'pass > if string? :user [ > HTTP-Get-Header: make HTTP-Get-
Header [
> Proxy-
Authorization: join "Basic " enbase join user
> [#":" pass] > ] > ] > http-packet: reform ["CONNECT" HTTP-
Get-Header/Host
> "HTTP/1.1^/"] > append http-packet net-
utils/export HTTP-Get-Header
> append http-packet "^/" > net-utils/net-log http-packet > insert port/sub-port http-packet > continue-post/tunnel > ] > system/words/set-modes port/sub-
port [secure: true]
> ] > ] > http-command: "GET" > create-request: func [/local target user pass u] [ > HTTP-Get-Header: make object! [ > Accept: "*/*" > Connection: "close" > User-
Agent: get in get in system/schemes port/scheme 'user- agent
> Host: join port/host any [all [port/port-
id (port/port-id <> 80)
> join #":" port/port-id] #] > ] > if all [block? port/state/custom post-
data: select port/state/custom
> 'header block? post-data] [ > HTTP-Get-Header: make HTTP-Get-Header post-
data
> ] > HTTP-Header: make object! [ > Date: Server: Last-Modified: Accept-
Ranges: Content-Encoding:
> Content-Type: > Content-
Length: Location: Expires: Referer: Connection:
> Authorization: none > ] > http-version: "HTTP/1.0^/" > all [port/user port/pass HTTP-Get-
Header: make HTTP-Get-Header
> [Authorization: join "Basic " enbase join port/user [#"
:" port/pass]]]
> user: get in port/proxy 'user > pass: get in port/proxy 'pass > if all [generic-proxy? string? :user] [ > HTTP-Get-Header: make HTTP-Get-Header [ > Proxy-
Authorization: join "Basic " enbase join user [#":"
> pass] > ] > ] > if port/state/index > 0 [ > http-version: "HTTP/1.1^/" > HTTP-Get-Header: make HTTP-Get-Header [ > Range: rejoin ["bytes=" port/state/inde
x "-"]
> ] > ] > target: next mold to-
file join (join "/" either found? port/path
> [port/path] [""]) either found? port/target [port/targe
t] [""]
> post-data: none > if all [block? port/state/custom post-
data: find port/state/custom
> 'post post-data/2] [ > http-command: "POST" > HTTP-Get-Header: make HTTP-Get-
Header append [
> Referer: either find port/url #"?" [hea
d clear find copy
> port/url #"?"] [port/url] > Content-Type: "application/x-www-form-
urlencoded"
> Content-Length: length? post-data/2 > ] either block? post-data/3 [post-
data/3] [[]]
> post-data: post-data/2 > ] > http-packet: reform [http-
command either generic-proxy? [port/url]
> [target] http-version] > append http-packet net-utils/export HTTP-Get-
Header
> ] > send-and-check: func [] [ > net-utils/net-log http-packet > insert port/sub-port http-packet > if post-data [write-io port/sub-port post-
data length? post-data]
> continue-post > ] > continue-post: func [/tunnel] [ > response-line: system/words/pick port/sub-
port 1
> net-utils/net-log response-line > either none? response-line [do error] [ > either none? result: select either tunnel [
tunnel-actions]
> [response-actions] > response-code: to-
integer second parse response-line none [
> do error] [ > do get result] > ] > ] > tunnel-actions: [ > 200 tunnel-success > ] > response-actions: [ > 100 continue-post > 200 success > 201 success > 204 success > 206 success > 300 success ;forward ;patched -Romano > 301 success ;forward ;patched -Romano > 302 success ;forward ;patched -Romano > 304 success > 407 proxyauth > ] > tunnel-success: [ > while [(line: pick port/sub-
port 1) <> ""] [net-log line]
> ] > success: [ > headers: make string! 500 > while [(line: pick port/sub-
port 1) <> ""] [append headers join line
> "^/"] > port/locals/headers: headers: Parse-
Header HTTP-Header headers
> port/size: 0 > if querying [if headers/Content-
Length [port/size: load
> headers/Content-Length]] > if error? try [port/date: parse-header-
date headers/Last-Modified]
> [port/date: none] > port/status: 'file > ] > error: [ > system/words/close port/sub-port > net-
error reform ["Error. Target url:" port/url "could not b e
> retrieved. Server response:" response-line] > ] > forward: [ > page: copy "" > while [(str: pick port/sub-
port 1) <> ""] [append page reduce [str
> newline]] > headers: Parse-Header HTTP-Header page > insert port/locals/list port/url > either found? headers/Location [ > either any [find/match headers/Location "ht
tp://" find/match
> headers/Location "https://"] [ > port/path: port/target: port/port-
id: none
> net-utils/URL-Parser/parse-url/set-
scheme port to-url
> port/url: headers/Location > if not port/port-id: any [port/port-
id all [in system/schemes
> port/scheme get in get in system/schemes port/scheme 'p
ort-id]] [
> net-
error reform ["HTTP forwarding error: Scheme"
> port/scheme "for URL" port/url "not supported in this R
EBOL."]
> ] > ] [ > either (first headers/Location) = slash
[port/path: none
> remove headers/Location] [either port/path [insert port
/path "/"] [port/path:
> copy "/"]] > port/target: headers/Location > port/url: rejoin [lowercase to-
string port/scheme "://"
> port/host either port/path [port/path] [""] either port
/target [port/target]
> [""]] > ] > if find/case port/locals/list port/url [net
-error reform ["Error.
> Target url:" port/url {could not be retrieved. Circula
r forwarding
> detected}]] > system/words/close port/sub-port > build-port > create-request > send-and-check > ] [ > do error] > ] > proxyauth: [ > system/words/close port/sub-port > either all [generic-
proxy? (not string? get in port/proxy 'user)] [
> port/proxy/user: system/schemes/http/proxy/
user: port/proxy/user
> port/proxy/pass: system/schemes/http/proxy/
pass: port/proxy/pass
> if not error? try [result: get in system/sc
hemes 'https] [
> result/proxy/user: port/proxy/user > result/proxy/pass: port/proxy/pass > ] > ] [ > net-
error reform ["Error. Target url:" port/url {could not be
> retrieved: Proxy authentication denied}] > ] > build-port > create-request > send-and-check > ] > build-port > create-request > send-and-check > ] in system/schemes/HTTP/handler 'open > > --- > Ciao > Romano > > ----- Original Message ----- > From: "Reboler" <[reboler--bol--com--br]> > To: <[rebol-list--rebol--com]> > Sent: Saturday, September 06, 2003 4:23 PM > Subject: [REBOL] Re: Cookies and Redirected URLs > > > > > Thanks Steffen, I just fixed my date-settings. ok. > > > > ----- Original Message ----- > > From: "Steffen Kahr Pedersen" <[eskape--tdcadsl--dk]> > > To: <[rebol-list--rebol--com]> > > Sent: Saturday, September 06, 2003 11:01 AM > > Subject: [REBOL] Re: Cookies and Redirected URLs > > > > > > > > > > This is NOT related to Rebol :-) > > > > But my questions has to do with rebol. I just want t
o know how the
> > parameters avoiding the redirecting. I can use the ht
tp-tools.r to do rest,
> > just it. > > > > Any tips? > > > > Thanks in advance for your attention, > > > > Regards, > > > > --DJ > > > > > > > > Your date-setting seems to be wrong. > > > > > > Regards Steffen (of Denmark) > > > > > > > > > ----- Original Message ----- > > > From: "Reboler" <[reboler--bol--com--br]> > > > To: <[rebol-list--rebol--com]> > > > Sent: Sunday, September 21, 2003 8:30 PM > > > Subject: [REBOL] Re: Cookies and Redirected URLs > > > > > > > > > > > > > > Sorry, I just forget to ask. > > > > > > > > Is there any way to disable the url redirection ?
Maybe I will have to
> > set > > > > read each URL indivually, setting the cookies for
each, or/and I must
> > send > > > > all the cookies that's been set until the final U
RL..
> > > > > > > > Thanks for your nicely attention, I know you're v
ery busy, I really
> > > > apologize myself for my questions.. I know it's v
ery basic, but we start
> > > > from basic to advanced, don't you think ? > > > > > > > > Best Regards.. > > > > > > > > --Dj. > > > > > > > > > > > > ----- Original Message ----- > > > > From: "Reboler" <[reboler--bol--com--br]> > > > > To: <[rebol-list--rebol--com]> > > > > Sent: Sunday, September 21, 2003 3:17 PM > > > > Subject: [REBOL] Cookies and Redirected URLs > > > > > > > > > > > > > > > > > > Hi Folks!, > > > > > > > > > > Sorry to bother you, but I'm really needing of
your guru advices.
> > > > > How can I read all the cookies set by the serve
r?
> > > > > > > > > > I'm reading an URL that sets a cookie, then red
irects to another URL,
> > set > > > > > another cookie, then redirects to another URL a
nd set another cookie,
> > this > > > > > process takes five steps. > > > > > I just can read the first URL, because after I
set the cookie it
> > redirects > > > > > to another url, then I receive the error 404. > > > > > > > > > > I've also tried: > > > > > > > > > > port: open http://www.somesite.com/?
xas&fsnf«NDF;;;
> > > > > headers: port/locals/headers > > > > > urls: port/locals/list > > > > > if empty? urls [ urls: port/url ] > > > > > close port > > > > > > > > > > If I could get all the new urls and the cookies
great, but it's not
> > > > working. > > > > > Any tips? > > > > > What about RebOldes' cookie-daemon? > > > > > > > > > > Thanks in advance, > > > > > > > > > > Best Regards, > > > > > > > > > > --DJ > > > > > > > > > > > > > > > > > > > > -- > > > > > To unsubscribe from this list, just send an ema
il to
> > > > > rebol-
[request--rebol--com] with unsubscribe as the subject.
> > > > > > > > > > > > > > > > > > > > > > -- > > > > To unsubscribe from this list, just send an email
to
> > > > rebol-
[request--rebol--com] with unsubscribe as the subject.
> > > > > > > > > > > > > > -- > > > To unsubscribe from this list, just send an email t
o
> > > rebol-
[request--rebol--com] with unsubscribe as the subject.
> > > > > > > > > -- > > To unsubscribe from this list, just send an email to > > rebol-
[request--rebol--com] with unsubscribe as the subject.
> > > > -- > To unsubscribe from this list, just send an email to > rebol-
[request--rebol--com] with unsubscribe as the subject.
>
__________________________________________________________________________ Acabe com aquelas janelinhas que pulam na sua tela. AntiPop-up UOL - … grŠtis!