http-headers

What is the most appropriate HTTP status code to return if a required header is missing?

我只是一个虾纸丫 提交于 2019-12-30 05:32:16
问题 I read What HTTP status response code should I use if the request is missing a required parameter? but it did not specifically ask about headers and there didn't seem to be a consensus. The context of this question assumes successful authentication. I'm currently favoring either a 400 (though that doesn't feel right because this isn't really a case of "malformed syntax") or 403. Given 403's description: The server understood the request, but is refusing to fulfill it. Authorization will not

Amazon SES custom header List-Unsubscribe isn't working

≯℡__Kan透↙ 提交于 2019-12-30 05:27:05
问题 I'm tryin to add the "List-Unsubscribe" header in my sent emails (through amazon ses) but when i see the received email there's no such header in it. I need it to reduce the number of spam complaints and to improve deliverability and reputation. SendEmailRequest sendEmailRequest = new SendEmailRequest(); sendEmailRequest.putCustomRequestHeader(UNSUBSCRIBE_HEADER, unsuscribeURL); PS: Using others providers such as Mandrill or Sendgrid it works, but i really need it at amazon 回答1: So... i found

Cross-origin resource sharing for Tomcat 5.5

末鹿安然 提交于 2019-12-30 04:26:18
问题 I am new to Cross-origin resource sharing and I want to enable it in a Tomcat 5.5 server. Anybody can give me some hint how can this be achieved? I want to set the header universally for all requests, and to allow all origins ( Access-Control-Allow-Origin: * ) 回答1: If it's a static site, then starting with Tomcat 7.0.41, you can easily control CORS behavior via a built-in filter. Pretty much the only thing you have to do is edit the global web.xml in CATALINA_HOME/conf and add the filter

cURL hanging for 15 seconds when sending HEAD requests

℡╲_俬逩灬. 提交于 2019-12-30 04:15:08
问题 Background I've been timing some HTTP requests via the CLI using time and tools such as wget and curl as follows: /usr/bin/time -v wget --spider http://localhost/index /usr/bin/time -v curl http://localhost/index 2>&1 > /dev/null What I noticed is that when using curl , I was getting similar response times as with wget only on the first request, and much lower times on subsequent requests, as if the responses to curl were served from cache and wget were not. After investigating I found out

URLConnection setRequestProperty vs addRequestProperty

*爱你&永不变心* 提交于 2019-12-30 03:03:10
问题 Lets say I'm talking HTTP to a web server, and I will Accept html or text, but prefer html. In other words, the header should say (I think!) Accept: text/html, text/* I'm using Java, so I have a URLConnection. Should I use: myUrlConnction.setRequestProperty("Accept", "text/html"); myUrlConnction.addRequestProperty("Accept", "text/*"); or myUrlConnction.setRequestProperty("Accept", "text/html, text/*"); or are they equivalent??? In general, most of the third party code I see doesn't seem to

Python: How to download file using range of bytes?

♀尐吖头ヾ 提交于 2019-12-30 01:30:07
问题 I want to download file in multi thread mode and I have following code here: #!/usr/bin/env python import httplib def main(): url_opt = '/film/0d46e21795209bc18e9530133226cfc3/7f_Naruto.Uragannie.Hroniki.001.seriya.a1.20.06.13.mp4' headers = {} headers['Accept-Language'] = 'en-GB,en-US,en' headers['Accept-Encoding'] = 'gzip,deflate,sdch' headers['Accept-Charset'] = 'max-age=0' headers['Cache-Control'] = 'ISO-8859-1,utf-8,*' headers['Cache-Control'] = 'max-age=0' headers['User-Agent'] =

How to sent a POST request with form-data and parameters in PL/SQL

流过昼夜 提交于 2019-12-29 09:19:12
问题 I'm trying to call REST WebService in PL/SQL but it doesn't work. I get this error: Content-type must be multipart/form-data Here is what I have: DECLARE req UTL_HTTP.REQ; resp UTL_HTTP.RESP; value VARCHAR2(1024); -- URL to post to v_url VARCHAR2(200) := 'http://local/api/ws'; -- Post Parameters v_param VARCHAR2(500) := 'art=11111\&qty=1'; v_param_length NUMBER := length(v_param); BEGIN req := UTL_HTTP.BEGIN_REQUEST (url=> v_url, method => 'POST'); UTL_HTTP.SET_HEADER(req, 'User-Agent',

WCF Content-Length HTTP header on outbound message

别来无恙 提交于 2019-12-29 08:02:31
问题 I'm in a tough situation in which a Java web service endpoint hosted on an IBM HTTP Server (IHS) requires a Content-Length header, although it supposedly conforms to HTTP/1.1. If I send the header, everything works. If I leave it off, I get a 500 error response informing me that my POST entity body was empty (even though it was not). We've invested significant time into our WCF client for these services (developed by a third party) and I can't seem to find a good way to append a Content

Add Custom Headers using HttpWebRequest

末鹿安然 提交于 2019-12-29 05:14:06
问题 I am not really sure what type of headers these highlighted values are, but how should I add them using HttpWebRequest? Is the highlighted part considered body of the http request or header data? In other words, which way is correct? Here is the code I am currently using: HttpWebRequest request = (HttpWebRequest) WebRequest.Create("/securecontrol/reset/passwordreset"); request.Headers.Add("Authorization", "Basic asdadsasdas8586"); request.ContentType = "application/x-www-form-urlencoded";

Allow All Content Security Policy?

蓝咒 提交于 2019-12-29 03:54:27
问题 Is it possible to configure the Content-Security-Policy to not block anything at all? I'm running a computer security class, and our web hacking project is running into issues on newer versions of Chrome because without any CSP headers, it's automatically blocking certain XSS attacks. 回答1: For people who still want an even more permissive posts, because the other answers were just not permissive enough, and they must work with google chrome for which * is just not enough: default-src * data: