http-headers

JAX-RS custom headers not being added to redirect response

我怕爱的太早我们不能终老 提交于 2019-12-05 03:24:38
问题 I am trying to add some custom header parameters to a HTTP 303 (redirect) response. However, the new headers seem to be getting stripped from the response. This code is meant to receive a request and returns a HTTP 303 response: @POST @Path("/authorize") @Produces("application/x-www-form-urlencoded") public Response getOAuthGrant(@HeaderParam(OAuth2.AUTHORIZATION) @DefaultValue("") String authorization, @HeaderParam(OAuth2.CLIENT_ID) @DefaultValue("") String clientId, @HeaderParam(OAuth2

PHP curl changes the Content-Type to application/x-www-form-urlencoded. Shouldn't do that

[亡魂溺海] 提交于 2019-12-05 03:17:43
I want to upload a video direct to Youtube from my server for which I am using PHP curl. I need this request format: POST /feeds/api/users/default/uploads HTTP/1.1 Host: uploads.gdata.youtube.com Authorization: Bearer ACCESS_TOKEN GData-Version: 2 X-GData-Key: key=adf15ee97731bca89da876c...a8dc Slug: video-test.mp4 Content-Type: multipart/related; boundary="f93dcbA3" Content-Length: 1941255 Connection: close --f93dcbA3 Content-Type: application/atom+xml; charset=UTF-8 <?xml version="1.0"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http:/

Nginx, how to add header if it is not set

喜欢而已 提交于 2019-12-05 02:45:16
I want to add a header ( Cache-control ) in nginx only if it is not set. I need to increase cache time in some case via the header in nginx. Stefan Kögl You can use map to populate a variable $cachecontrol . If $http_cache_control (the header from the client) is empty, set a custom value. Otherwise (default) reuse the value from the client. map $http_cache_control $cachecontrol { default $http_cache_control; "" "public, max-age=31536000"; } Afterwards you can use that variable to send the upstream header. proxy_set_header X-Request-ID $cachecontrol; For the follow-up question from jmcollin92 ,

IE6 and Caching

若如初见. 提交于 2019-12-05 02:23:15
问题 It seems that IE6 ignores any form of cache invalidation sent via http headers, I've tried setting Pragma to No Cache and setting Cache Expiration to the current time, yet in IE6, hitting back will always pull up a cached version of a page I am working on. Is there a specific HTTP Header that IE6 does listen too? 回答1: Cache-Control: private, max-age=0 should fix it. From classic ASP this is done with Response.Expires=-1 . Keep in mind when testing that just because your server is serving

How to test for “If-Modified-Since” HTTP Header support

巧了我就是萌 提交于 2019-12-05 02:21:45
Using PHP how can I accurately test that a remote website supports the "If-Modified-Since" HTTP header. From what I have read, if the remote file you GET has been modified since the date specified in the header request - it should return a 200 OK status. If it hasn't been modified, it should return a 304 Not Modified. Therefore my question is, what if the server doesn't support "If-Modified-Since" but still returns a 200 OK? There are a few tools out there that check if your website supports "If-Modified-Since" so I guess I'm asking how they work. Edit: I have performed some testing using Curl

What is the definition of HTTP_X_PURPOSE?

爱⌒轻易说出口 提交于 2019-12-05 02:18:42
Recently we've been looking at a few exceptions captured in our Stack Overflow logs and have discovered an issue for Safari users. I noticed this HTTP header in one of the exceptions we have captured: HTTP_X_PURPOSE preview Does anyone know what action triggers this header or the meaning of HTTP_X_PURPOSE? Martin Sutherland The "X-Purpose: preview" header is definitely a Safari 4 top sites thing. The Top Sites page tries to show a live-ish thumbnail of the favourite pages. If favourite page is open in a tab, it grabs a thumbnail from the current version of the page. If a page is not available

What to do with extra HTTP header from proxy?

浪子不回头ぞ 提交于 2019-12-05 01:23:04
Our environment requires the use of an outbound proxy for offsite services. Normally this isn't a problem. In this case with Twilio, the extra header returned breaks the client. Outgoing headers: POST /2010-04-01/Accounts/FOO/SMS/Messages.json HTTP/1.1 Authorization: Basic FOO== User-Agent: twilio-php/3.10.0 Host: api.twilio.com Accept: */* Accept-Charset: utf-8 Content-Type: application/x-www-form-urlencoded Content-Length: 108 Response Headers: HTTP/1.0 200 Connection established HTTP/1.1 201 Created Server: nginx Date: Thu, 06 Jun 2013 14:39:24 GMT Content-Type: application/json; charset

Is it possible to get the Set-Cookie value from an HTTP response header in JavaScript?

自闭症网瘾萝莉.ら 提交于 2019-12-05 00:30:48
问题 I'm using jQuery's ajax() method to make some asynchronous server calls and want to catch the case where a call fails because the session has timed out. From looking at the response headers in this case, I see that they include Set-Cookie: SMSESSION=LOGGEDOFF which seems like a pretty reliable test. But calling getAllResponseHeaders on the XMLHttpRequest object passed to jQuery's error callback apparently returns an empty string, and I'm having trouble figuring out any other way of getting

what characters are allowed in HTTP header values?

强颜欢笑 提交于 2019-12-05 00:29:21
After studying HTTP/1.1 standard , specifically page 31 and related I came to conclusion that any 8-bit octet can be present in HTTP header value. I.e. any character with code from [0,255] range. And yet HTTP servers I tried refuse to take anything with code > 127 (or most US-ASCII non-printable chars). Here is dried out excerpt of grammar used in standard: message-header = field-name ":" [ field-value ] field-name = token field-value = *( field-content | LWS ) field-content = <the OCTETs making up the field-value and consisting of either *TEXT or combinations of token, separators, and quoted

How does one parse HTTP headers with libcurl?

[亡魂溺海] 提交于 2019-12-05 00:11:34
I've been looking around and am quite surprised that there seems to be no means by which one can parse headers generically in libcurl (which seems to be the canonical C library for http these days). The closest thing I've found was a mailing list post where someone suggested someone else search through the mailing list archives. The only facility that is provided by libcurl via setopt is CURLOPT_HEADERFUNCTION which will feed the header responses a single line at a time. This seems entirely too primitive considering headers can span multiple lines . Ideally this should be done once correctly