w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Why .Net WebClient is able to use HTTPS without any configuration whereas Java HttpClient can't
Ok I think I've finally got it: as I suspected .Net does not have its own certificates store but uses the OS store I've managed to find and delete the certificate but this is not easy because Windows is fighting to maintain some certificates in its store once deleted, as expected, the WebClient is broken and complains because it "Could not establish trust relationship for the SSL/TLS secure channel" so yes the WebClient uses correctly SSL, that's a relief :) Hopefully this information will be useful for somebody else...

Categories : Java

Apache HttpClient and remote files in URL with https scheme
There seem to be a couple of problems: You registered the Scheme to use 3920 as the default port, which is a non-standard port number for HTTPS. If the server is actually running on that port, then you would have to access using this URL in the browser: https://www.thedomain.with:3920/my_resource.pdf. Since the URL that you use in the browser does not include the 3920 port, then the server will be running on the default port of 443, so you should use change new Scheme("https", 3920, sf) to new Scheme("https", 443, sf). It appears that the CN in your server's certificate doesn't match its hostname, which is causing the SSLPeerUnverifiedException. In order for this to work, you would need to use the SSLSocketFactory(TrustStrategy, HostnameVerifier) constructor and pass a verifier that does

Categories : Java

Requirements on connecting to https
Basically you have to add nothing, you only need to add http basic auth credentials if needed. This is how i usually connect to a https api with http basic auth. //Base URL NSURL *requestPasswordURL = [NSURL URLWithString:BASEURL]; //Http client with server credentials AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:requestURL]; [httpClient setAuthorizationHeaderWithUsername:@"user" password:@"password"]; //Set request parameters for example email NSDictionary *params = @{@"email": email}; NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:API_REQUEST parameters:params]; request.cachePolicy = NSURLRequestReloadIgnoringCacheData; //Prepare request AFHTTPRequestOperation *request = [[AFHTTPRequestOperation alloc] initWithRequest:request]; [requestPa

Categories : IOS

Connecting to https host with soapclient: how to fix SSL problems?
Interesting. Try adding this: wget https://[[SERVER]]/soap/ —post-file=request.xml —header=”Content-Type: text/xml” -O response.xml This will save the result as a file named response.xml.

Categories : PHP

Haproxy 1.4 connecting to an https backend servers
haproxy 1.4 does not support SSL. Either update to 1.5 or look at using something like stunnel. I have used both in a very large enterprise implementation and both products work well. If you want to stick with haproxy 1.4 then the stunnel route is VERY easy. Simply install stunnel on your haproxy servers, listen on a local port, have haproxy connect to that local port and then configure stunnel to point to the remote https endpoint. Besides global settings in stunnel, the actual config would be 3 lines name listen port on localhost destination host and port

Categories : Ubuntu

Connecting to Alfresco with DotCMIS gives https error
Check the DotCMIS README file: The Web Services binding only works with HTTPS. The .NET framework does not allow calls with UsernameTokens over plain HTTP. You have to use HTTPS here.

Categories : C#

Does connecting to an HTTPS:// destroy all current sessions?
You can find an explanation here Session lost when switching from HTTP to HTTPS in PHP Hope this helps you.

Categories : PHP

WebScarab : Getting a PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException while connecting via https
Are you using WebScarab or WebScarab-NG? Please try WebScarab "classic", rather than the -NG variant. NG was a failed experiment, and no real effort was put into validating the client-side certificate functionality. Also, what version of Java are you using, what operating system, 32 bit or 64-bit, etc, etc Regards, Rogan

Categories : Java

Maven release plugin throws error when connecting to TFS repo using HTTPS - maven doesnt trust cert
Try retrieving the SSL certificate first. http://kingsfleet.blogspot.ca/2007/07/q-how-do-i-get-remote-server-ssl-cert.html?m=1 Then follow the instructions from one of my previous answers here: SSL client certificate in Maven

Categories : Maven

JAVA - Tomcat 5 Application connecting to Web Service using HTTPS, while Tomcat 7 Application does not
It would seem that the root cause of this problem is that when you are running the newer version (tc7, jdk1.7) you application is unable to find the certificate store. Are you specifying where the certificates are stored in you java code? Or anywhere else for that matter? If so you may be doing it in a Java1.4 way that has been updated in later versions. The default certificate store for java is {$JAVA_HOME}/lib/security/cacerts If your certificate is not being stored here, then this may be your problem. This store is per java version so this would explain why the older version is working while the new version is not. (This is covered in the post linked to by Michael) If this doesn't fix the problem, then it would be useful if you could post some more information about how you are con

