mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
See ChangeLog: Fri Oct 8 20:32:01 CEST 1999 Werner Koch
This commit is contained in:
parent
296f9de0bc
commit
5e66583143
35 changed files with 3234 additions and 2890 deletions
|
@ -1,3 +1,12 @@
|
|||
Fri Oct 8 20:32:01 CEST 1999 Werner Koch <wk@gnupg.de>
|
||||
|
||||
* w32reg.c: New.
|
||||
* simple-gettext.c: Use the Registry to locate the mo file.
|
||||
|
||||
* http.c (send_request): Add support for proxys; suggested by
|
||||
Walter Hofmann.
|
||||
(http_open_document): Pass flags to http_open.
|
||||
|
||||
Fri Sep 17 12:56:42 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ noinst_LTLIBRARIES = libutil.la
|
|||
libutil_la_LDFLAGS =
|
||||
libutil_la_SOURCES = g10u.c logger.c fileutil.c miscutil.c strgutil.c \
|
||||
ttyio.c argparse.c memory.c secmem.c errors.c iobuf.c \
|
||||
dotlock.c http.c simple-gettext.c
|
||||
dotlock.c http.c simple-gettext.c w32reg.c
|
||||
|
||||
|
||||
http-test: http.c
|
||||
|
|
40
util/http.c
40
util/http.c
|
@ -74,7 +74,7 @@ http_open( HTTP_HD hd, HTTP_REQ_TYPE reqtype, const char *url,
|
|||
{
|
||||
int rc;
|
||||
|
||||
if( flags || !(reqtype == HTTP_REQ_GET || reqtype == HTTP_REQ_POST) )
|
||||
if( !(reqtype == HTTP_REQ_GET || reqtype == HTTP_REQ_POST) )
|
||||
return G10ERR_INV_ARG;
|
||||
|
||||
/* initialize the handle */
|
||||
|
@ -82,6 +82,7 @@ http_open( HTTP_HD hd, HTTP_REQ_TYPE reqtype, const char *url,
|
|||
hd->sock = -1;
|
||||
hd->initialized = 1;
|
||||
hd->req_type = reqtype;
|
||||
hd->flags = flags;
|
||||
|
||||
rc = parse_uri( &hd->uri, url );
|
||||
if( !rc ) {
|
||||
|
@ -148,10 +149,7 @@ http_open_document( HTTP_HD hd, const char *document, unsigned int flags )
|
|||
{
|
||||
int rc;
|
||||
|
||||
if( flags )
|
||||
return G10ERR_INV_ARG;
|
||||
|
||||
rc = http_open( hd, HTTP_REQ_GET, document, 0 );
|
||||
rc = http_open( hd, HTTP_REQ_GET, document, flags );
|
||||
if( rc )
|
||||
return rc;
|
||||
|
||||
|
@ -427,21 +425,47 @@ send_request( HTTP_HD hd )
|
|||
byte *request, *p;
|
||||
ushort port;
|
||||
int rc;
|
||||
const char *http_proxy = NULL;
|
||||
|
||||
server = *hd->uri->host? hd->uri->host : "localhost";
|
||||
port = hd->uri->port? hd->uri->port : 80;
|
||||
|
||||
hd->sock = connect_server( server, port );
|
||||
if( (hd->flags & HTTP_FLAG_TRY_PROXY)
|
||||
&& (http_proxy = getenv( "http_proxy" )) ) {
|
||||
PARSED_URI uri;
|
||||
|
||||
rc = parse_uri( &uri, http_proxy );
|
||||
if (rc) {
|
||||
log_error("invalid $http_proxy: %s\n", g10_errstr(rc));
|
||||
release_parsed_uri( uri );
|
||||
return G10ERR_NETWORK;
|
||||
}
|
||||
hd->sock = connect_server( *uri->host? uri->host : "localhost",
|
||||
uri->port? uri->port : 80 );
|
||||
release_parsed_uri( uri );
|
||||
}
|
||||
else
|
||||
hd->sock = connect_server( server, port );
|
||||
|
||||
if( hd->sock == -1 )
|
||||
return G10ERR_NETWORK;
|
||||
|
||||
p = build_rel_path( hd->uri );
|
||||
request = m_alloc( strlen(p) + 20 );
|
||||
sprintf( request, "%s %s%s HTTP/1.0\r\n",
|
||||
request = m_alloc( strlen(server) + strlen(p) + 50 );
|
||||
if( http_proxy ) {
|
||||
sprintf( request, "%s http://%s:%hu%s%s HTTP/1.0\r\n",
|
||||
hd->req_type == HTTP_REQ_GET ? "GET" :
|
||||
hd->req_type == HTTP_REQ_HEAD? "HEAD":
|
||||
hd->req_type == HTTP_REQ_POST? "POST": "OOPS",
|
||||
server, port, *p == '/'? "":"/", p );
|
||||
}
|
||||
else {
|
||||
sprintf( request, "%s %s%s HTTP/1.0\r\n",
|
||||
hd->req_type == HTTP_REQ_GET ? "GET" :
|
||||
hd->req_type == HTTP_REQ_HEAD? "HEAD":
|
||||
hd->req_type == HTTP_REQ_POST? "POST": "OOPS",
|
||||
*p == '/'? "":"/", p );
|
||||
}
|
||||
m_free(p);
|
||||
|
||||
rc = write_server( hd->sock, request, strlen(request) );
|
||||
|
|
|
@ -242,19 +242,21 @@ set_gettext_file( const char *filename )
|
|||
#endif
|
||||
) {
|
||||
/* absolute path - use it as is */
|
||||
log_info("trying `%s'\n", filename );
|
||||
domain = load_domain( filename );
|
||||
}
|
||||
else { /* relative path - append ".mo" and get DIR from env */
|
||||
else { /* relative path - append ".mo" and get dir from the environment */
|
||||
char *buf = NULL;
|
||||
const char *s;
|
||||
char *dir;
|
||||
|
||||
s = getenv("MINGW32_NLS_DIR");
|
||||
if( s && (buf=malloc(strlen(s)+strlen(filename)+1+3+1)) ) {
|
||||
strcpy(stpcpy(stpcpy(stpcpy( buf, s),"/"), filename),".mo");
|
||||
dir = read_w32_registry_string( NULL,
|
||||
"Control Panel\\Mingw32\\NLS",
|
||||
"MODir" );
|
||||
if( dir && (buf=malloc(strlen(dir)+strlen(filename)+1+3+1)) ) {
|
||||
strcpy(stpcpy(stpcpy(stpcpy( buf, dir),"/"), filename),".mo");
|
||||
domain = load_domain( buf );
|
||||
free(buf);
|
||||
}
|
||||
free(dir);
|
||||
}
|
||||
if( !domain )
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue