[squeak-dev] The Trunk: WebClient-Core-ul.128.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Sep 21 12:18:20 UTC 2021


Levente Uzonyi uploaded a new version of WebClient-Core to project The Trunk:
http://source.squeak.org/trunk/WebClient-Core-ul.128.mcz

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

Name: WebClient-Core-ul.128
Author: ul
Time: 21 September 2021, 2:16:18.204886 pm
UUID: 2ea71dca-a72d-4724-b8a2-98b1ab2e8e8a
Ancestors: WebClient-Core-dtl.127

- added missing vertical bars to empty blocks

=============== Diff against WebClient-Core-dtl.127 ===============

Item was changed:
  ----- Method: WebClient>>httpDelete: (in category 'methods') -----
  httpDelete: urlString
  	"Sends an DELETE request"
  
+ 	^self httpDelete: urlString do:[:req|]
- 	^self httpDelete: urlString do:[:req]
  !

Item was changed:
  ----- Method: WebClient>>httpGet: (in category 'methods') -----
  httpGet: urlString
  	"GET the response from the given url"
  	"(WebClient httpGet: 'http://www.squeak.org') content"
  
+ 	^self httpGet: urlString do:[:req|]
- 	^self httpGet: urlString do:[:req]
  !

Item was changed:
  ----- Method: WebClient>>httpHead: (in category 'methods') -----
  httpHead: urlString
  	"Sends a HEAD request"
  
+ 	^self httpHead: urlString do:[:req|]
- 	^self httpHead: urlString do:[:req]
  !

Item was changed:
  ----- Method: WebClient>>httpOptions: (in category 'methods') -----
  httpOptions: urlString
  	"Sends an OPTIONS request"
  
+ 	^self httpOptions: urlString do:[:req|]
- 	^self httpOptions: urlString do:[:req]
  !

Item was changed:
  ----- Method: WebClient>>httpPost:content:type: (in category 'methods') -----
  httpPost: urlString content: postData type: contentType
  	"POST the data to the given url"
  
+ 	^self httpPost: urlString content: postData type: contentType do:[:req|]!
- 	^self httpPost: urlString content: postData type: contentType do:[:req]!

Item was changed:
  ----- Method: WebClient>>httpPostChunked:content:type: (in category 'methods') -----
  httpPostChunked: urlString content: chunkBlock type: contentType
  	"POST the data to the given url using chunked transfer-encoding.
  	The chunkBlock takes a request and can be fed using #nextChunkPut:
  	until all the data has been sent.
  
  	Chunked encoding can be used for long-lasting connections to a server,
  	but care must be taken to ensure that the client isn't running afoul of
  	the server expecting to read the full response (i.e., you should use this
  	only if you have control over both ends).
  
  	However, it is a great way to send output from commands that take awhile
  	and other time-consuming operations if authentication has been handled."
  
+ 	^self httpPostChunked: urlString content: chunkBlock type: contentType do: [:req|]!
- 	^self httpPostChunked: urlString content: chunkBlock type: contentType do: [:req]!

Item was changed:
  ----- Method: WebClient>>httpPut:content:type: (in category 'methods') -----
  httpPut: urlString content: postData type: contentType
  	"PUT the data to the given url"
  
+ 	^self httpPut: urlString content: postData type: contentType do:[:req|]!
- 	^self httpPut: urlString content: postData type: contentType do:[:req]!

Item was changed:
  ----- Method: WebClient>>httpTrace: (in category 'methods') -----
  httpTrace: urlString
  	"Sends a TRACE request"
  
+ 	^self httpTrace: urlString do:[:req|]
- 	^self httpTrace: urlString do:[:req]
  !

Item was changed:
  ----- Method: WebRequest>>send200Response:contentType: (in category 'responses') -----
  send200Response: aString contentType: contentType
  	"Send a 200 OK response"
  
+ 	^self send200Response: aString contentType: contentType do:[:resp|]!
- 	^self send200Response: aString contentType: contentType do:[:resp]!

Item was changed:
  ----- Method: WebRequest>>send301Response: (in category 'responses') -----
  send301Response: location
  	"Send a 301 permanent redirect response"
  
+ 	^self send301Response: location do:[:resp|].!
- 	^self send301Response: location do:[:resp].!

Item was changed:
  ----- Method: WebRequest>>send302Response: (in category 'responses') -----
  send302Response: location
  	"Send a 302 temporary redirect response"
  
+ 	^self send302Response: location do:[:resp|].!
- 	^self send302Response: location do:[:resp].!

Item was changed:
  ----- Method: WebRequest>>send3xxResponse:code: (in category 'responses') -----
  send3xxResponse: location code: statusCode
  	"Send a 3xx redirect response"
  
+ 	^self send3xxResponse: location code: statusCode do:[:resp|].!
- 	^self send3xxResponse: location code: statusCode do:[:resp].!

Item was changed:
  ----- Method: WebRequest>>sendResponse:chunked: (in category 'responses') -----
  sendResponse: code chunked: chunkBlock
  	"Send a chunked response"
  
+ 	^self sendResponse: code chunked: chunkBlock do:[:resp|]!
- 	^self sendResponse: code chunked: chunkBlock do:[:resp]!

Item was changed:
  ----- Method: WebRequest>>stream200Response:size:type: (in category 'responses') -----
  stream200Response: aStream size: streamSize type: contentType
  	"Stream a 200 OK response"
  
+ 	^self stream200Response: aStream size: streamSize type: contentType do:[:resp|].!
- 	^self stream200Response: aStream size: streamSize type: contentType do:[:resp].!

Item was changed:
  ----- Method: WebServer>>handleConnectionFrom: (in category 'handling') -----
  handleConnectionFrom: aSocket
  	"Synchronously handle an incoming socket connection."
  
  	| stream request |
  
  	"Give the process a pretty name"
  	Processor activeProcess name: (String streamContents:[:s|
  		aSocket remoteAddress do:[:b| s print: b] separatedBy:[s nextPut: $.].
  		s nextPut: $:; print: aSocket remotePort.
  		s nextPutAll: ' - ', self class name, ' request handler'.
  	]).
  
  	"Read the request from the socket, and dispatch it.
  	Since we've been forked already it's okay to block."
  	[
  		certName ifNil:["Regular request"
  			stream := SocketStream on: aSocket.
  		] ifNotNil:["SSL/TLS"
  			| ssl |
  			ssl := Smalltalk at: #SqueakSSL ifAbsent:[self error: 'SqueakSSL not installed'].
  			stream := ssl secureSocketStream on: aSocket.
  			[stream sslAccept: certName] on: Error do:[^stream destroy].
  		].
  
  		[aSocket isConnected] whileTrue:[
  
  			"Read the next request from the connection. If the connection is closed,
  			or if a network error occurs, or the read times out, just close the connection
  			without further ado (rather than logging an error). Any other error resulting
  			from parsing the input is treated as a 400 bad request."
  
  			stream peek ifNil:[^aSocket destroy].
  			request := self newRequest.
  			[request readFrom: stream] on: Error do:[:ex| 
  				(ex isKindOf: NetworkError) ifFalse:[
+ 					[request send400Response] on: Error do:[:ignore|].
- 					[request send400Response] on: Error do:[:ignore].
  				].
  				^aSocket destroy].
  
  			self dispatchRequest: request.
  		].
  	] on: Error do:[:ex|
  		(ex isKindOf: NetworkError) ifFalse:[
  			self log: 'Error in request handling: ', ex description.
  			self log: (self errorReportFor: ex).
  		].
  	].!



More information about the Squeak-dev mailing list