Loading include/curl/curl.h +5 −1 Original line number Diff line number Diff line Loading @@ -666,7 +666,11 @@ typedef enum { CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, CURLINFO_LASTONE = 18 CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, /* Fill in new entries here! */ CURLINFO_LASTONE = 19 } CURLINFO; /* unfortunately, the easy.h include file needs the options and info stuff Loading lib/getinfo.c +8 −1 Original line number Diff line number Diff line Loading @@ -48,9 +48,13 @@ CURLcode Curl_initinfo(struct SessionHandle *data) info->httpcode = 0; info->httpversion=0; info->filetime=-1; /* -1 is an illegal time and thus means unknown */ if (info->contenttype) free(info->contenttype); info->contenttype = NULL; info->header_size = 0; info->request_size = 0; return CURLE_OK; } Loading Loading @@ -134,6 +138,9 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) case CURLINFO_CONTENT_LENGTH_UPLOAD: *param_doublep = data->progress.size_ul; break; case CURLINFO_CONTENT_TYPE: *param_charp = data->info.contenttype; break; default: return CURLE_BAD_FUNCTION_ARGUMENT; } Loading lib/transfer.c +25 −0 Original line number Diff line number Diff line Loading @@ -466,6 +466,31 @@ CURLcode Curl_readwrite(struct connectdata *conn, conn->size = k->contentlength; Curl_pgrsSetDownloadSize(data, k->contentlength); } /* check for Content-Type: header lines to get the mime-type */ else if (strnequal("Content-Type:", k->p, 13)) { char *start; char *end; int len; /* Find the first non-space letter */ for(start=k->p+14; *start && isspace((int)*start); start++); /* count all non-space letters following */ for(end=start+1, len=0; *end && !isspace((int)*end); end++, len++); /* allocate memory of a cloned copy */ data->info.contenttype = malloc(len + 1); if (NULL == data->info.contenttype) return CURLE_OUT_OF_MEMORY; /* copy the content-type string */ memcpy(data->info.contenttype, start, len); data->info.contenttype[len] = 0; /* zero terminate */ } else if((k->httpversion == 10) && conn->bits.httpproxy && compareheader(k->p, "Proxy-Connection:", "keep-alive")) { Loading lib/url.c +3 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,9 @@ CURLcode Curl_close(struct SessionHandle *data) /* free the connection cache */ free(data->state.connects); if(data->info.contenttype) free(data->info.contenttype); free(data); return CURLE_OK; } Loading lib/urldata.h +2 −0 Original line number Diff line number Diff line Loading @@ -432,6 +432,8 @@ struct PureInfo { the time was unretrievable */ long header_size; /* size of read header(s) in bytes */ long request_size; /* the amount of bytes sent in the request(s) */ char *contenttype; /* the content type of the object */ }; Loading Loading
include/curl/curl.h +5 −1 Original line number Diff line number Diff line Loading @@ -666,7 +666,11 @@ typedef enum { CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, CURLINFO_LASTONE = 18 CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, /* Fill in new entries here! */ CURLINFO_LASTONE = 19 } CURLINFO; /* unfortunately, the easy.h include file needs the options and info stuff Loading
lib/getinfo.c +8 −1 Original line number Diff line number Diff line Loading @@ -48,9 +48,13 @@ CURLcode Curl_initinfo(struct SessionHandle *data) info->httpcode = 0; info->httpversion=0; info->filetime=-1; /* -1 is an illegal time and thus means unknown */ if (info->contenttype) free(info->contenttype); info->contenttype = NULL; info->header_size = 0; info->request_size = 0; return CURLE_OK; } Loading Loading @@ -134,6 +138,9 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) case CURLINFO_CONTENT_LENGTH_UPLOAD: *param_doublep = data->progress.size_ul; break; case CURLINFO_CONTENT_TYPE: *param_charp = data->info.contenttype; break; default: return CURLE_BAD_FUNCTION_ARGUMENT; } Loading
lib/transfer.c +25 −0 Original line number Diff line number Diff line Loading @@ -466,6 +466,31 @@ CURLcode Curl_readwrite(struct connectdata *conn, conn->size = k->contentlength; Curl_pgrsSetDownloadSize(data, k->contentlength); } /* check for Content-Type: header lines to get the mime-type */ else if (strnequal("Content-Type:", k->p, 13)) { char *start; char *end; int len; /* Find the first non-space letter */ for(start=k->p+14; *start && isspace((int)*start); start++); /* count all non-space letters following */ for(end=start+1, len=0; *end && !isspace((int)*end); end++, len++); /* allocate memory of a cloned copy */ data->info.contenttype = malloc(len + 1); if (NULL == data->info.contenttype) return CURLE_OUT_OF_MEMORY; /* copy the content-type string */ memcpy(data->info.contenttype, start, len); data->info.contenttype[len] = 0; /* zero terminate */ } else if((k->httpversion == 10) && conn->bits.httpproxy && compareheader(k->p, "Proxy-Connection:", "keep-alive")) { Loading
lib/url.c +3 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,9 @@ CURLcode Curl_close(struct SessionHandle *data) /* free the connection cache */ free(data->state.connects); if(data->info.contenttype) free(data->info.contenttype); free(data); return CURLE_OK; } Loading
lib/urldata.h +2 −0 Original line number Diff line number Diff line Loading @@ -432,6 +432,8 @@ struct PureInfo { the time was unretrievable */ long header_size; /* size of read header(s) in bytes */ long request_size; /* the amount of bytes sent in the request(s) */ char *contenttype; /* the content type of the object */ }; Loading