Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Content for large string of data. 1

Status
Not open for further replies.

vinzmen

Programmer
Oct 1, 2010
2
GB
Hi all,

I was hoping somebody could help me with my web server problem.

I am using the HTTPApp unit in my server application to develope html pages, send/recieve data between server and client. I set the Response (TWebResponse) properties inorder for the client user to download attachments etc.

I assign the Response.Content to a string which holds an xml file and then set the Response.ContentType to 'text/csv' and the Response.Customheaders to let the user download the response.Contents as a csv file in their local drive. This works if the Response.Content does not hold a very large string of data.

My problem is that when assigning the Response.Content to be a very large string of data it comes up as 'HTTP 500 internal server error' even though the Response.content holds this large string. I have tried changing the ContentType to 'application/octet-stream' and it still dosent work.

Does anybody have any ideas on how i can over come this issue?

Many thanks
Vinzmen
 
My problem is that when assigning the Response.Content to be a very large string of data it comes up as 'HTTP 500 internal server error' even though the Response.content holds this large string.

I can't say I know what you're doing. But, String data types have a data size limit. Short Strings have a limit of one byte (255) while AnsiStrings (typical type) have a limit of two bytes (65535).

You might check to see if you're trying to put more than 65535 bytes to this string variable. As a pre-emptive thing, you might try going to a data buffer block of bigger size than a string, or try to do multiple reads. This is probably the more safer way to handle this data, especially if you are pushing large amounts of data at your server program.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Glenn,

don't know where you got this from but to my knowledge Delphi Ansistrings have a 32-bit size limit, not 16 bit as you indicate.

Vinzmen,
try to find out what the size limit is and try to find/debug the exception on the webserver side as this will give more information about your problem.

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
don't know where you got this from but to my knowledge Delphi Ansistrings have a 32-bit size limit, not 16 bit as you indicate.

I stand corrected. Standard MTU though is about 1500 bytes, so I would for the OP that things are equipped in such a way that they can handle good amounts of data. We shall see if the OP responds on the issue, as there are a few more variables in regard to these things which might explain the problem.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
If it makes you feel any better, you're both wrong about string lengths :p

In Delphi, the maximum string length is restricted by the 2 GB stack limit. That means that no string type can ever exceed 2 GB (31-bit).

For AnsiString, the maximum length is 31-bit (2 billion characters because each character occupies 1-byte).
For UnicodeString, the maximum length is 30-bit (1 billion characters, because each character occupies 2-bytes).
 
tuyen,

you are correct,
but what I meant is that the size field of an AnsiString is 32 bits long, as this is a signed integer you have indeed a maximum size of 31 bits.
Beware about unicode strings, the actual character size could be more than 2 bytes.

Glenn,

the reponse.content maximum size can normally be controlled on the server side. MTU should not be an issue in this case.

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top