What is the invalid request header name here? - http

GET http://msdn.microsoft.com/en-us/library/ms737550(v=vs.85).aspx HTTP/1.1
Host: msdn.microsoft.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.17) Gecko/20110420 AlexaToolbar/alxf-2.11 Firefox/3.6.17
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Proxy-Connection: keep-alive
Cookie: A=I&I=AxUFAAAAAAA6BwAAF8HSyidJIZx1KvyAM/QBJw!!&M=1&CS=1175b0002j2020#; TocHashCookie=ms310241(n)/aa139672(n)/ff576017(VS.85,n)/ff576020(VS.85,n)/ff576022(VS.85,n)/ff573209(VS.85,n)/ff573212(VS.85,n)/ff573407(VS.85,n)/ff573625(VS.85,n)/ff573631(VS.85,n)/na/; omniID=1304990477297_007d_a5e4_4a8f_b3cc040ef8ae; WT_FPC=id=116.236.150.80-235145280.30150320:lv=1305713955000:ss=1305712394162; WT_NVR_RU=0=msdn:1=:2=; WT_NVR=0=/:1=en-us:2=en-us/library|zh-cn/library; msresearch=%7B%22version%22%3A%224.6%22%2C%22state%22%3A%7B%22name%22%3A%22IDLE%22%2C%22url%22%3Aundefined%2C%22timestamp%22%3A1304990488606%7D%2C%22lastinvited%22%3A1304990488606%2C%22userid%22%3A%2213049904886068387915347343170%22%2C%22vendorid%22%3A1%2C%22surveys%22%3A%5Bundefined%5D%7D; MC1=GUID=fb6fc2d32e7a924698e043e5f5aff4e6&HASH=d3c2&LV=20115&V=3; msdn=L=2052; mcI=Tue, 24 May 2011 05:51:59 GMT; MUID=0DBD349328166C4B30BF35662D166C8B; MSID=Microsoft.CreationDate=05/17/2011 05:48:18&Microsoft.LastVisitDate=05/18/2011 02:00:06&Microsoft.VisitSt
artDate=05/18/2011 02:00:06&Microsoft.CookieId=979bc6e3-fa2d-4dad-816c-432790d7397e&Microsoft.TokenId=ffffffff-ffff-ffff-ffff-ffffffffffff&Microsoft.NumberOfVisits=5&Microsoft.CookieFirstVisit=1&Microsoft.IdentityToken=AA==&Microsoft.MicrosoftId=0359-2958-1412-9584; TocPosition=0; s_sq=%5B%5BB%5D%5D; s_cc=true; ADS=SN=175A21EF; GsfxSessionCookie=144229042098420446; GsfxStatsLog=true
Cache-Control: max-age=0
The above is dumped from my programe,but I don't see which part is invalid...

