http-headers

“No match Found” when using matcher's group method

怎甘沉沦 提交于 2019-12-17 04:32:10
问题 I'm using Pattern / Matcher to get the response code in an HTTP response. groupCount returns 1, but I get an exception when trying to get it! Any idea why? Here's the code: //get response code String firstHeader = reader.readLine(); Pattern responseCodePattern = Pattern.compile("^HTTP/1\\.1 (\\d+) OK$"); System.out.println(firstHeader); System.out.println(responseCodePattern.matcher(firstHeader).matches()); System.out.println(responseCodePattern.matcher(firstHeader).groupCount()); System.out

Are Duplicate HTTP Response Headers acceptable?

≡放荡痞女 提交于 2019-12-17 04:27:30
问题 I have not found any specification about whether duplicate HTTP response headers are allowed by the standard, but I need to know if this will cause compatibility issues. Say I have a response header like this: HTTP/1.1 302 Moved Temporarily Server: Apache-Coyote/1.1 X-Powered-By: Servlet 2.4; JBoss-4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200510231054)/Tomcat-5.5 Cache-Control: no-cache Cache-Control: no-store Location: http://localhost:9876/foo.bar Content-Language: en-US Content-Length:

What MIME type should I use for CSV?

你离开我真会死。 提交于 2019-12-17 04:12:48
问题 I've seen application/csv used and also text/csv . What's the difference? Is there a difference? Does it matter which as long as the request matches something that's available? Are they interchangeable? 回答1: RFC 7111 There is an RFC which covers it and says to use text/csv . This RFC updates RFC 4180. Excel Recently I discovered an explicit mimetype for Excel application/vnd.ms-excel. It was registered with IANA in '96. Note the concerns raised about being at the mercy of the sender and

Caching HTTP responses when they are dynamically created by PHP

人走茶凉 提交于 2019-12-17 04:01:23
问题 I think my question seems pretty casual but bear with me as it gets interesting (at least for me :)). Consider a PHP page that its purpose is to read a requested file from filesystem and echo it as the response. Now the question is how to enable cache for this page? The thing to point out is that the files can be pretty huge and enabling the cache is to save the client from downloading the same content again and again. The ideal strategy would be using the "If-None-Match" request header and

HTTP post XML data in C#

为君一笑 提交于 2019-12-17 03:51:14
问题 I need to HTTP post XML data to a URL that has Textarea with the name of XMLdata. My XMl data is ready and is inside of XDocument Sendingxml = xml; but the post code that I have tried is not working. Mostly because I don't know how to put the XML data in postData Variable as it only accept string. This is my code: XDocument Sendingxml = xml; // string Sendingxml = "<?xml version=1.0 encoding=UTF-8> <PluginData> <Credential UserName=avosfieldagent01 AuthenticationToken

S3 - Access-Control-Allow-Origin Header

感情迁移 提交于 2019-12-17 02:07:32
问题 Did anyone manage to add Access-Control-Allow-Origin to the response headers? What I need is something like this: <img src="http://360assets.s3.amazonaws.com/tours/8b16734d-336c-48c7-95c4-3a93fa023a57/1_AU_COM_180212_Areitbahn_Hahnkoplift_Bergstation.tiles/l2_f_0101.jpg" /> This get request should contain in the response, header, Access-Control-Allow-Origin: * My CORS settings for the bucket looks like this: <?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws

Proper MIME media type for PDF files

馋奶兔 提交于 2019-12-16 20:02:20
问题 When working with PDFs, I've run across the MIME types application/pdf and application/x-pdf among others. Is there a difference between these two types, and if so what is it? Is one preferred over the other? I'm working on a web app which must deliver huge amounts of PDFs and I want to do it the correct way, if there is one. 回答1: The standard MIME type is application/pdf . The assignment is defined in RFC 3778, The application/pdf Media Type, referenced from the MIME Media Types registry.

Accessing the web page's HTTP Headers in JavaScript

孤人 提交于 2019-12-16 18:21:12
问题 How do I access a page's HTTP response headers via JavaScript? Related to this question, which was modified to ask about accessing two specific HTTP headers. Related: How do I access the HTTP request header fields via JavaScript? 回答1: It's not possible to read the current headers. You could make another request to the same URL and read its headers, but there is no guarantee that the headers are exactly equal to the current. Use the following JavaScript code to get all the HTTP headers by

Difference between Parameters and HTTP headers

≡放荡痞女 提交于 2019-12-14 03:52:54
问题 i'm wondering if someone can explain to me what is the difference between passing values in a HTTP request as parameters or Headers as in this example : HTTP request : GET /<api version>/<account> HTTP/1.1 Host: storage.swiftdrive.com X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb HTTP Response HTTP/1.1 200 Ok Date: Thu, 07 Jun 2010 18:57:07 GMT Server: Apache Content-Type: text/plain; charset=UTF-8 Content-Length: 32 Is the Host, X-Auth-Tiken in the request, and Date, Server, Content

PHP Empty $_POST

邮差的信 提交于 2019-12-14 03:52:23
问题 I am sending data to PHP through HTTP POST. This works fine for data shorter than 8MB (8192KB), however when higher quantities of data are sent, PHP shows the $_POST variable to be empty. I emphasize that the $_POST variable does not even contain the names of the post fields, it exists as an empty array. The critical point seems to be between 8.0MB and 9.0MB, and continues higher of course. I have attempted the following with no success: ini_set('memory_limit', '500M'); ini_set('post_max_size