diff options
author | Eduardo Chappa <chappa@washington.edu> | 2021-08-10 21:40:12 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2021-08-10 21:40:12 -0600 |
commit | 94fb9813ffc82c72aecdbc37d696bdd9c24a91bc (patch) | |
tree | 78913bde1bfe10b7cc3f7b08fe0f49711eec516c | |
parent | 54e2c115d9c9a6dc695fee58435c7b5506b84d1c (diff) | |
download | alpine-94fb9813ffc82c72aecdbc37d696bdd9c24a91bc.tar.xz |
* Improvements to http.c and json.c for support of future code.
-rw-r--r-- | imap/src/c-client/http.c | 11 | ||||
-rw-r--r-- | imap/src/c-client/json.c | 11 | ||||
-rw-r--r-- | pith/pine.hlp | 2 |
3 files changed, 14 insertions, 10 deletions
diff --git a/imap/src/c-client/http.c b/imap/src/c-client/http.c index e158db37..617b457a 100644 --- a/imap/src/c-client/http.c +++ b/imap/src/c-client/http.c @@ -87,7 +87,6 @@ typedef struct http_header_data_s { /* helper functions */ HTTP_STATUS_S *http_status_line_get(unsigned char *); void http_status_line_free(HTTP_STATUS_S **); -void http_add_body(HTTP_REQUEST_S **, unsigned char *); void buffer_add(unsigned char **, unsigned char *); unsigned char *hex_escape_url_part(unsigned char *, unsigned char *); unsigned char *encode_url_body_part(unsigned char *, unsigned char *); @@ -1132,14 +1131,14 @@ http_reply (HTTPSTREAM *stream) if (s) fs_give ((void **) &s); size = 0L; if((s = (unsigned char *) net_getline (stream->netstream)) != NIL){ -// buffer_add(&stream->reply, s); -// buffer_add(&stream->reply, "\015\012"); if(stream->debug) mm_log(s, HTTPDEBUG); size = strtol(s, NIL, 16); fs_give ((void **) &stream->response); - stream->response = (unsigned char *) net_getsize (stream->netstream, size); - buffer_add(&stream->reply, stream->response); - if(stream->debug) mm_log(stream->response, HTTPDEBUG); + if(size > 0){ + stream->response = (unsigned char *) net_getsize (stream->netstream, size); + buffer_add(&stream->reply, stream->response); + if(stream->debug) mm_log(stream->response, HTTPDEBUG); + } } } while (stream && stream->netstream && s && (size > 0 || !*s )); } diff --git a/imap/src/c-client/json.c b/imap/src/c-client/json.c index fbc5aa9c..973c8ff5 100644 --- a/imap/src/c-client/json.c +++ b/imap/src/c-client/json.c @@ -453,10 +453,15 @@ json_assign(void **v, JSON_S *j, char *s, JObjType t) { JSON_S *json = json_body_value(j, s); + *v = NIL; if(json && json->jtype == t && json->value){ - switch(t){ /* override here */ - case JString : *v = (void *) cpystr((char *) json->value); break; - default : break; + switch(t){ + case JString : *v = (void *) cpystr((char *) json->value); + break; + case JArray : + case JObject : *v = json->value; + break; + default : break; /* use default value for *v */ } } } diff --git a/pith/pine.hlp b/pith/pine.hlp index 1bb55ee7..30288ba9 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 571 2021-08-10 02:28:13 +Alpine Commit 572 2021-08-10 21:38:40 ============= h_news ================= <HTML> <HEAD> |