Solved

POST data being mangled during POST operations under Apache

Posted on 2003-11-26
3
246 Views
Last Modified: 2010-04-20
Hi everyone.  I'm offering up 500 points for this one as it's got me completely and utterly stumped, and I need a solution.  I'm going to be very stringent in awarding these points, as the solution must work completely.  First person to solve it completely gets 500 points.

This is the situation:

I'm running Apache 2.0 with PHP 4.2.2 on a Dell Precision 340 running RedHat 9.

I've been writing a Content Management System for some time now, and I've recently noticed something strange happening, and it's only happened since I moved development of the CMS from a temporary server to my workstation (temporarily until a permanent home for the CMS is acquired here).

At times when I'm attempting to update data within the CMS (say, a stylesheet snippet, content block, etc.) when I submit the form the POST operation mangles the code.

That is to say, it's taking some of the original code, and appending it to the end of the complete block of the original code.

Here's an example of the good input:  http://web.unbc.ca/~gossep/good_code.txt

And here's an example of the garbage output:  http://web.unbc.ca/~gossep/bad_code.txt

Additionally, the mangling of the code is slightly different depending on which browser you try this with.

As you can see, part of the POSTed code has been appended to the end of the original code.  This is not happening with all code, but only with certain snippets.  The one common thing I've been able to pinpoint it to is perhaps the length of the code segment in question.  I unfortunately do not have time to built a POSTed piece of code one character at a time to figure out if this is indeed the case.

Additionally, this seems to also happen with images that are uploaded via the CMS as well.

To see how it mangles some of the images, please view the images at http://web.unbc.ca/~gossep/sample_images/.  The images which were mangled are named [filename]_uploaded.ext so you can see the originals and the mangled images.

My initial thoughts were that it must be something in my code, but that's simply not the case.  For both text posts and image uploads I created bare-bones forms (nothing more than the form tags, a textarea and submit button for the former, and the form tags, file input and upload button for the latter) and on my machine the problem still occurs but on others it does not.

I'm not overly concerened that this will be a problem in the long run, since the CMS will be going to its permanent home within the next couple of months, and I've run a number of tests on other workstations and these problems do not occur.

However, right now it's proving very difficult for me in development, since I will often need to make changes to a template or other code chunk, in which case I need to copy the code from the CMS to notepad (the CMS requires IE5.5 so I'm accessing it via our tss box) escape all necessary characters and then copy it into a manual sql query.

I look forward to replies to this problem.

GOOD LUCK!

Cheers,
Pablo Gosse
0
Comment
Question by:pablogosse
3 Comments
 
LVL 2

Accepted Solution

by:
JClawson earned 500 total points
ID: 10806430
That is quite a strange problem... .Assuming your code is correct, it sounds like somthing is wrong in either apache or PHP.  Perhaps a file was somhow corrupted... who knows.  First I would suggest updating PHP to 4.3.5 or 4.3.6.  Hopefully this will fix it.  If that doesn't work ty reinstalling apache... or vice-versa.  I imagine a fresh reinstall should fix it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now