You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this is a bug or the expected behavior, but the curl.getHttpCode() function does not seem to work as intended by the name. It returns 200 for a successfully request and it's ok, but for example when you get a HTTP 403 Forbidden error it simply return -1 and not 403. Same thing for the 404 missing page error, it always returns -1.
Is there any way to get the "real" http code returned by the request?
If it can help this is the code I'm using:
URI uri = new URI(url);
Map<String, String> fakeHeaders = new HashMap<String, String>();
fakeHeaders.put("User-Agent", ua);
CUrl curl = new CUrl(uri.toASCIIString())
.timeout(this.timeout, this.rtimeout)
.headers(fakeHeaders)
.cookieJar("cookie.jar")
.location()
.insecure();
curl.exec("UTF-8");
int r = curl.getHttpCode();
System.out.println("HTTP response code: " + r);
The text was updated successfully, but these errors were encountered:
I don't know if this is a bug or the expected behavior, but the
curl.getHttpCode()
function does not seem to work as intended by the name. It returns 200 for a successfully request and it's ok, but for example when you get a HTTP 403 Forbidden error it simply return -1 and not 403. Same thing for the 404 missing page error, it always returns -1.Is there any way to get the "real" http code returned by the request?
If it can help this is the code I'm using:
The text was updated successfully, but these errors were encountered: