w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
HttpMessageConverter invalid EOF handling
Second option is probably better as it is easier to translate that into response code 400. IOException is too general exception to make any special handling for it. Spring's own MappingJackson2HttpMessageConverter is also translating all IOExceptions into HttpMessageNotReadableExceptions.

Categories : Java

Spring Android Get Request implementation : Could not extract response: no suitable HttpMessageConverter found for response type and content type
Your server returns an XML content but says it returns HTML content (content type is text/html according to the error message) and thus the parsing failed. You need to make sure your server returns something like text/xml and also that you have the correct converters in you rest template object. Edit: Try to add this message converter. Put it first (before StringHttpMessageConverter and SourceHttpMessageConverter) Jaxb2RootElementHttpMessageConverter jaxbMessageConverter = new Jaxb2RootElementHttpMessageConverter(); List<MediaType> mediaTypes = new ArrayList<MediaType>(); mediaTypes.add(MediaType.TEXT_HTML); jaxbMessageConverter.setSupportedMediaTypes(mediaTypes); messageConverters .add(jaxbMessageConverter);

Categories : Android

How to send an image from HTTP client to http server listening on this URL(http://localhost:8000/test)
Are you using web container like apache/nginx or one you write it yourself? If you are wondering how to decode the tcp packet in your own server, just upload a file to a server and grasp the http packet to see the detail of the protocol

Categories : Misc

Is it reasonable to assume that all HTTP headers (of a single HTTP message) arrive in the same SSL/TLS record?
No, cookies alone could be well above 16K. According to RFC2109 and IE implementation for cookie limits the recommended minimum restriction on cookie size per domain is 80K RFC 2109 section "6.3 Implementation Limits": at least 4096 bytes per cookie (as measured by the size of the characters that comprise the cookie non-terminal in the syntax description of the Set-Cookie header) at least 20 cookies per unique host or domain name

Categories : C

Blackberry 10: How to correspond incoming http replies to their previous http request counterparts?
You have at least two ways to do this: From the QNetworkReply, you can access to your original request (https://developer.blackberry.com/cascades/reference/qnetworkreply.html#request), on which you can set an originatingObject: https://developer.blackberry.com/cascades/reference/qnetworkrequest.html#setOriginatingObject, and any other attribute on your request You can check against the content URL: https://developer.blackberry.com/cascades/reference/qnetworkreply.html#url

Categories : C++

Use JMeter HTTP Proxy to record JSON over HTTP request from not-a-browser client
You can see my question and the answer I got below: Use Jmeter proxy to record HTTP calls from iOS simulator In short: With this tutorial you can record calls from your Android device: http://blazemeter.com/blog/load-testing-mobile-apps-made-easy For make same thing with iPhone, do the following steps: Mac configuration: system preferences -> Network -> Advanced.. -> Proxies -> check "Web Proxy (HTTP) ->in "Web Proxy Server" field, type your IP (http://www.wikihow.com/Find-Your-IP-Address-on-a-Mac), and choose available port (I using 8080) ->ok -> Apply iPhone configuration: Settings -> WiFi -> choose same wifi you use with your Mac -> press on it again to go to it's details -> scroll down ->In HTTP proxy, choose Manual -> server = your mac IP you found earlier -> port = the port yo

Categories : Http

Configure IIS Windows Authentication to return HTTP 403 instead of HTTP 401 for permission denied with an authenticated user
What did not work I tried just about every IIS configuration permutation with no luck. I goofed around with the Windows authentication provider settings, like NTLM, Negotiate, and Negotiate:Kerberos. None of them seemed to do the trick. This isn't too much of a surprise since the browsers are deciding to try authentication again, even though they probably shouldn't. 401 Unauthorized The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.47) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refu

Categories : Asp Net

Writing a custom http server, does supporting AJAX require extra code over HTTP GET?
AJAX is fine, it's just GET (or occasionally POST) requests which are formatted exactly the same on the server side. The difference on the server is, they'll typically go to a different "servlet" (or method in your C code) to be answered. Typically, the answer may be XML, JSON (serialized data for Javascript) or perhaps an HTML fragment (without or tags, just the content of a or something.). Or it could just be a 200 OO response indicating "success". On the browser side, AJAX is requested & used from Javascript within a page; with the results then either pasted into the DOM via innerHtml (for HTML fragments), or built into the DOM via Javascript (for JSON). The second option is less performant. Your first typical use-case might well be an autocomplete for a search-box, or somet

Categories : C

Text FIle - Access forbidden through http://localhost but OK if accessed http://private-ip ( LAMP )
Solved - looks like this was due to me keeping the doc root in a folder under /home. Once i switched that back to the /srv/www/htdocs folder , everything was ok. I made no other changes in the httpd.conf. - App/My work has been stable for a few weeks already

Categories : PHP

sun.net.www.protocol.http.HttpURLConnection - when will support http method PATCH?
The JDK HttpURLConnection doesn't support the HTTP PATCH method in JDK6, JDK7 nor JDK8. No official JDK roadmap shows this item for the moment. You can use Apache HTTPClient 4.2+ or AsyncHTTPClient.

Categories : Misc

HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable
503 means the functions are working and you're getting a response from the remote server denying you. If you ever tried to cURL google results the same thing happens, because they can detect the user-agent used by file_get_contents and cURL and as a result block those user agents. It's also possible that the server you're accessing from also has it's IP address blackballed for such practices. Mainly three common reasons why the commands wouldn't work just like the browser in a remote situation. 1) The default USER-AGENT has been blocked. 2) Your server's IP block has been blocked. 3) Remote host has a proxy detection.

