I'm trying to call a HTTP JSON-RPC server for Bitcoin using Go (not on GAE), but I get error of
dial tcp http://user:pass#127.0.0.1:8332: too many colons in address
or
dial ip http://user:pass#127.0.0.1:8332: lookup http://user:pass#127.0.0.1:8332: no such host
I tried various network configurations, but couldn't get anything going. When I just typed the address into the browser, I got a response from the server:
{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}
Which looks like a proper response for an empty call.
How do I correctly call that HTTP JSON-RPC server in Go?
Use brackets around the host like this:
[user:pass#127.0.0.1]:8332
Reference:
http://golang.org/src/pkg/net/ipsock.go?s=2247:2304#L68
Related
We are facing 499 error when we close the browser tab before getting response for the request. We are using nginx in k8s.
I have tried by configuring "proxy_ignore_client_abort: on" property in ingress configuration, still we are getting issue even after configuring the above property. Please suggest me way to fix this issue.
Firstly we are supposed to know that the nginx throw 499 if the client actively disconnected the connection. So it you may not pay much attention to it if everything is good.
Nginx could be the server to the user and the client to the backend server like the below:
from user->->nginx->server(tomcat).
In my case, I found that server like tomcat would abort the connection if it cannot handle too many requests in the accepted list.(or too slow to respond).
In tcp, the real server like tomcat would maintain 2 list. The first 1 is SYN list, and the 2nd is accepted list. Pls let me ellaborate it:
Clients firstly send syn to the server.
and the server put it into syn list and return SYN+ACK.
Client send the ACK to the server.
Finally the server established the connection after removing it from the syn list and put it into the accepted list.
In your case, if you close the tab before step2, I think you needn't do anything at all.
if you close the tab before the tab 4, you can refactor the interface of your server to be async to greatly enhance its responding speed.
Is it possible to send a HTTP message to client via browser by typing
http://CLIENT_IP:PORT/MESSAGE
http://192.168.1.1:7777/HELLO
If so could you give me some link to such project or example code ?
Yes, it is, provided you have a http server listening on port 7777 of host 192.168.1.1 that will get your message and do something with it.
Yes, you will get the message as the route or path in the server. The specific variable will vary depending on the language and framework you’re using.
I am trying to connect GPRS GSM A6 to arduino. Everything works fine, but there is a slight problem.
And its that AT+CIPSTART only accepts IP or domain name.
For example this,
AT+CIPSTART="TCP", "xxx.xx.x.xxx", 80
works fine, Or this,
AT+CIPSTART="TCP", "www.google.com", 80
also works fine, but what I am looking for is something like this.
AT+CIPSTART="TCP", "xxx.xx.x.xxx/trackerCode/", 80
That is I want to specify directory along with the ip. But it does not allow me to do this and returns a +CME Error.
Is there a way to do this?
The only way would be direct support in your GPRS module firmware. So start with available AT commands with something like HTTP in it.
If there is none, you have to send HTTP request over TCP connection openned by examples 1 or 2. How the HTTP protocol looks like is defined in RFC 2612. Request name, path and http version on the first line are mandatory, few more headers might be needed (for the server with virtual domains it'll be Host header)
And line endings must be "\r\n"
I am following a course on lynda.com. We are experimenting with sending HTTP requests by using a command-line telnet app.
However, in the video, the "teacher" is explicitly typing:
telnet www.httpbin.org 80
GET /ip HTTP/1.0
Which returns the local IP address. Unfortunately, this doesn't work for me, although I did exactly what he did. When I type the GET /ip HTTP/1.0 line, I get a 400 Bad Request response, but the page /ip does exist. What am I doing wrong? Why does it work for the teacher in the video, but not for me?
Edit: Also, when it tried to connect to www.httpbin.org, I can see:
Trying "IP_FROM_WEBSITE"
Connected to www.httpbin.org.herokudns.com
The part of .herokudns.com is only on my side, in the video I can only see Connected to www.httpbin.org.
Looks like the server doesn't support HTTP 1.0. Maybe the video is older and it used to.
A valid HTTP 1.1 request would look like this:
telnet www.httpbin.org 80
GET /ip HTTP/1.1
Host: www.httpbin.org
So I'm not a very good network person so I was hoping someone could point me in the right direction to figuring out what I am doing wrong.
I am trying to use curl to post a SOAP message. I am running the following:
curl -d "string of xml message" -H "Content-Type:text/xml; charset=utf-8" "[ip]:[port]/[service]"
This results in a 'Connection refused' message.
So I try pinging ip by itself...no problems.
Then I think maybe I need http://[ip]:[port]/[service] so I tried pinging http://[ip] and I get:
unknown host http://[ip] yet if I ping the IP by itself I get no issues.
Any thoughts on where to start debugging this issue?
First of all, ping can't use the HTTP-protocol, you can only ping domain names. Have a look at ping at wikipedia to learn more.
Curl normally doesn't need anything fancy, just begin by typing curl [protocol]:[host]:[port]/[service] and see if you get a response at all. I think that's what you're looking for when you tried to ping the remote address.
Judging by the response of the cURL attempt, you'll know if your attempt was successfull. It probably won't be since it is indeed the connection that was refused, you didn't include bad parameters.
Now, assuming it's a connection problem, try curling something else (a regular domain, like Google.com) to make sure you don't have a connection problem. Then, to learn whether the remote server has a problem, perform the same Curl attempt from another server somewhere (or ask someone else to do it) and see if they, too, are refused to connect. This is a good attempt to circle in around the problem and gain more clarity.
Ping (or ICMP) traffic runs (usually) on a different port than HTTP traffic. HTTP typically runs on port 80.
Try to telnet to the service (the ip and the port) using the following command:
telnet (ip) 80 (without the parens).
If you are able to connect to the service then you have some other issues, however, if the service doesn't let you connect, then you know the service is blocking you from the port (usually 80 for http) on which the service is running.