~ubuntu-branches/ubuntu/saucy/curl/saucy-201307251546

« back to all changes in this revision

Viewing changes to lib/pop3.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2012-03-23 16:24:51 UTC
  • mto: (3.6.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 59.
  • Revision ID: package-import@ubuntu.com-20120323162451-z4gstlabjkgnrh7h
Tags: upstream-7.25.0
ImportĀ upstreamĀ versionĀ 7.25.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
 
8
 * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
9
9
 *
10
10
 * This software is licensed as described in the file COPYING, which
11
11
 * you should have received as part of this distribution. The terms
79
79
#include "url.h"
80
80
#include "rawstr.h"
81
81
#include "strtoofft.h"
82
 
#include "http_proxy.h"
83
82
 
84
83
#define _MPRINTF_REPLACE /* use our functions only */
85
84
#include <curl/mprintf.h>
670
669
  pp->endofresp = pop3_endofresp;
671
670
  pp->conn = conn;
672
671
 
673
 
  if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
674
 
    /* for POP3 over HTTP proxy */
675
 
    struct HTTP http_proxy;
676
 
    struct FTP *pop3_save;
677
 
 
678
 
    /* BLOCKING */
679
 
    /* We want "seamless" POP3 operations through HTTP proxy tunnel */
680
 
 
681
 
    /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member
682
 
     * conn->proto.http; we want POP3 through HTTP and we have to change the
683
 
     * member temporarily for connecting to the HTTP proxy. After
684
 
     * Curl_proxyCONNECT we have to set back the member to the original struct
685
 
     * POP3 pointer
686
 
     */
687
 
    pop3_save = data->state.proto.pop3;
688
 
    memset(&http_proxy, 0, sizeof(http_proxy));
689
 
    data->state.proto.http = &http_proxy;
690
 
 
691
 
    result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
692
 
                               conn->host.name, conn->remote_port);
693
 
 
694
 
    data->state.proto.pop3 = pop3_save;
695
 
 
696
 
    if(CURLE_OK != result)
697
 
      return result;
698
 
  }
699
 
 
700
672
  if(conn->handler->flags & PROTOPT_SSL) {
701
673
    /* BLOCKING */
702
674
    result = Curl_ssl_connect(conn, FIRSTSOCKET);
755
727
  Curl_safefree(pop3c->mailbox);
756
728
  pop3c->mailbox = NULL;
757
729
 
758
 
  /* clear these for next connection */
 
730
  /* Clear the transfer mode for the next connection */
759
731
  pop3->transfer = FTPTRANSFER_BODY;
760
732
 
761
733
  return result;
1035
1007
                         char *str,
1036
1008
                         size_t nread)
1037
1009
{
1038
 
  /* This code could be made into a special function in the handler struct. */
 
1010
  /* This code could be made into a special function in the handler struct */
1039
1011
  CURLcode result = CURLE_OK;
1040
1012
  struct SessionHandle *data = conn->data;
1041
1013
  struct SingleRequest *k = &data->req;
1131
1103
  }
1132
1104
 
1133
1105
  if(pop3c->eob == POP3_EOB_LEN) {
1134
 
    /* We have a full match so the transfer is done! */
 
1106
    /* We have a full match so the transfer is done, however we must transfer
 
1107
    the CRLF at the start of the EOB as this is considered to be part of the
 
1108
    message as per RFC-1939, sect. 3 */
 
1109
    result = Curl_client_write(conn, CLIENTWRITE_BODY, (char*)POP3_EOB, 2);
 
1110
 
1135
1111
    k->keepon &= ~KEEP_RECV;
1136
1112
    pop3c->eob = 0;
1137
 
    return CURLE_OK;
 
1113
 
 
1114
    return result;
1138
1115
  }
1139
1116
 
1140
1117
  if(pop3c->eob)