8000 GitHub - dominikbraun/gohttp: Convenience functions for parsing net/http objects from a source and serializing them back to byte slices. · GitHub
[go: up one dir, main page]

Skip to content
  • Pricing
  • Sign up
    dominikbraunPublic

    About

    Convenience functions for parsing net/http objects from a source and serializing them back to byte slices.

    Resources

    Stars

    2 stars

    Watchers

    3 watching

    Forks

    Latest commit

     

    History

    34 Commits

    Folders and files

    NameName
    Last commit message
    Last commit date
     
     
     
     
     
     
     
     
     
     
     
     

    Repository files navigation

    gohttp

    gohttp provides convenience functions for parsing net/http objects from a source and serializing them back to byte slices. At the moment, gohttp is HTTP/1.1-compatible only.

    Status: WIP and experimental. If you intend to parse requests from a byte source, use http.ReadRequest instead.

    Examples

    ParseRequest

    ParseRequest reads a given source and parses an http.Request instance from it.

    conn, err := server.listener.Accept()
    
    // Handle errors, defer closing the connection etc.
    
    conn.setReadDeadline(time.Now().Add(10 * time.Second))
    connReader := bufio.NewReader(conn)
    
    request, _ := gohttp.ParseRequest(connReader)

    SerializeRequest

    SerializeRequest converts an http.Request instance into a byte slice.

    conn.setWriteDeadline(time.Now().Add(10 * time.Second))
    serializedRequest, _ := gohttp.SerializeRequest(request)
    _, _ = conn.Write(serializedRequest)

    About

    Convenience functions for parsing net/http objects from a source and serializing them back to byte slices.

    Resources

    Stars

    2 stars

    Watchers

    3 watching

    Forks

    Releases

    Packages

    Used by

    Contributors

    Languages

    0