The line after Cookie is invalid as it needs to be indented to be interpreted as a fold:
HTTP/1.1 header field values can be folded onto multiple lines if the
continuation line begins with a space or horizontal tab. All linear
white space, including folding, has the same semantics as SP. A
recipient MAY replace any linear white space with a single SP before
interpreting the field value or forwarding the message downstream.
LWS = [CRLF] 1*( SP | HT )
Thus:
Cookie: A=I&I=AxUFAAAAAAA6BwAAF8HSyidJIZx1KvyAM/QBJw!!&M=1&CS=1175b0002j2020#; TocHashCookie=ms310241(n)/aa139672(n)/ff576017(VS.85,n)/ff576020(VS.85,n)/ff576022(VS.85,n)/ff573209(VS.85,n)/ff573212(VS.85,n)/ff573407(VS.85,n)/ff573625(VS.85,n)/ff573631(VS.85,n)/na/; omniID=1304990477297_007d_a5e4_4a8f_b3cc040ef8ae; WT_FPC=id=116.236.150.80-235145280.30150320:lv=1305713955000:ss=1305712394162; WT_NVR_RU=0=msdn:1=:2=; WT_NVR=0=/:1=en-us:2=en-us/library|zh-cn/library; msresearch=%7B%22version%22%3A%224.6%22%2C%22state%22%3A%7B%22name%22%3A%22IDLE%22%2C%22url%22%3Aundefined%2C%22timestamp%22%3A1304990488606%7D%2C%22lastinvited%22%3A1304990488606%2C%22userid%22%3A%2213049904886068387915347343170%22%2C%22vendorid%22%3A1%2C%22surveys%22%3A%5Bundefined%5D%7D; MC1=GUID=fb6fc2d32e7a924698e043e5f5aff4e6&HASH=d3c2&LV=20115&V=3; msdn=L=2052; mcI=Tue, 24 May 2011 05:51:59 GMT; MUID=0DBD349328166C4B30BF35662D166C8B; MSID=Microsoft.CreationDate=05/17/2011 05:48:18&Microsoft.LastVisitDate=05/18/2011 02:00:06&Microsoft.VisitSt
artDate=05/18/2011 02:00:06&Microsoft.CookieId=979bc6e3-fa2d-4dad-816c-432790d7397e&Microsoft.TokenId=ffffffff-ffff-ffff-ffff-ffffffffffff&Microsoft.NumberOfVisits=5&Microsoft.CookieFirstVisit=1&Microsoft.IdentityToken=AA==&Microsoft.MicrosoftId=0359-2958-1412-9584; TocPosition=0; s_sq=%5B%5BB%5D%5D; s_cc=true; ADS=SN=175A21EF; GsfxSessionCookie=144229042098420446; GsfxStatsLog=true
But as a folding is interpreted as a single space, you should fold the line at a separator that allows a space without adulterating the value like after a ;:
Cookie: A=I&I=AxUFAAAAAAA6BwAAF8HSyidJIZx1KvyAM/QBJw!!&M=1&CS=1175b0002j2020#; TocHashCookie=ms310241(n)/aa139672(n)/ff576017(VS.85,n)/ff576020(VS.85,n)/ff576022(VS.85,n)/ff573209(VS.85,n)/ff573212(VS.85,n)/ff573407(VS.85,n)/ff573625(VS.85,n)/ff573631(VS.85,n)/na/; omniID=1304990477297_007d_a5e4_4a8f_b3cc040ef8ae; WT_FPC=id=116.236.150.80-235145280.30150320:lv=1305713955000:ss=1305712394162; WT_NVR_RU=0=msdn:1=:2=; WT_NVR=0=/:1=en-us:2=en-us/library|zh-cn/library; msresearch=%7B%22version%22%3A%224.6%22%2C%22state%22%3A%7B%22name%22%3A%22IDLE%22%2C%22url%22%3Aundefined%2C%22timestamp%22%3A1304990488606%7D%2C%22lastinvited%22%3A1304990488606%2C%22userid%22%3A%2213049904886068387915347343170%22%2C%22vendorid%22%3A1%2C%22surveys%22%3A%5Bundefined%5D%7D; MC1=GUID=fb6fc2d32e7a924698e043e5f5aff4e6&HASH=d3c2&LV=20115&V=3; msdn=L=2052; mcI=Tue, 24 May 2011 05:51:59 GMT;
MUID=0DBD349328166C4B30BF35662D166C8B; MSID=Microsoft.CreationDate=05/17/2011 05:48:18&Microsoft.LastVisitDate=05/18/2011 02:00:06&Microsoft.VisitStartDate=05/18/2011 02:00:06&Microsoft.CookieId=979bc6e3-fa2d-4dad-816c-432790d7397e&Microsoft.TokenId=ffffffff-ffff-ffff-ffff-ffffffffffff&Microsoft.NumberOfVisits=5&Microsoft.CookieFirstVisit=1&Microsoft.IdentityToken=AA==&Microsoft.MicrosoftId=0359-2958-1412-9584; TocPosition=0; s_sq=%5B%5BB%5D%5D; s_cc=true; ADS=SN=175A21EF; GsfxSessionCookie=144229042098420446; GsfxStatsLog=true

