Giter VIP home page Giter VIP logo

Comments (3)

soimort avatar soimort commented on May 18, 2024

I guess it would be possible to handle HTTP proxies in gawk, though it was not implemented yet.

For HTTPS: one possible solution is to create a gawk binding of any existing SSL/TLS library (e.g. OpenSSL). Compared to "modern" scripting languages like Python and Ruby (which have almost everything in their standard libraries), that is indeed more difficult.

Using cURL to replace gawk's network layer is a more viable solution and it's on the future plan.

from translate-shell.

m13253 avatar m13253 commented on May 18, 2024

I just read your source code. It seems that you manage TCP connections manually.
That will be pretty easy.

Just see these HTTP headers:
Without proxy:

GET /translate_a HTTP/1.1
Host: www.google.com

With proxy:

GET http://www.google.com/translate_a HTTP/1.1
Host: www.google.com

The proxy support can be implemented at Translate.awk:getResponse.
I am not good at awk. So I would be grateful if you can help me do that.

BTW, how do you use translate-shell in China?

from translate-shell.

soimort avatar soimort commented on May 18, 2024

@m13253 That's not correct. The actual request is GET http://www.google.com/translate_a/..., not GET /translate_a. If you pay attention to the HttpProtocol HttpHost part:

url = HttpProtocol HttpHost "/translate_a/t?client=t"       \
        "&ie=UTF-8&oe=UTF-8"                                    \
        "&text=" preprocess(text) "&sl=" sl "&tl=" tl "&hl=" hl

print "GET " url |& HttpService

The problem is that gawk isn't aware of proxy. Not that only HTTP request line matters.

FYI. I don't use it in China since I don't live in China. Is http://www.google.com inaccessible to you?

from translate-shell.

Related Issues (20)

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.