Commit Graph

200 Commits

Author SHA1 Message Date
Marten Seemann
cdee407331 Merge pull request #1360 from nogoegst/request-host-fix
Use http.Request.Host only for authority header and not for dialing
2018-06-01 18:28:11 +08:00
Marten Seemann
6b82e46e0c use the prefix logger for client, server and proxy 2018-05-29 20:52:54 +08:00
Ivan Markin
350a663115 Use http.Request.Host only for authority header and not for dialing
Signed-off-by: Ivan Markin <sw@nogoegst.net>
2018-05-15 20:51:57 +00:00
Marten Seemann
5a0a231c02 use H2 helper functions from httpguts repository
httplex was merged into httpguts:
cbb82b59bc
2018-05-08 14:00:31 +09:00
Marten Seemann
948eef3e42 create a logger interface and use it everywhere 2018-04-04 13:03:28 +07:00
Marten Seemann
6712a8d023 don't log the PeerGoingAway error in the h2quic client 2018-03-11 15:42:20 +07:00
Marten Seemann
a588b9e140 make golint happier 2018-03-02 16:58:19 +07:00
Lorenzo Saino
10acc677aa Make RoundTripper.RoundTrip(...) return if client timeout expires
Currently, the implementation of h2quic.RoundTripper.RoundTrip(req
*http.Request) ignores the context of req. As a result, if the
RoundTripper is used as transport of an http.Client with a timeout value
set, that is ignored.

For example, in the following snippet, client.Do(req) does not promptly
return if the task takes more than client.Timeout to complete.

    client := http.Client{
        Timeout: 50 * time.Millisecond,
        Transport = &h2quic.RoundTripper{}
    }
    req, err := http.NewRequest("GET", "https://www.example.com", nil)
    response, err := client.Do(req)

This commit updates h2quic.client.RoundTrip(req *http.Request) to return
an error if the request is cancelled.
2018-02-25 20:58:37 +00:00
Marten Seemann
286a51bcc0 run staticcheck in gometalinter 2018-02-23 22:42:32 +08:00
Marten Seemann
11af98e338 run misspell in gometalinter 2018-02-23 22:39:08 +08:00
Marten Seemann
da49295b52 expose methods for opening and accepting unidirectional streams 2018-02-21 22:19:37 +08:00
Marten Seemann
7c9b18ea67 make the h2quic client test less racy 2018-02-01 22:35:53 +08:00
Marten Seemann
ef56cae9dc implement a Dial function for the h2quic.RoundTripper
If Dial is set, it will be used for dialing new QUIC connections. If it
is nil, quic.DialAddr will be used.
2018-01-21 13:47:06 +11:00
Marten Seemann
66fd3b5195 expose the ConnectionState in the Session
The ConnectionState contains basic details about the QUIC connection.
2018-01-11 16:27:42 +07:00
Marten Seemann
19c12a9470 refactor the loop reading the header stream in the h2quic client 2018-01-04 08:35:25 +07:00
Marten Seemann
fc4adb4775 improve error handling in the h2quic client for header stream handling
When the underlying QUIC stream is closed, the close error should be
returned. This always happens when receiving a CONNECTION_CLOSE from the
server.
Furthermore, this adds a missing break statement in the case when
receiving an invalid HTTP request.
2018-01-03 09:07:18 +07:00
Marten Seemann
a1058c0d97 make h2quic.Server.ListenAndServe error if it was closed before 2017-12-20 17:26:32 +07:00
Marten Seemann
d0b22e3439 refactor stream to support canceling Read and Write 2017-12-16 09:10:24 +07:00
Julien Schmidt
feab6e8450 shorten blocking call of Server.handleRequest 2017-12-08 09:41:57 +01:00
Marten Seemann
ff17ef79fe Merge pull request #987 from julienschmidt/handleHeaderStream
remove superfluous goroutine
2017-12-06 17:21:12 +07:00
Julien Schmidt
06c87af606 remove unused encryptionLevel from client 2017-12-06 10:51:28 +01:00
Julien Schmidt
54b62fb4a5 remove superfluous goroutine 2017-12-06 10:44:37 +01:00
Marten Seemann
f662822486 use stream 0 for the crypto stream when using TLS 2017-11-04 15:22:07 +07:00
Marten Seemann
d98a11bb35 save version numbers such that can be written in big endian
This makes the version number representation consistent with the IETF
draft.
2017-10-27 17:24:24 +07:00
Marten Seemann
9cb7480050 rename connection ID truncation to connection ID omission 2017-09-29 22:52:54 +07:00
Lucas Clemente
ea4de9a08f Merge pull request #698 from twdkeule/implement-closeNotifier
implement the context for the server http.Request
2017-09-26 14:09:54 +02:00
Julien Benoist
ce9132e324 fix TLS initialization for the TCP h2quic Server 2017-09-22 20:25:52 +07:00
Marten Seemann
f1ada87dcf make the protocol package internal 2017-08-30 00:19:44 +07:00
Thomas De Keulenaer
4f6eef8b08 Add test for request context 2017-08-27 20:05:13 +02:00
Thomas De Keulenaer
51be240488 Use datastream context for requests 2017-08-27 20:05:13 +02:00
Thomas De Keulenaer
55a8979bd5 Added session context to http.Request 2017-08-27 20:05:13 +02:00
Lucas Clemente
75070d057b Fix import order 2017-08-21 12:25:27 +02:00
Lucas Clemente
8ec11c0b53 Move testdata/ to internal/ 2017-08-18 12:06:36 +02:00
Marten Seemann
f6e8ce5c67 make tests independent of the supported QUIC versions
Now it's no longer necessary to edit the h2quic tests when adding a new
QUIC version to the slice of supported versions.
2017-08-10 20:23:20 +07:00
Marten Seemann
8ef69143ba implement a context for the stream
The context is cancelled when the write-side of the stream is closed.
2017-08-02 11:28:17 +07:00
Marten Seemann
e02f5d5fbe replace Session.WaitUntilClosed() by a context 2017-08-02 11:27:44 +07:00
Marten Seemann
43279c37a8 Merge pull request #753 from lucas-clemente/fix-734
implement a h2quic.RoundTripOpt that allow to only use cached QUIC conns
2017-07-25 08:36:51 +07:00
Marten Seemann
6bd6594003 implement a h2quic.RoundTripOpt that allow to only use cached QUIC conns 2017-07-24 21:46:18 +07:00
Marten Seemann
36ee4bd36b Revert "use a finalizer to close the h2quic.RoundTripper"
This reverts commit 65cea185bd.

