~ubuntu-branches/ubuntu/wily/dovecot/wily-proposed

« back to all changes in this revision

Viewing changes to src/lib-http/test-http-client.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2015-09-14 13:58:42 UTC
  • mfrom: (4.1.54 sid)
  • Revision ID: package-import@ubuntu.com-20150914135842-jhpp689shskxt0hu
Tags: 1:2.2.18-2ubuntu1
* Merge with Debian (after 552 days); remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
* d/control: Drop dovecot-postfix package as its no longer required.
* Rename init.d script to work with the dh_installinit --name option, so
  that it comes back. (LP: #1323274)
* d/dovecot-core.config: Drop db_input for ssl-cert-exists; this message
  not actually an error, is documented in the README.Debian, and blocks
  automated upgrades (LP: #1278897).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "ioloop.h"
6
6
#include "write-full.h"
7
7
#include "http-url.h"
8
8
#include "http-client.h"
 
9
#include "dns-lookup.h"
9
10
 
10
11
struct http_test_request {
11
12
        struct io *io;
63
64
        i_info("DEBUG: REQUEST: Got payload");
64
65
        i_stream_ref(response->payload);
65
66
        req->payload = response->payload;
66
 
        req->io = io_add(i_stream_get_fd(response->payload), IO_READ,
67
 
                         payload_input, req);
 
67
        req->io = io_add_istream(response->payload, payload_input, req);
68
68
        payload_input(req);
69
69
}
70
70
 
323
323
 
324
324
int main(int argc, char *argv[])
325
325
{
 
326
        struct dns_client *dns_client;
 
327
        struct dns_lookup_settings dns_set;
326
328
        struct http_client_settings http_set;
327
329
        struct http_client *http_client;
 
330
        const char *error;
328
331
        struct ioloop *ioloop;
329
332
 
 
333
        lib_init();
 
334
 
 
335
        ioloop = io_loop_create();
 
336
        io_loop_set_running(ioloop);
 
337
 
 
338
 
 
339
        memset(&dns_set, 0, sizeof(dns_set));
 
340
        dns_set.dns_client_socket_path = "/var/run/dovecot/dns-client";
 
341
        dns_set.timeout_msecs = 30*1000;
 
342
        dns_set.idle_timeout_msecs = UINT_MAX;
 
343
        dns_client = dns_client_init(&dns_set);
 
344
 
 
345
        if (dns_client_connect(dns_client, &error) < 0)
 
346
                i_fatal("Couldn't initialize DNS client: %s", error);
 
347
 
330
348
        memset(&http_set, 0, sizeof(http_set));
331
 
        http_set.dns_client_socket_path = "/var/run/dovecot/dns-client";
 
349
        http_set.dns_client = dns_client;
332
350
        http_set.ssl_allow_invalid_cert = TRUE;
333
351
        http_set.ssl_ca_dir = "/etc/ssl/certs"; /* debian */
334
352
        http_set.ssl_ca_file = "/etc/pki/tls/cert.pem"; /* redhat */
340
358
        http_set.debug = TRUE;
341
359
        http_set.rawlog_dir = "/tmp/http-test";
342
360
 
343
 
        lib_init();
344
 
 
345
 
        ioloop = io_loop_create();
346
 
        io_loop_set_running(ioloop);
347
 
 
348
361
        http_client = http_client_init(&http_set);
349
362
 
350
363
        switch (argc) {
364
377
        http_client_wait(http_client);
365
378
        http_client_deinit(&http_client);
366
379
 
 
380
        dns_client_deinit(&dns_client);
 
381
 
367
382
        io_loop_destroy(&ioloop);
368
383
        lib_deinit();
369
384
}