module http_post_utilities implicit none character(*), parameter::content_type_required = "application/x-www-form-urlencoded" contains function read_post_contents() result(res) use query_utilities, only: query use logging implicit none type(query)::res character(len=:), allocatable::transfered character(256)::header_info integer::content_length, istat, i call get_environment_variable("CONTENT_LENGTH", header_info, status=istat) if(istat == 0) then read(header_info, *) content_length else content_length = 0 end if call write_log("Content Length is: "//trim(header_info), LOG_DEBUG) call get_environment_variable("CONTENT_TYPE", header_info, status=istat) if(content_length > 0 .and. & istat == 0 .and. & trim(header_info) == content_type_required) & then call write_log("Processing post", LOG_DEBUG) allocate(character(len=content_length) :: transfered) do i = 1, content_length read(*, '(A1)', advance='no') transfered(i:i) end do call res%init(transfered) deallocate(transfered) end if call write_log("Content Type is: "//trim(header_info), LOG_DEBUG) end function read_post_contents end module http_post_utilities