Giter Site home page Giter Site logo

switchboard's Introduction

Switchboard

Fully asynchronous C# 5 / .NET4.5 HTTP intermediary server.

Uses HttpMachine for parsing incoming HTTP requests and a naive custom built response parser.

Supports SSL for inbound and outbound connections.

Uses/Why?

I wrote it cause I needed to transparently manipulate requests going from one application to a web service. The application made Http requests to a server and I needed a quick-fix solution for tweaking the requests/responses without either end knowing about it. Since the requests could potentially be rather large I decided it would be a good time to dig into the async goodness in C# 5 and make the middle man server fully asynchronous.

The hack evolved until it had a life of it's own so I'm putting it out there in case someone has similar problems.

Is it a web server?

TL;DR: no

It's more than capable of parsing requests and generating responses so there's nothing stopping you from using it as a stand-alone web server. But the primary use case is to read requests and (with or without modification) send them to a proper web server and deliver the response back.

As such Switchboard can rely on a competent fully capable http server such as IIS, lighttpd or Apache to deal with all the intricacies of the HTTP protocol and deal with shuffling data and tweaking requests and responses.

Potential uses

The lib is still really early in development and it's lacking in several aspects but here's some potential future use cases.

  • Load balancing/reverse proxy
  • Reverse proxy with cache (coupled with a good cache provider)
  • In flight message logging for web services either for temporary debugging or more permanent logging when there's zero or little control over the endpoints.
  • AJAX proxy

Notes/TODO

There are CancellationTokens sprinkled throughout but they won't do any smart cancellation as of yet.

There's currently no proper logging support, only the debug log.

No timeout support for connections which never gets around to making a request.

The original purpose of Switchboard was to run in a friendly environment. Security hardening is planned but for now it's probably not suited environments facing malicious requests/responses. This is especially true for malicious responses since we currently have our own parser for that.

Future improvment: Ability to establish outbound connection immediately after inbound connection is established (before request is read) thread safe openoutboundconnection

Chunked transfer support is currently limited. It works great for streaming but there's no support for merging chunks into a coherent response. Beware.

Documentation is severely lacking.

License

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

switchboard's People

Contributors

niik 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

Watchers

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

switchboard's Issues

Expect: 100-continue Header supported?

I'm testing using a soap post request and it never returns a response.

Looks like switchboard hangs if original client sends Expect: 100-continue header.

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.