http-headers

YouTube not showing as a referrer?

百般思念 提交于 2019-12-07 12:57:02
问题 I've been tracking referrers to my site and storing it a session to be used in some reports when they do certain actions. To get the referrer, I just do $_SESSION["s1"] = $_SERVER["HTTP_REFERER"]; It seems to work for everything except YouTube. Clicking a link on YouTube generates a blank referrer. What could cause this? Does YouTube do something to the headers? Does opening a new window lose the referrer info? 回答1: I came across this same issue today. Even though this question is 5 years old

Configuring Apache HttpClient to access service through proxy/load-balancer (overriding Host header)

≯℡__Kan透↙ 提交于 2019-12-07 12:55:52
问题 I am having a problem getting the Apache HttpClient to connect to a service external to my virtualised development environment. To access the internet (e.g. api.twitter.com) I need to call a local URL (e.g. api.twitter.com.dev.mycompany.net), which then forwards the request to real host. The problem is, that to whatever request I send, I get a 404 Not Found response. I have tried debugging it using wget, and it appears the problem is, that the destination server identifies the desired

How to Set HttpPost Headers for a Client Request in Java Android

别说谁变了你拦得住时间么 提交于 2019-12-07 12:19:46
问题 I am having trouble getting the Apache HttpClient to correctly send an HttpPost Header. I have no problems sending name value pairs and whatnot, but whenever I set or add a POST Header, it disappears when the request is made. I have tried both setHeader and addHeader, as well as trying both at once. Here is my code: HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("https://posttestserver.com/post.php"); httppost.setHeader("Authorization: Bearer", accessToken);

Is it possible to attach file in POST Json?

杀马特。学长 韩版系。学妹 提交于 2019-12-07 12:12:27
问题 I have a heap of data in format JSON(Serialized object). I send this data to server by POST method with header: Content-Type: application/json . Is it possible to attach file to body request and send at once. Or JSON data sugggests sending only text data? 回答1: Try to send the file inside the json object as a base64 string: { "file":"dGhpcyBpcyBhIGZpbGUgc2FtcGxl..." } Later you can open the file with something like: document.location = 'data:application/pdf;base64,' + file 回答2: In this context

SharePoint 2010 / IIS 7.5 Byte-Range Request Responds With Entire File

左心房为你撑大大i 提交于 2019-12-07 11:59:00
问题 I'm having problems getting SharePoint 2010/IIS 7.5 to respect byte-range requests. I'm developing a SharePoint 2010 Web Part using Silverlight, and am trying to retrieve part of a document stored inside SharePoint. When I request a byte range of a file in SharePoint, the server responds with the entire file. However, if I request the same byte range from a file sitting on an Apache server, everything works as expected. Below are the http headers observed with Fiddler. Any help would be

How to create javascript POST request to server with Headers and Data

喜夏-厌秋 提交于 2019-12-07 11:56:37
问题 I use JS automation framework for testing iOS application. In the middle of a test I need to create POST request to server to some money to user and then verify that changes are reflected in UI. Request looks like: wwww.testserver.com/userAddMoney?user_id=1&amount=999 but to authorize on server I need to pass special parameters to Header of request: Headers: X-Testing-Auth-Secret: kI7wGju76kjhJHGklk76 Thanks in advance! 回答1: So basically you want to set the header of a POST request. You can

Is Content-Length or Transfer-Encoding is mandatory in a response when it has body

不打扰是莪最后的温柔 提交于 2019-12-07 11:38:34
问题 If the response has a body / can have body (i.e status code is not 204 or 304), should it always have either content-length or Transfer-Encoding in the response header. In the spec it is not very clear. In my scenario I have a body without content-length or transfer encoding header, so the curl is keep on waiting no chunk, no close, no size. Assume close to signal end while other clients (like postman) are getting the content without hanging. 回答1: Transfer-Encoding is a HTTP/1.1 addition. So,

Google Closure Compiler and multipart/form-data not working

谁说胖子不能爱 提交于 2019-12-07 11:25:59
问题 I'm making a request to the google closure compiler API service: $content = file_get_contents('file.js'); $url = 'http://closure-compiler.appspot.com/compile'; $post = true; $postData = array('output_info' => 'compiled_code', 'output_format' => 'text', 'compilation_level' => 'SIMPLE_OPTIMIZATIONS', 'js_code' => urlencode($content))); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); if ($post) { curl

BasicNetwork.performRequest: Unexpected response code 401 android Volley library

跟風遠走 提交于 2019-12-07 09:48:22
问题 Iam calling web service in android . in that i want to call the URL i am not sending any params to the server, just calling the URL , But its getting Error like [10520] BasicNetwork.performRequest: Unexpected response code 401 my code is RequestQueue queue = Volley.newRequestQueue(getActivity()); JsonObjectRequest getRequest = new JsonObjectRequest(Request.Method.GET, Server.URL, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { // display

Chrome on Windows adding trailing underscores to downloaded files?

流过昼夜 提交于 2019-12-07 08:59:00
问题 I've got a rather odd situation happening, that I'm having difficulty tracking down in an existing Django application. One of the views, which inherits from APIView, returns with a file when a user makes a POST call. The endpoint works fine, but there's something odd happening when the downloaded file reaches the client machine. By the time the browser receives the file, the file extension has been renamed with a trailing underscore. (So suppose the file was originally "test.txt", the version