question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A percent sign breaks your service, sometimes.

See original GitHub issue

Todo

  • Add special parameter q for queries, that can be used with --data-urlencode
  • Add parameters answer and question to specify them explicitly
  • Add support of q into the cht.sh command line client

Details

I was doing a search over your curl service for query, trying to untangle a printf %s for bash question, which seemed a reasonable query. I get an nginx failure: 400 Bad Request nginx/1.13.12

For example this query produces an error: https://cheat.sh/python/print %s

But these work fine: http://cht.sh/python/% https://cheat.sh/python3/print list http://cht.sh/python/printf %25s

The last one was what I intended. Percent signs appear to be interpreted in transit between curl and nginx server side URL rewriting. Your server says eh bro that’s not a valid URL, barf.

https://www.w3schools.com/tags/ref_urlencode.ASP

But curl works fine on the terminal, showing me that maybe the problem’s on client side, as long as URL encoding is done in a way that makes your server happy, then all is well?

$ curl cht.sh/bash/printf %s
# bash - SPRINTF in shell scripting?
var=$(printf 'FILE=_%s_%s.dat' "$val1" "$val2")
...

This http://cht.sh/python/printf?myparameter#myhash only searches for printf

One answer is: “It’s the user’s responsibility to url-encode all queries so nginx is happy, and take care not to search for slashes, questionmarks, percent signs or any URL escape chars”. Is this the case or is there a cleverer solution for me to pass you a literal string over curl?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chubincommented, Oct 12, 2020

but I think it still would be great to have a special query like discussed above (i.e. q=)

1reaction
chubincommented, Apr 19, 2020

Probably, it would be better to add several additional parameters, like question, answer and already mentioned q, so that your query could be written like: ?q=rmse/0/1

So, that means, the following should be done:

  • Add special parameter q for queries, that can be used with --data-urlencode
  • Add support of q into the cht.sh command line client
  • Add parameters answer and question to specify them explicitly
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does a percent symbol in a get request break my site?
The "%" character in a url means something special. You encode the space character ' ' as %20 in a url. You encode...
Read more >
What is the use of percent signs (%) at the end of lines? (Why ...
The short answer is what others have said, % starts a comment that goes to the end of the line. The normal effect...
Read more >
Honda Maintenance Minder System
A: Once your vehicle reaches 0% the maintenance minder will begin to show negative mileage. This indicates how many miles your vehicle service...
Read more >
Percentage Sign | Punctuation | Grammar | Glossary - Ultius
The percentage sign (%) is used to indicate a percent, number, or ratio as a fraction of 100. It is usually followed after...
Read more >
Shift Breaks - The Healthy Employee Act Frequently Asked ...
What percentage of business must be provided in person in order for the Shift Break law to apply? For example, if the employer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found