The Trunk: Network-nice.51.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Network-nice.51.mcz

commits-2
Nicolas Cellier uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-nice.51.mcz

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

Name: Network-nice.51
Author: nice
Time: 14 January 2010, 9:11:50.453 pm
UUID: 65c0934a-614e-499a-a3df-5dfe85bc3286
Ancestors: Network-ar.50

Correct socket peekFor: ( http://bugs.squeak.org/view.php?id=7446 )
Remove some remote temps in PRServerDirectory  (simplify)

=============== Diff against Network-ar.50 ===============

Item was changed:
  ----- Method: PRServerDirectory>>writeProject:inFileNamed:fromDirectory: (in category 'squeaklets') -----
  writeProject: aProject inFileNamed: fileNameString fromDirectory: localDirectory
  "write aProject (a file version can be found in the file named  
  fileNameString in localDirectory)"
  | url arguments string |
  url := self urlFromServer: self server directories: {'programmatic'. 'uploadproject'}.
  arguments := self
  getPostArgsFromProject: aProject
  fileNamed: fileNameString
  fromDirectory: localDirectory.
  ""
+ string := Cursor read showWhile: [
+ (HTTPClient httpPostDocument: url args: arguments) contents
+ "(HTTPSocket httpGetDocument: url args: arguments) contents."].
+ (string beginsWith: '--OK--')
+ ifTrue: [^ true].
- Cursor read
- showWhile: [ | answer |""
- answer := HTTPClient httpPostDocument: url args: arguments.
- "answer := HTTPSocket httpGetDocument: url args: arguments."
- string := answer contents.
- (string beginsWith: '--OK--')
- ifTrue: [^ true]].
  ""
  self
  inform: ('Server responded: {1}' translated format: {string}).
  ^ false!

Item was changed:
  ----- Method: PRServerDirectory>>queryProjectsAndShow: (in category 'testing') -----
  queryProjectsAndShow: thingsToSearchForCollection
  "query the server for all the projects that match  
  thingsToSearchForCollection"
  | url arguments string |
  url := self urlFromServer: self server directories: {'programmatic'. 'queryprojects'}.
  arguments := self getPostArgsFromThingsToSearchFor: thingsToSearchForCollection.
  ""
+ string := Cursor read showWhile: [
+ "(HTTPClient httpPostDocument: url args:  args) contents."
+ (HTTPSocket httpGetDocument: url args: arguments) contents].
+ (string beginsWith: '--OK--')
+ ifTrue: [^ true].
- Cursor read
- showWhile: [ | answer |""
- "answer := HTTPClient httpPostDocument: url args:  
- args."
- answer := HTTPSocket httpGetDocument: url args: arguments.
- string := answer contents.
- (string beginsWith: '--OK--')
- ifTrue: [^ true]].
  ""
  self
  inform: ('Server responded: {1}' translated format: {string}).
  ^ false!

Item was changed:
  ----- Method: PRServerDirectory>>getOnly:ofProjectContents: (in category 'private') -----
  getOnly: numberOfBytes ofProjectContents: aString
  "private - get numberOfBytes of the project contents"
  | url args contents |
  self flag: #todo.
  "use an LRUCache"
  url := self urlFromServer: self server directories: {'programmatic'. aString}.
  ""
  args := numberOfBytes isNil
  ifFalse: ['numberOfBytes=' , numberOfBytes asString].
  ""
+ contents := Cursor read showWhile: [
+ (HTTPSocket httpGetDocument: url args: args) contents].
+ ""
- Cursor read
- showWhile: [ | answer |""
- answer := HTTPSocket httpGetDocument: url args: args.
- contents := answer contents].""
  (contents beginsWith: '--OK--')
  ifFalse: [^ nil].
  ""
  ^ contents allButFirst: 6!

Item was changed:
  ----- Method: PRServerDirectory>>getLines (in category 'private') -----
  getLines
  "private - answer a collection of lines with the server response"
  | url lines string |
  url := self urlFromServer: self server directories: {'programmatic'} , self directories.
  url := url , self slash.
  ""
+ string := Cursor read showWhile: [
+ (HTTPClient httpGetDocument: url) contents].
+ (string beginsWith: '--OK--')
+ ifFalse: [^ nil].
- Cursor read
- showWhile: [ | answer |""
- answer := HTTPClient httpGetDocument: url.
- string := answer contents.
- (string beginsWith: '--OK--')
- ifFalse: [^ nil]].
  ""
  lines := OrderedCollection new.
  (string allButFirst: 6)
  linesDo: [:line | lines add: line squeakToIso].
  ""
  ^ lines!

Item was changed:
  ----- Method: SocketStream>>peekFor: (in category 'stream in') -----
  peekFor: aCharacterOrByte
  "Read and return next character or byte
  if it is equal to the argument.
  Otherwise return false."
 
  | nextObject |
  self atEnd ifTrue: [^false].
  self isInBufferEmpty ifTrue:
  [self receiveData.
  self atEnd ifTrue: [^false]].
+ nextObject := inBuffer at: lastRead + 1.
- nextObject := inBuffer at: lastRead.
  nextObject = aCharacterOrByte ifTrue: [
  lastRead := lastRead + 1.
  ^true].
  ^false
  !