Changeset 6139
- Timestamp:
- 04/29/10 20:19:21 (3 years ago)
- Location:
- luci2
- Files:
-
- 1 added
- 3 modified
-
libustream/core.h (modified) (2 diffs)
-
libustream/io.c (added)
-
libustream/ustream.c (modified) (1 diff)
-
zhttpd/tcp.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
luci2/libustream/core.h
r6138 r6139 37 37 int action; 38 38 int status; 39 int fd[2]; 40 FILE *fp[2]; 39 41 ustream_state_cb *state; 40 42 void *data; … … 52 54 USTREAM_LOCAL int ustream_meta_set 53 55 (ustream_t *stream, const char *key, const char *value, size_t len); 56 USTREAM_LOCAL int ustream_io_socket(const char *host, const char *service); 54 57 55 58 #define USTREAM_HANDLER(name, handler) \ -
luci2/libustream/ustream.c
r6138 r6139 30 30 memcpy(stream->url, url, strlen(url) + 1); 31 31 char *c = stream->url + plen + 3; 32 url = c; 32 33 33 /* TODO: URL splitting */ 34 if (!(c = strchr(url, '/'))) { 35 goto error; 36 } 37 *c = 0; 38 stream->path = c + 1; 39 40 if ((c = strchr(url, '@')) && c < stream->path) { 41 stream->auth = url; 42 *c = 0; 43 url = c + 1; 44 } 45 46 stream->host = url; 47 if ((c = strchr(url, ':')) && c < stream->path) { 48 stream->port = c + 1; 49 *c = 0; 50 } 34 51 35 52 if (handler->entry(stream)) { 36 ustream_destroy(stream); 37 return NULL; 53 goto error; 38 54 } 39 55 return stream; 56 57 error: 58 ustream_destroy(stream); 59 return NULL; 40 60 } 41 61 -
luci2/zhttpd/tcp.c
r5916 r6139 257 257 /* Create TCP socket */ 258 258 static int zhttpd_tcp_server_socket(const char *host, const char *service) { 259 struct addrinfo hints,*result, *rp;259 struct addrinfo *result, *rp; 260 260 int sock = -1, clstat; 261 261 262 memset(&hints, 0, sizeof(hints));263 hints.ai_family = AF_UNSPEC;264 hints.ai_socktype = SOCK_STREAM;265 hints.ai_flags = AI_PASSIVE;266 hints.ai_protocol = 0;262 struct addrinfo hints = { 263 .ai_family = AF_UNSPEC, 264 .ai_socktype = SOCK_STREAM, 265 .ai_flags = AI_PASSIVE 266 }; 267 267 268 268 if (getaddrinfo(host, service, &hints, &result)) {