Categories : Java

Facebook like button https issue: protocol mismatch from http and https
Reviewing the js code on Facebook there are multiple urls containing hard coded strings for http://static .../rsrc.php it's possible those are the files triggering the error. This may be something Facebook needs to update. On a side note, it may be possible to download that js file from Facebook and store it on your server and remove the hard coded http string. I would test this further but I am on my phone at the moment.

Categories : Facebook

when using https, https can't find codeigniter controllers. Running Centos
Change this line : RewriteRule ^(.*)$ index.php?/$1 [L] to : RewriteRule ^(.*)$ /index.php?/$1 [L] The .htaccess would otherwise be redirected relatively to a index.php in the join folder, which off course is not there.

Categories : PHP

Once https page is visited, all subsequent pages are served from https
ok I think I found the reason. The links I am visiting are relative, so "/forum" for example. Once https is in the browser it seems like visiting a relative address is leaving the root as https:// and appending the relative path. I believe the fix here will be to use the full path for the link instead of relative.

Categories : Htaccess

How do you enable https and http->https redirects in ring / compojure
It's possible to serve HTTPS with clojure, but it's much more popular to put nginx or something like that in front of your ring server. If you can figure out how to configure jetty, though, run-jetty clearly supports SSL.

Categories : Http

How can i convert links to https when server providing https?
If you remove the http:// portion and use instead: <script type="text/javascript" src="//static.monstermmorpg.com/js_files/jquery-1.9.1.min.js"></script> It should request based on the current scheme being used.

Categories : C#

Can https fallback to http and security level of https
No, HTTPS never falls back to HTTP automatically. It would take deliberate action by the user. If you're just going to a web page by putting its URL into the address bar, this is easy; for form submission it's harder. Yes, sending plain text over SSL is fine. In fact, sending a hashed password doesn't really increase security much at all -- if someone manages to sniff the connection and gets the hashed password, that's all they need to be able to login to the site. It has one small advantage: if the user uses the same password at multiple sites, learning the hashed password for one site doesn't help them get into another site that uses a different (or no) hash. And it's not likely to be feasible to send salted hashes, since the client doesn't know the salt. A cnonce adds an extra level

Categories : Asp Net

Redirect all http AND https non-www URLS to https://www.xyz.com via htaccess
In case anyone from the future (HELLO PEOPLE OF THE FUTURE) stumble across this, I asked the same question and had it answered over at Server Fault. Short version: impossible. Long version: http://serverfault.com/questions/523199/redirect-all-http-and-https-non-www-urls-to-https-www-example-com-via-htaccess

Categories : Htaccess

HTTPS GET request to https://www.googleapis.com/plus/v1/people/me
Create a Google_Oauth2Service object (put it under the $plus initialization), like: $client = new Google_Client(); $plus = new Google_PlusService($client); $oauth2 = new Google_Oauth2Service($client); and after succesfully authenticating the client use: $userInfo = $oauth2->userinfo->get(); $email = $userInfo['email'];

Categories : PHP

IHttpHandler to redirect "https://example.com" to "https://www.example.com"?
If you use IIS7, you might want to try URL Rewrite Module. http://www.4guysfromrolla.com/articles/072810-1.aspx http://www.jppinto.com/2010/03/automatically-redirect-http-requests-to-https-on-iis7-using-url-rewrite-2-0/

Categories : Asp Net

How to redirect from url: https://myfavourite.test.com/Account/LogOn?ReturnUrl=/ to url: https://myfavourite.test.com/ using IIS7.5
I followed the steps mentioned in the below mentioned article and it helped me. http://www.trainsignal.com/blog/iis7-url-rewrite-extension-on-windows-server-2008 I used the Redirect option and then added a Blank rule with the following regular expression: account$|account/(?!LogOff) and that helped me to resolve the redirection issue.

Categories : Asp Net Mvc