The finalizer may run even before the h2quic.RoundTripper
variable falls out of scope. This can result in closing
the session before a HTTP transfer has completed.
2017-07-24 21:43:52 +07:00
Justin
0c3a466805 Remove Alternate-Protocol header 2017-07-17 22:20:40 -04:00
Justin
33bb42488a Remove Alternate-Protocol header 2017-07-17 22:20:34 -04:00
Marten Seemann
e09993403d add stream deadlines to the Stream interface 2017-07-15 23:46:15 +07:00
Marten Seemann
65cea185bd use a finalizer to close the h2quic.RoundTripper
The finalizer is executed when the RoundTripper is garbage collected.
This is not a perfect solution, since there are situations when an
unneeded RoundTripper is not garbage collected, e.g. when the program
exits before the GC ran. In those cases, the server will run into the
idle timeout and eventually close the connection  on its side.
2017-07-12 19:20:21 +07:00
Marten Seemann
bf6030a855 implement a function to close the h2quic.RoundTripper
h2quic.RoundTripper.Close() closes all QUIC connections that this
roundtripper has used.
2017-07-12 18:56:47 +07:00
Marten Seemann
ee6ca8dfb4 expose the quic.Config in the h2quic.RoundTripper 2017-07-10 22:00:03 +07:00
Marten Seemann
abb9594af8 change order of function parameters for the h2quic.client constructor 2017-07-10 22:00:03 +07:00
Marten Seemann
cb81a95ceb make the dependency-injected dialAddr in h2quic.client a global variable
It's only used for testing, so there's no need to have in each
h2quic.client instance.
2017-07-10 21:59:58 +07:00
Marten Seemann
d94b57fe29 expose the quic.Config in the h2quic.Server 2017-07-10 21:57:31 +07:00
Marten Seemann
79c7ed4ed1 dependency-inject quic.Listen and quic.ListenAddr in h2quic.Server 2017-07-10 21:57:31 +07:00
Lucas Clemente
bbf8977f64 Change h2quic.Server.Serve() to accept a net.PacketConn 2017-07-05 21:02:13 +02:00