httpresponse

Getting an API's response through curl's curl_exec() instead of the usual callback file

API integration description The API needs a form to be posted to the API URL with some input fields and a customer token. The API processes and then posts response to a callback.php file on my server (it is fixed as per the documentation and we cannot mention that we want the response to be posted to some other file). I can access the po...

Callback from API not happening after posting parameters to API URL from server side

API integration description The API needs a form to be posted to the API URL with some input fields and a customer token. The API processes and then posts response to a callback.php file on my server. I can access the posted vals using $_POST in that file. That's all about the existing method and it works fine. Requirement To hide the c...

Unable to follow a location (URL) using cURL when open_basedir is set - API callback failing

Existing method of posting values to API As per the API documentation, a form has to be posted to the API URL (method="POST" and action="API_URL") with some input fields and a customer token field. The API processes and then posts response to a callback.php file on my server (fixed - can't change it). The page redirects to the API URL an...

GZipStream is cutting off last part of XML

I have created an extension method called AddGZip which looks like the following: public static void AddGZip(this HttpResponse response) { response.Filter = new GZipStream(response.Filter, CompressionMode.Compress); response.AppendHeader("Content-Encoding", "gzip"); } This is a very cut down version of the code: var response ...

How do you force a download prompt, before data it sent from a servlet?

Hi all, How do you force a download prompt to popup before you send any data to browser? I know about content disposition attachment, but this is different. Basically, the servlet starts sending data to the client, and then the client open a dialog, open, save, cancel. The probably is my servlet is slow getting the data, and it gets ...

Why is HttpURLConnection.getResponseCode() returning 1?

I have a piece of Java code that opens a HTTP connection, writes data on that and then retrieves the response code. Since, the connectin was fine it should get HTTP_OK (i.e 200) but it is getting 1 in return. This is baffling as 1 appears nowhere in the Http Response code specification. Could anyone throw some ideas on the potential pro...

SSL in HttpContext.Current.Response

Might be a dumb question but I need a confirmation regardless. In ASP.NET, if a file was downloaded on a page that was protected by SSL, through a server-side postback that writes to HttpContext.Current.Response.OutputStream, is the transmission that file ALSO protected by SSL? Thanks for any help. ...

How to set an HTTP error code in JAX-RS

I have a web service using jar-rs. How do I throw a custom http error code to the calling application? Thanks ...

ASP.NET: Setting a cookie in a cached page

How do I set a cookie on a page, base on a query-string-value, if the page is returned by the Output-cache? I have a page with this output-cache: <%@ OutputCache VaryByParam="cookievalue" ... And I have this code in the Global.asax's *Application_BeginRequest*: // Validation and checkings HttpCookie cookie = new HttpCookie("__cookie...

HttpWebRequest and HttpWebResponse Error

I am trying to run a simple code for web crawler written in this page . every thing is fine and I tried the program on several sites and it works fine but there is one site instead of returning the html content in its pages it generates a srtange error : DotNetNuke Error: - Version 04.05.01 Return to main page and the html returned i...

What should my expires, cache-control, and pragma HTTP request header fields be set to?

I have a website in which I update the content approximately once monthly. When I check the HTTP request header fields, I get the following output: Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache My question is, given the frequency at which I u...

Input parameters are shown in response headers, which is vulnerable to security threats - have to avoid the same.

Hi, When the form is posted the input parameters are viwed in response headers, which is vulnerable to security threats. I dont want to show these input parameters in the response header. Example POST /genaw/reports/adv/RelatedPartyEdit.jsp HTTP/1.1 Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash,...

Render a pdf file returned as part of a HTTP response in Adobe AIR

My requirement is to render a PDF file which is dynamically generated from a web server in an Adobe AIR application. The user posts some data to the web server. A PDF file is generated at the web server and is returned as the response with content-type : application/pdf I use URLLoader to post the request and handle the response. When...

WSGI request and response wrappers

I'm looking for WSGI request and response wrappers for having a more convenient interface than the plain WSGI environ and start_response callback. I want something like WebOb or Werkzeug. But I don't like WebOb's PHP-like usage of GET and POST for parameter dictionaries, because HTTP is not limited to GET and POST and the distinction is ...

ASP.NET JavaScriptSerializer requires HttpResponse?

Hi It appears that the System.Web.Script.Serialization.JavascriptSerializer class tries to obtain the HttpResponse for the current request, presumably to apply appropriate character encoding. However this means that when you to to use the class with no HttpContext in scope, it blows up with the following exception + stack trace: [Ht...

Setting both error message and body from servlet

I want to write a servlet that will return an http response like so: HTTP/1.1 500 <short custom message> Content-Length: ... <longer custom message> The reason is that I want a programmatic client to be able to process the response message to take a particular response but I also want to fill in the response body with a longer explan...

Second request from Media Player in a web page

I have an ASP.NET web application where a Microsoft Media Player object on the page (in IE) is issuing a request for an .aspx web page. In the page I use TransmitFile to send back the audio file. This works fine most of the time. But, in some cases (a combination of IE version and a specific client, at least from what I can see) there...

502 Bad Gateway… invalid response from upstream server (apache and Mongrel)

I startup Mongrel and I'm able to access the web app, but after few seconds I eventually start getting "The proxy server received an invalid response from an upstream server" errors. If I restart Mongrel then everything works fine again, but several seconds later I have the same issue... ...

Finding out is user fully completed download or not

I have an webapp which dynamically generates a file and stores it on the server. When a user comes along, this file is served, after which it gets deleted. Each user gets their own generated file after which it becomes useless. Is there a way to know if the user managed to download the file fully, so that it may be deleted and not clo...

HTTP Status code 500 from trivial $.getJSON call - why?

I have stripped my getJSON call to the simplest example possible trying to figure out why it's not working but I'm out of ideas. I currently have: public JsonResult MyAction() { return Json(new { status = "OK" }); } $.getJSON('MyController/MyAction', function(result) { alert('worked'); }); The action is called, but the alert does...