Categories : PHP

Why does $_SERVER["SERVER_PROTOCOL"] show HTTP/1.0 when the client spoke HTTP/1.1
Interesting problem! You have two connections here because you have a end-point proxy in between. The request from your version of nginx to apache is going over HTTP 1.0. CLIENT <---- (HTTP 1.1) ----> NGINX <----- (HTTP 1.0) ----> SERVER Nginx 1.1.4 onwards supports HTTP 1.1 to upstream servers.

Categories : PHP

Extracting elements from an HTTP XML response--HTTP Client & Java
Instead of trying to extract the value with string manipulation, try to use Java's inbuilt ability to parse XML. That's a much better approach. Http Components returns responses in an XML format - there's a reason for that. :) Here's probably one way to solve your problem: // Parse the response using DocumentBuilder so you can get at elements easily DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse(response); Element root = doc.getDocumentElement(); // Now let's say you have not one, but 'n' nodes that contain the value // you're looking for. Use NodeList to get a list of all those nodes and just // pull out the tag/attrib

Categories : Java

Python HTTP request with controlled ordering of HTTP headers
You can try to use the OrderedDict class to store the headers, instead of request's default one: >>> from collections import OrderedDict >>> from requests import Session >>> s = Session() >>> s.headers CaseInsensitiveDict({'Accept-Encoding': ... 'User-Agent': ... 'Accept': '*/*'}) >>> s.headers = OrderedDict([('User-Agent', 'foo-bar'), ('Accept', 'nothing')]) >>> s.headers OrderedDict([('User-Agent', 'foo-bar'), ('Accept', 'nothing')])

Categories : Python

C HTTP Server & OpenSSL - Works fine for HTTP - Multiple/rapid/concurrent connections being dropped using HTTPS
You should call SSL_accept() in your request handling thread. This will allow your listening thread to process the TCP accept/listen queue more quickly, and reduce the chance of new connections getting a RESET from the TCP stack because of a full accept/listen queue. SSL handshake is compute intensive. I would guess that your spammer is probably not using SSL session cache, so this causes your server to use the maximum amount of CPU. This will cause it to be CPU starved in regards to servicing the other connections, or new incoming connections.

Categories : C

getting java.io.IOException: HTTP request failed, HTTP status: 404 in ksoap2 while passing xml data to soap1.2 android
Try the below PropertyInfo req = new PropertyInfo(); req.name="silent"; req.type=String.class; req.setValue("<silent>" +"<action>"+logon+"</action>" +"<gameid>"+mygameid+"</gameid>" +"<gpassword>"+mypwd+"</gpassword>" +"<data>" +"<username>"+test@test.com+"</username>" +"<password>"+test+"</password>" +"</data>" +"</silent>"); request.addProperty(req);

Categories : Android

Angular JS cancel $http call before calling a new $http
You need to create a new canceler for each request, because once it's resolved it can't be used again. See here for an updated plnkr.

Categories : Http

Get http 500 in a Azure worker role http request
One thought is that when you run your code in the cloud, you are running on their servers, meaning you dates could all be out of whack. I have seen it before where you assume DateTime.Now (or whatever you are doing) is your time, but its actually the server time of the VM you are running on in the cloud. The reason it could be a date issue is that I see you are passing in date parameters to the URL, perhaps they are formatted wrong when you are running in the cloud?

Categories : C#

Which should be used when naming a variable in Objective C, "http" or "HTTP" prefix?
Honestly, it doesn't really matter. Rather than being worried about naming, you should make sure everything is clear and well spaced. Unless you have a name that is really similar or close to a class or method name, you should not worry about it. This is mainly a personal choice. Do whatever you want. Just make sure you can read it. |˙∆˙|/

Categories : Objective C

Htaccess redirects http://www... to https://www..., but does not redirect http://www
Try this: RewriteEngine On #not https RewriteCond %{HTTPS} off RewriteRule .* https://www.metalmetalland.com%{REQUEST_URI} [R=301,L] #https, but not www RewriteCond %{HTTP_HOST} !^www. RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Categories : Apache

How to parse http Get request body in a Go http server?
Most of the magic happens in transfer.go. Here's what I found that looks relevant in the fixLength func: if !isResponse && requestMethod == "GET" { // RFC 2616 doesn't explicitly permit nor forbid an // entity-body on a GET request so we permit one if // declared, but we default to 0 here (not -1 below) // if there's no mention of a body. return 0, nil } Looks like, as long as your client is ending a Content-Length header, you're all good. If not, the library will assume there's no body on a GET request. You're kind of off the edge of the map as your client is doing some pretty unusual/broken stuff. If you can fix the client, that's your best bet. That said, if you have a client you need to support that's doing this wrong, you're going to have to roll so

Categories : Http

handling $http.get and $http.post errors in Angularjs
Response interceptors are attached during the config phase of an angularjs app. You can use them to globally respond to any $http request. Be aware, template files also use $http request, so you may wish to filter some requests in your interceptor to only the ones you wish to respond to. A good understanding of the promises pattern is needed to successfully use response interceptors. Heres an example of how they are used: angular.module('services') .config(function($httpProvider){ //Here we're adding our interceptor. $httpProvider.responseInterceptors.push('globalInterceptor'); }) //Here we define our interceptor .factory('globalInterceptor', function($q){ //When the interceptor runs, it is passed a promise object return function(promise){

Categories : Angularjs

HTTP status 401, but expected data in HTTP response
I don't think the entity could theoretically be the data that would be sent to an authorized request. From RFC 2616: If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity might include relevant diagnostic information. So it's legal to present entity to a unauthenticated user. As you said, authorized data should not be returned to a client... but in your case, the entities are just both the same for authenticated and unauthenticated users. On the other hand, Google's login page uses 200 as the response code for failing to authenticate. Note that: the response MUST include a WWW-Authenticate hea

Categories : Http

turn http post request to http get
You should not do this as the semantics are different. GET requests are designed to be cached (i.e. usually static stuff). POST on the other hand is more dynamic and is not cached. You are very likely to get undesired behaviour if you do this.

Categories : Java

http:// vs http://www: Should I use subdomain or permanent redirect
Yes, if it is the same content, then give it a single URI; and redirect example.com -> www.example.com not the other way around (www. is the convention and is where systems will most likely look first). If you host on both urls, then Spiders and other bots may be smart enough to realize that it is the same, but why rely on it when a simple redirect ensures they know? This also means a slightly simple web server setup (only hosting a single domain) and will be easier down the road if you do things like enable ssl or load balancing. The only (arguable) downside to redirects is that it will mean an additional http request if the user gets it wrong.

Categories : Http

htaccess rewrite all using http:// or http://www. to https except for one or two URI
Move the rewrite condition to the part where http: is ON not where https: is already ON. RewriteCond %{HTTPS} !=on RewriteCond %{REQUEST_URI} !^/folder/next_folder/custom_id RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] RewriteCond %{HTTPS} on RewriteCond %{HTTP_HOST} ^www.(.*)$ RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

Categories : Htaccess

WordPress Site Error failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
To make the path request local and not over the network I had to use the WordPress template tag get_template_directory() instead of get_bloginfo('stylesheet_directory') .

Categories : Wordpress

Difference between XML Over HTTP & SOAP Over HTTP
SOAP is a specialization of XML, as it has a schema, such as http://www.xmlsoap.org/soap/envelope/, whereas XML is more general. For using GET, you can read through this discussion: http://www.coderanch.com/t/463869/Web-Services/java/SOAP-request-HTTP, but basically SOAP is done via POST, though Axis2 appears to have support for GET, as a way to have SOAP work in a world where REST seems to rule. And, according to this IBM article (http://www.ibm.com/developerworks/xml/library/x-tipgetr/index.html) SOAP 1.2 introduces GET. As you mentioned, SOAP is a standard, so there are tools that can easily work with it, including dynamic client generation, as shown in this question, dynamic proxy soap web service client in java?, whansere the client generates the stubs needed upon connection. If y

Categories : Web Services

apache http client org.apache.http.NoHttpResponseException: The target server failed to respond
Check if your "URL" has correct value. Error message says "The target server failed to respond". That's either your provided URL has wrong or server has shut down. If you provided wrong parameter name/value or something, error message would be different.

Categories : Java

YouTube Data API failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
is file_get_contents supported on your web server? many web servers dont support this function due to security risks. have you looked into using curl instead? maybe something like this: $option = array( 'part' => 'snippet', 'q' => 'search_query', 'type' => 'video', 'key' => 'your_key' ); $url = "https://www.googleapis.com/youtube/v3/search?".http_build_query($option, 'a', '&'); $curl = curl_init($url); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, false); $json_response = curl_exec($curl); curl_close($curl); $responseObj = json_decode($json_response);

Categories : PHP

How to send node.js http request via proxy (using require('http').request method)
According to http://nodejs.org/api/http.html#http_http_request_options_callback hostname: To support url.parse() hostname is preferred over host Should add this line when overwriting proxy informations. options.hostname = proxy.hostname;

Categories : Node Js

android-async-http library get http response header from Response Handler
@Zapnologica, it seems, that author of library provided changes based on this pull request: https://github.com/loopj/android-async-http/pull/170 But it is not released yet, at least latest available .jar version of library is 1.4.3 and it does not include these changes, unfortunately. The only option we may try to use is cloning/forking git repo and including its sources into your project. UPDATE: Seems library will soon be added to maven central repo, but at least now I was able to add 1.4.4 SNAPSHOT build using gradle for my project with such config changes: repositories { ... //android-async-client repo maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } } And then in dependencies section: compile 'com.loopj.android:android-async-http:1.

Categories : Android

When to use 'http://' or 'http://www.' when scraping?
Most sites redirect www to somesite.com, or the other way around automatically, so you should not have to worry about that. I would think Anemone can handle redirects(?). But if it can't then I suggest you pre-check the URLs for redirects before you hand them over to Anemone. You can look here how to do that: How can I get the final URL after redirects using Ruby? I.e.: final_url = check_base_url_for_redirect('www.somesite.com') Anemone.crawl(final_url) ...

Categories : Ruby On Rails

HTTP Proxy using Connect and node-http-proxy
Local server is getting stuck because the middleware does not delegate handling of cases when the if condition fails further down the middleware chain : The following should solve the problem : .use(function(req, res, next) { if (req.url.indexOf(endpoint.prefix) === 0) { proxy.proxyRequest(req, res, endpoint); } else next(); })

Categories : Node Js

make http call from within another http call in angular
This psuedo code will work fine. The then is a callback for the async operation. See promises in angular for more detail. You are correct that the flow of the code execution will continue, but the callback (then) will still fire when the response is returned. So, this means that if you are binding to $scope inside the then, all will be fine and the data will bind into the model.

Categories : Angularjs

NoSuchMethodError: org.apache.http.conn.scheme.Scheme.(Ljava/lang/String;ILorg/apache/http/conn/scheme/SchemeSocketFactory;)V
A NoSuchMethodError indicates that classes available at runtime are different to those used to compile your code. It usually boils down to having multiple versions of the same class on the classpath. Double check this for the class in question and remove the unwanted version. [EDIT] Add this to your pom.xml to control the version of httpclient: <dependencyManagement> <dependencies> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>[4.2.1]</version> </dependency> </dependencies> </dependencyManagement>

Categories : Java

What't the different between 'HTTP/1.1 200' and 'HTTP/1.1 200 OK'
There's no significant difference. All that matters for the protocol is the numeric reply code. Everything after that is just commentary that might be displayed to the human user, but it's ignored by the application. Since 200 responses are for successful downloads, and the document is displayed to the user with no error message, there's no real need for this text, although it's normal to include it for the benefit of users monitoring the traffic for debugging reasons.

Categories : Http

Web.go How can I do http redirections?
So turns out it was easy :) ctx.Request.Method = "GET" mypage(ctx) No need for http.Redirect. The important part is to change the Method to GET first, before calling mypage(ctx).

Categories : Go

Does HTTP use a checksum? Why/why not?
Yup (: the specs for HTTP/1.1 (RFC 2616) allow the use of a Content-MD5 header. Take a look at its section 14.15. Copy-pasted: The Content-MD5 entity-header field, as defined in RFC 1864 [23], is an MD5 digest of the entity-body for the purpose of providing an end-to-end message integrity check (MIC) of the entity-body.

Categories : Http

HTTP Compression with ASP.Net MVC on IIS 6.0
When you enable wildcard mapping, IIS 6 compression no longer works for extensionless URL (like MVC) because IIS 6 does not see any extension which is defined in IIS Metabase. One solution is to use a custom HttpModule to do the compression for dynamic requests by yourself. There is no magic in Gzip : it's simply GzipStream. there is an example here and sample code here.

Categories : Iis



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.