http-headers

Requests - get content-type/size without fetching the whole page/content

╄→гoц情女王★ 提交于 2019-12-21 04:50:32
问题 I have a simple website crawler, it works fine, but sometime it stuck because of large content such as ISO images, .exe files and other large stuff. Guessing content-type using file extension is probably not the best idea. Is it possible to get content-type and content length/size without fetching the whole content/page? Here is my code: requests.adapters.DEFAULT_RETRIES = 2 url = url.decode('utf8', 'ignore') urlData = urlparse.urlparse(url) urlDomain = urlData.netloc session = requests

Safari 11 X-XSRF-TOKEN not updated after refresh

我是研究僧i 提交于 2019-12-21 04:41:05
问题 Recently Safari 11 was released on Mac OSX. This update causes problem with our webapplication in combination with XSRF on the header of our reuest. I will try to describe the problem in a logic way. This is how a good situation would look like: When a user wants to log in, he receives a response from the server with a Set-Cookie that contains the value of the XSRF token. Eg: Set-Cookie: XSRF-TOKEN=LKNBX4DZhL708KjXNkgXnlxTDCNuhsZG1kTc2SFy498; Path=/; Secure The page refreshes The next call

Do HTTP RANGE headers work with Azure Blob Storage Shared Access Signatures?

狂风中的少年 提交于 2019-12-21 04:26:37
问题 I'm using Azure Blob Storage to store media files and providing access to these files using Shared Access Signatures; everything is working well in this regard. However, I have a client application that needs to "resume" access to these files and does so using an HTTP RANGE header. When it makes a request like this, it is unhappy with the result it gets back from Azure. I'm not sure how to view the details on the Azure side to see if the request failed, or if it just returned something the

Set response headers not using filter - RESTeasy

谁说胖子不能爱 提交于 2019-12-21 04:21:28
问题 I am trying to set a header value in a response from a RESTful endpoint using RESTeasy. I know that I can read header parameters using @HeaderParam but I want to change the value of that header parameter for the response. How can I do this without using a filter? 回答1: RESTEasy can inject HttpResponse which enables you to set header parameters. @Path("/") public class MyService { @Context org.jboss.resteasy.spi.HttpResponse response; @GET @Path("/") public void setHeader(){ response

Set response headers not using filter - RESTeasy

北城以北 提交于 2019-12-21 04:21:16
问题 I am trying to set a header value in a response from a RESTful endpoint using RESTeasy. I know that I can read header parameters using @HeaderParam but I want to change the value of that header parameter for the response. How can I do this without using a filter? 回答1: RESTEasy can inject HttpResponse which enables you to set header parameters. @Path("/") public class MyService { @Context org.jboss.resteasy.spi.HttpResponse response; @GET @Path("/") public void setHeader(){ response

Conditional serving of web pages based on “Accept” header with express?

て烟熏妆下的殇ゞ 提交于 2019-12-21 04:19:26
问题 I understand that you can serve static content over express with: app.use(express.static(__dirname + "../../../public_html")); However, I'm trying to have express change the presentation of the content it delivers based upon the "Accept" header the the response sends over. Normally, the content that I have is requested in a JSON format through a REST API so the url is: http://blah.com/this/that/item and that works well. However, I would also like for users to be able to access that same page

Howto setup JAX-WS client to use ISO-8859-1 instead of UTF-8?

爱⌒轻易说出口 提交于 2019-12-21 04:12:50
问题 I would like to configure my JAX-WS client to send messages in ISO-8859-1 . Currently UTF-8 is used. Here is what the client tries to do: Map<String, Object> reqContext = ((BindingProvider) service).getRequestContext(); Map httpHeaders = new HashMap(); httpHeaders.put("Content-type",Collections.singletonList("text/xml;charset=ISO-8859-1")); reqContext.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders); But this setting is ignored and tcpmon shows that the following is received by the

Setting Custom HTTP Headers in Alamofire in iOS 7 not working

删除回忆录丶 提交于 2019-12-21 03:43:24
问题 I've tried to set the Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders with my custom HTTP Headers in iOS 7 but I have had no luck. This works fine in iOS 8. Does anyone have any suggestions? 回答1: I got it working. This has no effect on iOS7: Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders = ["CustomHeader": customValue] This however will work on both iOS7 & 8: var headers = Alamofire.Manager.sharedInstance.session.configuration

How to read response headers with $resource?

只谈情不闲聊 提交于 2019-12-21 02:20:35
问题 I'm using $resource to get data from my RESTful service and I need to read response headers to get 'X-Page' and 'X-Total-Pages' value for pagination. Example: Access-Control-Max-Age:1728000 Cache-Control:max-age=0, private, must-revalidate Connection:Keep-Alive Content-Length:2637 Content-Type:application/json Date:Thu, 10 Apr 2014 16:53:01 GMT Server:WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24) Vary:Origin X-Page:1 X-Per-Page:10 X-Total:17 X-Total-Pages:2 But I couldn't get full headers from server

How to read response headers with $resource?

落花浮王杯 提交于 2019-12-21 02:20:11
问题 I'm using $resource to get data from my RESTful service and I need to read response headers to get 'X-Page' and 'X-Total-Pages' value for pagination. Example: Access-Control-Max-Age:1728000 Cache-Control:max-age=0, private, must-revalidate Connection:Keep-Alive Content-Length:2637 Content-Type:application/json Date:Thu, 10 Apr 2014 16:53:01 GMT Server:WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24) Vary:Origin X-Page:1 X-Per-Page:10 X-Total:17 X-Total-Pages:2 But I couldn't get full headers from server