Comments (3)
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.
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.
@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)
- Options -no-translate and -download-audio-as result in a error HOT 2
- Feature request: -b but showing both languages HOT 1
- Usage with persian language HOT 4
- New feature advice: collect history to an output text file HOT 1
- macOS,为什么输入命令无法启动translate-shell HOT 1
- What are the limitations? HOT 1
- Garbled html in Korean translations HOT 3
- I can't use -play and -speak options together in the same time! HOT 2
- Add pot/po translation support
- 无法使用
- Add option to force retry if connection is lost
- Voice output unavailable
- -no-autocorrect doesn't work with Google translate HOT 2
- Stuck at getting output for RTL languages HOT 2
- Strange bug with some Chinese sentences containg : HOT 3
- gpg public key doesnt seems to be working HOT 1
- not reading .curlrc HOT 7
- Show target language on REPL mode HOT 3
- Space bar not working on REPL mode HOT 1
- sentence HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from translate-shell.