[svn:parrot] r46743 - in trunk/runtime/parrot/library: . HTTP
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Mon May 17 16:32:32 UTC 2010
Author: fperrad
Date: Mon May 17 16:32:31 2010
New Revision: 46743
URL: https://trac.parrot.org/parrot/changeset/46743
Log:
[LWP] request POST (step 3)
Modified:
trunk/runtime/parrot/library/HTTP/Message.pir
trunk/runtime/parrot/library/LWP.pir
Modified: trunk/runtime/parrot/library/HTTP/Message.pir
==============================================================================
--- trunk/runtime/parrot/library/HTTP/Message.pir Mon May 17 15:33:24 2010 (r46742)
+++ trunk/runtime/parrot/library/HTTP/Message.pir Mon May 17 16:32:31 2010 (r46743)
@@ -394,6 +394,7 @@
.local string content
content = ''
if file == '' goto L8
+ load_bytecode 'osutils.pbc'
content = slurp(file)
L8:
$I0 = exists h['Content-Disposition']
@@ -434,6 +435,7 @@
L22:
push $P1, '--'
push $P1, _boundary
+ push $P1, '--'
push $P1, CRLF
$S0 = $P1
.return ($S0, _boundary)
Modified: trunk/runtime/parrot/library/LWP.pir
==============================================================================
--- trunk/runtime/parrot/library/LWP.pir Mon May 17 15:33:24 2010 (r46742)
+++ trunk/runtime/parrot/library/LWP.pir Mon May 17 16:32:31 2010 (r46743)
@@ -647,7 +647,6 @@
.param string method
.param string uri
.param pmc headers
- .param string content
.const string CRLF = "\r\n"
$P0 = new 'StringBuilder'
push $P0, method
@@ -667,7 +666,6 @@
goto L1
L2:
push $P0, CRLF
- push $P0, content
.return ($P0)
.end
@@ -755,20 +753,33 @@
request_headers = request.'headers'()
self.'_fixup_header'(request_headers, url)
- .local string content
- content = request.'content'()
-
- $S0 = _format_request(method, url, request_headers, content)
-
.local pmc ua
ua = self.'ua'()
+ $S0 = _format_request(method, url, request_headers)
sock.'send'($S0)
+ .local string content
+ content = request.'content'()
+ unless content goto L11
+ .local int content_length
+ content_length = length content
+ $I0 = 0
+ L12:
+ unless $I0 < content_length goto L11
+ $S0 = substr content, $I0, 8192
+ $I1 = sock.'send'($S0)
+ $I0 += $I1
+ $N0 = $I0 / content_length
+ ua.'progress'($N0, request)
+ sleep 1
+ goto L12
+ L11:
+
.local pmc response
response = new ['HTTP';'Response']
.local pmc buf
buf = new 'StringBuilder'
- .local int header_length, content_length
+ .local int header_length
content_length = 0
L21:
ua.'progress'('tick', request)
More information about the parrot-commits
mailing list