summaryrefslogtreecommitdiff
path: root/src/modules/m_remoteinclude_http.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-18 10:46:59 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-18 10:46:59 +0000
commit9b2a5837b18b27af3fcc9a25ba600ea7fb234ee6 (patch)
tree0a62de71f3c470c10d76b2243701dcc638ac4636 /src/modules/m_remoteinclude_http.cpp
parent85ea4dbed5c6085910e7373200a73189c0243616 (diff)
Test framework connects now
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8603 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_remoteinclude_http.cpp')
-rw-r--r--src/modules/m_remoteinclude_http.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/modules/m_remoteinclude_http.cpp b/src/modules/m_remoteinclude_http.cpp
index 1aa2ba7b4..c8dc3c2b2 100644
--- a/src/modules/m_remoteinclude_http.cpp
+++ b/src/modules/m_remoteinclude_http.cpp
@@ -47,30 +47,51 @@ class ModuleRemoteIncludeHttp : public Module
server = gethostbyname("neuron.brainbox.winbot.co.uk");
sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if (sockfd < 0)
+ if (sockfd < 0)
+ {
+ ServerInstance->Log(DEBUG,"Failed to socket()");
return 0;
+ }
if (server == NULL)
+ {
+ ServerInstance->Log(DEBUG,"No such host");
return 0;
+ }
memset(&serv_addr, sizeof(serv_addr), 0);
serv_addr.sin_family = AF_INET;
- memcpy(server->h_addr, &serv_addr.sin_addr.s_addr, server->h_length);
+ memcpy(&serv_addr.sin_addr.s_addr, server->h_addr, server->h_length);
serv_addr.sin_port = htons(portno);
if (connect(sockfd, (const sockaddr*)&serv_addr, sizeof(serv_addr)) < 0)
+ {
+ ServerInstance->Log(DEBUG,"Failed to connect()");
return 0;
+ }
- n = send(sockfd, "GET / HTTP/1.0\r\n", 16, 0);
+ ServerInstance->Log(DEBUG,"Connected to brainbox");
+
+ n = send(sockfd, "GET / HTTP/1.0\r\n\r\n", 18, 0);
if (n < 0)
+ {
+ ServerInstance->Log(DEBUG,"Failed to send()");
return 0;
+ }
+
+ ServerInstance->Log(DEBUG,"Sent GET request");
- n = read(sockfd,buffer,255);
+ n = read(sockfd,buffer,1);
if (n < 1)
+ {
+ ServerInstance->Log(DEBUG,"Failed to read()");
return 0;
+ }
+
+ ServerInstance->Log(DEBUG,"Read one byte");
return 1;
}