Comments (9)
We should definitely fix polyglot to ignore the trailing space.
As a workaround, can you pass the argument without a space in the meanwhile?
from polyglot.
@dinowernli If i pass argument without space ,server returns as authorization failure
from polyglot.
A few questions from my side:
- Is there any chance you could add your exact invocation of polyglot and the output you are seeing? That would make it easier to narrow down the issue.
- Your use case for passing a metadata value with a trailing space seems to be to pass an empty bearer token. Just curious, how come you need to do that? Is the recipient distinguishing the case of an empty bearer from the case of not passing any authorization header at all?
from polyglot.
I have the same problem, metadata key/value pairs that contain spaces fail to parse, which renders basic auth impossible. Example invocation:
java -jar polyglot.jar --command=call --proto_discovery_root=<proto dir> --endpoint=<server> --metadata=Authorization:"Basic xyz" --full_method='<method>' <<< '<payload>'
yields
[main] INFO me.dinowernli.grpc.polyglot.Main - Polyglot version: 1.6.0
Exception in thread "main" java.lang.RuntimeException: Unable to parse command line flags
at me.dinowernli.grpc.polyglot.Main.main(Main.java:33)
Caused by: java.lang.IllegalArgumentException: Unable to parse command line flags
at me.dinowernli.grpc.polyglot.config.CommandLineArgs.parse(CommandLineArgs.java:120)
at me.dinowernli.grpc.polyglot.Main.main(Main.java:31)
Caused by: org.kohsuke.args4j.CmdLineException: "--metadata=Authorization:Basic xyz" is not a valid option
at org.kohsuke.args4j.CmdLineParser.parseArgument(CmdLineParser.java:512)
at me.dinowernli.grpc.polyglot.config.CommandLineArgs.parse(CommandLineArgs.java:118)
... 1 more
Other combinations of single quotes / double quotes around the value only as well as both key-value pair had the same result.
Removing the space passes parsing but then obviously fails service authentication.
from polyglot.
I looked into the issue and it appears to be a problem with args4j
. I have long-standing plans to switch to something like jCommander or flagz, which should fix this.
Don't really have an ETA yet for when I'll get around to switching things over though.
from polyglot.
I already had a quick look and could provide a first PR soon if you're OK with that.
from polyglot.
@jchoffmann sounds great if you're up for it. Happy to stare at an early draft of a PR as well if that helps.
from polyglot.
@dinowernli Sure, first version is done and all tests are passing. Just need to do some cleaning up and will create the PR shortly.
from polyglot.
This is now fixed at head since #108.
from polyglot.
Related Issues (20)
- Strange reponse using OneOf HOT 1
- redefined error HOT 1
- Work with IDE HOT 4
- Capturing response HOT 2
- google.protobuf.Empty as param HOT 1
- Using proto text files instead of json HOT 2
- How to build a polyglot.jar? HOT 2
- Polyglot just exits without any error
- --proto_path error since 1.6.0 HOT 1
- Feature Request - Use server reflection to lists services and methods exposed at a given port
- Unable to compile latest master repo HOT 2
- hello,invoking ServerReflectionClient.listServices() Method errors
- google/api/annotations.proto: File not found.
- Can't build using Bazel HOT 1
- Intermittent Issues in using polyglot with reflection
- Not able to get complete response
- Request for a homebrew package HOT 1
- Java 7 support
- run call-command-example error HOT 2
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 polyglot.