• R/O
  • HTTP
  • SSH
  • HTTPS

bchanf: Commit

各種ライブラリ


Commit MetaInfo

Revision7d3ced32d141f594a5d0e248d8798377330d1737 (tree)
Time2015-03-14 18:59:39
Authorornse01 <ornse01@user...>
Commiterornse01

Log Message

enable to specify IP address string for host argument.

git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchanf/trunk@658 20a0b8eb-f62a-4a12-8fe1-b598822500fb

Change Summary

Incremental Difference

--- a/src/http/http_connector.c
+++ b/src/http/http_connector.c
@@ -1,7 +1,7 @@
11 /*
22 * http_connector.c
33 *
4- * Copyright (c) 2012-2014 project bchan
4+ * Copyright (c) 2012-2015 project bchan
55 *
66 * This software is provided 'as-is', without any express or implied
77 * warranty. In no event will the authors be held liable for any damages
@@ -129,6 +129,7 @@ LOCAL W http_reqentry_initialize(http_reqentry_t *entry, UB *host, W host_len, U
129129 W err;
130130 B buf[HBUFLEN];
131131 HOSTENT ent;
132+ struct in_addr addr;
132133 struct sockaddr_in *addr_in;
133134
134135 entry->host = malloc(sizeof(UB)*(host_len+1));
@@ -140,14 +141,18 @@ LOCAL W http_reqentry_initialize(http_reqentry_t *entry, UB *host, W host_len, U
140141 entry->host[host_len] = '\0';
141142 entry->host_len = host_len;
142143
143- err = so_gethostbyname(entry->host, &ent, buf);
144- if (err < 0) {
145- goto error_gethostbyname;
144+ err = inet_aton(host, &addr);
145+ if (err == 0) {
146+ err = so_gethostbyname(entry->host, &ent, buf);
147+ if (err < 0) {
148+ goto error_gethostbyname;
149+ }
150+ addr.s_addr = *(unsigned int *)(ent.h_addr_list[0]);
146151 }
147152 addr_in = (struct sockaddr_in *)&(entry->addr);
148153 addr_in->sin_family = AF_INET;
149154 addr_in->sin_port = htons( port );
150- addr_in->sin_addr.s_addr = *(unsigned int *)(ent.h_addr_list[0]);
155+ addr_in->sin_addr = addr;
151156
152157 entry->aborted_by_user = False;
153158 entry->status = WAITING_TRANSPORT;
Show on old repository browser