author | kergoth <kergoth> | 2003-08-09 17:00:23 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:00:23 (UTC) |
commit | c33d5ec60361238e50a4a9d6e0eec03e396dce60 (patch) (unidiff) | |
tree | 31c0c85dc4262044db90c7918014bc45265ef420 /noncore/net/ubrowser/httpfactory.cpp | |
parent | 78c296d534589835801fb6374ac9d43d44b2b1c9 (diff) | |
download | opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.zip opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.tar.gz opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.tar.bz2 |
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/net/ubrowser/httpfactory.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/ubrowser/httpfactory.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/net/ubrowser/httpfactory.cpp b/noncore/net/ubrowser/httpfactory.cpp index b57149f..369f206 100644 --- a/noncore/net/ubrowser/httpfactory.cpp +++ b/noncore/net/ubrowser/httpfactory.cpp | |||
@@ -86,63 +86,63 @@ const QMimeSource * HttpFactory::data(const QString &abs_name) const | |||
86 | //} | 86 | //} |
87 | 87 | ||
88 | //comm->setStuff(host, portS, file, text, image, isImage); | 88 | //comm->setStuff(host, portS, file, text, image, isImage); |
89 | 89 | ||
90 | //socket->connectToHost(host, port); | 90 | //socket->connectToHost(host, port); |
91 | 91 | ||
92 | int con, bytesSent; | 92 | int con, bytesSent; |
93 | struct sockaddr_in serverAddr; | 93 | struct sockaddr_in serverAddr; |
94 | struct hostent * serverInfo = gethostbyname( host.latin1() ); | 94 | struct hostent * serverInfo = gethostbyname( host.latin1() ); |
95 | 95 | ||
96 | if( serverInfo == NULL ) | 96 | if( serverInfo == NULL ) |
97 | { | 97 | { |
98 | QMessageBox *mb = new QMessageBox("Error!", | 98 | QMessageBox *mb = new QMessageBox(QObject::tr("Error!"), |
99 | "couldnt find ip address", | 99 | QObject::tr("IP-Address not found"), |
100 | QMessageBox::NoIcon, | 100 | QMessageBox::NoIcon, |
101 | QMessageBox::Ok, | 101 | QMessageBox::Ok, |
102 | QMessageBox::NoButton, | 102 | QMessageBox::NoButton, |
103 | QMessageBox::NoButton); | 103 | QMessageBox::NoButton); |
104 | mb->exec(); | 104 | mb->exec(); |
105 | perror("HttpFactory::data:"); | 105 | perror("HttpFactory::data:"); |
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | QByteArray data; | 109 | QByteArray data; |
110 | //printf( "HttpFactory::data: %s\n", inet_ntoa(*((struct in_addr *)serverInfo->h_addr )) ); | 110 | //printf( "HttpFactory::data: %s\n", inet_ntoa(*((struct in_addr *)serverInfo->h_addr )) ); |
111 | 111 | ||
112 | QString request("GET " + file + " HTTP/1.1\r\nHost: " + host + ':' + portS + "\r\nConnection: close\r\n\r\n"); | 112 | QString request("GET " + file + " HTTP/1.1\r\nHost: " + host + ':' + portS + "\r\nConnection: close\r\n\r\n"); |
113 | 113 | ||
114 | con = socket( AF_INET, SOCK_STREAM, 0 ); | 114 | con = socket( AF_INET, SOCK_STREAM, 0 ); |
115 | if( con == -1 ) | 115 | if( con == -1 ) |
116 | { | 116 | { |
117 | QMessageBox *mb = new QMessageBox("Error!", | 117 | QMessageBox *mb = new QMessageBox(QObject::tr("Error!"), |
118 | "couldnt create socket", | 118 | QObject::tr("Error creating socket"), |
119 | QMessageBox::NoIcon, | 119 | QMessageBox::NoIcon, |
120 | QMessageBox::Ok, | 120 | QMessageBox::Ok, |
121 | QMessageBox::NoButton, | 121 | QMessageBox::NoButton, |
122 | QMessageBox::NoButton); | 122 | QMessageBox::NoButton); |
123 | mb->exec(); | 123 | mb->exec(); |
124 | perror("HttpFactory::data:"); | 124 | perror("HttpFactory::data:"); |
125 | return 0; | 125 | return 0; |
126 | } | 126 | } |
127 | 127 | ||
128 | serverAddr.sin_family = AF_INET; | 128 | serverAddr.sin_family = AF_INET; |
129 | serverAddr.sin_port = htons( port ); | 129 | serverAddr.sin_port = htons( port ); |
130 | serverAddr.sin_addr.s_addr = inet_addr( inet_ntoa(*((struct in_addr *)serverInfo->h_addr )) ); | 130 | serverAddr.sin_addr.s_addr = inet_addr( inet_ntoa(*((struct in_addr *)serverInfo->h_addr )) ); |
131 | memset( &(serverAddr.sin_zero), '\0', 8 ); | 131 | memset( &(serverAddr.sin_zero), '\0', 8 ); |
132 | 132 | ||
133 | if(::connect( con, (struct sockaddr *)&serverAddr, sizeof(struct sockaddr)) == -1 ) | 133 | if(::connect( con, (struct sockaddr *)&serverAddr, sizeof(struct sockaddr)) == -1 ) |
134 | { | 134 | { |
135 | QMessageBox *mb = new QMessageBox("Error!", | 135 | QMessageBox *mb = new QMessageBox(QObject::tr("Error!"), |
136 | "couldnt connect to socket", | 136 | QObject::tr("Error connecting to socket"), |
137 | QMessageBox::NoIcon, | 137 | QMessageBox::NoIcon, |
138 | QMessageBox::Ok, | 138 | QMessageBox::Ok, |
139 | QMessageBox::NoButton, | 139 | QMessageBox::NoButton, |
140 | QMessageBox::NoButton); | 140 | QMessageBox::NoButton); |
141 | mb->exec(); | 141 | mb->exec(); |
142 | perror("HttpFactory::data:"); | 142 | perror("HttpFactory::data:"); |
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | bytesSent = send( con, request.latin1(), request.length(), 0); | 147 | bytesSent = send( con, request.latin1(), request.length(), 0); |
148 | //printf("HttpFactory::data: bytes written: %d out of: %d\n", bytesSent, request.length() ); | 148 | //printf("HttpFactory::data: bytes written: %d out of: %d\n", bytesSent, request.length() ); |