SCTC
the soundcloud.com terminal client
http.h
Go to the documentation of this file.
1 /*
2  SCTC - the soundcloud.com client
3  Copyright (C) 2015 Christian Eichler
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>
17 */
18 
19 #ifndef _HTTP_H
20  #define _HTTP_H
21 
22  //\cond
23  #include <stddef.h> // for size_t
24  //\endcond
25 
26  struct http_response {
27  struct network_conn *nwc;
28  char *buffer;
29  char *body;
30  size_t header_length;
31  size_t content_length;
33  char *location;
34  };
35 
54  struct http_response* http_request_get_only_header(struct network_conn *nwc, char *url, char *host, size_t follow_redirect_steps);
55 
67  struct http_response* http_request_get(struct network_conn *nwc, char *url, char *host);
68 
75  void http_response_destroy(struct http_response *resp);
76 
77 #endif /* _HTTP_H */
void http_response_destroy(struct http_response *resp)
Free any data associated to the http_response.
Definition: http.c:154
size_t header_length
The length of the header in Bytes.
Definition: http.h:30
char * location
The location in case of a non-resolved redirect.
Definition: http.h:33
struct http_response * http_request_get_only_header(struct network_conn *nwc, char *url, char *host, size_t follow_redirect_steps)
Send an HTTP request to host using nwc and reads the header.
Definition: http.c:47
Definition: url.h:24
int http_status
The HTTP-Status, 200 in case of success.
Definition: http.h:32
char * buffer
A pointer to the raw buffer (most likely not usefull, primarily for http_response_destroy() ...
Definition: http.h:28
Definition: network.h:41
struct network_conn * nwc
A new network-connection (used if the server redirects)
Definition: http.h:27
struct http_response * http_request_get(struct network_conn *nwc, char *url, char *host)
Send an HTTP request and read the header along with the body.
Definition: http.c:114
size_t content_length
The length of the body (the actual data)
Definition: http.h:31
char * body
A pointer to the body (the actual data returned by the server)
Definition: http.h:29
Definition: http.h:26