HTTP header request
[1/13] from: koopmans:itr:ing:nl at: 7-Jun-2001 10:56
Hi,
I need the HTTP header that is sent back when I do a read http://whatever.com
[so I can catch some cookies that are being set]
Any ideas?
Thanks,
Maarten
[2/13] from: sterling:rebol at: 7-Jun-2001 10:28
It is stored in the port/locals object. You just have to use OPEN and
CLOSE so that you get the port reference for it:
a: open http://www.rebol.com
probe a/locals/headers
data: copy a
close a
Sterling
[3/13] from: gchiu:compkarori at: 8-Jun-2001 9:19
> a: open http://www.rebol.com
Hi Stirling,
What's happening here?
a: open http://www.hotmail.com
** User Error: Error. Target url:
http://lc3.law5.hotmail.passport.com/ppsecure/login could
not be ret
rieved. Circular forwarding detected
** Near: a: open http://www.hotmail.com
Same happens with 'read
--
Graham Chiu
[4/13] from: sterling:rebol at: 7-Jun-2001 15:11
That's a bug in the HTTP code. It's not properly changing the Host
entry in the header as it forwards. It therefore keeps getting
redirects on each read to send it to the right address and it never
responds correctly so it dies.
This will be fixed in the next minor release as well as adding a way
for you to control the outgoing HTTP headers if you so desire.
Sterling
[5/13] from: gchiu:compkarori at: 8-Jun-2001 10:46
On Thu, 7 Jun 2001 15:11:51 -0700
[sterling--rebol--com] wrote:
> as well as adding a way
> for you to control the outgoing HTTP headers if you so
> desire.
Yes!
--
Graham Chiu
[6/13] from: petr:krenzelok:trz:cz at: 8-Jun-2001 1:48
Hi Sterling,
what about slightly better support for POST method? Maybe I am just confused
or don't remember exactly what was http scheme behavior, because I used
Maarten's post solution as a base. However:
- we have to prepare all headers separately, deriving form 'tcp scheme
http-port: open/direct [
scheme: 'tcp
port-id: port-spec/port-id
timeout: port-spec/timeout
host: port-spec/host
user: port-spec/user
pass: port-spec/pass
]
... from my conversation with Scott:
The problem with header is -
scheme: 'tcp" - you simply derive from pure
tcp port, not http one. Once I changed the line to scheme: 'http, the header
WAS complete, but instead of "POST", first word used was - "GET". It seems
to me that current http scheme implementation is restricting "POST" usage to
usage of /custom refinement ...."
I also remember some earlier ally posts, using some method of
skipping/reading a part (it was specified in custom block), but it was said
it will not probably become part of official http scheme implementation. How
about this one?
btw: if we will make some changes to http protocol, how safe we are re async
http scheme which is supposed to come? Will there be many changes?
Thanks,
-pekr-
not sure anymore, but once we use open/custom url [POST "data"]
[7/13] from: sterling:rebol at: 7-Jun-2001 18:53
The POST capability works as you comment at the end:
read/custom http://site.com/cgi-bin/script.r [post "my post data"]
You ahve to form the post data yourself right now and using that
method you can only safely post data that is x-www-form-urlencoded
which is the same format of a GET request "var=value&var2=value2"
because the urlencoded header is sent by REBOL. Of course, if you're
posting to your own REBOL script or one that doesn't check that
header, you can post whatever you like.
Adding to this dialect, yo uwill be able to say:
[header [user-agent: "My user-agent field" content-type: "application/x-my-app"]]
and the sent HTTP header will include fields like this:
Accept: */*
user-agent: "My user-agent field"
content-type: "application/x-my-app"
Host: site-you-connected-to.com
You can use both the header and post requests together if you like.
Reading a part of a web page is currently possible using read/skip.
If the server supports partial downloads, you'll get it. Turn
trace/net on and do a read like that to see the headers. Read/skip
also works with FTP to support resumed downloads there also.
Sterling
[8/13] from: jchapdelaine:datachest at: 18-Jun-2001 11:36
When will we get a new CORE version that handle correctly the HTTP header
request ?
Jeannot
[9/13] from: gjones05:mail:orion at: 18-Jun-2001 11:47
From: "Jeannot Chapdelaine"
> When will we get a new CORE version that handle correctly the HTTP header
> request ?
Out of curiosity, what functionality are wishing were included?
--Scott Jones
[10/13] from: jchapdelaine:datachest at: 18-Jun-2001 13:44
Scott:
I am not talking about new functionality. This is about fixing a problem we
are getting when we try to read a redirected URL.
For instance, if you try this with "REBOL/Core 2.5.0.3.1 23-Mar-2001":
>> read http://www.csma.org
connecting to: www.csma.org
connecting to: www.cspa.org
connecting to: www.cspa.org
connecting to: www.cspa.org
connecting to: www.cspa.org
connecting to: www.cspa.org
.
.
.
...it will loop until doomsday. Why ? Well, I guess it is because this URL
has been redirected to http://www.cspa.org.
Let me know if I can use another way to bypass this issue !
Jeannot
[11/13] from: gjones05:mail:orion at: 18-Jun-2001 15:39
> From: "Jeannot Chapdelaine"
> > When will we get a new CORE version that handle correctly the HTTP header
<<quoted lines omitted: 10>>
> has been redirected to http://www.cspa.org.
> Let me know if I can use another way to bypass this issue !
Hi, Jeannot,
Yes, the redirection bug. I thought you might have been talking about a new
feature. Perhaps you overlooked Maarten Koopmans' post last week. He found
what seems to be a workaround. I have been using for the last week, and so far
it appears to work fine. I have not successfully developed an insertion patch,
but I can send you the altered http protocol if you wish. Here is the link to
the written description, if you prefer:
http://www.escribe.com/internet/rebol/m10481.html
Hope this helps.
--Scott Jones
[12/13] from: jchapdelaine:datachest at: 18-Jun-2001 17:14
Thanks scott.
Effectively, I was out of Canada last week. Thank you for the information.
Jeannot
[13/13] from: gchiu:compkarori at: 19-Jun-2001 9:06
On Mon, 18 Jun 2001 13:44:43 -0400
"Jeannot Chapdelaine" <[jchapdelaine--datachest--com]> wrote:
> I am not talking about new functionality. This is about
> fixing a problem we
> are getting when we try to read a redirected URL.
>
Is this what you need?
A quick hack but it works for me:
In system/schemes/http there is a forward function.
If you add the line
http-get-header/host: port/host
After the function call to build-port in forward HTTP
forwarding more or less
works (more or less meaning : keep testing!)
Enjoy,
Maarten
--
Graham Chiu
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted