[svn:parrot] r49202 - trunk/runtime/parrot/library/LWP

fperrad at svn.parrot.org fperrad at svn.parrot.org
Tue Sep 21 17:01:02 UTC 2010


Author: fperrad
Date: Tue Sep 21 17:01:01 2010
New Revision: 49202
URL: https://trac.parrot.org/parrot/changeset/49202

Log:
[LWP] handles an IO error

Modified:
   trunk/runtime/parrot/library/LWP/Protocol.pir

Modified: trunk/runtime/parrot/library/LWP/Protocol.pir
==============================================================================
--- trunk/runtime/parrot/library/LWP/Protocol.pir	Tue Sep 21 16:38:41 2010	(r49201)
+++ trunk/runtime/parrot/library/LWP/Protocol.pir	Tue Sep 21 17:01:01 2010	(r49202)
@@ -476,6 +476,8 @@
     $S0 = _format_request(method, fullpath, request_headers)
     sock.'send'($S0)
 
+    .local pmc response
+    response = new ['HTTP';'Response']
     .local string content
     content = request.'content'()
     unless content goto L11
@@ -486,13 +488,18 @@
     unless $I0 < content_length goto L11
     $S0 = substr content, $I0, 8192
     $I1 = sock.'send'($S0)
+    if $I1 >= 0 goto L13
+    $P0 = box RC_INTERNAL_SERVER_ERROR
+    setattribute response, 'code', $P0
+    $P0 = box "I/O error"
+    setattribute response, 'message', $P0
+    .return (response)
+  L13:
     $I0 += $I1
     $N0 = $I0 / content_length
     goto L12
   L11:
 
-    .local pmc response
-    response = new ['HTTP';'Response']
     .local pmc buf
     buf = new 'StringBuilder'
     .local int header_length


More information about the parrot-commits mailing list