]> git.saurik.com Git - apt.git/blame_incremental - methods/https.h
handle complete responses to https range requests
[apt.git] / methods / https.h
... / ...
CommitLineData
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
3// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
4/* ######################################################################
5
6 HTTP Acquire Method - This is the HTTP aquire method for APT.
7
8 ##################################################################### */
9 /*}}}*/
10
11#ifndef APT_HTTPS_H
12#define APT_HTTPS_H
13
14#include <iostream>
15#include <curl/curl.h>
16
17#include "server.h"
18
19using std::cout;
20using std::endl;
21
22class HttpsMethod;
23class FileFd;
24
25class HttpsServerState : public ServerState
26{
27 protected:
28 virtual bool ReadHeaderLines(std::string &Data) { return false; }
29 virtual bool LoadNextResponse(bool const ToFile, FileFd * const File) { return false; }
30
31 public:
32 virtual bool WriteResponse(std::string const &Data) { return false; }
33
34 /** \brief Transfer the data from the socket */
35 virtual bool RunData(FileFd * const File) { return false; }
36
37 virtual bool Open() { return false; }
38 virtual bool IsOpen() { return false; }
39 virtual bool Close() { return false; }
40 virtual bool InitHashes(FileFd &File) { return false; }
41 virtual Hashes * GetHashes() { return NULL; }
42 virtual bool Die(FileFd &File) { return false; }
43 virtual bool Flush(FileFd * const File) { return false; }
44 virtual bool Go(bool ToFile, FileFd * const File) { return false; }
45
46 HttpsServerState(URI Srv, HttpsMethod *Owner);
47 virtual ~HttpsServerState() {Close();};
48};
49
50class HttpsMethod : public pkgAcqMethod
51{
52 // minimum speed in bytes/se that triggers download timeout handling
53 static const int DL_MIN_SPEED = 10;
54
55 virtual bool Fetch(FetchItem *);
56 static size_t parse_header(void *buffer, size_t size, size_t nmemb, void *userp);
57 static size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp);
58 static int progress_callback(void *clientp, double dltotal, double dlnow,
59 double ultotal, double ulnow);
60 void SetupProxy();
61 CURL *curl;
62 FetchResult Res;
63 HttpsServerState *Server;
64
65 public:
66 FileFd *File;
67
68 HttpsMethod() : pkgAcqMethod("1.2",Pipeline | SendConfig)
69 {
70 File = 0;
71 curl = curl_easy_init();
72 };
73
74 ~HttpsMethod()
75 {
76 curl_easy_cleanup(curl);
77 };
78};
79
80#include <apt-pkg/strutl.h>
81URI Proxy;
82
83#endif