Redirect the user when missing repost data.

In the case where we are missing the repost data, we currently
display a 400 Bad Request error. This patch changes the code to
redirect to the end URL instead, which at least has a chance to
work.

git-svn-id: https://modmellon.googlecode.com/svn/trunk@202 a716ebb1-153a-0410-b759-cfb97c6a1b53
This commit is contained in:
olavmrk 2013-03-22 11:44:02 +00:00
parent 3f8920c4b5
commit daaa6fae37
1 changed files with 7 additions and 4 deletions

View File

@ -2375,11 +2375,14 @@ static int am_handle_repost(request_rec *r)
return HTTP_BAD_REQUEST;
}
psf_filename = apr_psprintf(r->pool, "%s/%s", mod_cfg->post_dir, psf_id);
if ((post_data = am_getfile(r->pool, r->server, psf_filename)) == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
psf_filename = apr_psprintf(r->pool, "%s/%s", mod_cfg->post_dir, psf_id);
post_data = am_getfile(r->pool, r->server, psf_filename);
if (post_data == NULL) {
/* Unable to load repost data. Just redirect us instead. */
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
"Bad repost query: cannot find \"%s\"", psf_filename);
return HTTP_BAD_REQUEST;
apr_table_setn(r->headers_out, "Location", return_url);
return HTTP_SEE_OTHER;
}
if ((post_form = (*post_mkform)(r, post_data)) == NULL) {