Re: CFNetwork POST with redirect.
Re: CFNetwork POST with redirect.
- Subject: Re: CFNetwork POST with redirect.
- From: Frederick Cheung <email@hidden>
- Date: Sun, 29 Apr 2007 17:00:38 +0100
On 29 Apr 2007, at 16:57, Joshua wrote:
This is a server I do have control of, but I believe the behavior
is fairly common (my yahoo for example is a post with a redirect).
After reading the RFC you referenced I think I understand what you
mean. It would seem that the server shouldn't return a 302, but
instead return a 303. I'm not sure if I can control the redirect
type, but clearly the behavior isn't uniform (the RFC even mentions
some clients do treat a 302 as a 303, which is most likely what I
am seeing in windows vs mac). I will look into seeing if I can get
the server to send the 303 instead.
As to the hook in CFNetwork, I couldn't find one. I was expecting
the same, that I could catch the event and then control the
behavior, but I haven't found it in the portion of the API I have
been using.
Thanks, you've given me something new to investigate.
You could turn off the autoredirect and then handle the 30x responses
yourself.
Fred
- Josh
----- Original Message ----
From: Daniel Jalkut <email@hidden>
To: email@hidden
Cc: email@hidden
Sent: Sunday, April 29, 2007 11:09:34 AM
Subject: Re: CFNetwork POST with redirect.
On Apr 29, 2007, at 9:50 AM, Joshua wrote:
> Perhaps related... do CFNetwork interfaces automatically handle
> cookies? The server is also trying
> to set a cookie and I am wondering if this is also the reason the
> server doesn't continue the
> appropriate redirection.
I doubt the server's cookies have anything to do with it. The desired
behavior for redirects is laid out pretty well in the HTTP RFC
(http://www.ietf.org/rfc/rfc2616.txt) but it varies based on the type
of redirect being encountered, and the request method. Many of the
redirect cases hinge on prompting the user to confirm the new value.
See section 10.3.x of the RFC.
So I imagine the "auto redirect" in CFNetwork is not really intended
to be used for methods (namely, POST), where the user's interaction
is generally required.
NSURLConnection has a "connection:willSendRequest:..." method where
the client can manipulate redirect requests, but I'm not sure if
CFHTTP has a similar hook.
Is this particular redirect you're running into something you're
seeing in the wild, or is it a URL you're in charge of? If you have
the ability to do so, it might make sense to avoid redirects on URLs
where a POST is required, because the policy is so complicated for
user agents.
Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden