[Pkg] The Trunk: Network-ul.97.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Nov 16 04:00:34 UTC 2010
Levente Uzonyi uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-ul.97.mcz
==================== Summary ====================
Name: Network-ul.97
Author: ul
Time: 16 November 2010, 4:59:58.149 am
UUID: 0dbcd0ce-f3e0-e541-adb0-cac2cd088294
Ancestors: Network-ul.93
- use #= for integer comparison instead of #== (http://bugs.squeak.org/view.php?id=2788 )
=============== Diff against Network-ul.93 ===============
Item was changed:
----- Method: HierarchicalURI>>relativeFromString: (in category 'private') -----
relativeFromString: aString
| remainder authorityEnd |
remainder := (aString beginsWith: '//')
ifTrue: [
authorityEnd := aString indexOf: $/ startingAt: 3.
+ authorityEnd = 0
- authorityEnd == 0
ifTrue: [authorityEnd := aString size+1].
self extractAuthority: (aString copyFrom: 3 to: authorityEnd-1)]
ifFalse: [aString].
self extractSchemeSpecificPartAndFragment: remainder!
Item was changed:
----- Method: Socket>>receiveDataInto:startingAt: (in category 'receiving') -----
receiveDataInto: aStringOrByteArray startingAt: aNumber
"Receive data into the given buffer and return the number of bytes received.
Note the given buffer may be only partially filled by the received data.
Waits for data once. The answer may be zero (indicating that no data was
available before the socket closed)."
| bytesRead closed |
bytesRead := 0.
closed := false.
+ [closed not and: [bytesRead = 0]]
- [closed not and: [bytesRead == 0]]
whileTrue: [
self waitForDataIfClosed: [closed := true].
bytesRead := self primSocket: socketHandle
receiveDataInto: aStringOrByteArray
startingAt: aNumber
count: aStringOrByteArray size-aNumber+1].
^bytesRead
!
Item was changed:
----- Method: Socket>>receiveDataSignallingClosedInto:startingAt: (in category 'receiving') -----
receiveDataSignallingClosedInto: aStringOrByteArray startingAt: aNumber
"Receive data into the given buffer and return the number of bytes received.
Note the given buffer may be only partially filled by the received data.
Waits for data until something is read or the socket is closed, upon which
we signal."
| bytesRead |
bytesRead := 0.
+ [bytesRead = 0]
- [bytesRead == 0]
whileTrue: [
self waitForData.
bytesRead := self primSocket: socketHandle
receiveDataInto: aStringOrByteArray
startingAt: aNumber
count: aStringOrByteArray size-aNumber+1].
^bytesRead
!
Item was changed:
----- Method: SocksSocket>>connectTo:port: (in category 'connection open/close') -----
connectTo: hostAddress port: port
self initializeNetwork.
self shouldUseSocks
ifFalse: [^super connectTo: hostAddress port: port].
super connectTo: socksIP port: socksPort.
self waitForConnectionUntil: Socket standardDeadline.
dstIP := hostAddress.
dstPort := port.
+ vers = 4
- vers == 4
ifTrue: [self connectSocks4]
ifFalse: [self connectSocks5]
!
Item was changed:
----- Method: SocksSocket>>connectToHostNamed:port: (in category 'connection open/close') -----
connectToHostNamed: hostName port: port
super connectTo: socksIP port: socksPort.
self waitForConnectionUntil: Socket standardDeadline.
dstName := hostName.
dstPort := port.
+ vers = 4
- vers == 4
ifTrue: [self connectSocks4]
ifFalse: [self connectSocks5]
!
Item was changed:
----- Method: SocksSocket>>socks5MethodSelection (in category 'socks5') -----
socks5MethodSelection
"The client connects to the server, and sends a version
identifier/method selection message.
The server selects from one of the methods given in METHODS, and
sends a METHOD selection message."
| requestString response |
requestString := WriteStream on: ByteArray new.
requestString
nextPut: 5;
nextPut: 1;
nextPut: 0.
self sendData: requestString contents.
response := self waitForReply: 2 for: self defaultTimeOutDuration.
+ (response at: 2) = 16rFF
- (response at: 2) == 16rFF
ifTrue: [self socksError: 'No acceptable methods.']
ifFalse: [method := response at: 2]!
Item was changed:
----- Method: URI class>>extractSchemeFrom: (in category 'instance creation') -----
extractSchemeFrom: aString
| colonIndex slashIndex |
colonIndex := aString indexOf: $: .
^colonIndex > 0
ifTrue: [
slashIndex := aString indexOf: $/ .
+ (slashIndex = 0
- (slashIndex == 0
or: [colonIndex < slashIndex])
ifTrue: [aString copyFrom: 1 to: colonIndex-1]
ifFalse: [nil]]
ifFalse: [nil]!
More information about the Packages
mailing list