diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-09-18 15:29:57 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-09-18 15:29:57 +0000 |
commit | 437fd064c9b294de81b15972c40e8a1c5c0191d7 (patch) | |
tree | 4be36140a7988e08db56de97f6f1af4b026c2828 /lib | |
parent | 28dd4e4f1f4dc2311d4e1870161dfa73ae93aeb3 (diff) |
modified GetLine(), removed Curl_http_close()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/lib/http.c b/lib/http.c index 6ba4d235a..353ab5c7c 100644 --- a/lib/http.c +++ b/lib/http.c @@ -204,31 +204,18 @@ CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size) */ static -int GetLine(int sockfd, char *buf, struct connectdata *conn) +int GetLine(int sockfd, char *ptr, struct connectdata *conn) { ssize_t nread; - int read_rc=1; - char *ptr; - struct SessionHandle *data=conn->data; - - ptr=buf; /* get us a full line, terminated with a newline */ - for(nread=0; - (nread<BUFSIZE) && read_rc; - nread++, ptr++) { + for(nread=0; (nread<BUFSIZE); nread++, ptr++) { if((CURLE_OK != Curl_read(conn, sockfd, ptr, 1, &nread)) || - (nread <= 0) || - (*ptr == '\n')) + (nread <= 0) || (*ptr == '\n')) break; } *ptr=0; /* zero terminate */ - if(data->set.verbose) { - fputs("< ", data->set.err); - fwrite(buf, 1, nread, data->set.err); - fputs("\n", data->set.err); - } return nread>0?nread:0; } @@ -282,6 +269,9 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, while(GetLine(tunnelsocket, data->state.buffer, conn)) { if('\r' == data->state.buffer[0]) break; /* end of headers */ + if(data->set.verbose) + fprintf(data->set.err, "< %s\n", data->state.buffer); + if(2 == sscanf(data->state.buffer, "HTTP/1.%d %d", &subversion, &httperror)) { @@ -341,15 +331,6 @@ CURLcode Curl_http_connect(struct connectdata *conn) return CURLE_OK; } -/* called from curl_close() when this struct is about to get wasted, free - protocol-specific resources */ -CURLcode Curl_http_close(struct connectdata *conn) -{ - if(conn->data->state.auth_host) - free(conn->data->state.auth_host); - return CURLE_OK; -} - CURLcode Curl_http_done(struct connectdata *conn) { struct SessionHandle *data; |