Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PINDEX PHTTP::ParseResponse ( const PString line ) [protected, virtual, inherited]

Parse a response line string into a response code and any extra info on the line. Results are placed into the member variables lastResponseCode and lastResponseInfo.

The default bahaviour looks for a space or a '-' and splits the code and info either side of that character, then returns FALSE.

Position of continuation character in response, 0 if no continuation lines are possible.
lineInput response line to be parsed

Reimplemented from PInternetProtocol.

Definition at line 1296 of file http.cxx.

References PString::AsInteger(), PString::Find(), PHTTP::InternalServerError, PString::Left(), and PString::Mid().

  PINDEX endVer = line.Find(' ');
  if (endVer == P_MAX_INDEX) {
    lastResponseInfo = "Bad response";
    lastResponseCode = PHTTP::InternalServerError;
    return 0;

  lastResponseInfo = line.Left(endVer);
  PINDEX endCode = line.Find(' ', endVer+1);
  lastResponseCode = line(endVer+1,endCode-1).AsInteger();
  if (lastResponseCode == 0)
    lastResponseCode = PHTTP::InternalServerError;
  lastResponseInfo &= line.Mid(endCode);
  return 0;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index