Related

Headers but no data in file when downloaded via download.file from R

On this website (https://live.euronext.com/en/products/etfs/list), you can download a csv file. The file can be directly downloaded with this direct link: https://live.euronext.com/pd_es/data/track/download?mics=XAMS%2CXBRU%2CXLIS%2CXPAR%2CXLDN%2CXMSM%2CXOSL.
You can use that link by putting it directly in your web browser. You can observe that after having hit Enter button, the file is downloading directly with data in it (ISIN code).
I would like to download this file from R; it downloads the file but the data are not there: so I tried to mimick the browser, so I used the exact same User-Agent but downloaded file remains empty (no ISIN code)
url2call <- "https://live.euronext.com/pd_es/data/track/download?mics=XAMS%2CXBRU%2CXLIS%2CXPAR%2CXLDN%2CXMSM%2CXOSL"
options(HTTPUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36")
getOption("HTTPUserAgent")
options(internet.info = 0)
getOption("internet.info")
expr = download.file(url = url2call,
destfile = "./file.csv",
quiet = FALSE,
method = "libcurl",
cacheOK = FALSE,
mode = "w")
print(expr)
Here is the log of code above:
trying URL 'https://live.euronext.com/pd_es/data/track/download?mics=XAMS%2CXBRU%2CXLIS%2CXPAR%2CXLDN%2CXMSM%2CXOSL'
* Trying 45.223.139.7:443...
* Connected to live.euronext.com (45.223.139.7) port 443 (#0)
* schannel: disabled automatic use of client certificate
> GET /pd_es/data/track/download?mics=XAMS%2CXBRU%2CXLIS%2CXPAR%2CXLDN%2CXMSM%2CXOSL HTTP/1.1
Host: live.euronext.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Accept: */*
Pragma: no-cache
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Mon, 02 Jan 2023 15:12:20 GMT
< Server: Apache
* skipped cookie with bad tailmatch domain: priv.atos.fr
< Set-Cookie: SessionStatId=ec362863.5f14960ae7a67; path=/; expires=Tue, 31-Dec-30 15:12:20 GMT; domain=.priv.atos.fr; secure; httpOnly
< X-Content-Type-Options: nosniff
< Content-Disposition: attachment; filename="Euronext_ETPs_2023-01-02.csv"
< Vary: Accept-Encoding
< Content-Length: 263
< Content-Type: text/csv;charset=UTF-8
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: X-Requested-With
* Added cookie visid_incap_2784297="TSHS7aJ+Sg+lIwsikCSFUFP0smMAAAAAQUIPAAAAAACORJXoFQ6SWQTy9K1vAVdW" for domain euronext.com, path /, expire 1704147471
< Set-Cookie: visid_incap_2784297=TSHS7aJ+Sg+lIwsikCSFUFP0smMAAAAAQUIPAAAAAACORJXoFQ6SWQTy9K1vAVdW; expires=Mon, 01 Jan 2024 22:17:51 GMT; HttpOnly; path=/; Domain=.euronext.com
* Added cookie incap_ses_1103_2784297="ib7VDHy0tnHw2/pdcKVOD1P0smMAAAAAPpueNm9TLrLE2TSGjw+A4Q==" for domain euronext.com, path /, expire 0
< Set-Cookie: incap_ses_1103_2784297=ib7VDHy0tnHw2/pdcKVOD1P0smMAAAAAPpueNm9TLrLE2TSGjw+A4Q==; path=/; Domain=.euronext.com
< X-CDN: Imperva
< X-Iinfo: 13-480095013-480095029 NNNY CT(21 45 0) RT(1672672339599 71) q(0 0 0 -1) r(3 3) U12
<
Content type 'text/csv;charset=UTF-8' length 263 bytes
* Connection #0 to host live.euronext.com left intact
downloaded 263 bytes
Below you find an overview of file downloaded from R: it does not contain ISIN data.
What should I do to have data in my csv when downloaded from R?

How to generate Python XHR Request in requests.post()

I am trying to get info from a website using AJAX. The Website showing different size for perfume and basically, the price would change when selecting different size.
I checked chrome Network Tab and found it's a XHR request, but looking at the request head I have no idea how to generate the same headers and data with the Requests package.
This is how my code currently looks like:
import requests
url = "https://www.beautyfresh.com/uc_aac"
session = requests.Session()
data = {"attributes[Size]":"100ml"} # I want to get the price for 100ml
headers = {"Referer": "https://www.beautyfresh.com/product/fragrance/men/perfume-fragrance/women/perfume-men/fragrance/perfume/jo-malone-orange-blossom-cologne",}
r = session.post(url,headers=headers,data=data)
print(r.text)
The General information under Chrome Network tab is
Request URL: https://www.beautyfresh.com/uc_aac
Request Method: POST
Status Code: 200 OK
Remote Address: 103.255.250.100:443
Referrer Policy: no-referrer-when-downgrade
The Response Headers is
HTTP/1.1 200 OK
date: Fri, 18 Dec 2020 02:01:05 GMT
expires: Sun, 19 Nov 1978 05:00:00 GMT
x-site: beautyfresh
x-url: /uc_aac
last-modified: Fri, 18 Dec 2020 02:01:05 GMT
x-backend-server: web4
content-type: application/json
x-varnish: 700512226
age: 0
via: 1.1 varnish (Varnish/6.0)
x-cache: MISS
cache-control: Cache-Control: store, no-cache, must-revalidate
accept-ranges: bytes
content-length: 2193
The Request Headers is
POST /uc_aac HTTP/1.1
Host: www.beautyfresh.com
Connection: keep-alive
Content-Length: 164
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Origin: https://www.beautyfresh.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.beautyfresh.com/product/fragrance/men/perfume-fragrance/women/perfume-men/fragrance/perfume/jo-malone-orange-blossom-cologne
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: has_js=1; SESSc5f2026dce40de323b60d32130e6ce0b=n7tr5e2fsragf1js6garc6u06n; _ga=GA1.2.959938064.1608216963; _gid=GA1.2.1979056032.1608216963; _v1EmaticSolutionsUTMData=%7B%22utm_source%22%3A%22%22%2C%22utm_medium%22%3A%22%22%2C%22utm_campaign%22%3A%22%22%7D; _fbp=fb.1.1608216963288.1600789170; _v1EmaticSolutionsBye=%7B%2228732%22%3A%7B%2230038%22%3A%7B%22dont_show_till%22%3A%222020-12-20%22%2C%22loop%22%3A1%7D%7D%2C%2228739%22%3A%7B%2230045%22%3A%7B%22dont_show_till%22%3A%222020-12-20%22%2C%22loop%22%3A1%7D%7D%7D; _v1EmaticSolutionsEI=%7B%22c_28739_1%22%3A%5B1%2C1608216997180%2C33181%5D%2C%22c_28732_2%22%3A%5B1%2C1608216969616%2C0%5D%7D; _v1EmaticSolutions=%5B%22fc5d18b3-4077-11eb-970e-0242ac160003%22%2C1608217230870%2C%5B%22IMG%22%2C%22%22%2C1%2C%22glasshouse_fragrances_amalfi_coast_sea_candle_350gr.jpg%22%5D%5D; __atuvc=8%7C51; __atuvs=5fdc0d5961186ea4000; _gat=1; _dc_gtm_UA-63339192-1=1
And Form Data shows:
attributes%5BSize%5D=100ml&nid=2905&qty=1&form_build_id=form-991e88780c30fdf883375a36a986b550&form_id=uc_product_add_to_cart_form_2905&product-nid=2905&aac_nid=2905
I don't actually know how to construct my request so it can be successfully posted to the server the get the proper response. It should return the price for "100ml", but currently my code get nothing.
Thank you so much for any help!
You are missing some information in your data. To receive a response, try adding "aac_nid": "2905" to your data when sending the post request:
import requests
headers = {
"Referer": "https://www.beautyfresh.com/product/fragrance/men/perfume-fragrance/women/perfume-men/fragrance/perfume/jo-malone-orange-blossom-cologne",
}
data = {"attributes[Size]": "30ml", "aac_nid": "2905"}
response = requests.post(
"https://www.beautyfresh.com/uc_aac", headers=headers, data=data
)
>>> print(response.content)
b'{"nid":"2905","model":"690251006564","replacements":{"sellprice":"<div class=\\"product-info sellprice\\"><div class=\'retail_price\'>City Price: <div class=\'product-info retail_price\'><span class=\'uc-price\'>S$110.00<\\/span><\\/div><\\/div>\\r\\n <div class=\'promoprice\'>Our Price: <div class=\'product-info sellprice1\'><span class=\'uc-price\'>S$89.00<\\/span><\\/div><\\/div><\\/div>","model":"<div class=\\"model\\"><span class=\\"label\\">Product Code: <\\/span>690251006564<\\/div>"},"form":"<form action=\\"\\/uc_aac\\" accept-charset=\\"UTF-8\\" method=\\"post\\" id=\\"uc-product-add-to-cart-form\\" class=\\" uc-aac-cart\\">\\n<div><div class=\'attributes\'><div class=\\"form-item\\" id=\\"edit-attributes-Size-wrapper\\">\\n <label for=\\"edit-attributes-Size\\">Size <span class=\\"form-required\\" title=\\"This field is required.\\">*<\\/span><\\/label>\\n <select name=\\"attributes[Size]\\" class=\\"form-select required chosen-widget\\" data-name=\\"Size\\" id=\\"edit-attributes-Size\\" ><option value=\\"30ml\\" selected=\\"selected\\">30ml<\\/option><option value=\\"100ml\\">100ml<\\/option><\\/select>\\n<\\/div>\\n<\\/div><input type=\\"hidden\\" name=\\"nid\\" id=\\"edit-nid\\" value=\\"2905\\" \\/>\\n<div class=\\"form-item\\" id=\\"edit-qty-wrapper\\">\\n <label for=\\"edit-qty\\">Qty <\\/label>\\n <input type=\\"text\\" maxlength=\\"3\\" name=\\"qty\\" id=\\"edit-qty\\" size=\\"5\\" value=\\"1\\" class=\\"form-text textfield\\" \\/>\\n<\\/div>\\n<input type=\\"hidden\\" name=\\"form_build_id\\" id=\\"form-b7adf002178f04ed96377894057352a2\\" value=\\"form-b7adf002178f04ed96377894057352a2\\" \\/>\\n<input type=\\"hidden\\" name=\\"form_id\\" id=\\"edit-uc-product-add-to-cart-form\\" value=\\"uc_product_add_to_cart_form\\" \\/>\\n<input type=\\"hidden\\" name=\\"aac_nid\\" id=\\"edit-aac-nid\\" value=\\"2905\\" \\/>\\n<div class=\'leadtime_message\' style=\'margin-bottom:1em;\'><p>Delivers in 1-3 working days<\\/p><\\/div><input type=\\"submit\\" name=\\"op\\" id=\\"edit-submit-2905\\" value=\\"Add to Cart\\" class=\\"notranslate form-submit node-add-to-cart primary\\" \\/>\\n\\n<\\/div><\\/form>\\n"}'
To get the price, try searching for it with the help of the built-in re (regex) module:
import re
prices = re.findall(r"'uc-price\\'>S(\$\d.*?)<", str(response.content))
print("Original Price:", prices[0])
print("Our Price:", prices[1])
Output:
Original Price: $110.00
Our Price: $89.00

Strange firefox bug triggers on reload

I noticed a bug in an old version of firefox, that was shipped with my os.
These were the sympthoms:
Guile web server failed to serve the request when data was reposted.
I came up with a minimal example to show the problem.
Steps to reproduce:
start the server script
load localhost:8080
select the test.csv file for upload, and upload it
hit the refresh button in the browser
answer yes to resend post data dialog.
test.scm:
(use-modules (web server)
(rnrs bytevectors))
(define (handler request body)
(if body
(display (utf8->string body)))
(values '((content-type . (text/html)))
(string-append "<html><body>"
"<form action=\"do\" method=\"POST\" enctype=\"multipart/form-dat\
a\">"
"<input type=\"file\" name=\"x\">"
"<input type=\"submit\">")))
(run-server handler)
test.csv:
a,b
Expected result: no error displayed on the console.
Actual result:
-----------------------------18912432064747206221264673165
Content-Disposition: form-data; name="x"; filename="test.csv"
Content-Type: text/csv
In ice-9/boot-9.scm:
841:4 4 (with-throw-handler _ _ _)
In web/server/http.scm:
127:28 3 (_)
In web/request.scm:
205:31 2 (read-request #<closed: file 5559bbcb82a0> _)
In web/http.scm:
1141:6 1 (read-request-line _)
In ice-9/boot-9.scm:
752:25 0 (dispatch-exception _ _ _)
Bad request: Bad Request-Line: "a,b"
What am I doing wrong here?
Some additional information:
on a whireshark capture it turns out, that the following is sent on resend:
POST /do HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: hu-HU,hu;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/do
Content-Type: multipart/form-data; boundary=---------------------------121791188820701943592108452984
Content-Length: 150
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
-----------------------------121791188820701943592108452984
Content-Disposition: form-data; name="x"; filename="test.csv"
Content-Type: text/csv
POST /do HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: hu-HU,hu;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/do
Content-Type: multipart/form-data; boundary=---------------------------121791188820701943592108452984
Content-Length: 150
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
-----------------------------121791188820701943592108452984
Content-Disposition: form-data; name="x"; filename="test.csv"
Content-Type: text/csv
a,b
-----------------------------121791188820701943592108452984--
I will check the http spec if it has anything to say about this. The first http request is partial, followed by a well formed request.
UPDATE:
It turned out that guile webserver threw the error completely legitimately.
Answering my own question:
This is actually this firfox bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1434553
Fixed in firefox62.

206 Partial Content does not accept data from server

I'm trying return video partially, using 206 Partial Content, I transfer all the headers correctly, but the request passes only 4kb, but if I answer 200 OK, the video will work, what could be the problem?
(If I answer 200 OK, then I can't rewind the video)
Type: Document
Request:
GET / HTTP/1.1
Host: 127.0.0.1:8080
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36
DNT: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: ru,en;q=0.9
Response:
HTTP/1.1 200 OK
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Mon, 11 Mar 2019 19:03:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Accept-Ranges: bytes
Content-Encoding: gzip
Content-Type: video/mp4; charset=utf-8
Date: Mon, 11 Mar 2019 19:03:02 GMT
Content-Length: 16766763
Keep-Alive: timeout=15,max=100
=============================================
Type: Media
Request:
GET / HTTP/1.1
Host: 127.0.0.1:8080
Connection: keep-alive
DNT: 1
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36
Accept: */*
Referer: http://127.0.0.1:8080/
Accept-Language: ru,en;q=0.9
Range: bytes=0-
Response:
HTTP/1.1 206 Partial Content
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Mon, 11 Mar 2019 19:03:02 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Accept-Ranges: bytes
Content-Type: video/mp4; charset=utf-8
Date: Mon, 11 Mar 2019 19:03:02 GMT
Keep-Alive: timeout=15,max=100
Content-Range: bytes 0-29593599/29593600
Content-Length: 29593600
The problem was in localhost, everything works on server, thanks :)

Sample http range request session

Is it possible to show me a sample http session with range requests.
I mean what would be the request and response headers?
The following exchange is between Chrome and a static web server, retrieving an MP4 video.
Initial request - for the video. Note the Accept-Ranges response header to indicate the server has range header support:
GET /BigBuckBunny_320x180.mp4
Cache-Control: max-age=0
Connection: keep-alive
Accept-Language: en-GB,en-US,en
Host: localhost:8080
Range:
Accept: text/html,application/xhtml+xml,application/xml,*/*
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 ...
Accept-Encoding: gzip,deflate,sdch
Accept-Charset: ISO-8859-1,utf-8,*
200 OK
Content-Type: video/mp4
Connection: keep-alive
Last-Modified: Wed,14 Dec 2011 15:50:59 GMT
ETag: A023EF02BD589BC472A2D6774EAE3C58
Transfer-Encoding:
Content-Length: 64657027
Accept-Ranges: bytes
Server: Brisket/1.0.1
Date: Wed,14 Dec 2011 16:11:24 GMT
Range header in previous response detected - subsequent request with open-ended range to confirm support. Response returns a 206 status and Content-Range header to indicate the bytes present in the response body:
GET /BigBuckBunny_320x180.mp4
Connection: keep-alive
Accept-Language: en-GB,en-US,en
Host: localhost:8080
Range: bytes=0-
Accept: */*
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 ...
Referer: http://localhost:8080/BigBuckBunny_320x180.mp4
Accept-Encoding: identity
Accept-Charset: ISO-8859-1,utf-8,*
206 Partial Content
Content-Type: video/mp4
Connection: keep-alive
Last-Modified: Wed,14 Dec 2011 15:50:59 GMT
ETag: A023EF02BD589BC472A2D6774EAE3C58
Transfer-Encoding:
Content-Length: 64657027
Accept-Ranges: bytes
Server: Brisket/1.0.1
Date: Wed,14 Dec 2011 16:11:25 GMT
Content-Range: bytes 0-64657026/64657027
Subsequent range request to capture the end of the file (probably to capture trailing metadata):
GET /BigBuckBunny_320x180.mp4
Connection: keep-alive
Accept-Language: en-GB,en-US,en
Host: localhost:8080
Range: bytes=64312833-64657026
Accept: */*
If-Range: A023EF02BD589BC472A2D6774EAE3C58
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 ...
Referer: http://localhost:8080/BigBuckBunny_320x180.mp4
Accept-Encoding: identity
Accept-Charset: ISO-8859-1,utf-8,*
206 Partial Content
Content-Type: video/mp4
Connection: keep-alive
Last-Modified: Wed,14 Dec 2011 15:50:59 GMT
ETag: A023EF02BD589BC472A2D6774EAE3C58
Transfer-Encoding:
Content-Length: 344194
Accept-Ranges: bytes
Server: Brisket/1.0.1
Date: Wed,14 Dec 2011 16:11:25 GMT
Content-Range: bytes 64312833-64657026/64657027
User clicks in the video progress bar beyond the downloaded range - a range request is issued to begin playing from the selected position:
GET /BigBuckBunny_320x180.mp4
Connection: keep-alive
Accept-Language: en-GB,en-US,en
Host: localhost:8080
Range: bytes=1073152-64313343
Accept: */*
If-Range: A023EF02BD589BC472A2D6774EAE3C58
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 ...
Referer: http://localhost:8080/BigBuckBunny_320x180.mp4
Accept-Encoding: identity
Accept-Charset: ISO-8859-1,utf-8,*
206 Partial Content
Content-Type: video/mp4
Connection: keep-alive
Last-Modified: Wed,14 Dec 2011 15:50:59 GMT
ETag: A023EF02BD589BC472A2D6774EAE3C58
Transfer-Encoding:
Content-Length: 63240192
Accept-Ranges: bytes
Server: Brisket/1.0.1
Date: Wed,14 Dec 2011 16:11:25 GMT
Content-Range: bytes 1073152-64313343/64657027

Resources