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

BOOL PHTTPClient::GetDocument ( const PURL url,
PMIMEInfo &  outMIME,
PMIMEInfo &  replyMIME,
BOOL  persist = TRUE 

Get the document specified by the URL.

TRUE if document is being transferred.
url  Universal Resource Locator for document.
outMIME  MIME info in request
replyMIME  MIME info in response
persist  if TRUE, enable HTTP persistence

Definition at line 519 of file httpclnt.cxx.

References PURL::AsString(), ExecuteCommand(), PString::IsEmpty(), PHTTP::MovedPermanently, PHTTP::MovedTemporarily, ReadContentBody(), and PHTTP::RequestOK.

Referenced by GetTextDocument().

  int count = 0;
  static const char locationTag[] = "Location";
  PURL url = _url;
  for (;;) {
    PMIMEInfo outMIME = _outMIME;
    PString u = url.AsString();
    int code = ExecuteCommand(GET, url, outMIME, PString(), replyMIME, persist);
    switch (code) {
      case RequestOK:
        return TRUE;
      case MovedPermanently:
      case MovedTemporarily:
          if (count > 10)
            return FALSE;
          PString str = replyMIME(locationTag);
          if (str.IsEmpty())
            return FALSE;
          PString doc;
          if (!ReadContentBody(replyMIME, doc))
            return FALSE;
          url = str;
        return FALSE;

Generated by  Doxygen 1.6.0   Back to index