'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 4 July 2006 at 11:45:10 am'! !HttpAdaptor class methodsFor: 'instance creation' stamp: 'jecel 6/11/2005 21:36'! readAndWriteToSocket: aSocket service: httpService ^self readAndWriteTo: ((FastSocketStream on: aSocket) timeout: self dataTimeout; autoFlush: false; yourself) service: httpService! ! !HttpRequest methodsFor: 'accessing' stamp: 'jecel 6/17/2005 17:54'! host ^self propertyAt: #host ifAbsentPut: [self header at: 'host' ifAbsent: ['unknown']]! ! !ModFile methodsFor: 'processing' stamp: 'jecel 6/13/2005 20:25'! processHttp | fullFilePath method | method := ModCore method. (#(#GET #POST) includes: method) ifFalse: [^false]. fullFilePath := ModDoc fullFilePath. (FileStream isAFileNamed: fullFilePath) ifFalse: [^false]. self processSubModules ifTrue: [^true]. HttpResponse current: (HttpResponse fromStream: (StandardFileStream readOnlyFileNamed: fullFilePath)). ^true! ! !ProtocolClient methodsFor: 'private' stamp: 'jecel 6/11/2005 21:37'! ensureConnection self isConnected ifTrue: [^self]. self stream ifNotNil: [self stream close]. self stream: (FastSocketStream openConnectionToHost: self host port: self port). self checkResponse. self login! ! !WADispatcher methodsFor: 'private' stamp: 'jecel 6/11/2005 19:38'! handlerForRequest: aRequest relativeTo: base | path name | path := aRequest url. ((path beginsWith: base) or: [base isEmpty]) ifTrue: [| relativePath | relativePath := path allButFirst: base size. (relativePath notEmpty and: [relativePath first = $/]) ifTrue: [name := (relativePath findTokens: '/') at: 1 ifAbsent: []]. entryPoints at: name ifPresent: [:n | ^ n]]. ^ WANotFoundHandler new ! ! !WAKomEncoded methodsFor: 'as yet unclassified' stamp: 'avi 5/29/2005 16:41'! convertResponse: aResponse | komResponse responseStream | aResponse ifNil: [^ HttpResponse fromString: 'Request handling aborted; reload to retry']. komResponse := HttpResponse new. aResponse cookies do: [:assoc | komResponse setCookieName: assoc key value: assoc valueWithExpiry path: assoc path]. aResponse headers associationsDo: [:assoc | komResponse fieldAt: assoc key put: assoc value]. (HttpResponse classPool at: #StatusCodes) associationsDo: [:assoc | assoc value key = aResponse status ifTrue: [komResponse status: assoc key]]. " conversion to UTF-8 " responseStream _ aResponse. (aResponse contentType upTo: $/) = 'text' ifTrue: [responseStream _ MultiByteBinaryOrTextStream on: WideString new encoding: #utf8. responseStream nextPutAll: aResponse contents. responseStream binary reset]. komResponse contents: responseStream contents readStream. komResponse contentType: aResponse contentType. ^ komResponse! !