Git Product home page Git Product logo

gospdy's People

Contributors

jmckaskill avatar slymarbo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gospdy's Issues

Incomplete use of tls.Config in gospdy.Transport

In gospdy.Transport.RoundTrip(), on line 246, the TLS connection verifies the certificate's hostname, even if this has been disabled in the tls.Config.

My proposed fix replaces:

   if err := tlsSock.VerifyHostname(cfg.ServerName); err != nil {
       t.lk.Unlock()
       tlsSock.Close()
       proxySock.Close()
       return nil, err
   }

with:

   if !cfg.InsecureSkipVerify {
       if err := tlsSock.VerifyHostname(cfg.ServerName); err != nil {
       t.lk.Unlock()
       tlsSock.Close()
       proxySock.Close()
       return nil, err
       }
   }

Could you provide a HelloWorld example

I have tried to write hello world example using gospdy, but was out of luck. Here is my code:

package main

import (
    "fmt"
    "net/http"
    "github.com/jmckaskill/gospdy"
)

type Hello struct{}

func (h Hello) ServeHTTP(
        w http.ResponseWriter,
        r *http.Request) {
    fmt.Fprint(w, "Hello!")
}

func main() {
    var h Hello
    spdy.ListenAndServe("localhost:4000", h)
}

There were no errors, but localhost:4000 just did not respond.

client: Awkward to use different priorities with the same Transport

Given that the connection pool is inside Transport, to have multiple streams on the same connection one must use the same Transport.

However, to make requests with different priorities, the API is to set fields in RequestExtra, and then e.g. http.Client.Get. So, in practice, that would mean one needs to have a mutex protecting RequestExtra, and do something like Lock; RequestExtra.Priority = ...; Get; Unlock.

I understand that there is no good place for a priority in the net/http APIs. Maybe there could be per-priority RoundTrippers? In fact, all of RequestExtra could be done like that. Something like:

type customTransport struct {
  RequestExtra
  *Transport
}

func (t *customTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
    return t.Transport.roundTrip(req, &t.RequestExtra)
}



func (t *Transport) Custom(extra RequestExtra) http.RoundTripper {
    return &customTransport{RequestExtra: extra, Transport: t}
}

func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
    return t.roundTrip(req, &RequestExtra{})
}

func (t *Transport) roundTrip(req *http.Request, extra *RequestExtra) (resp *http.Response, err error) {
    ...
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.