eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTTPConnection':



Class: HTTPConnection



rev: 1.40 date: 2019/07/09 18:51:38
user: cg
file: HTTPConnection.st directory: goodies/webServer
module: stx stc-classLibrary: webServer


I represent a still active http connection and will serve requests from this
until closed.

Class protocol:

o  defaultConnectionProcessStackSize

o  defaultConnectionProcessStackSize: something
HTTPConnection defaultConnectionProcessStackSize:2*1024*1024

o  idleTimeoutToCloseConnection
the number of idle seconds, after which a kept connection is closed

o  maxRequestHeaderSize
return the maximum size of a requests header

o  requestTimeOut
return the maximum time in secs until a request times out

o  requestTransmitTimeOut
return the maximum time in secs until a request must be transmitted

Instance protocol:

o  httpServer

o  httpServer: something

o  keepConnection: something

o  lastRequestTime

o  lastRequestTime: something

o  serveProcess

o  socket

o  socket: aSocket

o  startReadRequestTime

o  verbose
return the verbose messages flag from the server

o  verboseData
return the verbose-data flag from the server

o  verboseErrors
return the verbose errors flag from the server

o  close
force an immediate close and terminate the process

o  closeSocket
close down the connection

o  scheduleForClose
remember to close the connection after processing

o  debugError: msg
debug-report some error condition to the Transcript

o  debugInfo: msg
debug-report some trace information to the Transcript

o  flushLog
flush our buffered log

o  logAccess: request
MessageTally spyDetailedOn:[

o  logError: aString
Add to the log.

o  logReply: aString
Add to the log.

o  logStream

o  logStream: aStream
set the log stream

o  logString: aString
Add to the log.

o  logWarning: aString
Add to the log.

o  printOn: aStream
aStream nextPutAll:' n='.

usage example(s):

requestCount printOn:aStream.

o  overallNumberOfRequests
the number of served requests in this connection

o  requestTimeToPerform
what a stupid name

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  timeInRequest
the time we have spent in the current request
Or the last one, if finished.
In milliseconds or nil

o  timeToPerformRequest
the time it took to perform the previous request.
In milliseconds or nil

o  getContentLengthFrom: requestString

o  process
serve the connection (as a new process)

o  readQueryDataForPostMessageFrom: header
some browsers apparently don't send content-length when user hits back button

o  readUpToEndOrSize: nMax
got timeout

o  serve
main loop on a connection:
- read request
- generate reply

when leaving the loop, the connection will be closed by our sender

o  setKeepConnectionForRequest: aRequest
handle keepConnection as specified in aRequest.
Notice: this is invoked BEFORE the request is actually handled - if a service
detects a bad guy or intruder, it may still choose to invoke keepConnection:false

o  waitForAndFetchRequest
Read the request and return an HTTPRequest instance,
or nil on any error.

startup & release
o  initializeFor: aHTTPServer socket: aSocket
initialize a connection served by aHTTPServer on aSocket

test support
o  quickSendTestResponse
used only for tests

o  isKeepAlive

o  isOpen

o  shouldTimeout
answer true, if the currently pending request should timeout

ST/X; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 11 Aug 2022 12:37:57 GMT