apache redrict 301 from https://www.domain.com to https://domain.com
If you request https://www.meinedomain.de/ and your cert isn't authorized for www.meinedomain.de, then you'll get a security warning regardless of how you redirect. The redirect can only happen after they accept the security exception. Make sure you've put those rules in the SSL vhost's config, not the non-SSL one. Apache usually has them separate. If that still doesn't work, you can try just putting this in an htaccess file in your document root: RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www.meinedomain.de$ [NC] RewriteRule (.*) https://meinedomain.de%{REQUEST_URI} [R=301,L]

Categories : Apache

c# - how to get last url from HttpClient
So from the msdn articles HttpResponseMessage returns as a Task from an HttpClient call. This HttpResponseMessage has a property called Request Message, which has a property called RequestUri, make sure to look in the properties section of this link. Sample Code: // Create a New HttpClient object. HttpClient client = new HttpClient(); HttpResponseMessage response = await client.GetAsync("http://www.yahoo.com/"); response.EnsureSuccessStatusCode(); string responseUri = response.RequestMessage.RequestUri.ToString(); Console.Out.WriteLine(responseUri);

Categories : C#

HttpClient timeout
You cannot set a maximum request duration. This has some helpful info. Generally with http connections, you should have the same timeout regardless of connection type. It makes no sense to have multiple ticks counting off the same thing at different points. You should set up your API to either have the reports either pre-run, or run on a different thread that's doesn't lock up your invoker. This way you can get back a status object that lets you know if you need to check again for a report.

Categories : Java

Eclipse Get via HttpClient
The proxy preferences in Eclipse itself have no bearing on your program. You need to change your program to use the necessary proxy. Probably this section in the Apache HttpClient documentation will help: HttpClient proxy configuration

Categories : Java

What is the difference in HttpClient in .net 4.0 and .net 4.5
The two versions are identical from an API perspective and 4.5 is backwards compatible with 4.0 from a functionality perspective. The 4.5 version does support a couple new features on WebRequestHandler (ContinueTimeout & ServerCertificateValidationCallback) so avoid those. You shouldn't run into any conflicts when using this library and running on 4.5. The 4.5 version has the same name as the 4.0 version and the framework will unify to the inbox version.

Categories : Dotnet

how to use HttpClient in WindowsPhone 8
You shouldn't be calling Result. Try this instead: var httpClient = new HttpClient(); var request = await httpClient.GetAsync(new Uri("http://www.google.com/", UriKind.RelativeOrAbsolute)); var txt = await request.Content.ReadAsStringAsync(); MessageBox.Show(txt);

Categories : Windows Phone 8

Windows 8 HttpClient
Try this: var httpClient = new HttpClient(); var content = await httpClient.GetStringAsync("http://api.themoviedb.org/3/search/movie?api_key=" + key + "&query=" + movieNam); return await Task.Run(() => JsonObject.Parse(content)); Three lines to do an asynchronous HTTP GET and parsing (not counting the try/catch you need to wrap this method with). There are few resources where you can find out how to use HttpClient: HttpClient makes GET and POST very simple Microsoft' HttpClient sample for C++C#JS

Categories : C#

ASP.NET MVC 4 HttpClient() issue
It appears you are incorrectly setting the header value. Try the following to see if it works: client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(accessToken.access_token));

Categories : C#

Android httpClient
If you are using this code in android 4.0+ you get exception android.os.NetworkOnMainThreadException. Use AsyncTask to provide any http communication.

Categories : Java

How to post using HttpClient?
You could use the PostAsync method: using (var client = new HttpClient()) { var content = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("username", "john"), new KeyValuePair<string, string>("password", "secret"), }); content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); var response = await client.PostAsync( "http://59.185.101.2:10080/jsp/Login.jsp", content ); response.EnsureSuccessStatusCode(); var responseBody = await response.Content.ReadAsStringAsync(); } You will have to provide all the necessary input parameters that your server side script requires in the FormUrlEncodedContent content instance. As far as the hidden variables are concerned, y

Categories : C#

Use 4.0 version of httpclient
It looks like httpclient 4.0 used ThreadSafeClientConnManager, which was deprecated in favor of PoolingClientConnectionManager in version 4.2. I found this in the following thread: Best Practice to Use HttpClient in Multithreaded Environment

Categories : Java

