[Gambas-user] Issue 451 in gambas: XML-RPC/RpcServer crashes if the receiving socket is closed

gambas at ...2524... gambas at ...2524...
Sat Jul 6 19:53:27 CEST 2013


Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 451 by uAle... at ...626...: XML-RPC/RpcServer crashes if the  
receiving socket is closed
http://code.google.com/p/gambas/issues/detail?id=451

1) Describe the problem.
The Gambas application will crash if the other side (the client) receiving  
socket is too early closed. Gambas will complain the "stream" is closed.  
Expected behavior is that

The following needs to be changed in  
the "gb.xml/src/rpc/gb.xml.rpc/.src/miniServer.class" to prevent this issue:
   hS.Begin
   hS.EndOfLine = gb.Windows
   Print #hS, "HTTP/1.1 " & hErr
   Print #hS, "Server: Gambas XML-RPC Server"
   Print #hS, "Connection: close"
   Print #hS, "Content-Type: text/html; charset=iso-8859-1"
   Print #hS, ""
   Print #hS, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">"
   Print #hS, "<HTML><HEAD>"
   Print #hS, "<TITLE>" & hErr & "</TITLE>"
   Print #hS, "</HEAD><BODY>"
   Print #hS, "<H1>Bad Request</H1>"
   Print #hS, hErr & ".<P>"
   Print #hS, "<HR>"
   Print #hS, "<ADDRESS>Gambas XML-RPC Server</ADDRESS>"
   Print #hS, "</BODY></HTML>"
   Print #hS, ""
   Print #hS, ""
   ...
   hS.Begin
   hS.EndOfLine = gb.Windows
   Print #hS, "HTTP/1.1 200 OK"
   Print #hS, "Connection: close"
   Print #hS, "Content-Length: " & Len(sReply)
   Print #hS, "Content-Type: text/xml"
   Print #hS, "Server: Gambas RPC Server"
   Print #hS, ""
   Write #hS, sReply, Len(sReply)
   ...

TO:
   Try hS.Begin
   Try hS.EndOfLine = gb.Windows
   Try Print #hS, "HTTP/1.1 " & hErr
   Try Print #hS, "Server: Gambas XML-RPC Server"
   Try Print #hS, "Connection: close"
   Try Print #hS, "Content-Type: text/html; charset=iso-8859-1"
   Try Print #hS, ""
   Try Print #hS, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">"
   Try Print #hS, "<HTML><HEAD>"
   Try Print #hS, "<TITLE>" & hErr & "</TITLE>"
   Try Print #hS, "</HEAD><BODY>"
   Try Print #hS, "<H1>Bad Request</H1>"
   Try Print #hS, hErr & ".<P>"
   Try Print #hS, "<HR>"
   Try Print #hS, "<ADDRESS>Gambas XML-RPC Server</ADDRESS>"
   Try Print #hS, "</BODY></HTML>"
   Try Print #hS, ""
   Try Print #hS, ""
   ...
   Try hS.Begin
   Try hS.EndOfLine = gb.Windows
   Try Print #hS, "HTTP/1.1 200 OK"
   Try Print #hS, "Connection: close"
   Try Print #hS, "Content-Length: " & Len(sReply)
   Try Print #hS, "Content-Type: text/xml"
   Try Print #hS, "Server: Gambas RPC Server"
   Try Print #hS, ""
   Try Write #hS, sReply, Len(sReply)
   ...

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: TRUNK
Revision: r5722
Operating system: Linux
Distribution: Ubuntu
Architecture: x86_64
GUI component: QT4
Desktop used: Gnome

3) Provide a little project that reproduces the bug or the crash.

To reproduce it, just create a XML-RPC server and execute the following  
command:
cat xml-reques.txt | nc 127.0.0.1 9009

4) If your project needs a database, try to provide it, or part of it.

5) Explain clearly how to reproduce the bug or the crash.

6) By doing that carefully, you have done 50% of the bug fix job!

IMPORTANT NOTE: if you encounter several different problems or bugs, (for
example, a bug in your project, and an interpreter crash while debugging
it), please create distinct issues!

Attachments:
	xml-request.txt  215 bytes

-- 
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings




More information about the User mailing list