File:  [Coherent Logic Development] / freem / mlib / %NETHTTP.m
Revision 1.3: download - view: text, annotated - select for diffs
Mon Mar 10 00:38:15 2025 UTC (4 months, 3 weeks ago) by snw
Branches: MAIN
CVS tags: v0-63-1-rc1, v0-63-0-rc1, v0-63-0, v0-62-3, v0-62-2, v0-62-1, v0-62-0, HEAD
Phase 3 of REUSE compliance and header reformatting

    1: %NETHTTP ;VCL/SNW-FREEM HTTP SYSTEM LIBRARY; 10/23/2020 6:55 PM
    2:     ;0.0;FreeM;****FREEM**;Serena Willis @2020
    3:     ;
    4:     ;   $Id: %NETHTTP.m,v 1.3 2025/03/10 00:38:15 snw Exp $
    5:     ;    FreeM HTTP system library
    6:     ;
    7:     ;  
    8:     ;   Author: Serena Willis <jpw@coherent-logic.com>
    9:     ;    Copyright (C) 1998 MUG Deutschland
   10:     ;    Copyright (C) 2020 Coherent Logic Development LLC
   11:     ;
   12:     ;
   13:     ;   This file is part of FreeM.
   14:     ;
   15:     ;   FreeM is free software: you can redistribute it and/or modify
   16:     ;   it under the terms of the GNU Affero Public License as published by
   17:     ;   the Free Software Foundation, either version 3 of the License, or
   18:     ;   (at your option) any later version.
   19:     ;
   20:     ;   FreeM is distributed in the hope that it will be useful,
   21:     ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
   22:     ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   23:     ;   GNU Affero Public License for more details.
   24:     ;
   25:     ;   You should have received a copy of the GNU Affero Public License
   26:     ;   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
   27:     ;
   28:     ;   $Log: %NETHTTP.m,v $
   29:     ;   Revision 1.3  2025/03/10 00:38:15  snw
   30:     ;   Phase 3 of REUSE compliance and header reformatting
   31:     ;
   32:     ;
   33:     ; SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
   34:     ; SPDX-License-Identifier: AGPL-3.0-or-later   
   35: 	QUIT
   36:  	;
   37:  	;
   38: GET(URL) ; HTTP GET
   39: 	;
   40:  	; SET UP ERROR TRAP
   41:  	;
   42:  	N OET S OET=$ZTRAP S $ZTRAP="GETERR^%HTTP"
   43:  	; INIT TERMINATION SEQUENCE
   44:  	N CH,%,LN S CH=255,^$DEVICE(CH,"TERMINATOR")=$C(13,10),LN=0
   45:  	; PARSE URL
   46:  	N PROTO S PROTO=$P(URL,":",1)
   47:  	N SRV,HOST,PRT S SRV=$P(URL,"/",3) I $L(SRV,":") S PRT=$P(SRV,":",2),HOST=$P(SRV,":",1) E  S HOST=SRV,PRT=80
   48:  	N PTH I $L(URL,"/")>3 S PTH=$P(URL,"/",4) E  S PTH="/"
   49:  	I PROTO'="http" K % W "Protocol "_PROTO_" not supported.",! G GETERR
   50:  	; OPEN CONNECTION TO SERVER
   51:  	O CH:HOST_":"_PRT_":IPV4:TCP"
   52:  	U CH:/CONNECT
   53:  	; SEND GET COMMAND
   54:  	W "GET "_PTH_" HTTP/1.1",!,"Host: "_HOST,!,!
   55:  	;
   56:  	;
   57: GETERR U $P C CH K % S $ZTRAP=OET Q 0

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>