efl_net_dialer_http: fix HEAD requests.
We do not need to keep a "only_head" flag, but we must set CURLOPT_NOBODY instead of going the "CUSTOMREQUEST" route, otherwise curl won't follow redirects, etc.
This commit is contained in:
parent
d52daf8dd7
commit
0073e87761
|
@ -143,7 +143,6 @@ struct _Ecore_Con_Url
|
|||
int status;
|
||||
int write_fd;
|
||||
Efl_Net_Http_Version http_version;
|
||||
Eina_Bool only_head;
|
||||
Eina_Bool ssl_verify_peer;
|
||||
Eina_Bool verbose;
|
||||
Eina_Bool ftp_use_epsv;
|
||||
|
@ -497,9 +496,6 @@ _ecore_con_url_dialer_headers_done(void *data, const Efl_Event *event EINA_UNUSE
|
|||
|
||||
end:
|
||||
eina_iterator_free(it);
|
||||
|
||||
if (url_con->only_head && ((status >= 200) && (status < 300)))
|
||||
_ecore_con_url_dialer_close(url_con);
|
||||
}
|
||||
|
||||
EFL_CALLBACKS_ARRAY_DEFINE(ecore_con_url_dialer_cbs,
|
||||
|
@ -726,8 +722,6 @@ _ecore_con_url_request_prepare(Ecore_Con_Url *url_con, const char *method)
|
|||
|
||||
_c->curl_easy_setopt(curl_easy, CURLOPT_FTP_USE_EPSV, (long)url_con->ftp_use_epsv);
|
||||
|
||||
url_con->only_head = strcmp(method, "HEAD") == 0;
|
||||
|
||||
/* previously always set encoding to gzip,deflate */
|
||||
efl_net_dialer_http_request_header_add(url_con->dialer, "Accept-Encoding", "gzip,deflate");
|
||||
|
||||
|
|
|
@ -1879,6 +1879,8 @@ _efl_net_dialer_http_request_apply(Eo *o, Efl_Net_Dialer_Http_Data *pd, const ch
|
|||
r = curl_easy_setopt(pd->easy, CURLOPT_HTTPGET, 1L);
|
||||
else if (strcasecmp(method, "POST") == 0)
|
||||
r = curl_easy_setopt(pd->easy, CURLOPT_POST, 1L);
|
||||
else if (strcasecmp(method, "HEAD") == 0)
|
||||
r = curl_easy_setopt(pd->easy, CURLOPT_NOBODY, 1L);
|
||||
else if (strcasecmp(method, "PUT") == 0)
|
||||
{
|
||||
if (primary_mode == EFL_NET_DIALER_HTTP_PRIMARY_MODE_AUTO)
|
||||
|
|
Loading…
Reference in New Issue