Git Product home page Git Product logo

memoizing-proxy's Introduction

memoizing proxy

a small forward proxy to serve the http requests from local files - local data created on first request with the content retrieved from the remote url

Note: once the local file is created it won't be updated as the main purpose of this proxy was to get consistent results when running the automated (xslt&xquery) tests that are accessing remote files (schemas, dtds, images, etc.)

  • store the uri->local file name mappings in a dictionary
    • load to memory from a json file on program start; if the file doesn't exists an empty dictionary is created
  • on a http request the url is remapped to a local file name
    • the local file name is retieved from the dictionary
    • if there is no existing mapping a new entry is created from the tuple (uri, len(dictionary))
    • the updated dictionary is serialized as json and saved to disk
  • if the local file doesn't exists then a new one is created with the content retrieved from the remote location or with empty if there was a http or url exception
  • finally the GET request is served from the local file content with succes code 200 or with error 404 if the file is empty

memoizing-proxy's People

Contributors

birodb avatar

Watchers

 avatar

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.