http-headers

Canonical Header Links for PDF and Image files in .htaccess

时间秒杀一切 提交于 2019-12-07 20:54:15
问题 I'm attempting to setup Canonical links for a number of PDF and images files on my website. Example Folder Structure: /index.php /docs/ file.pdf /folder1/ file.pdf /folder2/ file1.pdf file2.pdf /img/ sprite.png /slideshow/ slide1.jpg slide2.jpg Example PDF URL to Canonical URL: http://www.example.com/docs/folder1/file.pdf --> http://www.example.com/products/folder1/ I am trying to avoid having to put individual .htaccess files in each of the sub-folders that contain all of my images and PDFs.

PHP cURL: Read a specific response header

那年仲夏 提交于 2019-12-07 20:22:37
问题 I am using cURL in PHP to POST to an endpoint that is creating a resource. It returns a 201 response with a Location header giving the URL of the resource created. I also get some information in the body of the response. What's the best way to get the plain-text body of the response, and also get the value of the location header? curl_getinfo doesn't return that header, and when I do this: curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($ch, $header) { var_dump($header); }); I only see one

Replicating HTTP requests with PHP & cURL

主宰稳场 提交于 2019-12-07 19:49:26
问题 I am trying to request a password protected page from something called "CM/ECF" (Pacer) to view court dockets and such with PHP/cURL. I am using a FireFox extension called Tamper Data which allows me to see headers and POST data, then trying to replicate that request PHP using cURL. It's not working for some reason, I keep getting a request to log in. I can log in just fine, save the cookie to the cookie jar and get the the "Main" page, but when I do a second curl call (sending the same

How to get HTTP response headers after POST request in PHP?

≯℡__Kan透↙ 提交于 2019-12-07 18:37:16
问题 I want to know if it's possible to read/parse the HTTP response header after a POST request in PHP without the use of cURL.. I have PHP 5 under IIS7 The code I use to POST is :- $url="http://www.google.com/accounts/ClientLogin"; $postdata = http_build_query( array( 'accountType' => 'GOOGLE', 'Email' => 'xxxxx@gmail.com', 'Passwd' => 'xxxxxx', 'service' => 'fusiontables', 'source' => 'fusiontables query' ) ); $opts = array('http' => array( 'header' => 'Content-type: application/x-www-form

How to support backwards compatibility with the changes to the Accept header handling in Rails 2.3.4

 ̄綄美尐妖づ 提交于 2019-12-07 18:11:27
问题 In Rails 2.3.4, the way Accept headers are handled has changed: http://github.com/rails/rails/commit/1310231c15742bf7d99e2f143d88b383c32782d3 We won't Accept it The way in which Rails handles incoming Accept headers has been updated. This was primarily due to the fact that web browsers do not always seem to know what they want ... let alone are able to consistently articulate it. So, Accept headers are now only used for XHR requests or single item headers - meaning they're not requesting

Check url content type with javascript

柔情痞子 提交于 2019-12-07 16:36:31
问题 In order to conserve server resources I'm looking for a way to retrieve the content type of a given url using javascript. It should not download the complete content from the url only the headers. Is this possible with the restrictions javascript has. 回答1: Make an Ajax call with a head request. var url = window.location.href; var xhttp = new XMLHttpRequest(); xhttp.open('HEAD', url); xhttp.onreadystatechange = function () { if (this.readyState == this.DONE) { console.log(this.status); console

why cache-control:max-age don't work?

一个人想着一个人 提交于 2019-12-07 14:32:52
问题 I'm leaning http headers, and i want to run a test on the "cache-control" field,so i build a asp.net website which have only a default page.In this page i'm testing the "cache-control" field with codes in the Page_Load below: Response.AddHeader("Cache-Control","max-age=3600"); Response.Write(new Random().Next(0,9999).ToString()); I thought it will give me the same number every time when i refresh the page cause the page is cached on local by browser when it received the "Cache-Control:max-age

HTTP headers from some clients have characters randomly replaced

两盒软妹~` 提交于 2019-12-07 14:00:08
问题 Doing web traffic and log analysis, but there are a lot of malformed headers being passed from clients. These have characters transposed or replaced with "x"'s. Does anyone know where they come from or why? Is this some kind of attempt at security, or something more nefarious? Examples: xroxy-connection: Keep-Alive cneoction: close nncoection: close ocpry-connection: Keep-Alive pxyro-connection: close proxy-~~~~~~~~~~: ~~~~~~~~~~ x-xorwarded-for: 000.00.00.000 Referer: http://www.example.xom

with servicestack how can i prevent cookies being added to the response?

余生长醉 提交于 2019-12-07 13:46:50
问题 I can remove the cookies after the fact, with this: public override void Configure(Funq.Container container) { ResponseFilters.Add((req, res, dto) => { ((HttpListenerResponse)res.OriginalResponse).Headers.Remove("Set-Cookie"); }); } I have also considered overriding the SetCookie method of HttpResponse to just ditch the cookies, but I am not sure how to override that behaviour in servicestack. Question: How can I ensure no cookies are added to my responses in the first place? This seems more

Which file types can be viewed in browser (inline, without a plugin)

一笑奈何 提交于 2019-12-07 13:40:30
问题 I just want to know which file types (like .png, .pdf, .txt) can be viewed in browser (like Chrome, Firefox). Because sometimes when i click on file link, instead of displaying in browser it download automatically. Why this happens ? Below is my code. Any help will be appreciated. <script> function openPDF(url){ var w=window.open(url, '_blank'); w.focus(); } </script> <a href="burger1.jpg" target='_blank'>link</a> <div onclick="openPDF('1.pdf');">PDF 1</div> 回答1: In normal cases, following