tests/get-with-headers.py
author Gregory Szorc <gregory.szorc@gmail.com>
Mon, 26 Mar 2018 11:00:16 -0700
changeset 37288 9bfcbe4f4745
parent 36605 cfd0c1df5e33
child 40154 fe11fc7e541f
permissions -rwxr-xr-x
wireproto: add streams to frame-based protocol Previously, the frame-based protocol was just a series of frames, with each frame associated with a request ID. In order to scale the protocol, we'll want to enable the use of compression. While it is possible to enable compression at the socket/pipe level, this has its disadvantages. The big one is it undermines the point of frames being standalone, atomic units that can be read and written: if you add compression above the framing protocol, you are back to having a stream-based protocol as opposed to something frame-based. So in order to preserve frames, compression needs to occur at the frame payload level. Compressing each frame's payload individually will limit compression ratios because the window size of the compressor will be limited by the max frame size, which is 32-64kb as currently defined. It will also add CPU overhead, as it is more efficient for compressors to operate on fewer, larger blocks of data than more, smaller blocks. So compressing each frame independently is out. This means we need to compress each frame's payload as if it is part of a larger stream. The simplest approach is to have 1 stream per connection. This could certainly work. However, it has disadvantages (documented below). We could also have 1 stream per RPC/command invocation. (This is the model HTTP/2 goes with.) This also has disadvantages. The main disadvantage to one global stream is that it has the very real potential to create CPU bottlenecks doing compression. Networks are only getting faster and the performance of single CPU cores has been relatively flat. Newer compression formats like zstandard offer better CPU cycle efficiency than predecessors like zlib. But it still all too common to saturate your CPU with compression overhead long before you saturate the network pipe. The main disadvantage with streams per request is that you can't reap the benefits of the compression context for multiple requests. For example, if you send 1000 RPC requests (or HTTP/2 requests for that matter), the response to each would have its own compression context. The overall size of the raw responses would be larger because compression contexts wouldn't be able to reference data from another request or response. The approach for streams as implemented in this commit is to support N streams per connection and for streams to potentially span requests and responses. As explained by the added internals docs, this facilitates servers and clients delegating independent streams and compression to independent threads / CPU cores. This helps alleviate the CPU bottleneck of compression. This design also allows compression contexts to be reused across requests/responses. This can result in improved compression ratios and less overhead for compressors and decompressors having to build new contexts. Another feature that was defined was the ability for individual frames within a stream to declare whether that individual frame's payload uses the content encoding (read: compression) defined by the stream. The idea here is that some servers may serve data from a combination of caches and dynamic resolution. Data coming from caches may be pre-compressed. We want to facilitate servers being able to essentially stream bytes from caches to the wire with minimal overhead. Being able to mix and match with frames are compressed within a stream enables these types of advanced server functionality. This commit defines the new streams mechanism. Basic code for supporting streams in frames has been added. But that code is seriously lacking and doesn't fully conform to the defined protocol. For example, we don't close any streams. And support for content encoding within streams is not yet implemented. The change was rather invasive and I didn't think it would be reasonable to implement the entire feature in a single commit. For the record, I would have loved to reuse an existing multiplexing protocol to build the new wire protocol on top of. However, I couldn't find a protocol that offers the performance and scaling characteristics that I desired. Namely, it should support multiple compression contexts to facilitate scaling out to multiple CPU cores and compression contexts should be able to live longer than single RPC requests. HTTP/2 *almost* fits the bill. But the semantics of HTTP message exchange state that streams can only live for a single request-response. We /could/ tunnel on top of HTTP/2 streams and frames with HEADER and DATA frames. But there's no guarantee that HTTP/2 libraries and proxies would allow us to use HTTP/2 streams and frames without the HTTP message exchange semantics defined in RFC 7540 Section 8. Other RPC protocols like gRPC tunnel are built on top of HTTP/2 and thus preserve its semantics of stream per RPC invocation. Even QUIC does this. We could attempt to invent a higher-level stream that spans HTTP/2 streams. But this would be violating HTTP/2 because there is no guarantee that HTTP/2 streams are routed to the same server. The best we can do - which is what this protocol does - is shoehorn all request and response data into a single HTTP message and create streams within. At that point, we've defined a Content-Type in HTTP parlance. It just so happens our media type can also work as a standalone, stream-based protocol, without leaning on HTTP or similar protocol. Differential Revision: https://phab.mercurial-scm.org/D2907
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2532
84655f721f39 Add a test for getting raw files via the web UI.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     1
#!/usr/bin/env python
84655f721f39 Add a test for getting raw files via the web UI.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     2
8447
d5ebcf8f6855 tests: fix doc string in get-with-headers.py
Martin Geisler <mg@lazybytes.net>
parents: 7544
diff changeset
     3
