Infact, I was talking about the fragments send in the response as http 302 response specifically.
Maybe, I'll put a little code snippet below to explain the case better: :)
urls.py
=====
...
url(r'^$', 'dummy_app.views.index'),
url(r'^action/$', 'dummy_app.views.redirect_handler'),
...
views.py
=====
...
def index(request):
if request.method == "GET":
return HttpResponse("Index Page <form method='post'><input type="button" value="Try" /></form>")
else:
return HttpResponseRedirect("/action/")
def redirect_handler(request):
return HttpResponse("Hello")
...
Scenario 1:
User opens the browser, and hits URL : http://<server>/#test -> Gets to see "Index Page" with a button with text "Try" -> browser url shown as "http://<server>/#test" -> User clicks the button -> New page content is "Hello" -> current url in browser is "http://<server>/action/#test"
Scenario 2:
Changing the views.py as:
< return HttpResponseRedirect("/action/")
...
> return HttpResponseRedirect("/action/#hello")
User opens the browser, and hits URL : http://<server>/#test -> Gets to see "Index Page" with a button with text "Try" -> browser url shown as "http://<server>/#test" -> User clicks the button -> New page content is "Hello" -> current url in browser is "http://<server>/action/#hello"
Now, do you see the difference. The http response did have the fragment specified while issuing the 302 in the second case.
So, my original question still stands still for me. Is this behavior defined and expected?
On Thu, Aug 25, 2011 at 7:20 PM, Tom Evans <tevans.uk@googlemail.com> wrote:
On Thu, Aug 25, 2011 at 12:48 PM, Subhranath ChunderStop. Browsers do not send fragment identifiers to a server, they are
<subhranath@gmail.com> wrote:
> I was wondering whether this current behavior with respect to http redirects
> on fragmented urls is actually a desired behavior, or some bug.
> Let's suppose the user issues a GET request to the URI '/action#home'.
solely used by the browser.
Er - my browser doesn't do that. Are you sure you've tracked this through?
> Now, the handler which is associated with this, processes the request and
> lets suppose it wants to issue a http 302 to fetch the url '/' without any
> specific fragment, in response.
> Currently, this scenario seems to be not achievable in django using a simple
> HttpResponseRedirect('/'), as the fragment from the last requested GET is
> automatically appended to the next fetch request at the client side, which
> results from the 302 response issued.
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Thanks,
Subhranath Chunder.
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment