http-headers

Test url availability with javascript

左心房为你撑大大i 提交于 2019-12-14 03:48:40
问题 Is it possible through jQuery (or plain javascript) to test if a webpage on another domain is available? I tried getting the response headers with an ajax-call but I get an error no matter what site outside my own domain I test. So do I really need a proxy script on my server or would I be able to skip that request? 回答1: Yes, you need to use a proxy script on your server. JavaScript cannot be used in a browser to request resources across domains, as per the same-origin policy. 回答2: Is it

Python Requests Not Returning Same Header as Browser Request/cURL

泄露秘密 提交于 2019-12-14 03:42:51
问题 I'm looking to write a script that can automatically download .zip files from the Bureau of Transportation Statistics Carrier Website, but I'm having trouble getting the same response headers as I can see in Chrome when I download the zip file. I'm looking to get a response header that looks like this: HTTP/1.1 302 Object moved Cache-Control: private Content-Length: 183 Content-Type: text/html Location: http://tsdata.bts.gov/103627300_T_T100_SEGMENT_ALL_CARRIER.zip Server: Microsoft-IIS/8.5 X

How to best parse 1 HTTP header VALUE in PHP?

亡梦爱人 提交于 2019-12-14 03:36:29
问题 I have a very important, detailed HTTP header in my response that I want to parse the value of to get the details: Digest realm="My Very, Very Cool Site", nonce="A8W/7aDZBAA=ffc2afd053c8802dd64be69b985f38c85ec29607", algorithm=MD5, domain="/", qop="auth" It's obviously comma-separated, but it's also quoted, so values can contain , . There's also "Digest " that's not part of the key="value" -pairs. (I can assume the first part ("Digest") will never contain spaces, so that shouldn't be too hard

How to get the real file size of a file in a multipart/form-data request

倾然丶 夕夏残阳落幕 提交于 2019-12-14 01:12:32
问题 As the title says, I need to get the real filesize of a file posted as a multipart/form-data request. I'm based in the JSF world but I think the problem is technology-agnostic (only depends on HTTP). The value specified in the Content-Length header is not sufficient because it includes the boundaries and other form parameters. Example request (body only): -----------------------------355432893771247592819421210 Content-Disposition: form-data; name="composeform" composeform -------------------

Content-Type header not being set with Angular $http

故事扮演 提交于 2019-12-14 00:19:00
问题 I'm trying to make a cross-origin POST request using Angular $http with the following code. //I've tried setting and removing these http config options $http.defaults.useXDomain = true; delete $http.defaults.headers.common['X-Requested-With']; $http.defaults.headers.common['Content-Type'] = 'application/x-www-form-urlencoded'; //Basic request, with some private headers removed return $http({ method: 'POST', //withCredentials:true, headers: { 'Content-Type': 'application/x-www-form-urlencoded;

How to get Request Header value when accessing my Angular application

久未见 提交于 2019-12-13 21:23:45
问题 My Angular application will be accessed from another application and the environment which is used to deploy our applications are configured in such a way that, the request coming from that application to access my Angular application will contain some information which is set in Request Header. I'm asked to use that header information to identify the application from which my Angular application is called. The other application can be either External or Internal deployed application. And

Caching in Picasso

雨燕双飞 提交于 2019-12-13 21:07:58
问题 After reading several documentations, i want to clear some points Reference: this For Picasso to cache my image into memory, do i have to enable "Cache-control" header in my response? If i am using OkHttpDownloader with Picasso,will it still require me to enable the header? public Picasso getImageLoader(Context ctx) { Picasso.Builder builder = new Picasso.Builder(ctx); builder.downloader(new OkHttpDownloader(ctx) { @Override protected HttpURLConnection openConnection(Uri uri) throws

contentType: 'application/json' with POST method (JavaScript)

早过忘川 提交于 2019-12-13 20:51:20
问题 I need to create a web server client in JavaScript and I have some problems to define Request headers. I need POST method and Content-Type: "application/json". I tried this: $.ajax({ url: 'http://MyWebServiceAddress', data: JSON.stringify({user:'user',pass:'pass'}), type: 'POST', crossDomain: true, dataType: 'json', success: function () { alert("success") }, error: function (xhr, ajaxOptions, thrownError) { alert("Error: " + xhr.status + "\n" + "Message: " + xhr.statusText + "\n" + "Response:

Angular 7 - HttpInterceptor not adding header to request

限于喜欢 提交于 2019-12-13 20:17:01
问题 I am trying to add Authorization header to all my requests and am facing some issues. Even though I am adding the headers, the headers are not being used when network call is made. Below is my interceptors code: const user: string = localStorage.getItem('user'); const token: string = localStorage.getItem('token'); const authReq = request.clone({ headers: request.headers.set('Authorization', user + ',' + token) }); return next.handle(authReq); I have taken this code from angular documentation,

Is it possible to open new browser window with custom headers and content?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 19:35:35
问题 I have a Sencha Touch web application. I'm trying to generate a calendar event file and open it in another window hence forcing iOS to ask user to import this event into standard calendar. I can do window.open and then use document.write to generate the file I want, but I also need to specify custom headers with content-type so Safari would recognize it as a calendar file. Is it possible? 回答1: If you redirect to or window.open a data URI, you can specify a MIME type. As a simple test (Safari