Go urlfetch.Transport.RoundTrip, can call in GET, but not POST? - http

I'm having a problem getting any response from urlfetch.Transport.RoundTrip in GAE Go. When I browse a page that makes the call in a browser, the call is executed as intended. When the same function is called from a POST request made by poclbm Bitcoin miner, I can't get a response.
The call is made by this package I made at line 77.
Is it possible, that in Google App Engine one can request data from other web pages under a HTTP GET, but not POST, or is there something else that can be causing this problem?

You can do POST request from App Engine using http.Client.Post, just make sure you create the http client with urlfetch.Client function.

Related

HTTP Request on POST and GET

I have a server log and it shows POST and GET
So, if a page is showing POST /ping and GET /xyz
Does this mean that the user agent is Requesting a page is GET and POST is the response from the server?
Because in my server logs, it's showing a lot of POST with million of /ping while the other pages have been GET is a smaller amount of number.
Which should I focus on? Get the POST pages get index if the server shows this to Search engines?
I would suggest you learn the difference between HTTP GET and POSTS.
This answer is quite good.
In summary, the GET requests are pages/data being requested by clients. POSTs are clients sending data to the server, usually expecting data as a response.
In their comment, Sylwit pretty much explains what this has to do with search engines. I'm going to just describe the differences between GET and POST
GET and POST are two different types of requests to the server. A GET request is normally used to retrieve information from the server and usually has a series of GET parameters. When you search something on Google you're making a GET request.
https://google.com/?q="how+do+i+get"
In this case, the GET parameter is the q after the ?, and has a value of "how do i get". It should be noted that a GET request doesn't need these additional parameters (http://google.com) is still a GET request
POST requests, on the other hand, are normally used to send data to the server. You'll see this anytime you send a message, submit a form etc. When I click submit on this answer, I'll be making a POST request to stackoverflow's servers. The parameters for these aren't immediately visible in the browser. POST requests can also return a HTTP response, with a message.
Hope that shows the differences between the two.

GET request on website vs standalone

I'm a bit confused or maybe I don't fully understand http requests.
There is a website on which the search results are fetched through a GET request. I can see the whole parameter list in Firebug and if I click "search" the results are displayed as you would expect. What I don't understand is if I take this request URL (with the same parameters) and copy it in a new browser tab it doesn't return results anymore. Instead I see a 500 - Internal server error.
Can someone explain why is this happening or what can I do to see the results when accessing the URL?
As robert_b_clark suggested the solution is to send the referrer header when making the request.

Why request.getRequestDispatcher doesn't work?

I have a main JSP and process JSP. In process jsp I am committing the response and forward the response to a success page.
request.getRequestDispatcher("success.jsp").forward(request, response);
I am able to commit the response at the server side. Process jsp is also able to forward the response to success JSP.
But the url shows for example: http://process.jsp?param1=value1&parm2=value2
I want my output to display a clean as in url http://success.jsp
Please Note: This works perfectly fine for Java Servlet, i just tried it.
I am using only JSP instead of Java servelet, since this is our project requirement.
Can anyone suggest me a solution for this?
RequestDispatcher#forward() Is supposed to forward both the request and the response objects to another resource within the server. No response goes back to the client when you do a forward() and this is why the client shows the same initial URL.
For the client to show another URL you could use HttpServletResponse#sendRedirect(). This does go back to the client making it do a new request to the URL you want. So change it to:
response.sendRedirect("success.jsp").
Remember not to commit the response before doing this or you'll get an IllegalStateException
As to why you say that on a Servlet works, I'm not sure why, but is not how forward() is supposed to work, and JSP are compiled to Servlets so in the end they should behave the same.

NodeJS Express DynamicView Helper with an http request

I hava a node.js app running on express with a dynamicViewHelper that hits an http service with http.request. Unfortunately, when I try to do this, because the http request is asynchronous and the function calling it is not, the page just renders before the http request is finished and I end up with undefined on my page.
I am basically looking for a way to put an asynchronous action (the http request), inside of a dynamic view helper which gets rendered out on the page. I know I can't just turn it into a synchronous function, so I am looking for another way to get that dynamic data to the view.
Also, is there a way to cache the data that is returned from an http.request()? I don't want to put it on the session, but I want any further requests made to the exact same URL to possibly be cached... Not as big of a deal as the first part of my question, though.
I figured it out. I'll just load it in my route so that res.render() isn't called until the request is done.

Testing HTTP Hooks

I am building an API, one of its feature is the use of HTTP POST Hook calls triggered on particular actions.
Without taking the time to set a locale route to be the target of the POST call I was looking for an online service showing live POST to a given URL or some other way of testing POST hooks in my code.
Any advices ?
http://www.postbin.org/
You can manually create and test POST requests with Fiddler or the Poster Firefox addon
You can try HTTP request method same as POST,GET,PUT,DELETE at https://w3webtool.com/http-request-method with localhost (SEND BY CLIENT) and any host (SEND BY SERVER)

Resources