"""This does HTTP GET requests given a host:port and path and returns
2532
84655f721f39 Add a test for getting raw files via the web UI.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     4
a subset of the headers plus the body of the result."""
84655f721f39 Add a test for getting raw files via the web UI.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     5
36605
cfd0c1df5e33 get-with-headers: use bytes stdout thoroughly
Yuya Nishihara <yuya@tcha.org>
parents: 36309
diff changeset
     6
from __future__ import absolute_import
27296
8e86679d8acd tests: use absolute_import in /get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25208
diff changeset
     7
35780
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
     8
import argparse
27296
8e86679d8acd tests: use absolute_import in /get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25208
diff changeset
     9
import json
8e86679d8acd tests: use absolute_import in /get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25208
diff changeset
    10
import os
8e86679d8acd tests: use absolute_import in /get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25208
diff changeset
    11
import sys
7054
e837f2294643 get-with-headers: fix stream modes under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 5561
diff changeset
    12
29455
0c741fd6158a py3: conditionalize httplib import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28726
diff changeset
    13
from mercurial import (
0c741fd6158a py3: conditionalize httplib import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28726
diff changeset
    14
    util,
0c741fd6158a py3: conditionalize httplib import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28726
diff changeset
    15
)
0c741fd6158a py3: conditionalize httplib import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28726
diff changeset
    16
0c741fd6158a py3: conditionalize httplib import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28726
diff changeset
    17
httplib = util.httplib
0c741fd6158a py3: conditionalize httplib import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28726
diff changeset
    18
7054
e837f2294643 get-with-headers: fix stream modes under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 5561
diff changeset
    19
try:
27296
8e86679d8acd tests: use absolute_import in /get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25208
diff changeset
    20
    import msvcrt
7054
e837f2294643 get-with-headers: fix stream modes under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 5561
diff changeset
    21
    msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
e837f2294643 get-with-headers: fix stream modes under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 5561
diff changeset
    22
    msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
e837f2294643 get-with-headers: fix stream modes under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 5561
diff changeset
    23
except ImportError:
e837f2294643 get-with-headers: fix stream modes under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 5561
diff changeset
    24
    pass
e837f2294643 get-with-headers: fix stream modes under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 5561
diff changeset
    25
36605
cfd0c1df5e33 get-with-headers: use bytes stdout thoroughly
Yuya Nishihara <yuya@tcha.org>
parents: 36309
diff changeset
    26
stdout = getattr(sys.stdout, 'buffer', sys.stdout)
cfd0c1df5e33 get-with-headers: use bytes stdout thoroughly
Yuya Nishihara <yuya@tcha.org>
parents: 36309
diff changeset
    27
35780
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    28
parser = argparse.ArgumentParser()
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    29
parser.add_argument('--twice', action='store_true')
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    30
parser.add_argument('--headeronly', action='store_true')
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    31
parser.add_argument('--json', action='store_true')
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    32
parser.add_argument('--hgproto')
35781
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    33
parser.add_argument('--requestheader', nargs='*', default=[],
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    34
                    help='Send an additional HTTP request header. Argument '
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    35
                         'value is <header>=<value>')
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    36
parser.add_argument('--bodyfile',
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    37
                    help='Write HTTP response body to a file')
35780
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    38
parser.add_argument('host')
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    39
parser.add_argument('path')
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    40
parser.add_argument('show', nargs='*')
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    41
35780
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    42
args = parser.parse_args()
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    43
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    44
twice = args.twice
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    45
headeronly = args.headeronly
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    46
formatjson = args.json
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
    47
hgproto = args.hgproto
35781
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    48
requestheaders = args.requestheader
30764
e75463e3179f protocol: send application/mercurial-0.2 responses to capable clients
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29455
diff changeset
    49
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    50
tag = None
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    51
def request(host, path, show):
17017
953faba28e91 tests: prepare get-with-headers.py for MSYS
Mads Kiilerich <mads@kiilerich.com>
parents: 12250
diff changeset
    52
    assert not path.startswith('/'), path
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    53
    global tag
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    54
    headers = {}
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    55
    if tag:
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    56
        headers['If-None-Match'] = tag
30764
e75463e3179f protocol: send application/mercurial-0.2 responses to capable clients
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29455
diff changeset
    57
    if hgproto:
e75463e3179f protocol: send application/mercurial-0.2 responses to capable clients
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29455
diff changeset
    58
        headers['X-HgProto-1'] = hgproto
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 2532
diff changeset
    59
