Index: ioemu/vl.c =================================================================== --- ioemu.orig/vl.c 2006-07-14 15:55:59.491503372 +0100 +++ ioemu/vl.c 2006-07-14 15:55:59.693480386 +0100 @@ -4697,7 +4697,7 @@ "-S freeze CPU at startup (use 'c' to start execution)\n" "-s wait gdb connection to port %d\n" "-p port change gdb connection port\n" - "-d item1,... output log to %s (use -d ? for a list of log items)\n" + "-l item1,... output log to %s (use -d ? for a list of log items)\n" "-hdachs c,h,s[,t] force hard disk 0 physical geometry and the optional BIOS\n" " translation (t=none or lba) (usually qemu can guess them)\n" "-L path set the directory for the BIOS and VGA BIOS\n" @@ -4775,7 +4775,7 @@ QEMU_OPTION_S, QEMU_OPTION_s, QEMU_OPTION_p, - QEMU_OPTION_d, + QEMU_OPTION_l, QEMU_OPTION_hdachs, QEMU_OPTION_L, #ifdef USE_CODE_COPY @@ -4844,7 +4844,7 @@ { "S", 0, QEMU_OPTION_S }, { "s", 0, QEMU_OPTION_s }, { "p", HAS_ARG, QEMU_OPTION_p }, - { "d", HAS_ARG, QEMU_OPTION_d }, + { "l", HAS_ARG, QEMU_OPTION_l }, { "hdachs", HAS_ARG, QEMU_OPTION_hdachs }, { "L", HAS_ARG, QEMU_OPTION_L }, #ifdef USE_CODE_COPY @@ -5095,6 +5095,8 @@ char usb_devices[MAX_VM_USB_PORTS][128]; int usb_devices_index; + char qemu_dm_logfilename[64]; + LIST_INIT (&vm_change_state_head); #if !defined(CONFIG_SOFTMMU) /* we never want that malloc() uses mmap() */ @@ -5144,6 +5146,11 @@ nb_nics = 0; /* default mac address of the first network interface */ + /* init debug */ + sprintf(qemu_dm_logfilename, "/var/log/qemu-dm.%d.log", getpid()); + cpu_set_log_filename(qemu_dm_logfilename); + cpu_set_log(0); + optind = 1; for(;;) { if (optind >= argc) @@ -5329,7 +5336,7 @@ exit(1); } break; - case QEMU_OPTION_d: + case QEMU_OPTION_l: { int mask; CPULogItem *item; @@ -5700,7 +5707,7 @@ stk.ss_flags = 0; if (sigaltstack(&stk, NULL) < 0) { - perror("sigaltstack"); + fprintf(logfile, "sigaltstack returned error %d\n", errno); exit(1); } } ter'>committer
path: root/test/netlib/http/test_headers.py
blob: 51819b860048b18e36c1a9cb1185ad36729fc977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from netlib.http import Headers, parse_content_type
from netlib.tutils import raises


class TestHeaders(object):
    def _2host(self):
        return Headers(
            (
                (b"Host", b"example.com"),
                (b"host", b"example.org")
            )
        )

    def test_init(self):
        headers = Headers()
        assert len(headers) == 0

        headers = Headers([[b"Host", b"example.com"]])
        assert len(headers) == 1
        assert headers["Host"] == "example.com"

        headers = Headers(Host="example.com")
        assert len(headers) == 1
        assert headers["Host"] == "example.com"

        headers = Headers(
            [[b"Host", b"invalid"]],
            Host="example.com"
        )
        assert len(headers) == 1
        assert headers["Host"] == "example.com"

        headers = Headers(
            [[b"Host", b"invalid"], [b"Accept", b"text/plain"]],
            Host="example.com"
        )
        assert len(headers) == 2
        assert headers["Host"] == "example.com"
        assert headers["Accept"] == "text/plain"

        with raises(TypeError):
            Headers([[b"Host", u"not-bytes"]])

    def test_bytes(self):
        headers = Headers(Host="example.com")
        assert bytes(headers) == b"Host: example.com\r\n"

        headers = Headers([
            [b"Host", b"example.com"],
            [b"Accept", b"text/plain"]
        ])
        assert bytes(headers) == b"Host: example.com\r\nAccept: text/plain\r\n"

        headers = Headers()
        assert bytes(headers) == b""

    def test_replace_simple(self):
        headers = Headers(Host="example.com", Accept="text/plain")
        replacements = headers.replace("Host: ", "X-Host: ")
        assert replacements == 1
        assert headers["X-Host"] == "example.com"
        assert "Host" not in headers
        assert headers["Accept"] == "text/plain"

    def test_replace_multi(self):
        headers = self._2host()
        headers.replace(r"Host: example\.com", r"Host: example.de")
        assert headers.get_all("Host") == ["example.de", "example.org"]

    def test_replace_remove_spacer(self):
        headers = Headers(Host="example.com")
        replacements = headers.replace(r"Host: ", "X-Host ")
        assert replacements == 0
        assert headers["Host"] == "example.com"


def test_parse_content_type():
    p = parse_content_type
    assert p("text/html") == ("text", "html", {})
    assert p("text") is None

    v = p("text/html; charset=UTF-8")
    assert v == ('text', 'html', {'charset': 'UTF-8'})