http-headers

How to know if host support Range headers?

筅森魡賤 提交于 2020-01-01 17:27:15
问题 When i tried curl -r 0-100 to get a part of document i always got a full html page.Is there a simple way to know if host support range headers or don't , so i could use curl range option. 回答1: A server signals its support for ranges in the response headers. Look for "Accept-Ranges: bytes" in the response when you send a HEAD or a GET to the site. 来源: https://stackoverflow.com/questions/12332858/how-to-know-if-host-support-range-headers

Content-Length Header missing from Nginx-backed Rails app

最后都变了- 提交于 2020-01-01 12:24:10
问题 I've a rails app that serves large static files to registered users. I was able to implement it by following the excellent guide here: Protected downloads with nginx, Rails 3.0, and #send_file. The downloads and everything else is working great, but there is just this problem - The Content-Length header isn't being sent. It's okay for small files, but it gets really frustrating when large files are downloaded, since download managers and browsers don't show any progress. How can I fix this?

How do I get http headers in React.js

旧时模样 提交于 2020-01-01 09:16:30
问题 I've made a request to a React page, and I need to get the headers from the request. I call the page via the URL: http://localhost/dashboard and I set headers, for example authcode=1234. I then load the page with this route: <Route path="dashboard" name="dashboard" component={Dashboard} onEnter={requireAuth}></Route> is there something like this.props.header, I can call in the page constructor? 回答1: You cant get current page headers without sending a http request via javascript. See this

Distinguish ajax requests from full requests in JSF custom validator

五迷三道 提交于 2020-01-01 08:33:11
问题 My validator needs to know if it is a full request or an ajax request. In my current solution I check the http request header for the X-Requested-With element: public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest(); if (req.getHeader("X-Requested-With") != null) { // do something } else { // do something else } ... } Is there a better approach to achieve

Distinguish ajax requests from full requests in JSF custom validator

廉价感情. 提交于 2020-01-01 08:32:50
问题 My validator needs to know if it is a full request or an ajax request. In my current solution I check the http request header for the X-Requested-With element: public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest(); if (req.getHeader("X-Requested-With") != null) { // do something } else { // do something else } ... } Is there a better approach to achieve

Distinguish ajax requests from full requests in JSF custom validator

两盒软妹~` 提交于 2020-01-01 08:32:50
问题 My validator needs to know if it is a full request or an ajax request. In my current solution I check the http request header for the X-Requested-With element: public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest(); if (req.getHeader("X-Requested-With") != null) { // do something } else { // do something else } ... } Is there a better approach to achieve

PHPUnit - getallheaders not work

孤人 提交于 2020-01-01 08:05:10
问题 I'm testing my code, and i have some problem with header. In each api i use $headers = getallheaders(); to get that, and this works fine when i test with the app or crhome postman extension. When i lauch my test, like this $client = $this->createClient(); $client->request('GET', '/api/shotcard', ['qrcode'=>'D0m1c173'], [], ['HTTP_API_TOKEN' => 'abc123'] ); $this->assertEquals(200, $client->getResponse()->getStatusCode()); where i try to shot a card with that qrcode with a user with that test

Cache control and expires header for PHP

泪湿孤枕 提交于 2020-01-01 04:55:11
问题 I'm setting my headers $offset = 60 * 15; header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"); header("Cache-Control: max-age=$offset, must-revalidate"); However when running FireBug its giving me the following header information HTTP/1.1 200 OK Date: Mon, 25 Jul 2011 12:15:12 GMT Server: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9 X-Powered-By: PHP/5.2.9 Expires: Sat, 01 Jan 2000 00:00:01 GMT Cache-Control: post-check=0, pre-check=0, max-age=0

What is the current state of the Cookie2 specification?

空扰寡人 提交于 2020-01-01 04:20:06
问题 Do you have some information regarding browsers that implement/plan to implement this part of the HTTP 1.1 specification? Additionally, what frameworks have already implemented this feature. I've done my Google research but I'd like to know if there's something else. Also, do/would you use it? Do you find it better than the Cookie/Set-Cookie implementation? 回答1: Update : the Cookie2 specification never caught on, and RFC 6265 now declares it obsolete, making this question moot - though it's

How to capture HTTP request / response headers with mitmproxy?

浪尽此生 提交于 2020-01-01 03:30:13
问题 I have been able to capture the HTTP(s) traffic from a smartphone and also stored this traffic using mitmdump using the command mitmdump -w outfile This seems to dump the HTTP body along with the headers as well. I am interested in capturing only the headers, prefarably as a single csv row (or json string). How can I do that? 回答1: Yet another derived snippet based on previous responses and updated to python3: def response(flow): print("") print("="*50) #print("FOR: " + flow.request.url) print