How to use credentials in HttpClient in c#?
The code you are showing works for me against an authenticated resource. I suspect Delicious is doing something weird. Considering you are on Windows Phone, it is a pain to debug with Fiddler, so what I suggest is getting a Runscope account. Install this message handler which will redirect your request via the RunScope debugger. Once you do this, I suggest you look at the www-authenticate header and examine what that is returning. If all else fails you can always set the Authentication header directly with basic auth credentials. You don't need to use the Credentials class.

Categories : C#

how to use httpclient in Rho-Mobile
The Rhomobile have an AsynchHttp API. The Rhomobile Docs have a few examples of how to use it here. Alternative, you can use the Ruby net/http library. It is explained here, how to use net/http as an extension to your Rhodes Application.

Categories : Misc

HttpClient: ssl handshake on every request
HttpClient re-uses persistent SSL connections with client authentication only if it can make sure they belong to the same user / security context (for obvious reasons). Make sure you are using the same HttpContext for all logically related requests. This will ensure the security principal (DN of the client certificate) will get propagated between individual HTTP requests. Follow-up It tuned out the server simply does not want connections to be re-used. Every response contains 'Connection: close' directive that prompts the client to close connections after receiving the response. It may happen, though, that the server treats different clients differently based on the request message composition. Try masquerading HttpClient by using a different User-Agent header value and see if that ma

Categories : Java

HTTPClient - Submit inputs
The httpGet capture only the HTML, as you were acessing this by browser, more the javascript code its not executed, you can try get the HTML and create one HTML page and test this. If files css and javascript are with relative path, you can add context for they. Ex: /css/all.css Add context: http://www.correoargentino.com.ar/seguimiento_envios/css/all.css

Categories : Java

SSL Error with tornado HTTPClient
This looks like it might be related to the logic at https://github.com/facebook/tornado/blob/fd4d8997a772829b8439322dbce45091bc51beaf/tornado/simple_httpclient.py#L196 It's a known issue that tornado.simple_httpclient has trouble connecting to certain servers on Python 2.6, and this looks like the same error message, but I haven't seen this failure on Python 2.7 before. Try passing ssl_options={"ssl_version": ssl.PROTOCOL_TLSv1} to the HTTP request. You can also try tornado.curl_httpclient for an alternate implementation which is more likely to handle less-common server configurations.

Categories : Python

Can't Post a file to ASP.NET Web API from HttpClient
I think your only error is forgetting to reset the position of the memory stream before passing it to StreamContent. However, I prefer to create a new derived HttpContent class specifically for dealing with sending files. With this class your code would look like, var client = new HttpClient(); var content = new FileContent(@"C: empkillme.xml"); client.PostAsync( "http://localhost:52800/api/Import", content ).ContinueWith( ( task ) => { Console.WriteLine( task.Result.StatusCode.ToString() ); client.Dispose(); } ); E.g. public class FileContent : HttpContent { private const int DefaultBufferSize = 1024 * 64; private readonly string _fileName; private readonly FileInfo _fileInfo; public FileContent(string fileName) { if

Categories : Asp Net Web Api

how to create a HTTPserver / HTTPClient
It can be any HTTP server (web server). You can build a stand-alone HTTPServer using any .NET language, but also by writing an ISAPI plugin for ISS, or by installing PHP. In fact, a normal web server could also be a web service. The difference usually is that a web server serves web pages, while a service serves specialized chunks of information, often not in HTML, but rather in JSON or another format that is more friendly for further processing. It's mainly a symantic difference, technically there is virtually no difference.

Categories : Web Services

Handle popup's in httpclient
You can't automatically handle such pop-ups with http client because they are created via client JavaScript code. So you need client with JS interpreter (like web browser). You can proceed by reverse-engineering JavaScript code, passing parameters you grab from response body to resulting function and making new request with http client to generated url. This process is called Web scrapping.

Categories : Java

HttpClient Not Saving Cookies
Weird... Did you tried to directly use the HttpClientHandler's CookieContainer ? Code : public Initialize() { HttpClientHandler = new HttpClientHandler { AllowAutoRedirect = true, UseCookies = true, CookieContainer = new CookieContainer() }; HttpClient = new HttpClient(HttpClientHandler); } public CookieContainer Cookies { get { return HttpClientHandler.CookieContainer; } set { HttpClientHandler.CookieContainer = value; } }

Categories : C#



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