35781
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    60
    for header in requestheaders:
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    61
        key, value = header.split('=', 1)
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    62
        headers[key] = value
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    63
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    64
    conn = httplib.HTTPConnection(host)
17017
953faba28e91 tests: prepare get-with-headers.py for MSYS
Mads Kiilerich <mads@kiilerich.com>
parents: 12250
diff changeset
    65
    conn.request("GET", '/' + path, None, headers)
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    66
    response = conn.getresponse()
36605
cfd0c1df5e33 get-with-headers: use bytes stdout thoroughly
Yuya Nishihara <yuya@tcha.org>
parents: 36309
diff changeset
    67
    stdout.write(b'%d %s\n' % (response.status,
cfd0c1df5e33 get-with-headers: use bytes stdout thoroughly
Yuya Nishihara <yuya@tcha.org>
parents: 36309
diff changeset
    68
                               response.reason.encode('ascii')))
18380
a4d7fd7ad1f7 serve: don't send any content headers with 304 responses
Mads Kiilerich <madski@unity3d.com>
parents: 17017
diff changeset
    69
    if show[:1] == ['-']:
18393
a38039ef7312 tests: make test-hgweb.t output stable
Mads Kiilerich <madski@unity3d.com>
parents: 18380
diff changeset
    70
        show = sorted(h for h, v in response.getheaders()
a38039ef7312 tests: make test-hgweb.t output stable
Mads Kiilerich <madski@unity3d.com>
parents: 18380
diff changeset
    71
                      if h.lower() not in show)
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    72
    for h in [h.lower() for h in show]:
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
    73
        if response.getheader(h, None) is not None:
36605
cfd0c1df5e33 get-with-headers: use bytes stdout thoroughly
Yuya Nishihara <yuya@tcha.org>
parents: 36309
diff changeset
    74
            stdout.write(b"%s: %s\n" % (h.encode('ascii'),
cfd0c1df5e33 get-with-headers: use bytes stdout thoroughly
Yuya Nishihara <yuya@tcha.org>
parents: 36309
diff changeset
    75
                                        response.getheader(h).encode('ascii')))
18400
f1118507174b get-with-headers: add a --headeronly switch
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18393
diff changeset
    76
    if not headeronly:
36605
cfd0c1df5e33 get-with-headers: use bytes stdout thoroughly
Yuya Nishihara <yuya@tcha.org>
parents: 36309
diff changeset
    77
        stdout.write(b'\n')
23409
dc4d2cd3aa3e hgweb: send proper HTTP response after uncaught exception
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19865
diff changeset
    78
        data = response.read()
24543
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    79
35781
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    80
        if args.bodyfile:
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    81
            bodyfh = open(args.bodyfile, 'wb')
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    82
        else:
36605
cfd0c1df5e33 get-with-headers: use bytes stdout thoroughly
Yuya Nishihara <yuya@tcha.org>
parents: 36309
diff changeset
    83
            bodyfh = stdout
35781
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    84
24543
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    85
        # Pretty print JSON. This also has the beneficial side-effect
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    86
        # of verifying emitted JSON is well-formed.
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    87
        if formatjson:
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    88
            # json.dumps() will print trailing newlines. Eliminate them
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    89
            # to make tests easier to write.
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    90
            data = json.loads(data)
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    91
            lines = json.dumps(data, sort_keys=True, indent=2).splitlines()
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    92
            for line in lines:
35781
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    93
                bodyfh.write(line.rstrip())
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    94
                bodyfh.write(b'\n')
24543
747401086a38 get-with-headers: support parsing and pretty printing JSON
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23409
diff changeset
    95
        else:
35781
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    96
            bodyfh.write(data)
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    97
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    98
        if args.bodyfile:
c6ef8e841873 tests: teach get-with-headers.py some new tricks
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35780
diff changeset
    99
            bodyfh.close()
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
   100
31794
39f6333e968c tests: store ETag when using --headeronly
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30764
diff changeset
   101
    if twice and response.getheader('ETag', None):
39f6333e968c tests: store ETag when using --headeronly
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30764
diff changeset
   102
        tag = response.getheader('ETag')
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
   103
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
   104
    return response.status
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
   105
35780
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
   106
status = request(args.host, args.path, args.show)
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
   107
if twice:
35780
32317f8bbe2a tests: use argparse in get-with-headers.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31794
diff changeset
   108
    status = request(args.host, args.path, args.show)
12182
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
   109
1121af239761 tests: extend get-with-headers to support cache testing
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10905
diff changeset
   110
if 200 <= status <= 305:
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 2532
diff changeset
   111
    sys.exit(0)
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 2532
diff changeset
   112
sys.exit(1)