Forums / Developer / Wrong HTTP redirect status code returned when posting collected info

Wrong HTTP redirect status code returned when posting collected info

Author Message

Marko Žmak

Wednesday 20 January 2010 7:24:33 am

When posting collected info (ActionCollectInformation) successfully a 302 HTTP redirect is done to the collected info page. I belive a 303 redirect should be done instead because the method of the request is changed. Here are the reasons...

RFC2616 states for 302 rediretcs:

 Note: RFC 1945 and RFC 2068 specify that the client is not allowed
      to change the method on the redirected request.  However, most
      existing user agent implementations treat 302 as if it were a 303
      response, performing a GET on the Location field-value regardless
      of the original request method. The status codes 303 and 307 have
      been added for servers that wish to make unambiguously clear which
      kind of reaction is expected of the client

and for 303:

 The response to the request can be found under a different URI and
   SHOULD be retrieved using a GET method on that resource. This method
   exists primarily to allow the output of a POST-activated script to
   redirect the user agent to a selected resource. The new URI is not a
   substitute reference for the originally requested resource. The 303
   response MUST NOT be cached, but the response to the second
   (redirected) request might be cacheable.

This can produce problems in real life e.g. when you want to post the collected info using ajax calls - the responses are not handled correctly.

Can someone form th eZ crew confirm that this is a bug?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Gaetano Giunta

Wednesday 20 January 2010 2:13:31 pm

Interesting... have you ever seen some problems caused by this?

Principal Consultant International Business
Member of the Community Project Board

Marko Žmak

Wednesday 20 January 2010 4:02:15 pm

Well, this thread is motivated by a problem that I have experienced, it happened exactly like I described:

- I wanted to post the collected info using ajax calls, and the responses were not handled correctly

I'm not sure if this redirect "bug" caused the error (I'm still debugging it), but I came accross this "bug" in the debugging process.I'll try to find out if this is the cause of my problem, but still it would be nice to follow the standards.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

eZ debug

Timing: Jan 29 2025 13:31:03
Script start
Timing: Jan 29 2025 13:31:03
Module start 'content'
Timing: Jan 29 2025 13:31:03
Module end 'content'
Timing: Jan 29 2025 13:31:03
Script end

Main resources:

Total runtime0.1121 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 588.2031180.7969
Module start 'content' 0.00480.0048 769.000098.1953
Module end 'content' 0.00960.1024 867.1953527.9219
Script end 0.1120  1,395.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00302.6371200.0001
Check MTime0.00121.0271200.0001
Mysql Total
Database connection0.00060.503210.0006
Mysqli_queries0.076167.86761410.0005
Looping result0.00080.71611390.0000
Template Total0.102191.110.1021
Template load0.00070.615510.0007
Template processing0.101590.503910.1015
Override
Cache load0.00050.422010.0005
Sytem overhead
Fetch class attribute can translate value0.00050.437910.0005
XML
Image XML parsing0.00020.212310.0002
General
dbfile0.00534.7317200.0003
String conversion0.00000.004030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs