[squeak-dev] The Trunk: WebClient-HTTP-cmm.4.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Nov 20 23:30:37 UTC 2015


Chris Muller uploaded a new version of WebClient-HTTP to project The Trunk:
http://source.squeak.org/trunk/WebClient-HTTP-cmm.4.mcz

==================== Summary ====================

Name: WebClient-HTTP-cmm.4
Author: cmm
Time: 20 November 2015, 5:30:31.892 pm
UUID: 8f2d17a2-99b0-4216-8808-5d3276f15ae0
Ancestors: WebClient-HTTP-cmm.3

Support the 'args' variable in HTTPSocket class>>#httpGet:args:user:passwd:.
	This fixes the in-image 'mc history' and origin functions for methods and classes.

=============== Diff against WebClient-HTTP-cmm.3 ===============

Item was changed:
  ----- Method: HTTPSocket class>>httpGet:args:user:passwd: (in category '*webclient-http') -----
  httpGet: url args: args user: user passwd: passwd
  	"Upload the contents of the stream to a file on the server.
  
  	WARNING: This method will send a basic auth header proactively.
  	This is necessary to avoid breaking MC and SqueakSource since SS does not 
  	return a 401 when accessing a private (global no access) repository."
  
  	| urlString xhdrs client resp progress |
  
+ 	"Normalize the url and append args"
- 	"Normalize the url"
  	urlString := (Url absoluteFromText: url) asString.
+ 	args ifNotNil: [
+ 		urlString := urlString, (self argString: args) 
+ 	].
  
  	"Some raw extra headers which historically have been added"
  	xhdrs := HTTPProxyCredentials,
  		HTTPBlabEmail.	"may be empty"
  
  	client := WebClient new.
  	client username: user; password: passwd.
  	^[resp := client httpGet: urlString do:[:req|
  	
  		"HACK: Proactively send a basic auth header.
  		See comment above."
  		req headerAt: 'Authorization' put: 'Basic ', (user, ':', passwd) base64Encoded.
  
  		"Accept anything"
  		req addHeader: 'Accept' value: '*/*'.
  		"Add the additional headers"
  		(WebUtils readHeadersFrom: xhdrs readStream) 
  			do:[:assoc| req addHeader: assoc key value: assoc value]].
  
  	progress := [:total :amount| 
  		(HTTPProgress new) total: total; amount: amount; signal: 'Downloading...'
  	].
  
  	"Simulate old HTTPSocket return behavior"
  	(resp code between: 200 and: 299) 
  		ifTrue:[^(RWBinaryOrTextStream with: (resp contentWithProgress: progress)) reset]
  		ifFalse:[resp asString, resp content].
  	] ensure:[client destroy].
  !



More information about the Squeak-dev mailing list