Skip to content

Commit

Permalink
Undo recent changes by fperrad, so I have a clean revision from which…
Browse files Browse the repository at this point in the history
… to cut the release. Will re-apply these changes in a minute

git-svn-id: https://svn.parrot.org/parrot/trunk@46769 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
Whiteknight committed May 18, 2010
1 parent a99c490 commit 442c740
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 69 deletions.
3 changes: 1 addition & 2 deletions examples/io/post.pir
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
response = ua.'post'(url, contents :flat, 'form-data' :named('Content-Type'), 'close' :named('Connection'))
$I0 = response.'code'()
unless $I0 == 302 goto L1
$S0 = response.'content'()
say $S0
say "report uploaded"
L1:
.end

Expand Down
35 changes: 4 additions & 31 deletions runtime/parrot/library/LWP.pir
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,14 @@ see http://search.cpan.org/~gaas/libwww-perl/
referral_uri = response.'get_header'('Location')
$P0 = get_hll_global ['URI'], 'new_from_string'
$P1 = $P0(referral_uri)
$S0 = $P1.'scheme'()
unless $S0 == '' goto L5
$P2 = new 'StringBuilder'
$P3 = request.'uri'()
$S0 = $P3.'scheme'()
push $P2, $S0
push $P2, '://'
$S0 = request.'get_header'('Host')
push $P2, $S0
push $P2, referral_uri
$P1 = $P0($P2)
L5:
setattribute referral, 'uri', $P1

# work in progress

$I0 = self.'redirect_ok'(referral, response)
if $I0 goto L6
if $I0 goto L5
.return (response)
L6:
L5:
.tailcall self.'request'(referral, response)
L4:

Expand Down Expand Up @@ -690,19 +678,12 @@ see http://search.cpan.org/~gaas/libwww-perl/
.sub '_parse_response_headers' :method
.param pmc response
.param string str
.local string sep
sep = "\r\n"
$I0 = index str, "\r"
unless $I0 < 0 goto L0
sep = "\n"
L0:
$S0 = sep . sep
$I0 = index str, $S0
$I0 = index str, "\r\n\r\n"
if $I0 < 0 goto L1
str = substr str, 0, $I0
L1:

$P0 = split sep, str
$P0 = split "\r\n", str
.local string status_line
status_line = shift $P0
$I0 = index status_line, " "
Expand Down Expand Up @@ -751,15 +732,7 @@ see http://search.cpan.org/~gaas/libwww-perl/
$S0 = substr str, $I0
$P0 = box $S0
setattribute response, 'content', $P0
goto L2
L1:
$I0 = index str, "\n\n"
if $I0 < 0 goto L1
$I0 += 2
$S0 = substr str, $I0
$P0 = box $S0
setattribute response, 'content', $P0
L2:
.end

.sub 'request' :method
Expand Down
4 changes: 0 additions & 4 deletions runtime/parrot/library/distutils.pir
Original file line number Diff line number Diff line change
Expand Up @@ -2216,10 +2216,6 @@ a hash
ua.'show_progress'(1)
$S0 = kv['smolder_url']
response = ua.'post'($S0, contents :flat, 'form-data' :named('Content-Type'), 'close' :named('Connection'))
$I0 = response.'code'()
unless $I0 == 302 goto L1
$S0 = response.'content'()
say $S0
L1:
.end

Expand Down
57 changes: 25 additions & 32 deletions t/harness.pir
Original file line number Diff line number Diff line change
Expand Up @@ -333,45 +333,38 @@ TEST

.sub 'send_archive_to_smolder' :anon
.param pmc env_data
load_bytecode 'osutils.pbc'
.const string archive = 'parrot_test_run.tar.gz'
.const string smolder_url = 'http://smolder.plusthree.com/app/projects/process_add_report/8'
.const string username = 'parrot-autobot'
.const string password = 'squ@wk'
.local pmc config
$P0 = getinterp
config = $P0[.IGLOBALS_CONFIG_HASH]
.local pmc contents
contents = new 'ResizablePMCArray' # by couple
push contents, 'architecture'
.local string cmd
cmd = "curl -F architecture="
$S0 = config['cpuarch']
push contents, $S0
push contents, 'platform'
cmd .= $S0
cmd .= " -F platform="
$S0 = config['osname']
push contents, $S0
push contents, 'revision'
cmd .= $S0
cmd .= " -F revision="
$S0 = config['revision']
push contents, $S0
push contents, 'tags'
cmd .= $S0
cmd .= " -F tags=\""
$S0 = _get_tags(env_data)
push contents, $S0
push contents, 'username'
push contents, 'parrot-autobot'
push contents, 'password'
push contents, 'squ@wk'
push contents, 'comments'
push contents, "EXPERIMENTAL t/harness.pir with LWP.pir"
push contents, 'report_file'
$P0 = new 'FixedStringArray'
set $P0, 1
$P0[0] = 'parrot_test_run.tar.gz'
push contents, $P0
load_bytecode 'LWP.pir'
.const string url = 'http://smolder.plusthree.com/app/projects/process_add_report/8'
.local pmc ua, response
ua = new ['LWP';'UserAgent']
ua.'show_progress'(1)
response = ua.'post'(url, contents :flat, 'form-data' :named('Content-Type'), 'close' :named('Connection'))
$I0 = response.'code'()
unless $I0 == 302 goto L1
$S0 = response.'content'()
say $S0
L1:
cmd .= $S0
cmd .= "\""
cmd .= " -F username="
cmd .= username
cmd .= " -F password="
cmd .= password
cmd .= " -F comments=\"EXPERIMENTAL t/harness.pir\""
cmd .= " -F report_file=@"
cmd .= archive
cmd .= " "
cmd .= smolder_url
.tailcall system(cmd, 1 :named('verbose'))
.end

.sub '_get_tags' :anon
Expand Down

0 comments on commit 442c740

Please sign in to comment.