[Mono-dev] Bug in trunk version of xsp / mono

Ásgeir Halldórsson Asgeir.Halldorsson at dempseyclark.is
Fri Feb 12 04:23:48 EST 2010


Hi all,

                I have been having issues for the past 2 days with installing latest version of mono with apache.  Always getting Argument size exception.  After alot of debugging I fould the issue and here is a fix if anyone wants.



In ModMonoRequest.cs
void FillBuffer (int count)
                {
                        if (reader_ms.Capacity < count)
                                reader_ms.SetLength (count);

                        // This will "reset" the stream
                        reader_ms.SetLength (0);
                        reader_ms.Seek (0, SeekOrigin.Begin);

                        byte[] buffer = reader_ms.GetBuffer ();
                        int received = client.Receive (buffer, count, SocketFlags.None);
                        reader_ms.SetLength (received);
                }

Should be,  I am not sure if this is a bug in mono or the xsp but atleast xsp is assuming how MemoryStream handles buffer.

void FillBuffer (int count)
                {
                        if (reader_ms.Capacity < count)
                                reader_ms.SetLength (count);

                        // This will "reset" the stream
                        reader_ms.SetLength (0);

                        //byte[] buffer = reader_ms.GetBuffer ();
                        byte[] buffer = new byte[count];
                        int received = client.Receive (buffer, count, SocketFlags.None);
                        //reader_ms.SetLength (received);
                        reader_ms.Write(buffer, 0, received);
                        reader_ms.Seek (0, SeekOrigin.Begin);
                }

Regards,
                Ásgeir Halldórsson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100212/e03851da/attachment-0001.html 


More information about the Mono-devel-list mailing list